/*
 * Route Companion website chrome — the one definition of each shared part.
 *
 * Every page family loads this after tokens.css: the homepage and its de/ and
 * fr/ copies, the guides and What's new, the tools, the legal pages, the
 * Android beta page, the OAuth callback and the Worker-rendered plan page. A
 * family adds its own layout in its own stylesheet and does not restyle what
 * is here (SYSTEM.md §7, W7): one reset and type scale, one link, one button,
 * one header, one footer, one eyebrow and one link row.
 *
 * Sizes, colours, radii, shadows and motion all come from tokens.css.
 */

/* ── Base ──────────────────────────────────────────────────────────────── */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

body {
    margin: 0;
    font-family: var(--font-text);
    line-height: var(--leading-body);
    color: var(--text-primary);
    background: var(--bg-base);
}

/* ── Type ──────────────────────────────────────────────────────────────── */
/* One display face and one size per level. Tracking tightens as the size
   grows: -0.04em at hero scale down to -0.015em at row-heading scale. */
h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--text-primary);
    /* German compounds ("Kleidungsempfehlung") can outgrow a 320px screen at
       display sizes; break them rather than scroll the page sideways. */
    overflow-wrap: break-word;
}

:lang(de) :is(h1, h2, h3, h4) {
    -webkit-hyphens: auto;
    hyphens: auto;
}

h1 {
    font-size: var(--text-h1);
    line-height: var(--leading-tight);
    letter-spacing: -0.04em;
    text-wrap: balance;
}

h2 {
    font-size: var(--text-h2);
    line-height: 1.12;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

h3,
h4 {
    font-size: var(--text-h3);
    line-height: 1.25;
    letter-spacing: -0.015em;
}

/* A link takes the accent and answers the pointer with the ink. Zero
   specificity, so a component that sets its own colour (a button, a row)
   never has to out-shout it. */
:where(a) {
    color: var(--primary-light);
    text-decoration: none;
}

:where(a:hover) {
    color: var(--text-primary);
}

:where(a:focus-visible),
:where(button:focus-visible) {
    outline: 2px solid var(--primary-light);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* ── Eyebrow ───────────────────────────────────────────────────────────── */
/* The category over a heading. One label, in the mono face, wherever it
   appears (W10: it says something the heading does not). */
.kicker,
.hero-kicker,
.section-kicker,
.plan-eyebrow,
.tool-panel-title {
    margin: 0 0 var(--space-sm);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 400;
    letter-spacing: 0.14em;
    line-height: var(--leading-snug);
    text-transform: uppercase;
    color: var(--primary-light);
}

/* ── Button ────────────────────────────────────────────────────────────── */
/* The primary is filled with the ink and reads as the page's one action; the
   secondary is a hairline on the surface. Hover changes the colour and the
   edge, and nothing lifts (W9). */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    min-height: 46px;
    padding: var(--space-md) var(--space-xl);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: var(--text-md);
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition:
        background-color var(--dur-enter) var(--ease-enter),
        border-color var(--dur-enter) var(--ease-enter),
        color var(--dur-enter) var(--ease-enter);
}

.btn-primary {
    background-color: var(--text-primary);
    color: var(--bg-base);
}

.btn-primary:hover {
    background-color: color-mix(in srgb, var(--text-primary) 86%, var(--bg-base));
}

.btn-secondary,
.nav-links .nav-cta {
    background-color: color-mix(in srgb, var(--bg-surface) 90%, transparent);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover,
.nav-links .nav-cta:hover {
    background-color: var(--bg-surface);
    border-color: var(--primary-light);
}

/* A label belongs to its fill and never follows the link ramp, whatever the
   state of the link around it. */
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    color: var(--bg-base);
}

.btn-secondary:hover,
.btn-secondary:focus,
.btn-secondary:active {
    color: var(--text-primary);
}

.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
    background-color: var(--bg-surface);
    border-color: var(--border-color);
    color: var(--text-muted);
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    margin-top: var(--space-2xl);
}

/* ── Header ────────────────────────────────────────────────────────────── */
/* Stamped by scripts/stamp-nav.mjs, and mirrored by hand in the plan page's
   siteChrome(): the markup is the same on every page, and so is this. It sits
   at the top of the page and scrolls with it. */
