/* ==========================================================================
   Cartfolio "Fresh Ink" design system — privacy-first edition
   Same palette, type, and shelf-tag signature as the main site (mirrors the
   iOS app 1:1, see Theme.swift). New here: the "data receipt" component,
   a pair of printed-receipt cards that make the privacy pitch concrete
   instead of leaning on stock shield/lock imagery.
   ========================================================================== */

:root {
    --paper: #FBFAF6;
    --surface: #FFFFFF;
    --hairline: #E7E5DC;
    --ink: #18281E;
    --ink-secondary: #5F7166;
    --market: #1F6B45;
    --market-soft: #EAF2EB;
    --tag-yellow: #FFD84A;
    --tag-ink: #2B2410;
    --tomato: #C93A29;
    --tomato-soft: #FBEAE7;

    --font-display: "Baloo 2", ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", sans-serif;
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "IBM Plex Mono", "SF Mono", ui-monospace, Menlo, monospace;

    --header-height: 76px;
    --shadow-soft: 0 1px 3px rgba(24, 40, 30, 0.05);
    --shadow-card: 0 10px 30px -12px rgba(24, 40, 30, 0.16);
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #11150F;
        --surface: #1B211B;
        --hairline: #2B322B;
        --ink: #ECF2ED;
        --ink-secondary: #93A398;
        --market: #58B37F;
        --market-soft: #212B22;
        --tomato-soft: #2B1C19;
        --shadow-card: 0 10px 30px -12px rgba(0, 0, 0, 0.5);
    }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: var(--header-height); }

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--ink);
    background-color: var(--paper);
}

img { max-width: 100%; display: block; }
a { color: inherit; }

:focus-visible {
    outline: 2.5px solid var(--market);
    outline-offset: 3px;
    border-radius: 4px;
}

h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--market);
    background: var(--market-soft);
    padding: 6px 14px;
    border-radius: 999px;
}

/* ---- Shelf tag: signature shape, used ONLY where a dollar amount appears ---- */
.shelf-tag {
    --notch: 9px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--tag-ink);
    background: var(--tag-yellow);
    padding: 9px 16px 9px 12px;
    clip-path: polygon(
        var(--notch) 0, 100% 0, 100% 100%, var(--notch) 100%,
        0 calc(100% - var(--notch)), 0 var(--notch)
    );
}
.shelf-tag .hole { width: 6px; height: 6px; border-radius: 50%; background: rgba(0, 0, 0, 0.22); flex-shrink: 0; }
.shelf-tag.large { font-size: 1.2rem; padding: 12px 20px 12px 15px; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    text-decoration: none;
    padding: 14px 28px;
    border-radius: 999px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-primary { background: var(--market); color: #fff; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 24px -8px rgba(31, 107, 69, 0.45); }

/* ---- Header & Navigation ---- */
header {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(14px) saturate(1.4);
    -webkit-backdrop-filter: blur(14px) saturate(1.4);
    z-index: 1000;
    border-bottom: 1px solid var(--hairline);
}
nav {
    max-width: 1160px;
    margin: 0 auto;
    padding: 0 24px;
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.logo img { height: 38px; width: 38px; border-radius: 10px; }
.logo span { font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; color: var(--ink); }
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-links a {
    text-decoration: none;
    color: var(--ink-secondary);
    font-weight: 600;
    font-size: 0.94rem;
    padding: 9px 14px;
    border-radius: 999px;
    transition: background 0.2s ease, color 0.2s ease;
}
.nav-links a:hover { color: var(--ink); background: var(--market-soft); }
.nav-links a.nav-cta { color: var(--market); }

/* ---- Hero ---- */
.hero { padding: calc(var(--header-height) + 64px) 24px 24px; text-align: center; }
.hero-content { max-width: 720px; margin: 0 auto; }
.hero .eyebrow { margin-bottom: 20px; }
.hero h1 { font-size: clamp(2.3rem, 5vw, 3.5rem); line-height: 1.1; margin-bottom: 20px; }
.hero h1 .accent { color: var(--market); }
.hero .subtitle {
    font-size: 1.15rem;
    color: var(--ink-secondary);
    max-width: 580px;
    margin: 0 auto 32px;
    line-height: 1.55;
}
.cta-buttons { display: flex; justify-content: center; align-items: center; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; }
.app-store-button { display: inline-flex; }
.app-store-button img { height: 50px; transition: transform 0.25s ease; }
.app-store-button:hover img { transform: scale(1.04); }
/* ---- Typing demo: proves "type it, hit return" instead of just claiming it ---- */
.typing-demo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 220px;
    margin: 8px auto 0;
    padding: 13px 20px;
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: 999px;
    box-shadow: var(--shadow-soft);
}
.typing-demo-icon { font-size: 0.95rem; opacity: 0.5; }
.typing-demo-text {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink);
    text-align: left;
}
.typing-demo-cursor {
    color: var(--market);
    font-weight: 400;
    margin-left: 1px;
    animation: caretBlink 1s step-end infinite;
}
@keyframes caretBlink { 50% { opacity: 0; } }
.typing-demo-caption { font-size: 0.88rem; color: var(--ink-secondary); margin-top: 14px; }
@media (prefers-reduced-motion: reduce) {
    .typing-demo-cursor { animation: none; }
}

/* ---- The Two Receipts: signature section ---- */
.receipts {
    padding: 56px 24px 96px;
}
.receipts-head { text-align: center; max-width: 620px; margin: 0 auto 44px; }
.receipts-head h2 { font-size: clamp(1.8rem, 3.4vw, 2.4rem); margin-bottom: 10px; }
.receipts-head p { color: var(--ink-secondary); font-size: 1.05rem; }

.receipt-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
    max-width: 880px;
    margin: 0 auto;
    align-items: start;
}

