/*
 * SoniFi site stylesheet (sonicon.org/wifi/).
 * Tokens from projects/wifi/DESIGN.md ("Night Transit"): the connection drawn as a metro line.
 * Night service (dark, the app's lead): midnight ground, porcelain ink, enamel steps for depth.
 * Day service (light): porcelain ground, midnight ink, line inks darkened to pass contrast.
 * Service ramp running / good / delayed / weak / suspended; inks cobalt, rose, lilac only on the line.
 * Fira Sans 400/600 carries the whole voice; Fira Sans Condensed 600 is the signage voice
 * (labels, nav, station names, state words). Radii 4/8/12/16/20; capsule only on the router
 * station. No shadows, glows or gradients.
 */

@font-face {
    font-family: "Fira Sans";
    src: url("/wifi/fonts/fira-sans-400.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Fira Sans";
    src: url("/wifi/fonts/fira-sans-600.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Fira Sans Condensed";
    src: url("/wifi/fonts/fira-sans-condensed-600.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

/* Day service */
:root {
    color-scheme: light dark;
    --surface: #F7F5EF;
    --on-surface: #0C1730;
    --card: #F1EFE8;
    --card-high: #EBE9E2;
    --muted: #46506A;
    --outline: #6E7790;
    --hairline: #D3D1C8;
    --primary: #0C1730;
    --on-primary: #F1EFE8;
    --primary-container: #DCE4F5;
    --on-primary-container: #0C1730;
    --track: #D3D1C8;
    --station: #0C1730;
    --cobalt: #1D5BD0;
    --rose: #B8336A;
    --lilac: #6B3FD1;
    --running: #0B7045;
    --good: #4A6E0F;
    --delayed: #8A5A00;
    --weak: #A84700;
    --suspended: #B3261E;
    --shot-ground: #0C1730;
    --sans: "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --cond: "Fira Sans Condensed", "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --r-2xs: 4px;
    --r-xs: 8px;
    --r-sm: 12px;
    --r-md: 16px;
    --r-lg: 20px;
    --measure: 40rem;
}

/* Night service */
@media (prefers-color-scheme: dark) {
    :root {
        --surface: #0C1730;
        --on-surface: #F1EFE8;
        --card: #101C37;
        --card-high: #13213F;
        --muted: #AAB4C7;
        --outline: #7D89A6;
        --hairline: #26375B;
        --primary: #F1EFE8;
        --on-primary: #0C1730;
        --primary-container: #1F3461;
        --on-primary-container: #F1EFE8;
        --track: #2C3E66;
        --station: #F1EFE8;
        --cobalt: #4D8EFF;
        --rose: #E8618C;
        --lilac: #B592FF;
        --running: #3CC47C;
        --good: #9BD45A;
        --delayed: #F2B544;
        --weak: #F58A4B;
        --suspended: #EF5B4B;
    }
}

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

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

body {
    margin: 0;
    background: var(--surface);
    color: var(--on-surface);
    font-family: var(--sans);
    font-weight: 400;
    font-size: 1.0625rem;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

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

a {
    color: var(--primary);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
}

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

:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
    border-radius: var(--r-2xs);
}

h1,
h2,
h3 {
    font-family: var(--sans);
    font-weight: 600;
    line-height: 1.2;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
    text-wrap: balance;
    margin: 0 0 0.6em;
}

h1 {
    font-size: clamp(2rem, 1.3rem + 3.6vw, 3.3rem);
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem);
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.25rem;
}

p {
    margin: 0 0 1em;
}

code {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.92em;
    overflow-wrap: anywhere;
}

.num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 10;
    padding: 0.75rem 1rem;
    background: var(--primary);
    color: var(--on-primary);
    border-radius: var(--r-xs);
    font-weight: 600;
}

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

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

/* Top bar: flat on the ground */

.topbar {
    border-bottom: 1px solid var(--hairline);
}

.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 {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    min-height: 48px;
    color: var(--on-surface);
    text-decoration: none;
}

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

.wordmark {
    font-weight: 600;
    font-size: 1.4rem;
    letter-spacing: -0.01em;
}

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

.site-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    padding: 0 0.7rem;
    color: var(--on-surface);
    text-decoration: none;
    font-family: var(--cond);
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 0.01em;
}

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

.site-nav a[aria-current="page"] {
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

/* Signage label: a condensed stamp, then the sentence it stamps */

.stamp {
    display: block;
    margin: 0 0 0.5rem;
    font-family: var(--cond);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--muted);
}

/* Hero */

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

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

.hero-copy {
    min-width: 0;
}

.hero .answer {
    font-size: 1.15rem;
    max-width: var(--measure);
}

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

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

.play-badge {
    display: inline-block;
    border-radius: var(--r-xs);
    line-height: 0;
}

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

.hero-shot {
    justify-self: center;
    width: min(100%, 22rem);
}

/* Framed store shots (midnight canvas): a 1 px hairline border in both schemes */

.shot img,
.hero-shot img {
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    background: var(--shot-ground);
}

@media (min-width: 60rem) {
    .hero {
        padding: 4rem 0 4.5rem;
    }

    .hero-grid {
        grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
        gap: 4rem;
    }
}

/* Sections */

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

.section > .wrap > p,
.prose > p,
.prose > ul {
    max-width: var(--measure);
}

.answer {
    max-width: var(--measure);
}

.detail {
    color: var(--muted);
    max-width: var(--measure);
}

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

.split > * {
    min-width: 0;
}

@media (min-width: 52rem) {
    .split {
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
        gap: 3.5rem;
    }

    .split-flip > :first-child {
        order: 2;
    }
}

.shot {
    margin: 0;
    justify-self: center;
    width: min(100%, 19rem);
}

.shot figcaption {
    margin-top: 0.6rem;
    font-size: 0.9rem;
    color: var(--muted);
    line-height: 1.45;
}

/* The plate: one step up the enamel ramp, holding the line */

.plate {
    background: var(--card);
    color: var(--on-surface);
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    padding: 1.5rem 1.25rem;
}

@media (min-width: 40rem) {
    .plate {
        padding: 2rem 2.25rem;
    }
}

/* Route line (static): 8 px track, porcelain stations with a cut-out ring, router as a capsule.
   Each segment's state is also a word. */

.route {
    display: flex;
    margin: 1.75rem 0 0;
    padding: 0 0.5rem;
    list-style: none;
    max-width: 36rem;
}

.route li {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    padding-top: 1.9rem;
}

/* the segment */
.route li::before {
    content: "";
    position: absolute;
    top: 0.5rem;
    left: 0;
    right: 0;
    height: 8px;
    background: var(--seg, var(--track));
}

.route .running {
    --seg: var(--running);
}

.route .delayed {
    --seg: var(--delayed);
}

.route .suspended::before {
    height: 0;
    background: none;
    border-top: 8px dashed var(--suspended);
}

/* the station at the start of each segment */
.route li::after {
    content: "";
    position: absolute;
    top: calc(0.5rem - 7px);
    left: -11px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--station);
    border: 3px solid var(--card);
}

