/* Arspec — arspec.app
   One stylesheet for the landing page and the docs. Tokens first, then the
   pieces that use them. The palette is the app icon's: slate ground, off-white
   mark, the cyan apex dot. */

:root {
    color-scheme: light dark;

    /* light */
    --ground: #EEF1F2;
    --surface: #F8FAFA;
    --surface-2: #E3E8E9;
    --ink: #171D1E;
    --ink-2: #3A4548;
    --muted: #5F6E72;
    --line: #C8D0D2;
    --accent: #006874;
    --accent-ink: #FFFFFF;
    --accent-soft: #CFEAEE;
    --code-bg: #1F2426;
    --code-ink: #ECF2F3;
    --code-key: #82D3E0;
    --code-str: #C9E3A3;
    --code-dim: #8E9BA0;
    --shadow: 0 1px 2px rgba(23, 29, 30, .08), 0 8px 24px rgba(23, 29, 30, .08);

    --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: 66ch;
    --radius: 6px;
    --wrap: 1120px;
}

@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-ink: #0F2A2F;
        --accent-soft: #1E4A52;
        --code-bg: #171C1D;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
    }
}

:root[data-theme="dark"] {
    --ground: #1F2426;
    --surface: #2B3133;
    --surface-2: #343C3E;
    --ink: #ECF2F3;
    --ink-2: #C9D4D7;
    --muted: #9BAAAE;
    --line: #3E4749;
    --accent: #82D3E0;
    --accent-ink: #0F2A2F;
    --accent-soft: #1E4A52;
    --code-bg: #171C1D;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
}

/* ── base ── */

*, *::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: 17px;
    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, button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 3px;
}

h1, h2, h3, h4 {
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -.01em;
    margin: 0 0 .5em;
    text-wrap: balance;
}
h1 { font-size: clamp(2.1rem, 4.5vw, 3.4rem); letter-spacing: -.025em; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin-top: 0; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

code, pre, kbd, .mono { font-family: var(--font-mono); }
code {
    font-size: .92em;
    background: var(--surface-2);
    padding: .08em .35em;
    border-radius: 4px;
}
pre {
    margin: 0;
    padding: 1rem 1.15rem;
    background: var(--code-bg);
    color: var(--code-ink);
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: .88rem;
    line-height: 1.5;
    tab-size: 4;
}
pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
kbd {
    font-size: .85em;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 4px;
    padding: 0 .4em;
    background: var(--surface);
}

/* syntax: hand-marked in the HTML, since the snippets are few and fixed */
.k { color: var(--code-key); }
.s { color: var(--code-str); }
.d { color: var(--code-dim); }

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

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

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

/* ── the horizon: a rule with the eye on it ── */

.horizon {
    position: relative;
    height: 2px;
    background: var(--line);
    margin: 4.5rem 0;
    border: 0;
}
.horizon::after {
    content: "";
    position: absolute;
    left: 33%;
    top: 50%;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    transform: translate(-50%, -50%);
}

/* ── header ── */

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--ground) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.site-header .wrap {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-height: 60px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    color: var(--ink);
    font-weight: 600;
    letter-spacing: -.01em;
    font-size: 1.05rem;
}
.brand:hover { text-decoration: none; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.site-nav {
    display: flex;
    gap: 1.25rem;
    margin-left: auto;
    align-items: center;
}
.site-nav a { color: var(--ink-2); font-weight: 500; font-size: .95rem; }
.site-nav a[aria-current="page"] { color: var(--ink); }
.site-nav a:hover { color: var(--ink); text-decoration: none; }
/* the button in the nav is a link in the nav: without this the rule above
   wins, and its label is ink on the accent */
.site-nav a.btn-primary,
.site-nav a.btn-primary:hover { color: var(--accent-ink); }

/* ── buttons ── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .65rem 1.1rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: .95rem;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    line-height: 1.2;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: var(--ink-2); }
/* store marks: they take the button's own colour, so one asset serves both themes */
.btn .ico { width: 1.05em; height: 1.05em; flex: none; }
.btn-primary {
    background: var(--accent);
    color: var(--accent-ink);
    border-color: transparent;
}
.btn-primary:hover { filter: brightness(1.08); border-color: transparent; }
.btn-sm { padding: .45rem .8rem; font-size: .88rem; }
.btn[aria-disabled="true"] {
    opacity: .55;
    cursor: not-allowed;
    border-style: dashed;
}

/* ── the news strip: one line over the hero, for what the last release did ── */

.news {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1rem;
    margin-top: 1.5rem;
    padding: .7rem 1.1rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink-2);
    font-size: .95rem;
    line-height: 1.45;
}
.news:hover { text-decoration: none; border-color: var(--accent); color: var(--ink); }
.news-tag {
    flex: none;
    padding: .15rem .6rem;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    white-space: nowrap;
}
.news-text { flex: 1 1 24ch; }
.news-more { flex: none; margin-left: auto; font-weight: 600; color: var(--accent); white-space: nowrap; }
.news + .hero { padding-top: 3rem; }
@media (max-width: 640px) {
    .news-text { flex-basis: 100%; }
}