/* A real <table>, not styled divs — so the item/value pairing and the
   "which app does this row belong to" relationship are structural, not just
   visual, and survive plain-text/boilerplate extraction (screen readers,
   AI answer engines) intact. */
.receipt {
    width: 100%;
    background: var(--surface);
    font-family: var(--font-mono);
    padding: 28px 22px 24px;
    position: relative;
    box-shadow: var(--shadow-card);
    border-collapse: collapse;
    border-spacing: 0;
    /* Jagged top/bottom edge like a torn register receipt — same clip-path
       technique as .shelf-tag's notch, scaled up into a repeating zigzag. */
    --serr: 14px;
    clip-path: polygon(
        0% var(--serr), 4% 0%, 8% var(--serr), 12% 0%, 16% var(--serr), 20% 0%, 24% var(--serr), 28% 0%,
        32% var(--serr), 36% 0%, 40% var(--serr), 44% 0%, 48% var(--serr), 52% 0%, 56% var(--serr), 60% 0%,
        64% var(--serr), 68% 0%, 72% var(--serr), 76% 0%, 80% var(--serr), 84% 0%, 88% var(--serr), 92% 0%,
        96% var(--serr), 100% 0%,
        100% calc(100% - var(--serr)), 96% 100%, 92% calc(100% - var(--serr)), 88% 100%,
        84% calc(100% - var(--serr)), 80% 100%, 76% calc(100% - var(--serr)), 72% 100%,
        68% calc(100% - var(--serr)), 64% 100%, 60% calc(100% - var(--serr)), 56% 100%,
        52% calc(100% - var(--serr)), 48% 100%, 44% calc(100% - var(--serr)), 40% 100%,
        36% calc(100% - var(--serr)), 32% 100%, 28% calc(100% - var(--serr)), 24% 100%,
        20% calc(100% - var(--serr)), 16% 100%, 12% calc(100% - var(--serr)), 8% 100%,
        4% calc(100% - var(--serr)), 0% 100%
    );
}

