/**
 * eRechnung.new - Theme Tokens
 *
 * Single source of truth for the colour system.
 * Reference: docs/farbsystem.md (erechnung.new x PDFMAILER colour spec).
 *
 * Two meaning-bearing tones, kept strictly apart:
 *   - Warm yellow  --accent      = act / free of charge. Always a SURFACE with a
 *                                  dark label on it. Never a text colour on white.
 *   - Cool graphite --interactive = product / trust. The interaction colour:
 *                                  links, icons, secondary buttons, dark buttons.
 * Green is confirmation only, never a surface larger than an icon.
 * No text is black: body copy is --ink, a desaturated slate-green. A neutral
 * grey destroys the look.
 * No shadow is neutral black: every shadow carries the hue of its own surface.
 *
 * Loaded by every template. static/js/theme.js binds these tokens to Tailwind's
 * colour scales, so existing utility classes pick up the brand axis.
 * Change a colour HERE, nowhere else.
 */

/* ==========================================================================
   Typeface - Geist Sans, self-hosted variable font
   --------------------------------------------------------------------------
   Self-hosted on purpose: the CSP allows font-src 'self' only, so a runtime
   request to Google Fonts would be blocked. The files are the variable subsets
   (font-weight: 100 900) - a static cut would round the intermediate weights
   below to 400/500/600/700 and flatten the whole hierarchy, which is built on
   steps of only 20-30 units.
   Only latin + latin-ext are shipped; unicode-range keeps unused subsets from
   ever being fetched. Geist Mono is deliberately NOT included - it was dead
   weight in the mockup, referenced by no rule.
   ========================================================================== */