.site-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    max-width: var(--container);
    margin: 0 auto;
    padding: var(--space-md) var(--gutter);
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    font-weight: 800;
    font-size: var(--text-md);
    letter-spacing: -0.2px;
}

.brand-link img {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--hairline);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 22px;
    font-size: var(--text-sm);
    font-weight: 600;
}

.nav-links a {
    color: var(--text-secondary);
    transition: color var(--dur-enter) var(--ease-enter);
}

.nav-links a:hover {
    color: var(--text-primary);
}

/* The section you are in, so the header answers "where am I". */
.nav-links a[aria-current="page"] {
    position: relative;
    color: var(--text-primary);
}

.nav-links a[aria-current="page"]::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 2px;
    border-radius: var(--radius-pill);
    background: var(--primary-light);
}

/* The install path keeps its button on every page. It is the secondary button
   at header size, not a second kind of button. */
.nav-links .nav-cta {
    min-height: 0;
    padding: var(--space-sm) 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.4;
}

.nav-links a[aria-current="page"].nav-cta::after {
    content: none;
}

@media (max-width: 900px) {
    .site-nav-inner {
        padding-block: 10px;
    }

    .nav-links {
        gap: 14px;
        font-size: var(--text-sm);
    }
}

@media (max-width: 480px) {
    .brand-link span {
        display: none;
    }
}

/* ── Footer ────────────────────────────────────────────────────────────── */
.footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 36px 0 40px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-md);
    margin: 0 0 var(--space-sm);
    font-size: var(--text-base);
}

.footer-links a {
    color: var(--text-secondary);
    transition: color var(--dur-enter) var(--ease-enter);
}

.footer-links a:hover {
    color: var(--primary-light);
}

/* No margin: the flex gap already spaces these, and language.js injects one
   more dot of its own into .footer-links. */
.footer-links .dot {
    color: var(--text-muted);
}

.footer-copyright {
    margin: 0;
    font-size: var(--text-xs);
    color: var(--text-muted);
}

/* ── Link row ──────────────────────────────────────────────────────────── */
/* A pointer to another page: a title, one line, and the row's own arrow. One
   hairline between rows and nothing else (W6). The arrow is part of the row
   (W8), so it never gets typed into a translation. */
.guide-list,
.guide-link-list {
    border-top: 1px solid var(--border-color);
}

.guide-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) 24px;
    align-items: start;
    gap: var(--space-2xl);
    padding: 22px 0;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    text-decoration: none;
}

.guide-row strong,
.guide-row h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: var(--text-md);
    font-weight: 800;
    line-height: 1.25;
    letter-spacing: -0.015em;
    color: var(--text-primary);
    transition: color var(--dur-enter) var(--ease-enter);
}

.guide-row span,
.guide-row p {
    margin: 0;
    font-size: var(--text-base);
    line-height: var(--leading-snug);
    color: var(--text-secondary);
    transition: color var(--dur-enter) var(--ease-enter);
}

.guide-row::after {
    content: "\2192";
    color: var(--text-faint);
    line-height: 1.3;
    transition:
        transform var(--dur-enter) var(--ease-enter),
        color var(--dur-enter) var(--ease-enter);
}

.guide-row:hover::after {
    color: var(--primary-light);
    transform: translateX(3px);
}

.guide-row:hover strong,
.guide-row:hover h3 {
    color: var(--primary-light);
}

/* The row is one link, so all of it answers the pointer. The description lifts
   to the ink rather than the accent: turning body copy the link colour would
   read as a second link inside the first. */
.guide-row:hover span,
.guide-row:hover p {
    color: var(--text-primary);
}

@media (max-width: 700px) {
    .guide-row {
        grid-template-columns: minmax(0, 1fr) 20px;
        gap: 6px var(--space-lg);
    }

    .guide-row span,
    .guide-row p {
        grid-column: 1 / -1;
    }

    /* The arrow is the row's last child, so once the description takes the
       full width it would fall to a third line on its own. Pin it beside the
       title. */
    .guide-row::after {
        grid-column: 2;
        grid-row: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .guide-row::after,
    .btn {
        transition: none;
    }
}