/* Horizontal padding lives here, and ONLY here. Deliberately left/right-only
   (not the `padding` shorthand): `.receipt th` has higher specificity than a
   single class like `.receipt-label`, so a shorthand here would win the
   cascade on ALL four sides and silently clobber every vertical padding
   rule below regardless of source order. Touching only left/right means
   there's nothing for those rules to conflict with. (Table-level padding on
   .receipt itself is unreliable with border-collapse: collapse, so all
   spacing is done via cell padding instead.) */
.receipt th, .receipt td { padding-left: 22px; padding-right: 22px; text-align: left; font-weight: 400; }

.receipt-theirs { border-top: 3px solid var(--tomato); }
.receipt-ours { border-top: 3px solid var(--market); }

.receipt-label {
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
    /* Clears the jagged top edge (--serr: 14px) with room to spare. */
    padding-top: 24px;
    padding-bottom: 2px;
}
.receipt-theirs .receipt-label { color: var(--tomato); }
.receipt-ours .receipt-label { color: var(--market); }

.receipt-app-name {
    text-align: center;
    font-size: 0.72rem;
    color: var(--ink-secondary);
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--hairline);
}

.receipt-line td {
    font-size: 0.84rem;
    padding-top: 7px;
    padding-bottom: 7px;
    line-height: 1.4;
}
/* First row of tbody needs the app-name's bottom border to read as a gap
   above it, since real <td> padding replaces the old div's margin-bottom. */
.receipt-line:first-child td { padding-top: 14px; }

.receipt-line .item { color: var(--ink); }
/* nowrap so the status column sizes to its own content (as it did under
   the old flex layout's flex-shrink:0) instead of table auto-layout
   splitting width ~evenly and wrapping the longer item text instead. */
.receipt-line .status { text-align: right; font-weight: 600; white-space: nowrap; }
.receipt-theirs .receipt-line .status { color: var(--tomato); }
.receipt-ours .receipt-line .status { color: var(--market); }

.receipt-total td {
    border-top: 1px dashed var(--hairline);
    padding-top: 14px;
    /* Clears the jagged bottom edge, replacing the table-level bottom
       padding that border-collapse: collapse doesn't reliably apply. */
    padding-bottom: 22px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.receipt-total td:last-child { text-align: right; }
.receipt-theirs .receipt-total td { color: var(--tomato); }
.receipt-total .shelf-tag { font-family: var(--font-mono); font-size: 0.95rem; text-transform: none; letter-spacing: 0; }

.receipt-theirs .receipt-total-amount {
    color: var(--tomato);
    font-family: var(--font-mono);
}

/* The chunk-safe fallback: one plain sentence stating the full claim, for
   anything (or anyone) that only reads part of the receipts. */
.receipts-summary {
    max-width: 720px;
    margin: 28px auto 0;
    text-align: center;
    color: var(--ink-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ---- On-device strip ---- */
.on-device {
    padding: 0 24px 96px;
    background: var(--market-soft);
    padding-top: 80px;
    border-top: 1px solid var(--hairline);
    border-bottom: 1px solid var(--hairline);
}
.section-head { text-align: center; max-width: 580px; margin: 0 auto 52px; }
.section-head .eyebrow { margin-bottom: 16px; }
.section-head h2 { font-size: clamp(1.9rem, 3.6vw, 2.6rem); margin-bottom: 12px; }
.section-head p { color: var(--ink-secondary); font-size: 1.05rem; }

.device-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    max-width: 1080px;
    margin: 0 auto;
}
.device-card {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: 20px;
    padding: 24px 20px;
    text-align: left;
}
.device-card.exception { border: 1px dashed var(--tag-yellow); background: color-mix(in srgb, var(--tag-yellow) 10%, var(--surface)); }
.device-icon {
    width: 42px; height: 42px;
    border-radius: 12px;
    background: var(--market-soft);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 14px;
}
.device-card.exception .device-icon { background: var(--tag-yellow); }
.device-card h3 { font-size: 0.98rem; margin-bottom: 6px; }
.device-card p { color: var(--ink-secondary); font-size: 0.87rem; line-height: 1.5; }
.device-badge {
    display: inline-block;
    margin-top: 12px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--market);
}
.device-card.exception .device-badge { color: var(--tag-ink); }

/* ---- Screenshots ---- */
.screenshots { padding: 88px 24px; }
.screenshot-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 16px;
    max-width: 1160px;
    margin: 0 auto;
}
.device-frame {
    background: #111;
    border-radius: 32px;
    padding: 8px;
    box-shadow: 0 18px 40px -14px rgba(24, 40, 30, 0.35);
    transition: transform 0.4s ease;
}
.device-frame:hover { transform: translateY(-6px); }
.device-frame .screen { position: relative; border-radius: 24px; overflow: hidden; aspect-ratio: 1206 / 2622; }
.device-frame .screen img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.device-frame .notch {
    position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
    width: 34%; height: 3.2%; background: #111; border-radius: 999px; z-index: 2;
}
.screenshot-grid figcaption { text-align: center; margin-top: 14px; font-size: 0.85rem; font-weight: 600; color: var(--ink-secondary); }

