/* =====================================================================
   The public site. Its own stylesheet: the control panel is a separate
   deployment and shares no files with it.

   Colours are the council's seal, ARCHITECTURE.md section 12. Every pair
   was checked for WCAG AA contrast. Measurements follow design/Main.dc.html,
   design/Mobile.dc.html, design/Ask.dc.html and design/Track.dc.html; the
   two home designs are the ends of one fluid scale rather than two layouts,
   so the widths between them are drawn by clamp() and not by guesswork.

   There is no JavaScript on this site at all, so nothing here depends on a
   class being toggled at runtime. The phone menu is a <details>.
   ===================================================================== */

:root {
    /* The seal. */
    --page:      #FBF8F3;
    --card:      #FFFFFF;
    --band:      #F8EBD8;
    --border:    #E6D8C3;
    --ornament:  #CCAE88;
    --muted:     #7A5B3E;
    --primary:   #4A2F1A;
    --ink:       #3B2D22;

    /* The designs' own shades between those, used exactly as they use them. */
    --quiet:     #6F5F51;   /* secondary text; 5.2:1 even on the band */
    --field:     #D8C4A8;   /* the edge of anything you type into */
    --rule:      #F0E7DA;   /* the hairline between rows of a list */
    --foot:      #EFE4D4;
    --press:     #3B2513;   /* a primary button under the pointer */
    --danger:    #8A2B2B;
    --danger-bg: #F7ECEC;
    --warn-bg:   #FBF1E4;
    --shadow:    0 12px 28px rgb(59 45 34 / 0.14);

    /* Type. Arabic wants more height than Latin at the same size, and Amiri
       more still, so headings are set larger than a Latin page would set
       them and body text is never under 1.8. */
    --font-text: 'IBM Plex Sans Arabic', Tahoma, sans-serif;
    --font-head: 'Amiri', 'Times New Roman', serif;
    --fs-xs:     13px;
    --fs-sm:     14px;
    --fs-md:     15px;
    --fs-body:   16px;
    --fs-lead:   clamp(16px, 15.4px + 0.15vw, 17px);
    --fs-prose:  clamp(17px, 16px + 0.25vw, 19.5px);
    --fs-h1:     clamp(30px, 24px + 1.6vw, 44px);
    --fs-h2:     clamp(23px, 20.5px + 0.66vw, 30px);
    --fs-h3:     clamp(19px, 17.6px + 0.35vw, 22px);
    --fs-ayah:   clamp(28px, 20.3px + 2.07vw, 50px);
    --lh-text:   1.9;
    --lh-head:   1.5;

    /* One spacing scale. --space-block is the gap between the big blocks of
       a page, the rhythm the two home designs set at 32px and 72px. */
    --space-1:   4px;
    --space-2:   8px;
    --space-3:   12px;
    --space-4:   16px;
    --space-5:   24px;
    --space-6:   32px;
    --space-7:   48px;
    --space-block: clamp(36px, 24px + 3.3vw, 72px);
    --card-pad:  clamp(20px, 13px + 1.9vw, 32px);
    --radius:    10px;
    --radius-lg: 12px;
    --touch:     44px;

    /* The page. The gutter is 16px on the phone design and 80px on the
       desktop one. Past --content-max the gutter grows instead of the
       content, so a wide screen gets margins, not 200-character lines.
       --inset is what every full-width row pads itself by, and what the
       home page's bands pull back against, so they always agree. */
    --gutter:      clamp(16px, 6vw - 6px, 80px);
    --content-max: 1280px;
    --inset:       max(var(--gutter), (100vw - var(--content-max)) / 2);
    --body-top:    clamp(20px, 14px + 1.6vw, 40px);

    /* About seventy Arabic letters to the line at the prose size, plus the
       card's own padding. Measured on a real fatwa rather than taken from
       the "ch" unit, which is the width of a Latin zero. In rem, because a
       custom property in em would mean a different width on every element
       that used it. */
    --measure:     35rem;
    --read-max:    calc(var(--measure) + 2 * var(--card-pad) + 2px);
}

/* 100vw counts a desktop's scrollbar and 100% means something different in
   a padding and in a margin, so the shell is the container its rows are
   measured against: cqi is the page's width without the scrollbar, the
   same in every row. The vw above stays as the fallback. */
@supports (width: 1cqi) {
    .shell { container-type: inline-size; }
    :root { --inset: max(var(--gutter), (100cqi - var(--content-max)) / 2); }
}

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* The menu and a pinned heading must not land a jumped-to heading under
       themselves, and nothing is pinned today; this only keeps the anchor
       off the very edge. */
    scroll-padding-block-start: var(--space-4);
}

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font-family: var(--font-text);
    font-size: var(--fs-body);
    line-height: 1.8;
    /* A pasted address in a fatwa or a scholar's email is one long word. */
    overflow-wrap: break-word;
}

h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; margin: 0; line-height: var(--lh-head); }
p { margin: 0; }

a { color: var(--muted); text-underline-offset: 0.2em; }
a:hover { color: var(--ink); }

img, svg { max-width: 100%; }
img { height: auto; }

/* One visible focus ring everywhere, because a keyboard and a cheap phone
   are the only ways some visitors will reach these fields. */
:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Latin digits read left to right even on a right-to-left page. */
.ltr { direction: ltr; unicode-bidi: isolate; text-align: start; }

/* =====================================================================
   The shell: top bar, header, navigation, footer.
   ===================================================================== */

.shell { display: flex; flex-direction: column; min-height: 100vh; }

/* Seen only when it is reached by the keyboard: the header is long enough
   on a desktop that a screen-reader or keyboard user should not have to
   walk through every link of it on every page. */
.skip {
    position: absolute;
    inset-block-start: var(--space-2);
    inset-inline-start: var(--space-2);
    z-index: 30;
    padding: var(--space-2) var(--space-4);
    background: var(--primary);
    color: #FFFFFF;
    border-radius: var(--radius);
    font-weight: 600;
    transform: translateY(-200%);
}

