/*
 * GF Savings brand layer.
 *
 * One palette and one type system, shared with the ad creative (scripts/social/build.js):
 * deep purple, a gold accent, Space Grotesk headlines, purple-tinted neutrals, and the receipt
 * card that shows the "extra cost". The server adds this file LAST on every page (see
 * services/site-chrome.js), after the page's own styles, so a rule here wins without !important.
 *
 * Contrast rules for gold (#f2c14e), measured:
 *   - never as text on a light background (1.7:1);
 *   - as text on the purple only at 19px bold or larger (4.2:1, large-text pass only);
 *   - as a fill it carries ink or deep-purple text, never the brand purple (4.2:1);
 *   - freely as a rule, an outline, a list bar or a focus ring.
 */

:root {
    --brand-purple: #6d28d9;
    --brand-violet: #7c3aed;
    --brand-deep: #4c1d95;
    --brand-gold: #f2c14e;
    --brand-ink: #1b1530;
    --brand-body: #3a3256;
    --brand-muted: #6a6184;
    --brand-line: #e4def1;
    --brand-bg: #f6f2fd;
    --brand-cream: #fffdf7;
    --brand-lav: #ede9fe;
    --brand-lav-2: #ddd6fe;

    --font-display: 'Space Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-receipt: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* The app's neutral scale, retinted toward the brand purple. Same steps, same roles. */
    --gray-50: #f8f6fd;
    --gray-100: #f1edf9;
    --gray-200: #e4def1;
    --gray-300: #cfc8e0;
    --gray-400: #777091;
    --gray-500: #6a6184;
    --gray-600: #524a6e;
    --gray-700: #3a3256;
    --gray-800: #241d3d;
    --gray-900: #1b1530;
    --primary-tint: #f6f2fd;
}

/* ---------- Base ---------- */
/* Form controls do not inherit the page font by default (pricing and sign-in showed Arial). */
button, input, select, textarea { font-family: inherit; }

h1, h2,
.hero-title, .section-title, .unified-title, .brand-display {
    font-family: var(--font-display);
    letter-spacing: -0.02em;
    text-wrap: balance;
}

.brand-eyebrow {
    margin: 0 0 12px;
    font: 700 0.8rem/1.2 var(--font-body);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--brand-violet);
}
.brand-rule {
    display: block;
    width: 72px;
    height: 4px;
    margin: 0 0 20px;
    border: 0;
    border-radius: 2px;
    background: var(--brand-gold);
}

/* ---------- Shared header ---------- */
.gf-skip {
    position: absolute;
    left: -9999px;
    top: 8px;
    z-index: 200;
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--brand-ink);
    color: #fff;
    font: 600 0.95rem/1 var(--font-body);
}
.gf-skip:focus { left: 8px; }

.gf-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid var(--brand-line);
    font-family: var(--font-body);
}
.gf-header-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1120px;
    min-height: 64px;
    margin: 0 auto;
    padding: 0 24px;
}
.gf-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    color: var(--brand-ink);
    text-decoration: none;
}
.gf-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--brand-violet);
    color: #fff;
    font: 700 0.85rem/1 var(--font-display);
}
.gf-badge-gold { background: var(--brand-gold); color: var(--brand-ink); }
.gf-name { font: 700 1.08rem/1 var(--font-body); letter-spacing: -0.015em; }

.gf-nav { display: flex; align-items: center; gap: 4px; }
.gf-nav a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 10px;
    color: var(--brand-body);
    font: 500 0.95rem/1.2 var(--font-body);
    text-decoration: none;
    white-space: nowrap;
}
.gf-nav a:hover { color: var(--brand-purple); background: var(--brand-bg); }
.gf-nav a[aria-current="page"] { color: var(--brand-purple); font-weight: 600; }
.gf-nav a.gf-cta {
    margin-left: 8px;
    padding: 0 18px;
    background: var(--brand-purple);
    color: #fff;
    font-weight: 600;
}
.gf-nav a.gf-cta:hover { background: #5b21b6; color: #fff; }
.gf-header a:focus-visible, .gf-menu-btn:focus-visible, .gf-footer a:focus-visible {
    outline: 3px solid var(--brand-violet);
    outline-offset: 2px;
}
.gf-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--brand-line);
    border-radius: 10px;
    background: #fff;
    color: var(--brand-body);
    cursor: pointer;
}
.gf-menu-btn svg { width: 22px; height: 22px; }