/* ---- Features ---- */
.features { padding: 88px 24px; background: var(--market-soft); border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.features-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; max-width: 1160px; margin: 0 auto; }
.feature {
    padding: 26px 22px;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid var(--hairline);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-card); }
.feature-icon {
    width: 44px; height: 44px; border-radius: 13px;
    background: var(--market-soft);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; margin-bottom: 16px;
}
.feature.feature-deals .feature-icon { background: var(--tag-yellow); }
.feature h3 { font-size: 1.02rem; margin-bottom: 8px; }
.feature p { color: var(--ink-secondary); font-size: 0.92rem; line-height: 1.55; }
.feature .shelf-tag { margin-top: 14px; font-size: 0.78rem; padding: 5px 11px 5px 9px; }

/* ---- Closing CTA band ---- */
.closing-cta { padding: 88px 24px; text-align: center; background: var(--ink); color: var(--paper); }
.closing-cta h2 { color: var(--paper); font-size: clamp(1.9rem, 3.6vw, 2.6rem); margin-bottom: 14px; }
.closing-cta p { color: color-mix(in srgb, var(--paper) 70%, transparent); max-width: 480px; margin: 0 auto 32px; font-size: 1.05rem; }
.closing-cta .app-store-button img { height: 52px; }

/* ---- Footer ---- */
footer { background: var(--paper); border-top: 1px solid var(--hairline); padding: 40px 24px; }
.footer-content { max-width: 1160px; margin: 0 auto; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px; }
.footer-links { display: flex; gap: 24px; }
.footer-links a { text-decoration: none; color: var(--ink-secondary); font-size: 0.9rem; font-weight: 500; transition: color 0.2s ease; }
.footer-links a:hover { color: var(--market); }
.copyright { color: var(--ink-secondary); font-size: 0.85rem; }

/* ---- FAQ / Privacy shared content layout ---- */
.page-content { max-width: 760px; margin: 0 auto; padding: calc(var(--header-height) + 56px) 24px 80px; }
.page-content > .eyebrow { margin-bottom: 18px; }
.page-content h1 { font-size: clamp(2rem, 4vw, 2.7rem); margin-bottom: 10px; }
.last-updated { color: var(--ink-secondary); font-size: 0.88rem; margin-bottom: 24px; }