.skip:focus { transform: none; color: #FFFFFF; }

.topbar {
    background: var(--band);
    border-bottom: 1px solid var(--border);
    color: var(--quiet);
    font-size: var(--fs-xs);
    line-height: 1.6;
    padding: 6px var(--inset);
    display: flex;
    flex-wrap: wrap;
    gap: 4px 28px;
    align-items: center;
    justify-content: space-between;
}

.topbar a { color: var(--quiet); text-decoration: none; }
.topbar a:hover { color: var(--ink); text-decoration: underline; }
.topbar__links { display: flex; flex-wrap: wrap; gap: 4px 28px; }

/* On a phone the date is the whole bar, as Mobile.dc.html draws it; the
   links it would push onto a second and third line are in the menu. */
@media (max-width: 699px) {
    .topbar { justify-content: center; text-align: center; }
    .topbar__links { display: none; }
}

.masthead {
    position: relative;
    background: var(--card);
    padding: clamp(10px, 4px + 1.2vw, 20px) var(--inset);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand ask menu" "search search search";
    gap: 10px 8px;
    align-items: center;
}

.masthead__brand { grid-area: brand; }
.masthead__ask { grid-area: ask; justify-self: end; max-width: 100%; }
.menu { grid-area: menu; }
.search { grid-area: search; }

/* A tablet held sideways has room for the search beside the brand but not
   for seven section names beside each other, so the menu stays a button
   there and the whole header is one row. */
@media (min-width: 900px) and (max-width: 1199px) {
    .masthead {
        grid-template-columns: auto minmax(0, 1fr) auto auto;
        grid-template-areas: "brand search ask menu";
        gap: 24px;
    }
}

@media (min-width: 1200px) {
    .masthead {
        grid-template-columns: auto minmax(0, 560px);
        grid-template-areas: "brand search";
        justify-content: space-between;
        gap: 32px;
    }
}

.masthead__brand {
    display: flex;
    align-items: center;
    gap: clamp(8px, 4px + 1vw, 16px);
    text-decoration: none;
    color: var(--ink);
}

/* Sized so the emblem, the wordmark, the ask button and the menu share one
   row even on a 360px phone. */
.masthead__emblem { height: clamp(40px, 26px + 3.6vw, 78px); width: auto; display: block; flex-shrink: 0; }
.masthead__names { display: flex; flex-direction: column; gap: 2px; }
.masthead__wordmark { height: clamp(30px, 20px + 2.5vw, 56px); width: auto; display: block; }
.masthead__official { font-size: var(--fs-xs); color: var(--quiet); line-height: 1.5; }

@media (min-width: 900px) {
    .masthead__official { font-size: var(--fs-sm); }
}

@media (max-width: 559px) {
    .masthead__official { display: none; }
}

/* The search box. It is a plain GET form; there is no script behind it.
   On a phone it takes the whole second row of the header, so the first
   thing a visitor can do is the thing most of them came to do. */
.search {
    display: flex;
    align-items: stretch;
    height: 48px;
    border: 1px solid var(--field);
    border-radius: 24px;
    overflow: hidden;
    background: var(--card);
}

/* A ring on the field would be cut off by the box's rounded clip, so the
   box wears it; the button, dark already, takes a light ring inside itself. */
.search:has(input:focus, select:focus) { outline: 3px solid var(--primary); outline-offset: 2px; }
.search input:focus-visible, .search select:focus-visible { outline: none; }
.search button:focus-visible { outline: 3px solid #FFFFFF; outline-offset: -7px; }

.search select {
    height: auto;
    width: auto;
    border: none;
    border-radius: 0;
    border-inline-start: 1px solid var(--border);
    background: var(--page);
    padding: 0 12px;
    font-size: var(--fs-sm);
}

.search input {
    flex-grow: 1;
    min-width: 0;
    height: auto;
    border: none;
    border-radius: 0;
    padding: 0 16px;
    font-size: var(--fs-md);
    background: var(--card);
}

.search button {
    width: 56px;
    flex-shrink: 0;
    border: none;
    background: var(--primary);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.search button:hover { background: var(--press); }

/* On a phone the scope of the search costs more room than it is worth;
   without it the search covers every section, which is the default anyway. */
@media (max-width: 699px) {
    .search select { display: none; }
}

/* ---------- the phone menu ----------

   A <details>, so it opens and closes with no script, answers Enter and
   Space, and tells a screen reader whether it is open without anybody
   keeping an aria-expanded in step. It is drawn below 1200px only; the
   desktop bar under the header is a second copy of the same links, because
   a closed <details> cannot be forced open by a stylesheet in every browser
   the council's visitors use, and a menu that is hidden on a desktop with
   no way to open it would be far worse than twelve repeated links. */

.masthead > .masthead__ask { display: none; }

@media (min-width: 360px) and (max-width: 1199px) {
    .masthead > .masthead__ask {
        display: block;
        height: var(--touch);
        line-height: 42px;
        text-align: center;
        padding: 0 14px;
        font-size: var(--fs-sm);
        /* A council-written label longer than the row truncates rather than
           pushing the page sideways; the full label is in the menu. */
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

.menu__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--touch);
    height: var(--touch);
    border-radius: var(--radius);
    color: var(--primary);
    cursor: pointer;
    list-style: none;
}

.menu__toggle::-webkit-details-marker { display: none; }
.menu__toggle:hover, .menu[open] > .menu__toggle { background: var(--band); }
.menu__close, .menu[open] .menu__open { display: none; }
.menu[open] .menu__close { display: block; }

.menu__panel {
    position: absolute;
    inset-inline: 0;
    inset-block-start: 100%;
    z-index: 20;
    background: var(--card);
    border-block: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: var(--space-2) 0 var(--space-5);
}

.menu__items { list-style: none; margin: 0; padding: 0; }

.menu__items a {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 6px var(--inset);
    border-bottom: 1px solid var(--rule);
    border-inline-start: 3px solid transparent;
    color: var(--ink);
    text-decoration: none;
    font-size: 17px;
    line-height: 1.6;
}

.menu__items a:hover { background: var(--page); }
.menu__items a[aria-current] { font-weight: 600; background: var(--page); border-inline-start-color: var(--ornament); }

.menu__panel > .menu__ask { display: flex; margin: var(--space-5) var(--inset) 0; }

.menu__more {
    list-style: none;
    margin: var(--space-3) 0 0;
    padding: 0 var(--inset);
    display: flex;
    flex-wrap: wrap;
    gap: 0 24px;
    font-size: var(--fs-md);
}

.menu__more a { display: inline-flex; align-items: center; min-height: var(--touch); }

/* The top bar shows these links itself once it has room for them. */
@media (min-width: 700px) {
    .menu__more { display: none; }
}

@media (min-width: 1200px) {
    .menu { display: none; }
}

/* ---------- the desktop bar ---------- */

.mainnav { display: none; }

@media (min-width: 1200px) {
    .mainnav {
        background: var(--card);
        border-top: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
        padding: 0 var(--inset);
        display: flex;
        align-items: stretch;
        justify-content: space-between;
        gap: 8px 24px;
    }
}

/* The council may list three sections or twelve. Past what one row holds
   the bar wraps onto a second row rather than squeezing every label. */
.mainnav__items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0 4px;
    min-width: 0;
}

.mainnav__items a {
    display: flex;
    align-items: center;
    min-height: 56px;
    padding: 0 clamp(8px, 1.1vw - 2px, 16px);
    color: var(--ink);
    text-decoration: none;
    font-size: var(--fs-body);
    line-height: 1.5;
    border-bottom: 3px solid transparent;
}

.mainnav__items a:hover { border-bottom-color: var(--border); }
.mainnav__items a[aria-current] { font-weight: 600; border-bottom-color: var(--ornament); }

.mainnav__cta { display: flex; align-items: center; padding: 7px 0; flex-shrink: 0; }

.button-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 22px;
    background: var(--primary);
    color: #FFFFFF;
    border-radius: 21px;
    text-decoration: none;
    font-size: var(--fs-md);
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid var(--primary);
}

.button-pill:hover { background: var(--press); color: #FFFFFF; }

.shell__body {
    flex-grow: 1;
    padding: var(--body-top) var(--inset) var(--space-block);
}

/* A detail page is read, not scanned: its column is narrowed to a line
   length that can be followed back to the start, and centred so the
   margins on a wide screen are even rather than all on one side. */
.shell__body--reading { --inset: max(var(--gutter), (100vw - var(--read-max)) / 2); }

@supports (width: 1cqi) {
    .shell__body--reading { --inset: max(var(--gutter), (100cqi - var(--read-max)) / 2); }
}

.sitefoot {
    background: var(--foot);
    border-top: 1px solid var(--field);
    color: var(--ink);
    padding: clamp(32px, 20px + 3.2vw, 56px) var(--inset) 20px;
    display: flex;
    flex-direction: column;
    gap: clamp(20px, 12px + 2vw, 40px);
}

.sitefoot__columns {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-5);
}

@media (min-width: 900px) {
    .sitefoot__columns { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 56px; }
}

.sitefoot__brand { display: flex; flex-direction: column; gap: var(--space-4); }
.sitefoot__mark { height: clamp(110px, 90px + 4.2vw, 150px); width: auto; display: block; align-self: flex-start; }
.sitefoot h2 { font-family: inherit; font-size: var(--fs-body); font-weight: 600; margin-bottom: 4px; }
.sitefoot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.sitefoot li { display: flex; align-items: center; min-height: 40px; }
.sitefoot a { color: var(--quiet); text-decoration: none; font-size: var(--fs-md); }
.sitefoot a:hover { color: var(--ink); text-decoration: underline; }
.sitefoot li > span { color: var(--quiet); font-size: var(--fs-md); }

/* Mobile.dc.html sets the footer's links in a wrapped row: a column of
   eight links is a screen of scrolling on a phone to reach the last line. */
@media (max-width: 699px) {
    .sitefoot__links ul { flex-direction: row; flex-wrap: wrap; gap: 0 20px; }
    .sitefoot li { min-height: var(--touch); }
}

.sitefoot__about { font-size: var(--fs-md); line-height: var(--lh-text); color: var(--quiet); max-width: 480px; }

.sitefoot__rights {
    padding-top: 18px;
    border-top: 1px solid var(--field);
    font-size: var(--fs-xs);
    color: var(--quiet);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    justify-content: space-between;
}

.sitefoot__social { display: flex; flex-wrap: wrap; gap: 0 18px; }
.sitefoot__social a { display: inline-flex; align-items: center; min-height: var(--touch); font-size: var(--fs-sm); }

/* =====================================================================
   Page furniture.
   ===================================================================== */

.crumbs {
    font-size: var(--fs-sm);
    color: var(--quiet);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 8px;
    margin-bottom: var(--space-3);
    min-width: 0;
}

.crumbs a { display: inline-flex; align-items: center; min-height: var(--touch); }

/* The last crumb is the page's own title, which the heading below repeats
   in full. On one line it is a signpost; on three it is noise. */
.crumbs > :last-child {
    flex: 1 1 0;
    min-width: 8em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-title { font-size: var(--fs-h1); line-height: 1.45; }
.page-lead { margin-top: 10px; font-size: var(--fs-lead); line-height: var(--lh-text); color: var(--quiet); max-width: 760px; }
.page-lead p + p { margin-top: 0.6em; }

.columns { display: grid; grid-template-columns: 1fr; gap: var(--space-5); align-items: start; }
.page-title + .columns, .page-lead + .columns { margin-top: var(--space-5); }

@media (min-width: 1100px) {
    .columns { grid-template-columns: minmax(0, 1fr) 380px; gap: var(--space-7); }
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--card-pad);
    min-width: 0;
}

.card--band { background: var(--band); }

/* A card's own heading, and what follows it. Cards are written with bare
   h2s and paragraphs, so the space between them is the card's to give. */
.card > h2 { font-size: clamp(22px, 20px + 0.5vw, 26px); }
.card:not(form) > * + * { margin-top: var(--space-3); }
.card:not(form) > * + .actions { margin-top: var(--space-5); }

.stack { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }

.side, .home__side { display: flex; flex-direction: column; gap: var(--space-5); min-width: 0; }
.side p, .side li { font-size: var(--fs-md); line-height: 1.8; }
.side ul { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 10px; }

/* =====================================================================
   Lists of articles: rows, tiles, papers and the filters above them.
   ===================================================================== */

/* ---------- the section header over a block ---------- */

.sechead { display: flex; align-items: center; gap: var(--space-3); }
.sechead__mark { flex-shrink: 0; }
.sechead h2 { font-size: var(--fs-h2); min-width: 0; }
.sechead__rule { flex: 1 1 16px; height: 1px; background: var(--border); }

.sechead a {
    display: inline-flex;
    align-items: center;
    min-height: var(--touch);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    white-space: nowrap;
}

.sechead a:hover { text-decoration: underline; }

@media (min-width: 900px) {
    .sechead a { font-size: var(--fs-md); }
}

/* ---------- a list of articles, one to a row ----------

   On the home page every row is itself a link. On the section pages each
   is an <article> whose heading holds the link, so a screen reader can
   walk them by heading; the link is stretched over the row so a thumb can
   still land anywhere on it. */

.rows {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0 clamp(16px, 8px + 2vw, 28px);
    container-type: inline-size;
}

.rows__row {
    position: relative;
    display: flex;
    gap: clamp(14px, 10px + 1vw, 22px);
    align-items: flex-start;
    padding-block: clamp(16px, 13px + 0.8vw, 22px);
    border-bottom: 1px solid var(--rule);
    text-decoration: none;
    color: var(--ink);
}

.rows__row:last-child { border-bottom: none; }
.rows__row:hover .rows__title { text-decoration: underline; text-decoration-thickness: 1px; }
.rows__body { display: flex; flex-direction: column; gap: 6px; flex-grow: 1; min-width: 0; }
.rows__title { font-family: var(--font-head); font-size: var(--fs-h3); font-weight: 700; line-height: var(--lh-head); }
.rows__link { color: inherit; text-decoration: none; }
.rows__link::after { content: ""; position: absolute; inset: 0; }
.rows__summary { font-size: var(--fs-md); line-height: 1.8; color: var(--quiet); }
.rows__meta { display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: var(--fs-sm); color: var(--quiet); }

/* The number box, and the pill it becomes on a phone, where Mobile.dc.html
   puts it above the title so the title keeps the whole width. */
.num {
    flex-shrink: 0;
    width: 84px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 0;
    border-radius: 8px;
    background: var(--band);
    line-height: 1.5;
}

.num__label { font-size: 12px; color: var(--quiet); }
.num__value { font-size: 17px; font-weight: 600; color: var(--primary); }

@container (max-width: 519px) {
    .rows__row { flex-direction: column; gap: 6px; }
    .num { width: auto; flex-direction: row; gap: 6px; padding: 2px 10px; border-radius: 10px; }
    .num__label, .num__value { font-size: 12px; font-weight: 600; color: var(--primary); }
}

/* ---------- chips: categories, and the filters of a section ---------- */

.chips, .list-filter { display: flex; flex-wrap: wrap; gap: var(--space-2); }

.chips a, .filter-pill {
    display: inline-flex;
    align-items: center;
    min-height: var(--touch);
    padding: 4px 16px;
    border: 1px solid var(--field);
    border-radius: 22px;
    font-size: var(--fs-sm);
    line-height: 1.5;
    text-decoration: none;
    color: var(--primary);
    background: var(--page);
    white-space: nowrap;
}

.chips a:hover, .filter-pill:hover { background: var(--band); color: var(--primary); }
.chips--tabs a { background: var(--card); }
.filter-pill[aria-current] { background: var(--primary); border-color: var(--primary); color: #FFFFFF; font-weight: 600; }

/* A section's filters run to a dozen categories. On a phone they are one
   row that scrolls sideways inside its own box, reaching to the edges of
   the screen, instead of five rows standing between the title and the
   first fatwa. */
@media (max-width: 699px) {
    .list-filter {
        flex-wrap: nowrap;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scrollbar-width: none;
        margin-inline: calc(-1 * var(--inset));
        padding: 2px var(--inset) 6px;
        scroll-padding-inline: var(--inset);
    }

    .list-filter::-webkit-scrollbar { display: none; }
}

/* ---------- tiles: seminars, researches and verses ---------- */

.cards3 {
    container-type: inline-size;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 264px), 1fr));
    gap: clamp(16px, 12px + 1vw, 24px);
}