/* the router is an interchange capsule */
.route li:nth-child(2)::after {
    left: -18px;
    width: 36px;
    height: 22px;
    border-radius: 999px;
}

.route .end {
    position: absolute;
    top: calc(0.5rem - 7px);
    right: -11px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--station);
    border: 3px solid var(--card);
}

.route .stop,
.route .to {
    display: block;
    font-family: var(--cond);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.25;
    margin-left: -0.5rem;
}

.route .to {
    position: absolute;
    top: 1.9rem;
    right: -0.5rem;
    text-align: right;
}

.route .state {
    display: block;
    margin-top: 0.15rem;
    text-align: center;
    font-family: var(--cond);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--muted);
}

.route .delayed .state {
    color: var(--delayed);
}

.route-cap {
    margin: 0.9rem 0 0;
    font-size: 0.9rem;
    color: var(--muted);
}

.ladder {
    counter-reset: step;
    margin: 1.5rem 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.25rem;
}

.ladder li {
    counter-increment: step;
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr);
    gap: 0.25rem 0.9rem;
    align-items: start;
    padding: 0.9rem 0;
    border-top: 1px solid var(--hairline);
}

.ladder li::before {
    content: counter(step);
    grid-row: span 2;
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--primary);
    color: var(--on-primary);
    font-weight: 600;
    font-size: 1.05rem;
}

.ladder .q {
    font-weight: 600;
    margin: 0;
}

.ladder .label {
    margin: 0;
}

.ladder .label strong {
    font-family: var(--cond);
    font-weight: 600;
    font-size: 1.1rem;
}

/* Notes: a stamp, then the sentence it stamps */

.notes {
    margin: 1.25rem 0 0;
    padding: 0;
    list-style: none;
    max-width: var(--measure);
}

.notes li {
    display: grid;
    grid-template-columns: minmax(6.5rem, max-content) minmax(0, 1fr);
    gap: 0.25rem 1rem;
    padding: 0.7rem 0;
    border-top: 1px solid var(--hairline);
}

.notes li:last-child {
    border-bottom: 1px solid var(--hairline);
}

.notes .stamp {
    margin: 0.1rem 0 0;
}