/* ── hero ── */

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    gap: 3rem;
    align-items: center;
    padding: 4.5rem 0 1rem;
}
.hero .lede {
    font-size: 1.2rem;
    color: var(--ink-2);
    max-width: 44ch;
}
.hero .cta {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    margin: 1.75rem 0 1rem;
}
.hero .fine {
    font-size: .88rem;
    color: var(--muted);
}
.hero-mark {
    width: 64px;
    height: 64px;
    border-radius: 15px;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow);
}

@media (max-width: 860px) {
    .hero { grid-template-columns: 1fr; padding-top: 2.5rem; }
}

/* ── the two-panel illustration: data on the left, the view on the right ── */

.demo {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}
.demo.demo-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 640px) {
    .demo, .demo.demo-three { grid-template-columns: 1fr; }
}
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.panel-title {
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    padding: .5rem .9rem;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}
.panel pre { border-radius: 0; }

/* a rendered perspective, the way the app draws one */
.view { padding: .25rem 0 .5rem; }
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--line);
    padding: 0 .5rem;
    font-size: .85rem;
}
.tabs span {
    padding: .5rem .7rem;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tabs span[aria-selected="true"] {
    color: var(--ink);
    border-bottom-color: var(--accent);
    font-weight: 600;
}
.record { padding: .6rem .9rem .2rem; }
.record + .record { border-top: 1px solid var(--line); }
.term {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: .86rem;
    padding: .1em .45em;
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--ink);
}
.term.subject { font-weight: 600; }
.term.lit { background: transparent; border: 1px solid var(--line); }
.record .master { margin-bottom: .35rem; }
.fields {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: .3rem .9rem;
    align-items: center;
    padding-left: 1.1rem;
    border-left: 2px solid var(--accent-soft);
    margin-left: .35rem;
    font-size: .9rem;
}
.fields .pred { color: var(--muted); font-family: var(--font-mono); font-size: .84rem; }
.add-item {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    color: var(--accent);
    font-size: .84rem;
    padding: .4rem .9rem .3rem 1.6rem;
}
.add-item::before { content: "⊕"; font-size: 1rem; }

/* ── sections ── */

.section { padding: 1rem 0; }
.section-head { max-width: 60ch; margin-bottom: 2rem; }
.section-head p { color: var(--ink-2); font-size: 1.05rem; }

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}
.feature {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.35rem 1.35rem 1.1rem;
}
.feature h3 { margin-bottom: .45rem; }
.feature p { font-size: .96rem; color: var(--ink-2); }
.feature .glyph {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    font-family: var(--font-mono);
    font-weight: 600;
    margin-bottom: .8rem;
}

.formats {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem .6rem;
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
}
.formats li {
    font-family: var(--font-mono);
    font-size: .86rem;
    padding: .3em .7em;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
}
.formats li.writes::after {
    content: " ↔";
    color: var(--accent);
}

.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 3rem;
    align-items: center;
}
@media (max-width: 860px) { .split { grid-template-columns: 1fr; gap: 1.5rem; } }

.downloads {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .75rem;
    margin-top: 1.25rem;
}
.downloads .btn { justify-content: center; }

/* ── footer ── */

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

/* ── docs ── */