.faq-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 40px;
}
.faq-toc a {
    text-decoration: none;
    color: var(--market);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--market-soft);
    transition: background 0.2s ease;
}
.faq-toc a:hover { background: var(--hairline); }
.page-content section { margin-bottom: 44px; }
.page-content h2 { font-size: 1.35rem; margin: 0 0 20px; padding-left: 16px; border-left: 4px solid var(--tag-yellow); }
.page-content h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 10px; }
.page-content p { color: var(--ink-secondary); margin-bottom: 16px; line-height: 1.65; }
.page-content ul, .page-content ol { color: var(--ink-secondary); padding-left: 22px; margin: 0 0 16px; }
.page-content li { margin-bottom: 10px; line-height: 1.55; }
.question-block { background: var(--surface); border: 1px solid var(--hairline); border-radius: 16px; padding: 24px; margin-bottom: 18px; }
.question-block h3 { color: var(--ink); }
.question-block p:last-child, .question-block ul:last-child, .question-block ol:last-child { margin-bottom: 0; }
.contact-email { color: var(--market); font-weight: 600; text-decoration: none; }
.contact-email:hover { text-decoration: underline; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .receipt-pair { grid-template-columns: 1fr; max-width: 420px; }
    .device-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .features-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .screenshot-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .screenshot-grid figure:nth-child(4), .screenshot-grid figure:nth-child(5), .screenshot-grid figure:nth-child(6) { display: none; }
}
@media (max-width: 640px) {
    nav { padding: 0 16px; }
    .nav-links a:not(.nav-cta) { display: none; }
    .hero { padding-top: calc(var(--header-height) + 40px); }
    .device-grid { grid-template-columns: 1fr; }
    .features-grid { grid-template-columns: 1fr; }
    .screenshot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .screenshot-grid figure:nth-child(3) { display: none; }
    .footer-content { flex-direction: column; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    .device-frame, .feature, .app-store-button img { transition: none; }
}

/* ---- Scroll reveal ---- */
[data-reveal] {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
    transition-delay: var(--reveal-delay, 0s);
}
[data-reveal="left"] { transform: translateX(-32px); }
[data-reveal="right"] { transform: translateX(32px); }
[data-reveal].is-visible { opacity: 1; transform: none; }

/* Receipt lines "print" faster and shorter than the slower section fades,
   so a row of them reads as a printer ticking through lines, not a lazy drift. */
.receipt-line[data-reveal], .reveal-fast[data-reveal] {
    transform: translateY(8px);
    transition-duration: 0.35s;
}

/* The finale: the yellow $0.00 total slams down like a stamp, instead of
   fading in like everything before it. The one deliberately loud beat in
   an otherwise quiet reveal sequence. */
[data-reveal="smash"] {
    opacity: 0;
    transform: none;
    transition: none;
}
[data-reveal="smash"].is-visible {
    animation: receiptSmash 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: var(--reveal-delay, 0s);
}
@keyframes receiptSmash {
    0% { opacity: 0; transform: scale(2.1) rotate(-9deg); }
    55% { opacity: 1; transform: scale(0.94) rotate(3deg); }
    78% { transform: scale(1.05) rotate(-1deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.device-grid [data-reveal]:nth-child(1) { transition-delay: 0s; }
.device-grid [data-reveal]:nth-child(2) { transition-delay: 0.08s; }
.device-grid [data-reveal]:nth-child(3) { transition-delay: 0.16s; }
.device-grid [data-reveal]:nth-child(4) { transition-delay: 0.24s; }

.features-grid [data-reveal]:nth-child(1) { transition-delay: 0s; }
.features-grid [data-reveal]:nth-child(2) { transition-delay: 0.08s; }
.features-grid [data-reveal]:nth-child(3) { transition-delay: 0.16s; }
.features-grid [data-reveal]:nth-child(4) { transition-delay: 0.24s; }

.screenshot-grid [data-reveal]:nth-child(1) { transition-delay: 0s; }
.screenshot-grid [data-reveal]:nth-child(2) { transition-delay: 0.06s; }
.screenshot-grid [data-reveal]:nth-child(3) { transition-delay: 0.12s; }
.screenshot-grid [data-reveal]:nth-child(4) { transition-delay: 0.18s; }
.screenshot-grid [data-reveal]:nth-child(5) { transition-delay: 0.24s; }
.screenshot-grid [data-reveal]:nth-child(6) { transition-delay: 0.3s; }

@media (prefers-reduced-motion: reduce) {
    /* !important here is deliberate: this must win over every reveal variant's
       own specificity (.reveal-fast, [data-reveal="smash"], etc.) unconditionally. */
    [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; animation: none !important; }
}
