/*
 * Keys Dialer site styles.
 * Tokens from projects/dialer/DESIGN.md (the "Keys" direction): anodised body, off-white keys with a
 * solid ledge, black display windows, one signal orange. The app is light only; the dark palette below
 * is derived from DESIGN.md's own display and slot tokens (SEO-BRIEF.md §5).
 * Contrast fixes (owner ruling 2026-11-24): small orange text on the body uses signal-ledge #9A3500
 * (5.05:1), orange fills with white labels use signal-text-strong #B83D00 (5.67:1), and legends on the
 * body use legend-strong #57564F (5.11:1) instead of legend #6A6963 (3.82:1, fails AA).
 */

@font-face {
    font-family: "Archivo";
    src: url("/keys-dialer/fonts/archivo-var.woff2") format("woff2");
    font-weight: 100 900;
    font-stretch: 62% 125%;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Chivo Mono";
    src: url("/keys-dialer/fonts/chivo-mono-var.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light dark;
    --body: #D8D7D2;
    --body-top: #DEDDD8;
    --body-bottom: #D2D1CB;
    --body-recessed: #C6C5BF;
    --key: #F4F3EF;
    --key-shade: #E7E6E1;
    --key-ledge: #A7A69F;
    --graphite: #2B2B2D;
    --on-graphite: #EEEDE8;
    --display: #0E0F0F;
    --display-ink: #E8E8E2;
    --display-sub: #B9B8B1;
    --display-dim: #8D8D86;
    --signal: #FF5A00;
    --signal-fill: #B83D00;
    --on-signal-fill: #FFFFFF;
    --signal-fill-ledge: #7A2A00;
    --accent-text: #9A3500;
    --ink: #1E1E20;
    --ink-secondary: #3A3A3B;
    --legend: #57564F;
    --legend-rule: #A8A7A0;
    --led-on: #3BB273;
    --amber: #E3A23B;
    --focus: #1E1E20;
    --shadow: rgba(0, 0, 0, 0.18);
    --mono: "Chivo Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    --sans: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --body: #141415;
        --body-top: #18181A;
        --body-bottom: #111112;
        --body-recessed: #0E0F0F;
        --key: #2B2B2D;
        --key-shade: #232325;
        --key-ledge: #0B0B0C;
        --graphite: #0E0F0F;
        --on-graphite: #E8E8E2;
        --signal-fill: #FF5A00;
        --on-signal-fill: #0E0F0F;
        --signal-fill-ledge: #9A3500;
        --accent-text: #FF8444;
        --ink: #E8E8E2;
        --ink-secondary: #CFCEC8;
        --legend: #B9B8B1;
        --legend-rule: #58585A;
        --focus: #FF8444;
        --shadow: rgba(0, 0, 0, 0.5);
    }
}

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

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

body {
    margin: 0;
    font-family: var(--sans);
    font-size: 1.0625rem;
    line-height: 1.55;
    color: var(--ink);
    background: var(--body);
    overflow-wrap: break-word;
}

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

a { color: var(--accent-text); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 10;
    padding: 0.75rem 1rem;
    background: var(--display);
    color: var(--display-ink);
    border-radius: 8px;
}
.skip-link:focus { top: 1rem; outline-color: var(--signal); }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 1.25rem; }

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.75rem; }
h1 { font-size: clamp(2.1rem, 6vw, 3.6rem); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.5rem, 3.6vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1rem; }
code { font-family: var(--mono); font-size: 0.92em; }

/* Printed legend: tiny uppercase label on the body, with the 2dp rule on its left. */
.legend {
    display: inline-block;
    margin: 0 0 0.6rem;
    padding-left: 0.6rem;
    border-left: 2px solid var(--legend-rule);
    font-size: 0.8rem;
    font-weight: 600;
    font-stretch: 80%;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--legend);
}