.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    color: var(--ink);
    min-width: 0;
}

.tile:hover { border-color: var(--ornament); color: var(--ink); }
.tile:hover .tile__title { text-decoration: underline; text-decoration-thickness: 1px; }
.tile:has(.tile__link:focus-visible) { outline: 3px solid var(--primary); outline-offset: 2px; }
.tile__link:focus-visible { outline: none; }

.tile__cover {
    position: relative;
    height: clamp(160px, 150px + 2vw, 190px);
    background: var(--band);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tile__kind {
    position: absolute;
    top: 12px;
    inset-inline-start: 12px;
    font-size: 12px;
    background: var(--card);
    color: var(--primary);
    padding: 2px 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.tile__body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: var(--space-2); flex-grow: 1; }
.tile__title { font-family: var(--font-head); font-size: clamp(20px, 19px + 0.2vw, 21px); font-weight: 700; line-height: var(--lh-head); }
.tile__link { color: inherit; text-decoration: none; }
.tile__link::after { content: ""; position: absolute; inset: 0; }
.tile__meta { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: var(--fs-sm); color: var(--quiet); }
.tile__lead { font-size: var(--fs-md); line-height: 1.8; color: var(--quiet); }

/* Three seminars stacked at full width are three screens of mostly empty
   cover on a phone. In one column the cover becomes a square beside the
   title, as a list reads, and the tile keeps its colours and its mark. */
@container (max-width: 519px) {
    .tile:has(> .tile__cover) { flex-direction: row; }
    .tile__cover { flex: 0 0 104px; height: auto; min-height: 112px; }
    .tile__cover > svg { width: 40px; height: 40px; }
    .tile__kind { top: auto; inset-block-end: 8px; inset-inline-start: 50%; translate: 50% 0; padding: 0 8px; }
    .tile__body { padding: 14px 16px; gap: 4px; }
}

/* ---------- a research, drawn as a bound paper ---------- */

.paper {
    display: flex;
    gap: 18px;
    padding: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 0;
}

.paper__spine {
    flex-shrink: 0;
    width: clamp(72px, 60px + 3vw, 96px);
    aspect-ratio: 96 / 136;
    align-self: flex-start;
    padding: 5px;
    background: var(--band);
    border-start-start-radius: 8px;
    border-end-start-radius: 8px;
    border-start-end-radius: 3px;
    border-end-end-radius: 3px;
}

.paper__spine-inner {
    display: block;
    height: 100%;
    border: 1px solid var(--field);
    /* Main.dc.html sets the council's emblem on the cover. */
    background: url("../img/logo-emblem.png") center / 70% auto no-repeat;
}
.paper__body { display: flex; flex-direction: column; gap: var(--space-2); flex-grow: 1; min-width: 0; }
.paper__title { font-family: var(--font-head); font-size: 19px; font-weight: 700; line-height: var(--lh-head); text-decoration: none; color: var(--ink); }
.paper__title:hover { text-decoration: underline; }
.paper__meta { font-size: var(--fs-xs); color: var(--quiet); }
.paper__actions { display: flex; flex-wrap: wrap; gap: 0 18px; margin-top: auto; font-size: var(--fs-sm); font-weight: 600; }
.paper__actions a { display: inline-flex; align-items: center; min-height: var(--touch); text-decoration: none; color: var(--primary); }
.paper__actions a + a { color: var(--muted); }
.paper__actions a:hover { text-decoration: underline; }

/* ---------- paging ---------- */

.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-3) var(--space-5);
    margin-top: var(--space-2);
    font-size: var(--fs-md);
    color: var(--quiet);
}