@media (max-width: 900px) {
    .gf-header-inner { padding: 0 16px; }
    .gf-menu-btn { display: inline-flex; }
    .gf-nav {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        right: 16px;
        left: 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 8px;
        border: 1px solid var(--brand-line);
        border-radius: 14px;
        background: #fff;
        box-shadow: 0 18px 40px rgba(27, 21, 48, 0.18);
    }
    .gf-nav.gf-nav-open { display: flex; }
    .gf-nav a { min-height: 48px; padding: 0 14px; font-size: 1rem; }
    .gf-nav a.gf-cta { margin: 6px 0 0; justify-content: center; }
}

/* ---------- Shared footer ---------- */
.gf-footer {
    background: var(--brand-ink);
    color: #c9c2dc;
    font-family: var(--font-body);
}
.gf-footer-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 44px 24px 36px;
    text-align: center;
}
.gf-footer .gf-logo { color: #fff; }
.gf-footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px 8px;
    margin: 16px 0 20px;
}
.gf-footer-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 10px;
    color: var(--brand-lav-2);
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
}
.gf-footer-links a:hover { color: #fff; text-decoration: underline; }
.gf-footer-note {
    max-width: 680px;
    margin: 0 auto 10px;
    font-size: 0.82rem;
    line-height: 1.6;
    color: #c9c2dc;
}
.gf-footer-note a { color: var(--brand-lav-2); }

/* ---------- The receipt card (the ad's signature object) ---------- */
.receipt-card {
    position: relative;
    background: var(--brand-cream);
    border-radius: 6px;
    padding: 22px 24px 20px;
    font-family: var(--font-receipt);
    color: var(--brand-body);
    box-shadow: 0 18px 40px rgba(109, 40, 217, 0.14);
    text-align: left;
}
.receipt-card::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -10px;
    height: 10px;
    background:
        linear-gradient(135deg, var(--brand-cream) 5px, transparent 0) 0 0 / 10px 10px repeat-x,
        linear-gradient(225deg, var(--brand-cream) 5px, transparent 0) 0 0 / 10px 10px repeat-x;
}
.receipt-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 16px;
    padding: 8px 0;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.3;
}
.receipt-row > :last-child { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.receipt-row.receipt-total {
    margin-top: 8px;
    padding-top: 14px;
    border-top: 2px dashed var(--brand-lav-2);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--brand-purple);
}

/* ---------- Buttons ---------- */
.btn-primary { background: var(--brand-purple); font-weight: 600; }
.btn-primary:hover { background: #5b21b6; }

/* ---------- Home: hero (the ad cover, as a page) ---------- */
.hero {
    display: block;
    min-height: 0;
    padding-top: 56px;
    padding-bottom: 56px;
    background: var(--brand-purple);
}
.hero .beta-badge {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--brand-lav);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    margin-bottom: 16px;
}
.hero .hero-title {
    color: #fff;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.06;
    margin-bottom: 20px;
}
/* Gold is display-size here, so it passes as large text on the purple. */
.hero .purple-text { color: var(--brand-gold); font-weight: 700; }
.hero .brand-rule { margin: 0 auto 20px; }
.hero .hero-subtitle {
    color: var(--brand-lav);
    font-weight: 500;
    max-width: 640px;
    margin-bottom: 20px;
    text-wrap: pretty;
}
.hero-audience-note {
    margin: 0 auto 22px;
    max-width: 38em;
    color: var(--brand-lav);
    font-size: 0.9rem;
    line-height: 1.4;
}
.hero-audience {
    display: inline-block;
    margin: 0 0 10px;
    padding: 8px 16px;
    border: 2px solid var(--brand-gold);
    border-radius: 999px;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.25;
}

.hero .upload-zone {
    background: #fff;
    border: 0;
    border-radius: 20px;
    outline: 2px dashed var(--brand-lav-2);
    outline-offset: -12px;
    box-shadow: 0 24px 48px rgba(27, 21, 48, 0.28);
    margin-bottom: 24px;
}
.hero .upload-zone:hover { background: #fff; outline-color: var(--brand-violet); }
.hero .upload-zone.dragging { background: var(--brand-bg); outline-color: var(--brand-violet); }
.hero .upload-zone:focus-visible { outline: 3px solid var(--brand-gold) !important; outline-offset: 3px; box-shadow: 0 24px 48px rgba(27, 21, 48, 0.28); }
.upload-free-note {
    margin: 10px 0 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--brand-purple);
}