.docs {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 3.5rem;
    padding: 2.5rem 0 0;
}
@media (max-width: 800px) {
    /* minmax(0, …) and not a bare 1fr: 1fr will not go narrower than the
       widest thing in it that cannot wrap, and a page with a long line of
       code is then wider than the screen, its text cut off at the edge. */
    .docs { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
}
.docs-nav {
    position: sticky;
    top: 80px;
    align-self: start;
    font-size: .93rem;
}
.docs-nav .eyebrow { margin-bottom: .8rem; }
.docs-nav ul { list-style: none; margin: 0; padding: 0; }
.docs-nav li { margin: 0; }
.docs-nav a {
    display: block;
    padding: .38rem .6rem;
    color: var(--ink-2);
    border-left: 2px solid transparent;
    border-radius: 0 4px 4px 0;
}
.docs-nav a:hover { background: var(--surface-2); text-decoration: none; }
.docs-nav a[aria-current="page"] {
    color: var(--ink);
    font-weight: 600;
    border-left-color: var(--accent);
    background: var(--surface);
}
.docs-nav .sub { padding-left: 1rem; font-size: .88rem; }

/* One column: the nav is a block above the article, and a block that sticks
   there rides over the text all the way down the page. Narrow, it goes back
   into the flow and lies down as a row of links, so the page starts with the
   page. The places within a page are left to the page. */
@media (max-width: 800px) {
    .docs-nav { position: static; }
    .docs-nav .eyebrow { margin-bottom: .6rem; }
    .docs-nav ul { display: flex; flex-wrap: wrap; gap: .4rem; }
    .docs-nav li:has(> .sub), .docs-nav .sub { display: none; }
    .docs-nav a {
        padding: .3rem .75rem;
        border: 1px solid var(--line);
        border-radius: 999px;
    }
    .docs-nav a[aria-current="page"] { border-color: var(--accent); }
}

.article { max-width: var(--measure); }
.article > h1 { margin-bottom: .25em; }
.article .lede { color: var(--ink-2); font-size: 1.12rem; margin-bottom: 2rem; }
.article h2 {
    margin-top: 2.6rem;
    padding-top: 1.6rem;
    border-top: 1px solid var(--line);
    font-size: 1.45rem;
}
.article h3 { margin-top: 1.8rem; }
.article pre { margin: 1rem 0 1.4rem; }
.article ul, .article ol { padding-left: 1.3rem; max-width: var(--measure); }
.article li { margin-bottom: .4rem; }
.article table {
    border-collapse: collapse;
    width: 100%;
    font-size: .94rem;
    margin: 1rem 0 1.5rem;
    display: block;
    overflow-x: auto;
}
.article th, .article td {
    text-align: left;
    vertical-align: top;
    padding: .55rem .7rem;
    border-bottom: 1px solid var(--line);
}
.article th { color: var(--muted); font-weight: 600; font-size: .85rem; }

.callout {
    border-left: 3px solid var(--accent);
    background: var(--surface);
    padding: .9rem 1.1rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 1.25rem 0 1.5rem;
    font-size: .96rem;
}
.callout.warn { border-left-color: #B26A00; }
.callout p { max-width: none; }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 2rem;
}
.card {
    display: block;
    padding: 1.1rem 1.2rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
}
.card:hover { text-decoration: none; border-color: var(--accent); }
.card h3 { margin-bottom: .3rem; font-size: 1.05rem; }
.card p { font-size: .92rem; color: var(--ink-2); margin: 0; }

.steps { counter-reset: step; list-style: none; padding: 0; }
.steps li {
    counter-increment: step;
    position: relative;
    padding-left: 2.4rem;
    margin-bottom: .9rem;
}
.steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: .05rem;
    width: 1.7rem;
    height: 1.7rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
    font-size: .85rem;
}

dl.faq dt {
    font-weight: 600;
    margin-top: 1.6rem;
    font-size: 1.05rem;
}
dl.faq dd { margin: .4rem 0 0; color: var(--ink-2); }

/* ── what's new ── */