.pager .button { min-height: var(--touch); padding: 0 22px; font-size: var(--fs-md); }

/* =====================================================================
   A published article: its meta line, its body and its credits.
   ===================================================================== */

.item-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 16px;
    margin-top: var(--space-3);
    font-size: var(--fs-sm);
    color: var(--quiet);
}

/* A small ornament-coloured dot between items, drawn rather than typed so
   a screen reader does not read out a middle dot between every pair. */
.item-meta > * + *:not(.badge)::before,
.item-meta > .badge + *::before {
    content: "";
    display: inline-block;
    width: 4px;
    height: 4px;
    margin-inline-end: 16px;
    border-radius: 50%;
    background: var(--ornament);
    vertical-align: middle;
}

.item-meta > .badge + *::before { display: none; }

/* The cover drawn above an article, and a seminar's recordings: full width
   of the column, never wider than the text beside them. */
.item-cover { display: block; width: 100%; max-width: var(--measure); border-radius: var(--radius); }
.item-player { display: block; width: 100%; max-width: var(--measure); }

/* A download inside a tile sits above the tile's stretched link, or the
   click would open the article instead of the file. */
.tile__download { position: relative; z-index: 1; font-weight: 600; }

/* The question a fatwa answers, as the asker wrote it: plain text, whose
   only paragraphs are his line breaks. */