/* Helper lines under the upload card sit on purple. */
.hero .upload-claim-assist summary,
.hero .upload-past-receipts summary { color: #fff; }
.hero .upload-claim-assist .upload-claim-label,
.hero .upload-past-receipts p { color: var(--brand-lav); }
.hero .upload-privacy-note { color: var(--brand-lav); }
.hero .upload-privacy-note a { color: #fff; }
.hero .irs-disclaimer p { color: var(--brand-lav-2); }

@media (max-width: 768px) {
    .hero { padding-top: 32px; padding-bottom: 40px; }
    .hero .hero-subtitle { font-size: 1.05rem; line-height: 1.5; margin-bottom: 16px; }
    .hero-audience { margin-bottom: 8px; font-size: 0.9rem; }
    .hero-audience-note { margin-bottom: 20px; font-size: 0.85rem; }
    .hero .upload-zone { padding: 28px 20px 24px; }
}

/* ---------- Home: the worked example and the one solid button, in the upload card ---------- */
.hero-example {
    max-width: 420px;
    margin: 0 auto 16px;
    padding: 12px 16px 10px;
    border-radius: 6px;
    background: var(--brand-cream);
    box-shadow: inset 0 0 0 1px var(--brand-lav-2);
    font-family: var(--font-receipt);
    color: var(--brand-body);
    text-align: left;
}
.hero-example-label { margin: 0 0 4px; font-size: 0.78rem; font-weight: 600; line-height: 1.35; color: var(--brand-muted); }
.hero-example .receipt-row { padding: 4px 0; font-size: 0.92rem; }
.hero-example .receipt-row.receipt-total { margin-top: 4px; padding-top: 9px; font-size: 1.1rem; }
.upload-primary-btn {
    display: block;
    max-width: 420px;
    margin: 0 auto 12px;
    padding: 15px 20px;
    border-radius: 12px;
    background: var(--brand-purple);
    color: #fff;
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.2;
}
.upload-zone:hover .upload-primary-btn { background: #5b21b6; }
.hero .upload-text { font-size: 0.92rem; }
.hero .upload-formats { font-size: 0.8rem; }

/* A way in for a visitor with no receipt in hand: the app reading a sample one. */
.hero-sample { margin: 0 0 14px; }
.hero-sample summary { color: #fff; font-weight: 600; cursor: pointer; }
.hero-sample p { margin: 0 auto; max-width: 34em; color: var(--brand-lav); font-size: 0.88rem; line-height: 1.5; }
.hero-sample-video {
    display: block;
    width: min(100%, 290px);
    height: auto;
    margin: 16px auto;
    border: 9px solid #1b1530;
    border-radius: 34px;
    background: #1b1530;
    box-shadow: 0 24px 48px rgba(27, 21, 48, 0.35);
}

/* ---------- Home: how it works ---------- */
.how-it-works { background: #fff; border-top: 0; }
.section-title { font-weight: 700; color: var(--brand-ink); }
.step-card { background: var(--brand-bg); }
.step-number { background: var(--brand-gold); color: var(--brand-ink); font-family: var(--font-display); }
.step-card h3 { font-weight: 700; color: var(--brand-ink); }
.step-arrow { color: var(--brand-lav-2); }

/* ---------- Home: why you can trust it ---------- */
.social-proof { background: var(--brand-bg); }
.testimonial-card {
    border-left: 6px solid var(--brand-gold);
    border-radius: 6px 16px 16px 6px;
    box-shadow: 0 10px 28px rgba(109, 40, 217, 0.08);
}
.testimonial-card h3 { margin: 0 0 8px; font-size: 1.15rem; font-weight: 700; color: var(--brand-ink); }
.testimonial-text { font-style: normal; color: var(--brand-body); margin-bottom: 0; }
.trust-note a { color: var(--brand-purple); }

/* ---------- Result screen ---------- */
.unified-hero-savings {
    padding: 22px 24px;
    border: 0;
    border-radius: 18px;
    background: var(--brand-purple);
    box-shadow: 0 18px 40px rgba(109, 40, 217, 0.18);
}
.unified-hero-savings .hero-label { color: var(--brand-lav); font-weight: 700; letter-spacing: 0.12em; }
.unified-hero-savings .hero-amount {
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 2.8rem;
}
.unified-hero-savings .hero-amount::after {
    content: '';
    display: block;
    width: 56px;
    height: 4px;
    margin: 10px 0 2px;
    border-radius: 2px;
    background: var(--brand-gold);
}
.unified-hero-savings .hero-sub { color: var(--brand-lav); }
.unified-summary .savings-amount { color: var(--brand-purple); }
.unified-row.ok { border-left-color: var(--brand-violet); }
/* The divider above the extra-cost line was drawn on two grid cells with a gap between them. */
.unified-row-table { column-gap: 0; }
.unified-row-table .ur-value { padding-left: 18px; font-family: var(--font-receipt); font-size: 0.9rem; }
.unified-row-table .ur-label.premium,
.unified-row-table .ur-value.premium { border-top: 2px dashed var(--brand-lav-2); }
.unified-row-table .ur-label.premium { color: var(--brand-purple); font-weight: 700; }
.unified-row-table .ur-value.premium { color: var(--brand-purple); font-weight: 700; font-size: 1rem; }
.unified-row-table .ur-label-block .ur-sub { font-style: normal; font-size: 0.875rem; }
/* Text that carries a decision is at least 14px. */
.unified-tier-hint { font-size: 0.875rem; }
.unified-cta-note { font-size: 0.9rem; }
/* Nothing was read from the photo: no save buttons, only the way to try again. */
.is-unreadable .unified-attest,
.is-unreadable .unified-cta-row,
.is-unreadable .unified-cta-note,
.is-unreadable .unified-add-custom { display: none; }
.unified-empty [data-action="retake"] { margin-top: 16px; }
/* An unticked row's amount is not in the total: say so on the label. Follows the tick. */
.unified-row.row-excluded .ur-label.premium::after { content: ", not counted"; }
.unified-none-found a[data-waiting-go] { font-weight: 600; white-space: nowrap; }
.unified-none-found {
    margin: 0 0 12px;
    padding: 14px 16px;
    border: 1px solid var(--brand-line);
    border-radius: 12px;
    background: #fff;
    color: var(--brand-body);
}
[aria-invalid="true"] { border-color: #b91c1c !important; }

/* ---------- Focus: always visible, on light and on purple ---------- */
/* Several forms set outline:none with a 10% shadow. This is the one rule here that must win. */
/* A heading that only receives focus from code (tabindex -1) is not a control: no ring. */
:is(a, button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
    outline: 2px solid var(--brand-violet) !important;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.9);
}

/* ---------- Content pages (guides, legal, about): type and overflow ---------- */
/* A long bare source address or a wide table must never widen the page on a phone. */
main a, article a { overflow-wrap: anywhere; }
article table, main table, .content table { display: block; max-width: 100%; overflow-x: auto; }
/* A rule followed by a heading that draws its own top border made two lines. */
article hr + h2 { border-top: 0; padding-top: 0; margin-top: 0; }

/* On a phone the camera button sits between the upload text and the formats line. */
.hero .upload-camera-btn { margin-bottom: 12px; }

/* ---------- Home: one button, a sample receipt, a short page below ---------- */
.hero .upload-camera-btn { display: none !important; }
.hero-sample-link {
    display: block;
    margin: 0 0 4px;
    padding: 6px 0;
    color: var(--brand-purple);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}
.home-short { max-width: 640px; }
.home-short .section-title { margin: 0 0 8px; font-size: 1.25rem; text-align: left; }
.home-short .section-title + ul, .home-short .section-title + ol { margin: 0 0 24px; padding-left: 20px; line-height: 1.55; color: var(--brand-body); }
.home-short li { margin: 0 0 6px; }
.home-short a, .social-proof .home-short a { color: var(--brand-purple); font-weight: 600; }
.social-proof .home-short p { margin: 0; color: var(--brand-body); line-height: 1.55; }

/* The sample receipt on the result screen: no way to save it. */
.unified-sample-line {
    margin: 0 0 14px;
    padding: 10px 14px;
    border-radius: 8px;
    background: var(--brand-cream);
    box-shadow: inset 0 0 0 1px var(--brand-gold);
    color: var(--brand-ink);
    font-weight: 600;
}
.unified-sample-line[hidden], .unified-sample-row[hidden] { display: none; }
.unified-sample-next { display: none; margin: 14px 0 0; text-align: center; color: var(--brand-body); line-height: 1.5; }
.unified-sample-next a { color: var(--brand-purple); font-weight: 600; }
.is-sample .unified-sample-next { display: block; }
.social-proof .home-short p + p { margin-top: 10px; }
.is-sample .unified-attest,
.is-sample .unified-cta-row:not(.unified-sample-row),
.is-sample .unified-cta-note,
.is-sample .unified-add-custom,
.is-sample #unified-file-hint { display: none !important; }