/* Header */
.topbar { padding: 0.75rem 0; border-bottom: 1px solid var(--legend-rule); }
.topbar .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; min-height: 48px; color: var(--ink); text-decoration: none; }
.brand img { border-radius: 10px; }
.wordmark { font-weight: 800; font-size: 1.2rem; letter-spacing: -0.01em; }
.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; margin: 0; padding: 0; }
.site-nav a {
    display: inline-flex; align-items: center; min-height: 48px; padding: 0 0.75rem;
    color: var(--ink); text-decoration: none; font-weight: 600; border-radius: 8px;
}
.site-nav a:hover { background: var(--key); }
.site-nav a[aria-current="page"] { background: var(--key); box-shadow: inset 0 -3px 0 var(--signal-fill); }

/* Sections */
.section { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.section + .section { border-top: 1px solid var(--legend-rule); }
.answer { font-size: 1.15rem; max-width: 44rem; }
.detail { color: var(--ink-secondary); max-width: 44rem; }
.split { display: grid; gap: 2rem; align-items: center; }
.split > * { min-width: 0; }
@media (min-width: 48rem) {
    .split { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 3rem; }
    .split.flip > :first-child { order: 2; }
}

/* Hero */
.hero { padding: clamp(2rem, 6vw, 4rem) 0; }
.hero-grid { display: grid; gap: 2rem; align-items: center; }
.hero-grid > * { min-width: 0; }
@media (min-width: 48rem) {
    .hero-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 3rem; }
}
.hero .answer { font-size: 1.2rem; }
.badge-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-top: 1.5rem; }
.badge-row p { margin: 0; color: var(--ink-secondary); font-size: 0.95rem; }
.play-badge { display: inline-block; border-radius: 10px; }
.play-badge img { width: 188px; height: auto; }