.item-question { font-size: var(--fs-prose); line-height: 2; white-space: pre-line; max-width: var(--measure); }

/* ---------- the stored body ----------

   Everything Html.cs lets through, and nothing else, since nothing else
   can arrive: p, br, hr, div, span, h2-h4, strong/b, em/i, u, sup, sub,
   ul, ol, li, blockquote, figure, figcaption, table and its parts, a. */

.prose {
    font-size: var(--fs-prose);
    line-height: 2;
    max-width: var(--measure);
}

.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }

.prose p, .prose ul, .prose ol, .prose blockquote, .prose figure, .prose table { margin-block: 0 1em; }
.prose div + div { margin-top: 1em; }

.prose h2, .prose h3, .prose h4 { margin-block: 1.4em 0.5em; line-height: 1.5; }
.prose h2 { font-size: 1.5em; }
.prose h3 { font-size: 1.3em; }
.prose h4 { font-size: 1.12em; }

.prose ul, .prose ol { padding-inline-start: 1.4em; }
.prose li + li { margin-top: 0.35em; }
.prose li > ul, .prose li > ol { margin-block: 0.35em 0; }
.prose li::marker { color: var(--muted); }

.prose a { color: var(--muted); overflow-wrap: anywhere; }
.prose strong, .prose b { font-weight: 600; color: var(--ink); }

/* Superscripts are footnote markers in a fatwa; at the default line
   height they would open a gap in the line they sit on. */
.prose sup, .prose sub { line-height: 0; font-size: 0.75em; }

/* A quotation, and above all a verse of the Qur'an, which is why it is set
   in Amiri and larger: the mushaf's own face is a naskh, and a verse
   quoted in the sans of the surrounding text reads as the council's words
   rather than as scripture. */
.prose blockquote {
    margin-inline: 0;
    padding: 0.8em 1.2em;
    background: var(--page);
    border-inline-start: 3px solid var(--ornament);
    border-start-end-radius: 8px;
    border-end-end-radius: 8px;
    font-family: var(--font-head);
    font-size: 1.22em;
    line-height: 2.05;
}

.prose blockquote > * { margin-block: 0; }
.prose blockquote > * + * { margin-top: 0.5em; }

.prose figure { margin-inline: 0; }
.prose figcaption { margin-top: 0.5em; font-family: var(--font-text); font-size: var(--fs-sm); line-height: 1.8; color: var(--quiet); }

/* The eight-pointed star in the middle of a hairline. */
.prose hr {
    height: 18px;
    margin-block: 1.6em;
    border: 0;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='%23CCAE88' stroke-width='1.6'%3E%3Cpolygon points='7,7 17,7 17,17 7,17'/%3E%3Cpolygon points='12,4.9 19.1,12 12,19.1 4.9,12'/%3E%3C/g%3E%3C/svg%3E") center / 18px no-repeat,
        linear-gradient(to left, var(--border) calc(50% - 18px), transparent 0 calc(50% + 18px), var(--border) 0) center / 100% 1px no-repeat;
}

/* A table the council pastes in may be wider than a phone. It scrolls
   inside its own box; the page never does. As a block it keeps its own
   width when it is narrow, and at most the column's width when it is not. */
.prose table {
    display: block;
    width: max-content;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-family: var(--font-text);
    font-size: var(--fs-md);
    line-height: 1.8;
}

