/* The App list, /app-list.html (docs/claude/notes/118-app-list.md). Bump ?v= in app-list.html on every edit.

   A drawer of index cards, at the same front desk as the visitors' book (css/contact.css): the same paper, the same
   inks and the same two typefaces, so the two pages read as one set. tests/AppList.Harness/app-list-test.js holds the
   shared colours equal to contact.css's.

   Three decisions carry the look:
   - a card is an index card with a tab, and the tab's place says where the app stands before a word of it is read:
     at the start and filled with ink for "Available", in the middle in the team's violet for "Pilot conversations",
     at the end with a dashed edge for "In development";
   - the red rule under an app's name is an index card's head rule, the only ornament;
   - the team's violet is for what a card does when it is pressed, and for nothing else on a card that is available.
   A card comes up out of the drawer a little under the pointer or the keyboard: the page's one movement, and it
   answers the person. Printed matter (names, tabs, what a card does) is IBM Plex Sans Condensed; the line that
   describes an app is Newsreader. Logical properties throughout: the page mirrors. */

:root {
    --al-paper: #f3f5f1;
    --al-card: #fbfcfa;
    --al-ink: #16233a;
    --al-muted: #566173;
    --al-rule: #b5c0b8;
    --al-head: #d98c86;
    --al-stamp: #4a3fa8;
    --al-on-stamp: #ffffff;
    --al-form: "IBM Plex Sans Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
    --al-read: "Newsreader", Georgia, "Times New Roman", serif;
    --al-tab: 1.75rem;
    --site-nav-color: var(--al-ink);
    --site-nav-border: var(--al-rule);
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --al-paper: #12171e;
        --al-card: #18202a;
        --al-ink: #e6ebef;
        --al-muted: #9ba7b4;
        --al-rule: #364452;
        --al-head: #8f524f;
        --al-stamp: #aba5ff;
        --al-on-stamp: #12171e;
    }
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--al-paper);
    color: var(--al-ink);
    font-family: var(--al-form);
    font-size: 1rem;
    line-height: 1.5;
}

a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--al-stamp); }
:focus-visible { outline: 2px solid var(--al-stamp); outline-offset: 3px; }

.al-skip {
    position: absolute;
    inset-inline-start: 16px;
    inset-block-start: -4rem;
    padding: 8px 14px;
    background: var(--al-stamp);
    color: var(--al-on-stamp);
    font-weight: 600;
    text-decoration: none;
}
.al-skip:focus { inset-block-start: 12px; color: var(--al-on-stamp); }

.al-top,
.al-page {
    max-width: 72rem;
    margin: 0 auto;
    padding-inline: clamp(16px, 4vw, 40px);
}
.al-top { padding-block-start: 22px; }
.al-home { font-weight: 600; font-size: 1.05rem; text-decoration: none; }
.al-page { padding-block: clamp(28px, 6vw, 60px) 72px; }

/* The heading and the one sentence: the cards follow at once. */
.al-intro h1 {
    margin: 0 0 0.3em;
    font-size: clamp(2.5rem, 7vw, 3.75rem);
    font-weight: 600;
    line-height: 1.02;
    letter-spacing: -0.012em;
}
.al-lede {
    margin: 0;
    max-width: 33em;
    font-family: var(--al-read);
    font-size: clamp(1.15rem, 2.4vw, 1.35rem);
    line-height: 1.4;
    text-wrap: balance;
}
.al-small { margin: 0.7rem 0 0; color: var(--al-muted); }

/* The drawer. A row leaves room above it for the tabs that stand up from its cards. */
.al-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18.5rem), 1fr));
    gap: calc(var(--al-tab) + 1.5rem) 1.5rem;
    margin: calc(var(--al-tab) + clamp(28px, 5vw, 48px)) 0 0;
    padding: 0;
    list-style: none;
}

/* One index card, five by three. It grows when its words need more room. The two lines under it are the cards behind
   it in the drawer. */
.al-card {
    position: relative;
    display: flex;
    flex-direction: column;
    aspect-ratio: 5 / 3;
    padding: 1rem 1.2rem 0.95rem;
    background: var(--al-card);
    border: 1px solid var(--al-rule);
    border-radius: 3px;
    box-shadow: 0 2px 0 -1px var(--al-card), 0 3px 0 -1px var(--al-rule), 0 5px 0 -2px var(--al-card), 0 6px 0 -2px var(--al-rule);
    transition: transform 0.16s ease-out;
}

/* The tab stands on the card's upper edge and is one outline with it. */
.al-tab {
    position: absolute;
    inset-block-end: calc(100% - 1px);
    margin: 0;
    height: var(--al-tab);
    padding: 0 0.85rem;
    display: flex;
    align-items: center;
    border: 1px solid var(--al-rule);
    border-block-end: 0;
    border-radius: 7px 7px 0 0;
    background: var(--al-card);
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}
.al-card[data-status="available"] .al-tab { inset-inline-start: -1px; background: var(--al-ink); border-color: var(--al-ink); color: var(--al-paper); }
.al-card[data-status="pilot"] .al-tab { inset-inline-start: 50%; transform: translateX(-50%); background: var(--al-stamp); border-color: var(--al-stamp); color: var(--al-on-stamp); }
[dir="rtl"] .al-card[data-status="pilot"] .al-tab { transform: translateX(50%); }
.al-card[data-status="building"] .al-tab { inset-inline-end: -1px; border-style: dashed; border-color: var(--al-muted); color: var(--al-ink); }
/* A card that is not open yet is cut from the same stock, with the same dashed edge as its tab. */
.al-card[data-status="building"] { border-style: dashed; border-color: var(--al-muted); }

.al-name {
    margin: 0;
    padding-block-end: 0.45rem;
    border-block-end: 1.5px solid var(--al-head);
    font-size: 1.6rem;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.005em;
}
.al-name a { text-decoration: none; }
/* The whole card is the link: the name's link is stretched over it. */
.al-name a::after { content: ""; position: absolute; inset: 0; }

.al-line {
    margin: 0.7rem 0 0;
    font-family: var(--al-read);
    font-size: 1.1rem;
    line-height: 1.4;
    text-wrap: pretty;
}

/* What pressing the card does, at its foot, in the team's ink. */
.al-go {
    margin: auto 0 0;
    padding-block-start: 0.9rem;
    color: var(--al-stamp);
    font-weight: 600;
}

.al-card:hover { transform: translateY(-6px); }
.al-card:hover .al-name a { color: inherit; }
.al-card:hover .al-go { text-decoration: underline; text-underline-offset: 3px; }

/* The keyboard's ring goes round the card, not round the name inside it. */
@supports selector(:has(a)) {
    .al-name a:focus-visible { outline: none; }
    .al-card:has(a:focus-visible) { outline: 2px solid var(--al-stamp); outline-offset: 4px; transform: translateY(-6px); }
}

.al-more {
    margin: clamp(40px, 6vw, 64px) 0 0;
    font-family: var(--al-read);
    font-size: 1.1rem;
}

@media (prefers-reduced-motion: reduce) {
    .al-card { transition: none; }
    .al-card:hover { transform: none; }
    /* Its own rule: a browser that does not know :has() would drop a list that holds it. */
    .al-card:has(a:focus-visible) { transform: none; }
}