@media (max-width: 30rem) {
    .notes li {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Facts list (privacy) */

.facts {
    margin: 0;
    display: grid;
    gap: 0.6rem;
}

.facts div {
    background: var(--card);
    color: var(--on-surface);
    border-radius: var(--r-sm);
    padding: 0.85rem 1rem;
}

.facts dt {
    font-family: var(--cond);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--muted);
}

.facts dd {
    margin: 0.2rem 0 0;
    font-weight: 600;
    font-size: 1.1rem;
}

/* What it doesn't do */

.nots {
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
    max-width: var(--measure);
}

.nots li {
    display: grid;
    grid-template-columns: 1.4rem minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.6rem 0;
}

.nots svg {
    width: 1.3rem;
    height: 1.3rem;
    margin-top: 0.2rem;
    fill: none;
    stroke: var(--suspended);
    stroke-width: 2;
    stroke-linecap: round;
}

/* Feature grid (tools) */

.cards {
    display: grid;
    gap: 1rem;
    margin: 1.5rem 0 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 44rem) {
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.cards li {
    background: var(--card);
    color: var(--on-surface);
    border-radius: var(--r-md);
    padding: 1.25rem;
}

.cards h3 {
    margin-bottom: 0.4rem;
}

.cards p {
    margin: 0;
}

/* Next-question band: the whole band is the link, chevron at the far edge */

.bands {
    margin: 1.25rem 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.6rem;
    max-width: 46rem;
}

.band {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 48px;
    padding: 0.85rem 1.1rem;
    background: var(--primary-container);
    color: var(--on-primary-container);
    border-radius: var(--r-sm);
    text-decoration: none;
    font-weight: 600;
}

.band:hover {
    text-decoration: underline;
}

.band svg {
    flex: none;
    width: 1.4rem;
    height: 1.4rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Page head and breadcrumb (inner pages) */

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

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

.crumbs li {
    display: inline-flex;
    align-items: center;
}

.crumbs li + li::before {
    content: "\203A";
    padding: 0 0.5rem;
    color: var(--muted);
}

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

.crumbs [aria-current] {
    min-height: 48px;
    display: inline-flex;
    align-items: center;
}

.lede {
    font-size: 1.15rem;
    max-width: var(--measure);
    color: var(--muted);
}

/* Contents list on how-it-works */

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

.toc a {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    padding: 0 0.9rem;
    border: 1px solid var(--hairline);
    border-radius: var(--r-xs);
    text-decoration: none;
    color: var(--on-surface);
    font-family: var(--cond);
    font-weight: 600;
}

.toc a:hover {
    border-color: var(--outline);
    text-decoration: underline;
}

/* Tables: stack into cards at 600 px and below */

.table-wrap {
    margin: 1.25rem 0 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.98rem;
}

caption {
    display: block;
    text-align: left;
    font-weight: 600;
    padding-bottom: 0.5rem;
}

th,
td {
    text-align: left;
    vertical-align: top;
    padding: 0.75rem 0.9rem 0.75rem 0;
    border-bottom: 1px solid var(--hairline);
}

thead th {
    font-family: var(--cond);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 2px solid var(--outline);
}

tbody th {
    font-weight: 600;
    width: 30%;
}

.points td.n {
    width: 5rem;
}

@media (max-width: 600px) {
    table,
    thead,
    tbody,
    tr,
    th,
    td {
        display: block;
    }

    thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    tr {
        background: var(--card);
        color: var(--on-surface);
        border-radius: var(--r-sm);
        padding: 0.9rem 1rem;
        margin-bottom: 0.75rem;
    }

    th,
    td,
    tbody th,
    .points td.n {
        border: 0;
        padding: 0.2rem 0;
        width: auto;
    }

    td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-family: var(--cond);
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--muted);
    }
}

/* FAQ ledger */

.ledger {
    padding-bottom: 2rem;
}

.ledger section {
    padding: 1.75rem 0;
    border-top: 1px solid var(--hairline);
    max-width: 46rem;
}

.ledger h2 {
    font-size: clamp(1.3rem, 1.15rem + 0.7vw, 1.6rem);
}

/* Closing call */

.closing {
    padding: 3rem 0 3.5rem;
    border-top: 1px solid var(--hairline);
}

.closing .card-end {
    background: var(--card);
    color: var(--on-surface);
    border-radius: var(--r-lg);
    padding: 1.75rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 2rem;
}

.closing h2 {
    margin: 0;
}

/* Footer */

.footer {
    border-top: 1px solid var(--hairline);
    padding: 2.5rem 0 3rem;
    font-size: 0.95rem;
}

.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 0.25rem;
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
}

.footer-links a {
    display: inline-flex;
    align-items: center;
    min-height: 48px;
    padding: 0 0.6rem 0 0;
    margin-right: 0.6rem;
}

.fine {
    color: var(--muted);
    font-size: 0.88rem;
}

.fine p {
    margin: 0 0 0.35rem;
    max-width: 48rem;
}

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