/*
 * TalkToTheHand site styles. Tokens from projects/talk-to-the-hand/DESIGN.md
 * ("The Telegram Desk"; source of truth ui/theme/Palette.kt): warm paper ground,
 * slip cards with 1px borders and hairline-ruled fields, an airmail-blue shell
 * with a red-and-blue banded edge, and the double-rule verdict stamp as the one
 * signature mark. Flat: no shadows or tonal lift. Near-square 2/4/6/8px corners.
 * Barlow Condensed for caps furniture and headings; Barlow for reading and actions.
 */

@font-face {
    font-family: "Barlow";
    src: url("/talk-to-the-hand/fonts/barlow-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Barlow";
    src: url("/talk-to-the-hand/fonts/barlow-600.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Barlow Condensed";
    src: url("/talk-to-the-hand/fonts/barlow-condensed-600.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Barlow Condensed";
    src: url("/talk-to-the-hand/fonts/barlow-condensed-700.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light dark;

    --paper: #F6F3EC;
    --slip: #FFFDF8;
    --ink: #1B2130;
    --ink-muted: #4C5465;
    --rule: #DCD6C8;
    --rule-strong: #857E6E;
    --blue: #1F4E9E;
    --on-blue: #FFFDF8;
    --red: #B8323A;
    --band-gap: #FFFDF8;
    --band-blue: #1F4E9E;
    --band-red: #C8363F;
    --app-bar: #1F4E9E;
    --on-app-bar: #FFFDF8;
    --on-app-bar-muted: #D5DFF2;
    --stamp-callback: #1F4E9E;
    --stamp-scam: #B3262E;
    --stamp-spam: #8A4A36;
    --stamp-routine: #5F5E5A;
    --stamp-unknown: #4F5B73;
    --blue-container: #DDE6F6;
    --on-blue-container: #122C5E;
    --red-container: #F7E0DE;
    --on-red-container: #5C161B;
    --surface-high: #ECE7DC;

    --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
    --body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

    --gutter: 1rem;
    --wrap: 70rem;
    --r-xs: 2px;
    --r-sm: 4px;
    --r-md: 6px;
    --r-lg: 8px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #0D1524;
        --slip: #162038;
        --ink: #ECE7DC;
        --ink-muted: #AEB5C4;
        --rule: #2C3852;
        --rule-strong: #7D879C;
        --blue: #93B2F2;
        --on-blue: #0B2357;
        --red: #F0868B;
        --band-gap: #DCD6C8;
        --band-blue: #4F7BD0;
        --band-red: #D9545C;
        --app-bar: #17305F;
        --on-app-bar: #ECE7DC;
        --on-app-bar-muted: #B9C7E6;
        --stamp-callback: #93B2F2;
        --stamp-scam: #FF8A84;
        --stamp-spam: #DDA48F;
        --stamp-routine: #A8AAAF;
        --stamp-unknown: #AEB9D2;
        --blue-container: #23417A;
        --on-blue-container: #DCE6FB;
        --red-container: #5A1D24;
        --on-red-container: #FBDADB;
        --surface-high: #1C2741;
    }
}

/* ---------- Base ---------- */

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: 1rem;
}

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

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

svg {
    flex: none;
}

a {
    color: var(--blue);
    overflow-wrap: anywhere;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

a:hover {
    text-decoration-thickness: 2px;
}

:focus-visible {
    outline: 3px solid var(--blue);
    outline-offset: 2px;
}

h1,
h2,
h3 {
    font-family: var(--display);
    font-weight: 600;
    line-height: 1.15;
    margin: 0 0 0.75rem;
    hyphens: none;
    text-wrap: balance;
}

h1 {
    font-size: clamp(2.25rem, 1.6rem + 3vw, 3.5rem);
    letter-spacing: -0.01em;
}

h2 {
    font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.25rem);
}

h3 {
    font-size: 1.375rem;
}

p,
ul,
ol,
dl {
    margin: 0 0 1rem;
}

code {
    font-size: 0.92em;
}

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

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

.skip-link {
    position: absolute;
    left: 0.5rem;
    top: -4rem;
    z-index: 10;
    padding: 0.75rem 1rem;
    background: var(--slip);
    color: var(--blue);
    border: 1px solid var(--rule-strong);
    border-radius: var(--r-sm);
    font-weight: 600;
}

.skip-link:focus {
    top: 0.5rem;
}

/* ---------- Caps furniture ---------- */

.label {
    display: block;
    font-family: var(--display);
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-muted);
    margin: 0 0 0.5rem;
}

/* The airmail band: red and blue parallelograms on a paper gap. Decoration only. */
.band {
    display: block;
    height: 6px;
    background: repeating-linear-gradient(
        -45deg,
        var(--band-red) 0 12px,
        var(--band-gap) 12px 16px,
        var(--band-blue) 16px 28px,
        var(--band-gap) 28px 32px
    );
}

/* ---------- Top bar ---------- */

.topbar {
    background: var(--app-bar);
    color: var(--on-app-bar);
}

.topbar .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem 1.5rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.brand {
    min-width: 0;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    min-height: 48px;
    color: var(--on-app-bar);
    text-decoration: none;
}

.brand img {
    border-radius: var(--r-md);
}

.wordmark {
    min-width: 0;
    overflow-wrap: anywhere;
    font-family: var(--display);
    font-weight: 600;
    font-size: 1.375rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.site-nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.site-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    padding: 0 0.75rem;
    color: var(--on-app-bar);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 3px solid transparent;
}

.site-nav a:hover {
    text-decoration: underline;
}

.site-nav a[aria-current="page"] {
    border-bottom-color: var(--on-app-bar);
}

.topbar :focus-visible,
.footer :focus-visible {
    outline-color: var(--on-app-bar);
}

/* ---------- Hero ---------- */

.hero {
    padding: 2.5rem 0 2rem;
}

.hero-grid {
    display: grid;
    gap: 2rem;
    align-items: center;
}

.hero .sub {
    font-size: 1.1875rem;
    max-width: 38rem;
}

.cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    margin-top: 1.5rem;
}