@font-face {
    font-family: 'Geist';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../assets/fonts/geist-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
        U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
        U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Geist';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../assets/fonts/geist-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
        U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
        U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    /* ---- Typeface ---- */
    --font-sans: 'Geist', Arial, Helvetica, sans-serif;

    /* ---- Weight scale - named by role, not by number.
            These are variable-font weights: 450, 580, 620, 650, 680, 720, 740
            and 750 are not classic cuts and only render correctly because Geist
            is variable. Keep the roles, do not round the numbers. ---- */
    --weight-faq-sign: 450;     /* FAQ plus/minus glyph */
    --weight-nav: 580;          /* navigation */
    --weight-record: 600;       /* record rows, footer links */
    --weight-trust: 620;        /* trust line in the hero */
    --weight-segment: 650;      /* segment buttons, prototype bar */
    --weight-display: 680;      /* h1 + every section h2, FAQ questions, header CTA */
    --weight-button: 700;       /* buttons, format pill, card links */
    --weight-wordmark: 720;     /* wordmark, eyebrows, convert button, kicker */
    --weight-numeral: 740;      /* large decorative numerals */
    --weight-badge: 750;        /* badges, counters, step labels */

    /* ---- Neutral axis - slate-green, never neutral grey ---- */
    --ink: #323f42;                 /* body copy + every headline */
    --ink-muted: #687477;           /* secondary text, footer links */
    --interactive: #465356;         /* links, icons, dark buttons */
    --surface-dark: #222c2f;        /* darkest panel */
    --surface-dark-alt: #465356;    /* second dark panel */

    /* Interpolated steps of the same axis - keep the hue, fill the ramp */
    --neutral-400: #99a3a5;
    --neutral-600: #576366;
    --neutral-800: #3c494c;

    /* ---- Surfaces ---- */
    --surface: #ffffff;
    --surface-sunken: #f9f9f9;      /* tinted section */
    --surface-tint: #eef1f1;        /* icon tiles, active states */
    --line: #dfe4e4;                /* EVERY divider */
    --line-strong: #cbd2d3;         /* header divider, dashed borders */

    /* ---- Accent - action and "free of charge" ---- */
    --accent: #f9bd00;
    --accent-hover: #e0a500;
    --accent-warm: #ea901e;         /* gradient end only */
    --accent-light: #ffd651;        /* gradient end only */
    --accent-surface: #fff6d7;      /* pills, badges */
    --accent-ink: #9b6500;          /* label text on light grounds (WCAG AA) */
    --accent-ink-deep: #6b4a00;     /* small text on filled yellow */
    --accent-ink-soft: #554a32;     /* body text on filled yellow */

    /* Interpolated accent steps */
    --accent-50: #fffcf0;
    --accent-200: #ffeaa8;
    --accent-600: #c48c00;

    /* ---- Warm secondary - shares the accent hue, used for notices ---- */
    --warm-50: #fef6ec;
    --warm-200: #f8d3a4;
    --warm-400: #ea901e;
    --warm-500: #d97d0e;
    --warm-600: #b8650a;
    --warm-800: #7a4206;
    --warm-900: #5c3105;

    /* ---- Confirmation ---- */
    --success: #13966f;
    --success-light: #5fd5bf;       /* on dark grounds */
    --success-surface: #dff8f2;
    --success-line: #7ac8b0;
    --success-tint: #f3fcf8;

    /* Interpolated success steps */
    --success-200: #b6e6d6;
    --success-600: #0f7d5c;
    --success-700: #0c6449;
    --success-800: #0a5038;
    --success-900: #073a28;

    /* ---- Danger - the spec is silent here, so the previous values stay,
            tokenised so they are centrally changeable ---- */
    --danger: #dc2626;
    --danger-surface: #fef2f2;
    --danger-line: #fca5a5;
    --danger-ink: #991b1b;

    /* ---- Text on dark grounds - separate per ground (see spec 5) ---- */
    --on-dark: #ffffff;
    --on-dark-muted: #aec0d5;       /* ONLY on --surface-dark */
    --on-alt-muted: #c8d5e4;        /* on --surface-dark-alt */

    /* ---- Depth - a shadow takes the hue of its surface, darker + desaturated ---- */
    --shadow-card: 0 28px 80px rgba(20, 55, 92, 0.14);
    --shadow-flat: 0 18px 55px rgba(21, 55, 91, 0.07);
    --shadow-hover: 0 22px 52px rgba(22, 53, 88, 0.12);
    --shadow-accent: 0 13px 28px rgba(211, 154, 0, 0.23);
    --shadow-accent-sm: 0 9px 20px rgba(211, 154, 0, 0.22);
    --shadow-warm: 0 24px 60px rgba(196, 127, 0, 0.20);
    --shadow-white: 0 15px 34px rgba(1, 34, 78, 0.19);
    --shadow-icon: 0 10px 28px rgba(26, 67, 110, 0.11);
    --shadow-on-dark: 0 30px 80px rgba(0, 0, 0, 0.24);  /* the one black exception */
    --glow-dark: rgba(249, 189, 0, 0.14);               /* warm cone on dark panels */

    /* ---- Gradients ---- */
    --gradient-hero: linear-gradient(160deg, #fffdf6 0%, #fff8df 50%, #f4f5f5 100%);
    --gradient-accent: linear-gradient(135deg, var(--accent), var(--accent-light));
    --gradient-warm-neutral: linear-gradient(135deg, #fff3c7 0%, #f1f3f3 100%);
    --gradient-closing:
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.28), transparent 24%),
        linear-gradient(125deg, #f9bd00, #ea901e);
    --marker-accent: linear-gradient(transparent 66%, rgba(249, 189, 0, 0.72) 66%);

    /* ---- Legacy aliases - existing rules keep working via the new axis ---- */
    --primary-color: var(--accent);
    --primary-dark: var(--accent-hover);
    --primary-light: var(--accent-light);
}

/* Everything inherits the typeface from here - one declaration, like the
   mockup, where body was the single font-family rule in the whole stylesheet. */
body {
    font-family: var(--font-sans);
}

/* In-page anchors: glide instead of jumping, unless the visitor asked for
   reduced motion. */
@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

/* Keep anchor targets clear of the sticky header (h-20 = 5rem) */
section[id] {
    scroll-margin-top: 6rem;
}

/* ==========================================================================
   Component primitives (spec 3) - reuse these instead of re-styling per page
   ========================================================================== */

/* -- Buttons -------------------------------------------------------------- */

/* Primary: yellow surface, dark label, amber-tinted shadow - never black */
.button-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    padding: 0 21px;
    border: none;
    border-radius: 12px;
    background: var(--accent);
    color: var(--ink);
    box-shadow: var(--shadow-accent);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.button-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

/* Secondary: cool border, semi-transparent surface.
   Shares the primary's metrics so the two sit level side by side. */
.button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    padding: 0 21px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--ink);
    font-size: 13px;
    font-weight: var(--weight-button);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