/* Display window: content behind glass */
.display {
    background: var(--display);
    color: var(--display-ink);
    border-radius: 14px;
    padding: 1.25rem 1.4rem;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6), 0 0 0 4px var(--body-recessed);
}
.display a { color: #FF8444; }
.display :focus-visible { outline-color: #FF8444; }
.display .mono-line { font-family: var(--mono); color: var(--display-sub); font-size: 0.95rem; margin: 0; }
.display .mono-name { font-family: var(--mono); font-size: clamp(1.4rem, 4vw, 1.9rem); letter-spacing: 0.04em; margin: 0 0 0.25rem; color: var(--display-ink); text-transform: uppercase; }
.display .dim { color: var(--display-dim); font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; margin: 0.75rem 0 0.15rem; }
.display .cursor { display: inline-block; width: 0.55em; height: 1em; background: var(--signal); vertical-align: -0.12em; margin-left: 0.1em; }
.led { display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--led-on); margin-right: 0.4rem; vertical-align: 0.05em; }
.led-signal { background: var(--signal); }
.led-amber { background: var(--amber); }

/* Keys: off-white tactile cards with a solid ledge */
.keys { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.key {
    background: var(--key);
    color: var(--ink);
    border-radius: 14px;
    padding: 1.1rem 1.2rem 1.2rem;
    box-shadow: 0 3px 0 var(--key-ledge), 0 6px 10px -2px var(--shadow), 0 0 0 1px rgba(0, 0, 0, 0.12);
}
.key h3 { margin-bottom: 0.4rem; }
.key p:last-child { margin-bottom: 0; }
.key .legend { border-left-color: var(--signal-fill); }

/* Shots */
.shot { margin: 0; }
.shot img { border-radius: 14px; border: 1px solid var(--legend-rule); box-shadow: 0 8px 18px -6px var(--shadow); }
.hero-shot { display: block; max-width: 22rem; margin: 0 auto; }
.hero-shot img { border-radius: 18px; border: 1px solid var(--legend-rule); box-shadow: 0 3px 0 var(--key-ledge), 0 14px 28px -8px var(--shadow); }
.shot-narrow { max-width: 18rem; margin: 0 auto; }
.shot figcaption { font-size: 0.9rem; color: var(--ink-secondary); margin-top: 0.6rem; }
.gallery { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: 1.25rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 40rem) { .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 60rem) { .gallery { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* Facts list (privacy) */
.facts { margin: 0; display: grid; gap: 0.6rem; }
.facts div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.25rem 1rem; padding: 0.7rem 0; border-bottom: 1px solid #2B2C2C; }
.facts div:last-child { border-bottom: 0; }
.facts dt { color: var(--display-sub); }
.facts dd { margin: 0; font-family: var(--mono); color: var(--display-ink); }

/* Limits */
.limits { margin: 1.5rem 0 0; padding: 0; list-style: none; display: grid; gap: 1rem; }
.limits li { background: var(--key); color: var(--ink); border-radius: 12px; padding: 1rem 1.2rem; box-shadow: 0 2px 0 var(--key-ledge), 0 0 0 1px rgba(0, 0, 0, 0.1); max-width: 52rem; }
.limits strong { display: block; margin-bottom: 0.2rem; }
.limits strong::before { content: ""; display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--signal); margin-right: 0.5rem; vertical-align: 0.08em; }
.limits p { margin: 0; }

/* Ordered Shield steps */
.steps { counter-reset: step; list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; gap: 0.6rem; max-width: 46rem; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); gap: 0.75rem; align-items: start; }
.steps li::before {
    content: counter(step);
    font-family: var(--mono); font-weight: 600;
    display: grid; place-items: center;
    width: 2.4rem; height: 2.4rem; border-radius: 8px;
    background: var(--display); color: var(--display-ink);
}

/* Inner pages */
.page-head { padding: clamp(1.5rem, 5vw, 3rem) 0 1rem; }
.crumbs ol { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; font-size: 0.95rem; }
.crumbs li { display: inline-flex; align-items: center; }
.crumbs li + li::before { content: "\203A"; margin: 0 0.45rem; color: var(--legend); }
.crumbs a { display: inline-flex; align-items: center; min-height: 48px; color: var(--ink-secondary); }
.crumbs [aria-current="page"] { color: var(--ink); font-weight: 600; }
.toc { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.toc a {
    display: inline-flex; align-items: center; min-height: 48px; padding: 0 0.9rem;
    background: var(--key); color: var(--ink); text-decoration: none; font-weight: 600;
    border-radius: 10px; box-shadow: 0 2px 0 var(--key-ledge), 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.prose { max-width: 46rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: 0.4rem; }
.faq-item { padding: 1.75rem 0; border-top: 1px solid var(--legend-rule); max-width: 46rem; }
.faq-item:first-child { border-top: 0; }
.faq-item h2 { font-size: clamp(1.25rem, 3vw, 1.5rem); scroll-margin-top: 1rem; }
.faq-item .answer { font-size: 1.08rem; margin-bottom: 0; }
.qlinks { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 0.6rem; max-width: 46rem; }
.qlinks a {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 48px;
    padding: 0.7rem 1rem; background: var(--key); color: var(--ink); text-decoration: none; font-weight: 600;
    border-radius: 12px; box-shadow: 0 2px 0 var(--key-ledge), 0 0 0 1px rgba(0, 0, 0, 0.1);
}
.qlinks svg { flex: none; width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* Closing band */
.closing { padding: clamp(2.5rem, 6vw, 4rem) 0; text-align: left; }
.closing .display { display: grid; gap: 1rem; justify-items: start; padding: 1.75rem; }
.closing h2 { color: var(--display-ink); margin: 0; }

/* Footer: graphite plate */
.footer { background: var(--graphite); color: var(--on-graphite); padding: 2.5rem 0 2rem; margin-top: 2rem; }
.footer a { color: var(--on-graphite); }
.footer :focus-visible { outline-color: #FF8444; }
.footer-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; }
.footer-top p { margin: 0; }
.footer-links { list-style: none; margin: 1.5rem 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.footer-links a { display: inline-flex; align-items: center; min-height: 48px; overflow-wrap: anywhere; }
.fine { font-size: 0.88rem; color: #CFCEC8; }
.fine p { margin: 0 0 0.35rem; }

figure.display { margin: 0; }
.page-head + .section { padding-top: 0.5rem; border-top: 0; }