.cta p {
    margin: 0;
    color: var(--ink-muted);
    font-size: 0.9375rem;
    max-width: 22rem;
}

.play-badge {
    display: inline-block;
    border-radius: var(--r-sm);
}

.play-badge img {
    width: 188px;
    height: 56px;
}

.hero-shot,
.shot img {
    border: 1px solid var(--rule-strong);
    border-radius: var(--r-lg);
    overflow: hidden;
    background: var(--slip);
}

.hero-shot {
    display: block;
    max-width: 22rem;
    margin: 0 auto;
}

@media (min-width: 52rem) {
    .hero-grid {
        grid-template-columns: minmax(0, 1fr) 22rem;
        gap: 3rem;
    }

    .hero {
        padding: 3.5rem 0 3rem;
    }
}

/* ---------- Slips ---------- */

.slip {
    background: var(--slip);
    color: var(--ink);
    border: 1px solid var(--rule-strong);
    border-radius: var(--r-sm);
    overflow: hidden;
}

.slip-band {
    display: block;
    height: 4px;
}

.slip-body {
    padding: 1rem 1.25rem 1.25rem;
}

.slip-head {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding-bottom: 0.625rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--rule);
}

.slip-head .label {
    margin: 0;
    color: var(--blue);
}

/* "Read this first": the limits, before anything else */
.first {
    padding: 0 0 2rem;
}

.first .slip-body h2 {
    font-size: 1.625rem;
    margin: 0;
}

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

.limit-list li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--rule);
}

.limit-list li:last-child {
    border-bottom: 0;
}

.limit-list strong {
    font-weight: 600;
}

.limit-list .lead-limit {
    background: var(--red-container);
    color: var(--on-red-container);
    border: 1px solid var(--red);
    border-radius: var(--r-sm);
    padding: 0.75rem 1rem;
    margin: 0.25rem 0 0.5rem;
}

.lead-limit a {
    color: inherit;
}

.lead-limit .mark {
    display: inline-block;
    font-family: var(--display);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1px solid currentColor;
    border-radius: var(--r-xs);
    padding: 0 0.375rem;
    margin-right: 0.375rem;
}

.more {
    margin: 1rem 0 0;
    font-weight: 600;
}

/* ---------- Sections ---------- */

.section {
    padding: 2.5rem 0;
    border-top: 1px solid var(--rule);
}

.answer {
    font-size: 1.125rem;
    max-width: 42rem;
}

.detail {
    color: var(--ink-muted);
    max-width: 42rem;
}

.split {
    display: grid;
    gap: 2rem;
    align-items: start;
}

.shot {
    margin: 0;
    max-width: 18rem;
}

.shot figcaption {
    margin-top: 0.5rem;
    color: var(--ink-muted);
    font-size: 0.9375rem;
}

@media (min-width: 48rem) {
    .split {
        grid-template-columns: minmax(0, 1fr) 18rem;
        gap: 3rem;
    }
}

.steps-list {
    padding-left: 1.25rem;
    max-width: 42rem;
}

.steps-list li {
    margin-bottom: 0.5rem;
}

/* ---------- Verdict stamps ---------- */