/* Compact variant for use inside cards and drop zones */
.button-secondary--sm {
    min-height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    background: var(--surface);
    box-shadow: var(--shadow-icon);
}

.button-secondary:hover {
    border-color: var(--line-strong);
    background: var(--surface);
}

/* Dark main action - deliberately NOT yellow */
.button-solid {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    border: none;
    border-radius: 11px;
    background: var(--interactive);
    color: var(--on-dark);
    font-weight: 720;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.button-solid:hover {
    background: var(--ink);
    transform: translateY(-1px);
}

.button-solid:disabled {
    opacity: 0.38;
    cursor: not-allowed;
    transform: none;
}

/* On a coloured ground - same metrics as the primary/secondary pair */
.button-white {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 50px;
    padding: 0 21px;
    border: none;
    border-radius: 12px;
    background: var(--surface);
    color: var(--interactive);
    box-shadow: var(--shadow-white);
    font-size: 13px;
    font-weight: var(--weight-button);
    cursor: pointer;
    transition: transform 0.2s ease;
}

.button-white:hover {
    transform: translateY(-1px);
}

/* -- Icon tile - one formula for every icon ------------------------------- */

.icon-tile {
    display: grid;
    place-items: center;
    width: 45px;
    height: 45px;
    border-radius: 13px;
    background: var(--surface-tint);
    color: var(--interactive);
}

.icon-tile--success {
    background: var(--success-surface);
    color: var(--success);
    border-radius: 999px;
}

/* A deliberately cooler tile marks a different genus */
.icon-tile--cool {
    background: var(--surface-dark);
    color: var(--accent);
}

/* Raised: a white tile lifting off a tinted ground */
.icon-tile--raised {
    background: var(--surface);
    color: var(--interactive);
    box-shadow: var(--shadow-icon);
}

/* -- Warm pill - surface and text always come as a pair ------------------- */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 9px;
    background: var(--accent-surface);
    color: var(--accent-ink);
    font-size: 10px;
    font-weight: 700;
}

/* -- Dark panel with a warm light cone ----------------------------------- */

.panel-dark {
    background:
        radial-gradient(circle at 18% 100%, var(--glow-dark), transparent 30%),
        var(--surface-dark);
    color: var(--on-dark);
}

.panel-dark--alt {
    background:
        radial-gradient(circle at 18% 100%, var(--glow-dark), transparent 30%),
        var(--surface-dark-alt);
}

/* Body copy on dark panels - separate per ground, see spec 5 */
.panel-dark .panel-copy { color: var(--on-dark-muted); }
.panel-dark--alt .panel-copy { color: var(--on-alt-muted); }

/* Tile on a dark panel - relative lightening, so it works on both grounds */
.panel-dark .tile {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 16px;
}

/* Neutral chip on a dark panel - same relative-lightening idea as .tile.
   Warm chips keep their yellow surface, which reads on any ground. */
.panel-dark .chip {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--on-dark-muted);
}

/* Links and icons on a dark panel take the accent - the one place yellow may
   carry text, because the ground is dark (spec 1 forbids it on white only). */
.panel-dark .link-on-dark {
    color: var(--accent);
}

/* The one black-shadow exception in the whole system (spec 4) */
.panel-dark .tile:hover {
    background: rgba(255, 255, 255, 0.09);
    box-shadow: var(--shadow-on-dark);
}

/* -- Featured card without a layout jump --------------------------------- */

/* inset ring instead of border-width: 2px - double the optical weight,
   without the card growing by a pixel */