.prose th, .prose td { padding: 0.5em 0.8em; border: 1px solid var(--border); text-align: start; vertical-align: top; }

/* Without a floor a six-column table on a phone squeezes to a word per
   line before it ever needs to scroll. */
.prose td, .prose th { min-width: 6.5em; }
.prose th { background: var(--band); font-weight: 600; }
.prose tr:nth-child(even) td { background: var(--page); }

/* ---------- who wrote it ---------- */

.credits__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }

.credits__list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0 16px;
    min-height: var(--touch);
    padding-block: 6px;
    border-bottom: 1px solid var(--field);
}

.credits__list li:last-child { border-bottom: none; }
.credits__list a { font-weight: 600; color: var(--ink); text-decoration: none; }
.credits__list a:hover { text-decoration: underline; }
.credits__role { font-size: var(--fs-sm); color: var(--quiet); }

/* ---------- a scholar's own page ---------- */

.worklist { list-style: none; margin: 0; padding: 0; }

.worklist li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-block: 12px;
    border-bottom: 1px solid var(--rule);
}

.worklist li:last-child { border-bottom: none; padding-bottom: 0; }
.worklist a { font-size: var(--fs-body); font-weight: 500; color: var(--ink); text-decoration: none; }
.worklist a:hover { text-decoration: underline; }
.worklist__meta { display: flex; flex-wrap: wrap; gap: 0 16px; font-size: var(--fs-xs); color: var(--quiet); }

.scholar__portrait {
    display: block;
    width: 132px;
    height: 132px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--field);
    background: var(--band);
}

/* =====================================================================
   Forms.
   ===================================================================== */

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; min-width: 0; }
.field label { font-size: var(--fs-md); font-weight: 600; }
.hint { font-size: var(--fs-sm); line-height: 1.8; color: var(--quiet); }
.field .hint { font-size: var(--fs-xs); }
fieldset > .hint { margin-bottom: var(--space-3); }

.row2, .row3 { display: grid; grid-template-columns: 1fr; gap: 0 20px; }