.stamps {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0;
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
}

.stamps li {
    background: var(--slip);
    color: var(--ink);
    border: 1px solid var(--rule);
    border-radius: var(--r-sm);
    padding: 1rem;
}

.stamps p {
    margin: 0.75rem 0 0;
    font-size: 0.9375rem;
}

.stamp {
    display: inline-block;
    font-family: var(--display);
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.1;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--stamp-routine);
    border: 2px solid currentColor;
    border-radius: var(--r-xs);
    padding: 3px;
    transform: rotate(-5deg);
}

.stamp span {
    display: block;
    border: 1px solid currentColor;
    padding: 0.125rem 0.5rem;
}

.stamp-callback { color: var(--stamp-callback); }
.stamp-scam { color: var(--stamp-scam); }
.stamp-spam { color: var(--stamp-spam); }
.stamp-routine { color: var(--stamp-routine); }
.stamp-unknown { color: var(--stamp-unknown); }

/* ---------- Ruled facts ---------- */

.facts {
    margin: 0;
    background: var(--slip);
    color: var(--ink);
    border: 1px solid var(--rule-strong);
    border-radius: var(--r-sm);
    padding: 0.25rem 1.25rem;
}

.facts div {
    display: grid;
    gap: 0.125rem 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--rule);
}

.facts div:last-child {
    border-bottom: 0;
}

.facts dt {
    font-family: var(--display);
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-muted);
}

.facts dd {
    margin: 0;
}

@media (min-width: 30rem) {
    .facts div {
        grid-template-columns: 9rem minmax(0, 1fr);
    }
}

/* ---------- Question links ---------- */

.qlinks {
    list-style: none;
    padding: 0;
    margin: 0;
    max-width: 42rem;
}

.qlinks a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 48px;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--rule);
    font-weight: 600;
    text-decoration: none;
}

.qlinks a:hover span {
    text-decoration: underline;
}

.qlinks svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- End band ---------- */

.end {
    background: var(--app-bar);
    color: var(--on-app-bar);
    padding: 2.5rem 0;
    margin-top: 2rem;
}

.end h2 {
    margin-bottom: 1.25rem;
}

.end p {
    color: var(--on-app-bar-muted);
    max-width: 38rem;
}

.end a {
    color: var(--on-app-bar);
}

.end :focus-visible {
    outline-color: var(--on-app-bar);
}

/* ---------- Inner pages ---------- */

.page-head {
    padding: 2rem 0 1.5rem;
}

.crumbs ol {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    font-size: 0.9375rem;
    color: var(--ink-muted);
}

.crumbs li {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
}

.crumbs li + li::before {
    content: "\203A";
    margin: 0 0.5rem;
}

.crumbs a {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
}

.lede {
    font-size: 1.1875rem;
    max-width: 42rem;
}

.toc ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 1.25rem 0 0;
}

.toc a {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    padding: 0 0.875rem;
    background: var(--slip);
    border: 1px solid var(--rule-strong);
    border-radius: var(--r-sm);
    font-weight: 600;
    text-decoration: none;
}

.toc a:hover {
    background: var(--blue-container);
    color: var(--on-blue-container);
}

.steps > section,
.ledger > section {
    padding: 2rem 0;
    border-top: 1px solid var(--rule);
}

.steps h2 .num {
    font-family: var(--display);
    color: var(--blue);
    margin-right: 0.375rem;
    font-variant-numeric: tabular-nums;
}

.quote {
    margin: 0 0 1rem;
    max-width: 42rem;
    background: var(--slip);
    color: var(--ink);
    border: 1px solid var(--rule);
    border-left: 3px solid var(--blue);
    border-radius: var(--r-sm);
    padding: 0.875rem 1rem;
}

.quote .label {
    color: var(--blue);
}

.quote p {
    margin: 0;
}

.limits {
    max-width: 46rem;
    padding-left: 1.25rem;
}

.limits li {
    margin-bottom: 0.75rem;
}

.limits li::marker {
    color: var(--red);
}

/* ---------- Footer ---------- */

.footer {
    background: var(--app-bar);
    color: var(--on-app-bar);
    padding: 2rem 0 2.5rem;
    border-top: 1px solid var(--rule);
}

.end + .footer {
    border-top: 1px solid var(--on-app-bar-muted);
}

.footer a {
    color: var(--on-app-bar);
}

.footer-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.footer-top p {
    margin: 0;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0 1.25rem;
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
}

.fine {
    color: var(--on-app-bar-muted);
    font-size: 0.875rem;
}

.fine p {
    margin: 0 0 0.375rem;
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}