.card--featured {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

/* -- Text marker on a headline - hard edge, never a background-color ------ */

.marker {
    background: var(--marker-accent);
}

/* ==========================================================================
   Hero + upload card
   ========================================================================== */

/* The hero carries the warm ground; everything below it stays on --surface.
   Layers, top to bottom: the two light cones (spec 4), then a fade into the
   page's white so the section edge does not read as a hard line, then the
   hero gradient itself - which stays exactly as the spec defines it. */
.hero-glow {
    background:
        radial-gradient(circle at 9% 18%, rgba(249, 189, 0, 0.20), transparent 27%),
        radial-gradient(circle at 92% 76%, rgba(70, 83, 86, 0.10), transparent 25%),
        linear-gradient(to bottom, transparent 68%, var(--surface) 100%),
        var(--gradient-hero);
}

.upload-card {
    position: relative;
    background: var(--surface);
    border-radius: 24px;
    box-shadow: var(--shadow-card);
}

/* Warm sheet peeking out behind the card - a stacked-paper hint that the PDF
   becomes a second document. Purely decorative. */
/* No shadow of its own - the card's large soft shadow already falls across it,
   and a second one only muddies the warm tone. */
.upload-sheet {
    position: absolute;
    top: 22px;
    right: -16px;
    bottom: 28px;
    left: 50%;
    border-radius: 22px;
    background: linear-gradient(170deg, var(--accent-200) 0%, var(--accent-surface) 100%);
}

/* Closing CTA - the one large filled-yellow surface (spec 4).
   Its headline stays --ink. White on yellow is exactly the trap spec 5
   warns about, so this must never share a rule with the dark panels. */
.cta-closing {
    background: var(--gradient-closing);
    border-radius: 24px;
    box-shadow: var(--shadow-warm);
}

/* ==========================================================================
   Step panel - one bounded card split into equal columns by hairlines
   ========================================================================== */

.step-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    box-shadow: var(--shadow-flat);
    overflow: hidden;
}

/* Stacked on small screens: dividers run horizontally */
.step-panel > * + * {
    border-top: 1px solid var(--line);
}

@media (min-width: 768px) {
    .step-panel {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    /* Side by side: the same dividers turn vertical */
    .step-panel > * + * {
        border-top: 0;
        border-left: 1px solid var(--line);
    }
}

/* Large decorative numerals. Deliberately far below the contrast threshold
   (spec 5) - they are ornament, not information, so every one of them carries
   aria-hidden and must never be the only place a step is numbered. */
.step-number {
    color: var(--line-strong);
    font-size: 26px;
    font-weight: var(--weight-numeral);
    line-height: 1;
    letter-spacing: -0.02em;
}

.upload-dropzone {
    border: 2px dashed var(--line-strong);
    border-radius: 16px;
    background: var(--surface-sunken);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.upload-dropzone:hover,
.upload-dropzone:focus-visible {
    border-color: var(--accent);
    background: var(--accent-50);
}

/* Dragging anywhere over the hero highlights the drop zone itself */
#hero-drop-zone.drag-over .upload-dropzone {
    border-color: var(--accent);
    background: var(--accent-surface);
}

/* A staged file turns the zone into a confirmation */
.upload-dropzone.has-file {
    border-style: solid;
    border-color: var(--success-line);
    background: var(--success-tint);
}

/* ==========================================================================
   Token-bound utilities
   ========================================================================== */

.gradient-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
}

.gradient-hero { background: var(--gradient-hero); }
.gradient-closing { background: var(--gradient-closing); }
.gradient-warm-neutral { background: var(--gradient-warm-neutral); }

.bg-primary { background-color: var(--accent) !important; }
.bg-primary-light { background-color: var(--accent-surface); }
.text-primary { color: var(--accent-ink); }
.text-primary-dark { color: var(--accent-ink-deep); }
.border-primary { border-color: var(--accent); }
.hover\:bg-primary-dark:hover { background-color: var(--accent-hover); }

/* Shadow utilities are generated by Tailwind from theme.js (shadow-card,
   shadow-accent, shadow-warm, ...) - not redefined here. */

/* Translucent overlays - explicit classes, because Tailwind's opacity
   modifiers (bg-white/20) cannot resolve var()-based palette entries */
.overlay-dark {
    background-color: rgba(34, 44, 47, 0.34);
}

.overlay-light-hover:hover {
    background-color: rgba(255, 255, 255, 0.20);
}