.releases { max-width: 84ch; }
.releases .callout { max-width: var(--measure); }
.releases .release h2 {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .4rem 1rem;
}
.releases .release-version { font-family: var(--font-mono); font-weight: 600; }
.releases .release h2 time { font-size: .9rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.releases .release h3 { margin-top: 1.6rem; font-size: 1.05rem; }
.releases .release li { margin-bottom: .6rem; }
.releases table td:first-child { white-space: nowrap; }

/* ── download ── */

.hero-narrow { grid-template-columns: minmax(0, 1fr); padding-bottom: 0; }
.hero-narrow .lede { max-width: var(--measure); }

.browser-first { margin-top: 1.5rem; }
.browser-first .panel { padding: 1.25rem 1.4rem; }
.browser-first .panel .panel-title { padding: 0 0 .5rem; border: 0; }

.platform-tabs {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin: 1.25rem 0 2rem;
}
.platform-tabs a {
    padding: .35rem .85rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: .9rem;
    color: var(--ink-2);
    text-decoration: none;
}
.platform-tabs a {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
}
.platform-tabs a .ico { width: 1em; height: 1em; flex: none; }
.platform-tabs a:hover { border-color: var(--accent); color: var(--accent); }

.platform {
    border-top: 1px solid var(--line);
    padding: 2rem 0 1.5rem;
    /* The header is sticky, so an anchor must stop clear of it. */
    scroll-margin-top: 5.5rem;
}
.platform-head {
    display: flex;
    align-items: baseline;
    gap: .75rem;
    flex-wrap: wrap;
}
.platform-head h3 { margin: 0; font-size: 1.35rem; }

.platform-you {
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 999px;
    padding: .1rem .55rem;
}
.platform.is-yours { border-top-color: var(--accent); }

.dl-slot {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 1.1rem 0 1.5rem;
}
.dl-meta {
    font-size: .85rem;
    color: var(--muted);
    font-family: var(--font-mono);
    line-height: 1.5;
}
.dl-meta .sha {
    font-size: .76rem;
    word-break: break-all;
    background: none;
    padding: 0;
}

pre.verify { padding: .7rem .95rem; font-size: .85rem; margin: .75rem 0; }

.store-soon { font-size: .9rem; color: var(--muted); }

@media (max-width: 640px) {
    .dl-slot { align-items: flex-start; flex-direction: column; gap: .6rem; }
}

/* ── screenshots ── */

/* The app, drawn by the app. Each is a <picture> with a dark source, so the
   window shown is in the same theme as the page around it. */
.shot { margin: 1.75rem 0; }
.shot.center { margin-inline: auto; }
.shot img,
.shot-in img { display: block; width: 100%; height: auto; }
.shot img {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.shot figcaption {
    font-size: .88rem;
    color: var(--muted);
    margin-top: .6rem;
}

/* in a panel, under its title: the panel is the frame */
.shot-in { border-bottom: 1px solid var(--line); }
.shot-in:last-child { border-bottom: 0; }

.shots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
    align-items: start;
}
.shots .shot { margin: 0; }

/* A desktop window and a phone, side by side at one height: the columns are
   in the ratio that makes 16:9 and 1:2 come out equally tall. */
.shots.platforms {
    grid-template-columns: minmax(0, 3.56fr) minmax(0, 1fr);
    align-items: start;
}
@media (max-width: 640px) {
    .shots.platforms { grid-template-columns: 1fr; }
    .shots.platforms .shot:last-child { max-width: 240px !important; margin-inline: auto; }
}

/* the hero's two panels one above the other, so the window has the column's
   whole width and its letters stay readable */
.demo.demo-stack { grid-template-columns: minmax(0, 1fr); }

/* In the docs a figure may run past the text's measure, into the room the
   column has beside it — a window taken at 760 is then shown at 760. Only
   where the viewport leaves that room. */
@media (min-width: 1120px) {
    .article .shot { margin-right: min(0px, calc(var(--measure) - 760px)); }
}

/* ── motion ── */

@media (prefers-reduced-motion: no-preference) {
    .hero > * { animation: rise .6s ease-out both; }
    .hero > :nth-child(2) { animation-delay: .12s; }
    @keyframes rise {
        from { opacity: 0; transform: translateY(10px); }
        to { opacity: 1; transform: none; }
    }
}