@media (min-width: 700px) {
    .row2 { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
    .row3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 16px is also the size under which iOS zooms the page into a field. */
input[type=text],
input[type=email],
input[type=tel],
input[type=search],
select,
textarea {
    width: 100%;
    border: 1px solid var(--field);
    border-radius: 8px;
    padding: 0 14px;
    font: inherit;
    font-size: var(--fs-body);
    color: var(--ink);
    background: var(--card);
}

input[type=text],
input[type=email],
input[type=tel],
input[type=search],
select { height: 48px; }

input::placeholder, textarea::placeholder { color: var(--quiet); opacity: 1; }

textarea {
    min-height: 200px;
    padding: 12px 14px;
    line-height: var(--lh-text);
    resize: vertical;
}

select:disabled { background: var(--page); color: var(--quiet); }

input.input-validation-error, select.input-validation-error, textarea.input-validation-error { border-color: var(--danger); }

fieldset { margin: 0 0 20px; padding: 0; border: none; min-width: 0; }
legend { font-size: var(--fs-md); font-weight: 600; padding: 0; margin-bottom: 10px; }

.choice {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 16px 18px;
    border: 1px solid var(--field);
    background: var(--card);
    border-radius: var(--radius);
    cursor: pointer;
    margin-bottom: 12px;
}

.choice input { margin: 5px 0 0; accent-color: var(--primary); width: 20px; height: 20px; flex-shrink: 0; }
.choice:hover { border-color: var(--primary); }

/* Ask.dc.html marks the chosen reply by its frame, not only by the dot:
   a visitor choosing whether his question may be published should see at
   a glance which one he chose. One pixel of padding pays for the second
   pixel of border, so the text does not move. */
.choice:has(input:checked) { border: 2px solid var(--primary); padding: 15px 17px; background: var(--page); }

.choice__title { display: block; font-size: var(--fs-body); font-weight: 600; }
.choice__note { display: block; font-size: var(--fs-sm); line-height: 1.8; color: var(--quiet); }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    padding: 0 clamp(24px, 16px + 2vw, 36px);
    border: none;
    background: var(--primary);
    color: #FFFFFF;
    border-radius: 26px;
    font: inherit;
    font-size: var(--fs-body);
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

.button:hover { background: var(--press); color: #FFFFFF; }

.button--quiet {
    background: var(--card);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.button--quiet:hover { background: var(--band); color: var(--primary); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-4); }
.actions > a:not(.button) { display: inline-flex; align-items: center; min-height: var(--touch); }

/* On a phone the one thing a form is for is a full-width button under the
   thumb, and its hint reads under it rather than squeezed beside it. */
@media (max-width: 559px) {
    form .actions > .button, .once .actions > .button { flex: 1 1 100%; }
}

/* The small code box that appears in the sidebar and in the shell. */
.inline-form { display: flex; gap: 8px; }
.inline-form input, .inline-form select { flex: 1 1 auto; min-width: 0; border-radius: 22px; height: var(--touch); }
.inline-form .button { flex-shrink: 0; min-height: var(--touch); height: var(--touch); padding: 0 18px; font-size: var(--fs-md); }

/* ---------- messages ---------- */

.note, .error, .warn {
    padding: 14px 16px;
    margin-bottom: 20px;
    font-size: var(--fs-md);
    line-height: 1.8;
    border-inline-start: 4px solid var(--ornament);
    background: var(--band);
    border-radius: 8px;
}

.stack > .note, .stack > .error, .stack > .warn, .card > .note:last-child { margin-bottom: 0; }

.error {
    border-inline-start-color: var(--danger);
    background: var(--danger-bg);
    color: var(--danger);
}

.error ul { margin: 0; padding-inline-start: 1.2em; }

.warn { border-inline-start-color: var(--danger); background: var(--warn-bg); }
.warn strong { display: block; font-size: var(--fs-body); margin-bottom: 4px; }

/* The validation summary tag helper can draw its box with nothing in it
   when only the fields are wrong; an empty red box says nothing useful. */
.validation-summary-valid { display: none; }

.field-error { color: var(--danger); font-size: var(--fs-sm); font-weight: 600; }
.field-error:empty { display: none; }

/* =====================================================================
   Asking and tracking.
   ===================================================================== */

/* The tracking code, shown once. */
.once { border: 2px solid var(--primary); border-radius: var(--radius-lg); padding: var(--card-pad); background: var(--card); min-width: 0; }
.once > * + * { margin-top: var(--space-3); }
.once > .actions { margin-top: var(--space-5); }

.once__code {
    direction: ltr;
    text-align: center;
    font-family: Consolas, 'Courier New', monospace;
    font-size: clamp(22px, 17px + 1.6vw, 34px);
    font-weight: 700;
    letter-spacing: 3px;
    background: var(--band);
    border: 1px dashed var(--ornament);
    border-radius: var(--radius);
    padding: 20px 12px;
    word-break: break-all;
    /* Selectable by a long press on a phone: there is no copy button, because
       a copy button needs JavaScript. */
    user-select: all;
}

.steps {
    list-style: none;
    margin: 0 0 var(--space-5);
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.steps li { display: flex; flex-direction: column; gap: 6px; line-height: 1.6; }
.steps .bar { height: 6px; border-radius: 3px; background: var(--border); }
.steps .bar--done { background: var(--primary); }
.steps .label { font-size: var(--fs-sm); font-weight: 600; }
.steps .when { font-size: var(--fs-xs); color: var(--quiet); }

.answer {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: clamp(16px, 12px + 1vw, 24px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--page);
}

.answer__subject { font-size: var(--fs-sm); color: var(--quiet); }

/* The answer is stored markup now, with its own paragraphs; it is set in
   Amiri as Track.dc.html sets it, since it is the council's answer. */
.answer__body {
    font-family: var(--font-head);
    font-size: clamp(19px, 18px + 0.3vw, 21px);
    line-height: 2;
}

.answer__body > * + * { margin-top: 0.7em; }
.answer__body ul, .answer__body ol { padding-inline-start: 1.4em; margin-block: 0; }
.answer__by { font-size: var(--fs-sm); color: var(--muted); }

.badge {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 12px;
    background: var(--primary);
    color: #FFFFFF;
    font-size: var(--fs-xs);
    font-weight: 600;
    line-height: 1.7;
}

.talk { display: flex; flex-direction: column; gap: 12px; }

.talk__msg {
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--page);
    border: 1px solid var(--border);
}

/* The asker's own words are plain text he typed, and his line breaks are
   the only paragraphs they have. The council's are markup. */
.talk__text { white-space: pre-line; }
.talk__msg p + p { margin-top: 0.6em; }

/* A message template shown on the page: plain text from the templates
   screen, so its line breaks are its paragraphs too. */
.council-text { white-space: pre-line; }

.talk__msg--council { background: var(--band); border-color: var(--field); }
.talk__who { display: block; font-size: var(--fs-xs); font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.talk__when { display: block; font-size: var(--fs-xs); color: var(--quiet); margin-top: 6px; }

/* =====================================================================
   Prayer times, drawn as Mobile.dc.html draws them: six small tiles,
   three to a row wherever they sit, six on a page wide enough.
   ===================================================================== */

.times {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 88px), 1fr));
    gap: 8px;
}

.times li {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 4px;
    background: var(--band);
    border-radius: 8px;
    line-height: 1.5;
}

.times__name { font-size: var(--fs-xs); color: var(--quiet); }
.times__at { font-size: var(--fs-body); font-weight: 600; color: var(--primary); }
.times__method { font-size: var(--fs-xs); color: var(--quiet); }

@media (min-width: 1100px) {
    .home__side .times { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* =====================================================================
   The home page of design/Main.dc.html and design/Mobile.dc.html.

   Every block below is drawn only if core.HomeSections asks for it, so
   nothing here assumes a particular block is on the page.
   ===================================================================== */

/* A band that reaches the edges of the page although it sits inside the
   body's gutter. Negative inline margins are how, rather than wrapping
   every page in a second element that only this one needs. */
.hero, .band {
    margin-inline: calc(-1 * var(--inset));
    padding-inline: var(--inset);
}

.hero {
    position: relative;
    margin-top: calc(-1 * var(--body-top));
    background: var(--band);
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    padding-block: clamp(28px, 18px + 2.6vw, 56px);
}

.hero__lattice { position: absolute; inset: 0; width: 100%; height: 100%; }

.hero__frame {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding: clamp(6px, 5px + 0.2vw, 8px);
    background: var(--page);
    border: 1px solid var(--field);
}

.hero__inner {
    border: 1px solid var(--border);
    padding: clamp(24px, 20px + 1vw, 34px) clamp(18px, 4px + 4vw, 64px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(10px, 9px + 0.4vw, 14px);
    text-align: center;
}

.hero__kicker, .hero__ref { font-size: clamp(13px, 12.3px + 0.2vw, 15px); color: var(--muted); }

.hero__ayah {
    font-family: var(--font-head);
    font-size: var(--fs-ayah);
    line-height: 1.7;
    color: var(--ink);
    text-wrap: balance;
}

.hero__note { font-size: clamp(14px, 13px + 0.3vw, 17px); line-height: var(--lh-text); color: var(--quiet); max-width: 640px; }
.hero__note p + p { margin-top: 8px; }
.hero__more { display: inline-flex; align-items: center; min-height: var(--touch); font-size: var(--fs-md); font-weight: 600; color: var(--primary); }

/* ---------- the statements band ---------- */

.band {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding-block: clamp(28px, 20px + 2.2vw, 48px);
    display: flex;
    flex-direction: column;
    gap: clamp(16px, 12px + 1.2vw, 28px);
}

.band__grid { display: grid; grid-template-columns: 1fr; gap: var(--space-4) var(--space-7); }

@media (min-width: 1000px) {
    .band__grid { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
}

.band__lead {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: clamp(20px, 16px + 1.2vw, 28px) clamp(20px, 14px + 1.6vw, 32px);
    background: var(--page);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--ink);
}

.band__lead:hover { border-color: var(--ornament); color: var(--ink); }
.band__lead:hover .band__title { text-decoration: underline; text-decoration-thickness: 1px; }
.band__meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.band__number { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); }
.band__title { font-family: var(--font-head); font-size: clamp(21px, 18.4px + 0.7vw, 28px); font-weight: 700; line-height: var(--lh-head); }
.band__summary { font-size: clamp(14px, 13.4px + 0.2vw, 16px); line-height: var(--lh-text); color: var(--quiet); }
.band__when { font-size: var(--fs-xs); color: var(--quiet); }
.band__item { font-size: 17px; font-weight: 500; line-height: 1.6; }

.band__list { display: flex; flex-direction: column; }

.band__list a {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--ink);
}

.band__list a:hover .band__item { text-decoration: underline; }

.pill {
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 10px;
    background: var(--band);
    color: var(--primary);
}

/* ---------- the two columns ----------

   The invitation to ask is the page's one call to action. Mobile.dc.html
   puts it straight after the statements, where Main.dc.html puts it at the
   top of the aside; it is written before the articles, and on a desktop the
   grid lifts it into the aside's first row, so both designs hold without
   the card being drawn twice. */

.home {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-block);
    align-items: start;
    padding-top: var(--space-block);
}

@media (min-width: 1100px) {
    .home {
        grid-template-columns: minmax(0, 1fr) 360px;
        grid-template-rows: auto 1fr;
        gap: 28px 56px;
    }

    .home__ask { grid-column: 2; grid-row: 1; }
    .home__main { grid-column: 1; grid-row: 1 / span 2; }
    .home__side { grid-column: 2; grid-row: 2; }
    .home:not(:has(> .home__ask)) > .home__side { grid-row: 1 / span 2; }
    .home:not(:has(> .home__side, > .home__ask)) { grid-template-columns: minmax(0, 1fr); }
}

/* With no verse and no statements over it, the first block is the top of
   the page and needs no second gap under the header. */
.shell__body > .home:first-child { padding-top: 0; }

.home__main { display: flex; flex-direction: column; gap: var(--space-block); min-width: 0; }
.home__block { display: flex; flex-direction: column; gap: clamp(12px, 8px + 1.2vw, 24px); min-width: 0; }

.home__side .card, .home__ask { display: flex; flex-direction: column; gap: 14px; }
.home__side .card > * + *, .card.home__ask > * + * { margin-top: 0; }
.home__side .card > h2 { font-size: clamp(22px, 21px + 0.3vw, 24px); }
.home__side .card > a:last-child { align-self: flex-start; display: inline-flex; align-items: center; min-height: var(--touch); font-size: var(--fs-md); }

.invite > h2 { font-size: clamp(25px, 24px + 0.3vw, 28px); }
.invite p { font-size: var(--fs-md); line-height: var(--lh-text); color: var(--quiet); }
.invite > .button { width: 100%; min-height: 48px; }
.invite__track { display: flex; flex-direction: column; gap: 10px; padding-top: 18px; border-top: 1px solid var(--field); }
.invite__track label { font-size: var(--fs-md); font-weight: 600; }

/* Between a phone and the two-column desktop the aside's cards would each
   be a strip across the whole page: they pair up instead, and the
   invitation's button stops being a bar 700px long. */
@media (min-width: 700px) and (max-width: 1099px) {
    .home__side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
    .invite > .button { width: auto; align-self: flex-start; min-width: 240px; }
    .invite__track { max-width: 460px; }
}

.ranked { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ranked li { display: flex; gap: 14px; align-items: flex-start; }

.ranked__n {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    margin-top: 6px;
    border-radius: 15px;
    background: var(--band);
    color: var(--primary);
    font-size: var(--fs-xs);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ranked li a { display: flex; flex-direction: column; gap: 2px; padding-block: 4px; text-decoration: none; color: var(--ink); min-width: 0; flex-grow: 1; }
.ranked li a:hover .ranked__title { text-decoration: underline; }
.ranked__title { font-size: var(--fs-md); font-weight: 500; line-height: 1.6; }
.ranked__kind { font-size: var(--fs-xs); color: var(--quiet); }

/* =====================================================================
   The scholars: the row on the home page and the page of them all.

   Names are long here: «فضيلة الشيخ» and a full name of four parts. The
   grid decides its own column count from the width, so a phone gets two
   and a desktop six, and nobody's name is broken onto four lines.
   ===================================================================== */

.faces {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 124px), 1fr));
    gap: var(--space-5) var(--space-4);
}

