/* arspec.org — the namespace index.
   One page, so one small stylesheet. The palette is arspec.app's, because
   this is the same project's other face; the layout is not, because this is
   a table of documents and not a landing page. */

:root {
    color-scheme: light dark;

    --ground: #EEF1F2;
    --surface: #F8FAFA;
    --surface-2: #E3E8E9;
    --ink: #171D1E;
    --ink-2: #3A4548;
    --muted: #5F6E72;
    --line: #C8D0D2;
    --accent: #006874;
    --accent-soft: #CFEAEE;

    --font-sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;

    --measure: 68ch;
    --radius: 6px;
    --wrap: 940px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ground: #1F2426;
        --surface: #2B3133;
        --surface-2: #343C3E;
        --ink: #ECF2F3;
        --ink-2: #C9D4D7;
        --muted: #9BAAAE;
        --line: #3E4749;
        --accent: #82D3E0;
        --accent-soft: #1E4A52;
    }
}

:root[data-theme="dark"] {
    --ground: #1F2426;
    --surface: #2B3133;
    --surface-2: #343C3E;
    --ink: #ECF2F3;
    --ink-2: #C9D4D7;
    --muted: #9BAAAE;
    --line: #3E4749;
    --accent: #82D3E0;
    --accent-soft: #1E4A52;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--ground);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .15em; }
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 3px;
}

h1, h2, h3 {
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -.015em;
    margin: 0 0 .5em;
    text-wrap: balance;
}
h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); }
h2 { font-size: 1.3rem; margin: 0 0 .35em; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

code, .mono { font-family: var(--font-mono); font-size: .9em; }
code {
    background: var(--surface-2);
    padding: .08em .35em;
    border-radius: 4px;
    /* An IRI written inline is one long unbreakable word; without this it
       pushes the whole page wider than the screen. No effect inside <pre>,
       where the white-space rule forbids wrapping and the box scrolls. */
    overflow-wrap: anywhere;
}
pre {
    margin: 0 0 1em;
    padding: .9rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink);
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: .85rem;
    line-height: 1.55;
}
pre code { background: none; padding: 0; font-size: inherit; }

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

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }

.eyebrow {
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: .55rem;
}

/* ── header ── */

.site-header {
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}
.site-header .wrap {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-height: 58px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    color: var(--ink);
    font-weight: 600;
    font-family: var(--font-mono);
    font-size: 1rem;
}
.brand:hover { text-decoration: none; }
.brand img { width: 26px; height: 26px; border-radius: 7px; }
.site-header nav { margin-left: auto; display: flex; gap: 1.25rem; align-items: center; }
.site-header nav a { color: var(--ink-2); font-weight: 500; font-size: .93rem; }
.site-header nav a:hover { color: var(--ink); text-decoration: none; }

/* ── the page ── */

main { padding: 3rem 0 1rem; }
.lede { font-size: 1.1rem; color: var(--ink-2); max-width: 60ch; }

.section { margin-top: 3.25rem; }
.section > p { color: var(--ink-2); }

/* ── the document tables ──
   `documents`, not `docs`: arspec.app's stylesheet calls its two-column
   documentation layout `.docs`, and the two sites serve their sheets from
   the same path (`/assets/site.css`). Previewed one after the other on one
   localhost port, the cached sheet wins and a table becomes a grid. Distinct
   names cost nothing and make that impossible to mistake for a bug here. */

.documents {
    width: 100%;
    /* Wide enough that the prose column is never crushed to a word a line:
       under this the scroll container takes over, which is the right answer
       on a phone and never reached on a desktop. */
    min-width: 38rem;
    border-collapse: collapse;
    margin: 1.1rem 0 0;
    font-size: .93rem;
}
.documents th, .documents td {
    text-align: left;
    vertical-align: top;
    padding: .7rem .8rem;
    border-bottom: 1px solid var(--line);
}
.documents th {
    color: var(--muted);
    font-weight: 600;
    font-size: .78rem;
    letter-spacing: .06em;
    text-transform: uppercase;
    border-bottom-color: var(--ink-2);
}
.documents tbody tr:hover { background: var(--surface); }
.documents td:first-child { white-space: nowrap; }
.documents .what { color: var(--ink-2); }

/* A cell's own prose carries no bottom margin: what follows it states its
   own top gap, so the two cannot add up. */
.documents td > p { margin: 0; max-width: none; }

.file {
    font-family: var(--font-mono);
    font-size: .84rem;
    color: var(--accent);
    white-space: nowrap;
}
/* Neither a path nor an IRI wraps: broken across two lines mid-word, one is
   no longer something a reader can pick up and paste. The column sizes to
   the longest of them instead, and the scroll container takes what will not
   fit. */
.iri {
    display: block;
    margin-top: .15rem;
    font-family: var(--font-mono);
    font-size: .8rem;
    color: var(--muted);
    white-space: nowrap;
}

/* The scroll container, so a long line never pushes the page sideways. */
.table-scroll { overflow-x: auto; }

/* A prefix badge — ars:, av:, aset: */
.prefix {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: .82rem;
    font-weight: 600;
    padding: .1em .45em;
    border-radius: 4px;
    background: var(--accent-soft);
    color: var(--accent);
}

/* The perspectives one document defines: a name and the prefix it goes by,
   which is a description list and not a bulleted one. The grid is on the
   <dl> rather than on each pair, so every prefix starts in the same column;
   dt and dd are its items directly, and the browser's own dd indent — the
   one thing that would break that column — is cleared here. */
.defines {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: .25rem .9rem;
    margin: .6rem 0 0;
    font-size: .86rem;
}
.defines dt { color: var(--ink-2); }
.defines dd {
    margin: 0;
    font-family: var(--font-mono);
    font-size: .8rem;
    color: var(--muted);
    white-space: nowrap;
}
/* On a narrow screen a three-column table is one column of prose beside two
   of empty space, scrolled out of reach. Each row becomes a block instead —
   the document, then what it says, in the order they are read — and the
   scroll container has nothing left to do. The paths and IRIs still do not
   wrap, and at this width they do not have to: the longest of them is
   narrower than a phone. */
@media (max-width: 700px) {
    .documents { min-width: 0; }
    .documents thead { display: none; }
    .documents tbody, .documents tr, .documents td { display: block; }
    .documents tr { border-bottom: 1px solid var(--line); padding: .9rem 0; }
    .documents td { border: 0; padding: 0; }
    .documents td + td { margin-top: .5rem; }
    .table-scroll { overflow-x: visible; }

    /* Stacked, a path or an IRI has the whole width to itself and still
       does not always fit: the longest of them wants about 360px, which is
       a narrow phone exactly. Here they may break rather than push the page
       sideways — a wrapped IRI is a nuisance, a page that scrolls sideways
       is a fault. On a desktop they stay on one line, which is where
       copying one out of the page is what a reader is doing. */
    .file, .iri, .defines dd { white-space: normal; overflow-wrap: anywhere; }

    .defines { grid-template-columns: minmax(0, 1fr); gap: 0; }
    .defines dd { margin-bottom: .45rem; }
}

.note {
    border-left: 3px solid var(--accent);
    background: var(--surface);
    padding: .85rem 1.05rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 1.25rem 0 0;
    font-size: .93rem;
}
.note p { max-width: none; }

/* ── footer ── */

.site-footer {
    margin-top: 4.5rem;
    border-top: 1px solid var(--line);
    padding: 2rem 0 3rem;
    color: var(--muted);
    font-size: .88rem;
}
.site-footer .wrap {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem 2.5rem;
    justify-content: space-between;
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }
.site-footer a { color: var(--ink-2); }