.face { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); text-decoration: none; color: var(--ink); text-align: center; min-width: 0; }
.face:hover .face__name { text-decoration: underline; }

.face__photo, .scholar__photo {
    width: clamp(84px, 76px + 2vw, 108px);
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--band);
    border: 2px solid var(--field);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    overflow: hidden;
    flex-shrink: 0;
}

.face__photo img, .scholar__photo img { width: 100%; height: 100%; object-fit: cover; }
.face__name { font-size: var(--fs-md); font-weight: 600; line-height: 1.6; text-wrap: balance; }
.face__role { font-size: var(--fs-xs); color: var(--quiet); line-height: 1.6; }

.scholargrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
    gap: clamp(12px, 8px + 1vw, 20px);
}

@media (max-width: 459px) {
    .scholargrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.scholar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: clamp(16px, 12px + 1vw, 24px) clamp(10px, 6px + 1vw, 18px);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    text-decoration: none;
    color: var(--ink);
    min-width: 0;
}

.scholar:hover { border-color: var(--ornament); color: var(--ink); }
.scholar:hover .scholar__name { text-decoration: underline; text-decoration-thickness: 1px; }
.scholar__name { display: flex; flex-direction: column; font-family: var(--font-head); font-size: clamp(17px, 16px + 0.3vw, 19px); font-weight: 700; line-height: 1.5; text-wrap: balance; }
.scholar__name > span { font-family: var(--font-text); font-size: var(--fs-xs); font-weight: 500; color: var(--muted); }
.scholar__role { font-size: var(--fs-xs); color: var(--quiet); line-height: 1.6; }

@media print {
    .skip, .topbar, .menu, .masthead__ask, .mainnav, .search, .sitefoot, .side, .no-print { display: none !important; }
    body { background: #FFFFFF; }
    .shell__body { padding: 0; }
    .card { border: none; padding: 0; }
}
