/* ============================================================================
   MathPath — Editorial Design System
   Warm-paper, ink, single indigo accent. Fraunces (display) + Inter (body).
   Loaded by the redesigned pages; the result player keeps its own dark styles.
   ============================================================================ */

:root {
    /* ---- Color: warm editorial light ---- */
    --paper:      #FBFAF7;   /* page background, warm off-white */
    --paper-2:    #F3F2EC;   /* alternating section tint */
    --card:       #FFFFFF;
    --ink:        #0C0C0D;   /* headings */
    --ink-2:      #3A3A40;   /* body text */
    --ink-3:      #74747C;   /* muted / captions */
    --line:       #E7E5DE;   /* hairline borders (warm) */
    --line-2:     #F0EFE9;

    --accent:     #0F7A5F;   /* deep emerald — growth, calm, "you got it right", premium */
    --accent-600: #0B5E49;
    --accent-400: #18A07A;
    --accent-300: #74C9AE;
    --accent-tint:#E7F4EF;   /* faint green wash */
    --accent-ink: #0A4A3A;

    /* ---- Type ---- */
    --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* ---- Soft layered shadows ---- */
    --shadow-xs: 0 1px 2px rgba(15,15,20,.05);
    --shadow-sm: 0 1px 2px rgba(15,15,20,.04), 0 2px 6px rgba(15,15,20,.05);
    --shadow-md: 0 2px 6px rgba(15,15,20,.04), 0 10px 28px rgba(15,15,20,.08);
    --shadow-lg: 0 6px 14px rgba(15,15,20,.05), 0 28px 56px rgba(15,15,20,.11);
    --shadow-xl: 0 10px 24px rgba(15,15,20,.06), 0 48px 90px rgba(15,15,20,.16);
    --shadow-accent: 0 14px 40px rgba(15,122,95,.26);

    /* ---- Radius / layout / motion ---- */
    --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 20px; --r-btn: 9px; --r-pill: 999px;
    --container: 1180px;
    --container-narrow: 880px;
    --pad-x: clamp(1.25rem, 4vw, 2.5rem);
    --section-y: clamp(4.5rem, 10vw, 9rem);
    --ease: cubic-bezier(.22, 1, .36, 1);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html.has-motion { scroll-behavior: auto; } /* Lenis owns scrolling */
body {
    background: var(--paper);
    color: var(--ink-2);
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
input, textarea, select { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ---- Typography ---- */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--ink);
    font-weight: 540;
    line-height: 1.05;
    letter-spacing: -0.02em;
    font-optical-sizing: auto;
}
.display {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(2.85rem, 6.4vw, 5.4rem);
    line-height: 0.98;
    letter-spacing: -0.025em;
    color: var(--ink);
}
.h2 { font-size: clamp(2rem, 4.4vw, 3.1rem); line-height: 1.04; }
.h3 { font-size: clamp(1.3rem, 2.4vw, 1.7rem); letter-spacing: -0.015em; }
.lead {
    font-family: var(--font-sans);
    font-size: clamp(1.1rem, 1.7vw, 1.4rem);
    line-height: 1.5;
    color: var(--ink-3);
    font-weight: 400;
}
.eyebrow {
    display: inline-flex; align-items: center; gap: .55rem;
    font-size: .8rem; font-weight: 600; letter-spacing: .14em;
    text-transform: uppercase; color: var(--accent);
    font-family: var(--font-sans);
}
.eyebrow::before {
    content: ''; width: 22px; height: 1.5px; background: var(--accent); opacity: .5;
}
.muted { color: var(--ink-3); }
.serif { font-family: var(--font-display); }

/* Editorial highlight behind a phrase — wraps cleanly across lines */
.ink-mark {
    color: var(--accent);
    background-image: linear-gradient(transparent 60%, rgba(15,122,95,.20) 0);
    background-repeat: no-repeat;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    padding: 0 .04em;
}

/* ---- Layout ---- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--pad-x); }
.container.narrow { max-width: var(--container-narrow); }
.section { padding-block: var(--section-y); position: relative; }
.section.tint { background: var(--paper-2); }
.section-head { max-width: 720px; margin-bottom: clamp(2.5rem, 5vw, 4rem); }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head .lead { margin-top: 1.1rem; }
.grid { display: grid; gap: clamp(1.25rem, 2.5vw, 1.75rem); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .cols-3, .cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
    padding: .8rem 1.35rem; border-radius: var(--r-btn);
    font-family: var(--font-sans); font-weight: 600; font-size: .98rem; letter-spacing: -0.01em;
    white-space: nowrap; cursor: pointer; transition: transform .35s var(--ease), box-shadow .35s var(--ease), background .25s, color .25s, border-color .25s;
    will-change: transform;
}
.btn svg { width: 1.05em; height: 1.05em; transition: transform .35s var(--ease); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--ink); color: #fff; box-shadow: var(--shadow-md); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn-primary:hover svg { transform: translateX(3px); }
.btn-accent { background: var(--accent); color: #fff; box-shadow: var(--shadow-accent); }
.btn-accent:hover { background: var(--accent-600); transform: translateY(-2px); }
.btn-accent:hover svg { transform: translateX(3px); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: #fff; border-color: #d9d7cf; box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn-lg { padding: 1.05rem 1.8rem; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }

/* link with animated underline */
.link-arrow { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; color: var(--accent); }
.link-arrow svg { width: 1em; height: 1em; transition: transform .3s var(--ease); }
.link-arrow:hover svg { transform: translateX(4px); }

/* ---- Nav ---- */
.site-nav {
    position: fixed; inset: 0 0 auto 0; z-index: 100;
    transition: background .4s var(--ease), box-shadow .4s var(--ease), border-color .4s, backdrop-filter .4s;
    border-bottom: 1px solid transparent;
}
.site-nav.scrolled {
    background: rgba(251,250,247,.72);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom-color: var(--line);
    box-shadow: 0 1px 0 rgba(0,0,0,.02), 0 8px 30px rgba(0,0,0,.04);
}
.nav-inner {
    max-width: var(--container); margin-inline: auto; padding: 1rem var(--pad-x);
    display: flex; align-items: center; justify-content: space-between; gap: 1.5rem;
    transition: padding .4s var(--ease);
}
.site-nav.scrolled .nav-inner { padding-block: .65rem; }
.brand { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; color: var(--ink); letter-spacing: -0.02em; }
.brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-bottom: 2px; }
.nav-links { display: flex; align-items: center; gap: 2rem; }
.nav-links a { font-size: .96rem; font-weight: 500; color: var(--ink-2); position: relative; transition: color .2s; }
.nav-links a::after { content: ''; position: absolute; left: 0; right: 100%; bottom: -4px; height: 1.5px; background: var(--accent); transition: right .3s var(--ease); }
.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { right: 0; }
.nav-actions { display: flex; align-items: center; gap: 1rem; }
.nav-actions .login-link { font-weight: 500; color: var(--ink-2); display: inline-flex; align-items: center; }
.nav-actions .login-link:hover { color: var(--ink); }
.nav-toggle { display: none; width: 42px; height: 42px; border-radius: 12px; align-items: center; justify-content: center; }
.nav-toggle span { display: block; width: 20px; height: 2px; background: var(--ink); border-radius: 2px; position: relative; transition: transform .3s var(--ease), opacity .2s; }
.nav-toggle span::before, .nav-toggle span::after { content: ''; position: absolute; left: 0; width: 20px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .3s var(--ease); }
.nav-toggle span::before { top: -6px; } .nav-toggle span::after { top: 6px; }
.nav-toggle.open span { background: transparent; }
.nav-toggle.open span::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle.open span::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 860px) {
    /* !important so header.js's inline display toggle on #loginBtn can't override */
    .nav-links, .nav-actions .desktop-only { display: none !important; }
    .nav-toggle { display: inline-flex; }
    .mobile-drawer {
        position: fixed; inset: 0; z-index: 99; background: var(--paper);
        padding: 6rem var(--pad-x) 2rem; display: flex; flex-direction: column; gap: .5rem;
        transform: translateY(-100%); opacity: 0; pointer-events: none;
        transition: transform .5s var(--ease), opacity .4s;
    }
    .mobile-drawer.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
    .mobile-drawer a { font-family: var(--font-display); font-size: 1.8rem; color: var(--ink); padding: .6rem 0; border-bottom: 1px solid var(--line); }
    .mobile-drawer .btn { margin-top: 1.5rem; }
}
@media (min-width: 861px) { .mobile-drawer { display: none; } }

/* ---- Cards ---- */
.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: clamp(1.5rem, 3vw, 2.1rem); box-shadow: var(--shadow-sm);
    transition: transform .45s var(--ease), box-shadow .45s var(--ease), border-color .3s;
}
.card.lift:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: #d8d6cc; }
.card-icon {
    width: 50px; height: 50px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
    background: var(--accent-tint); color: var(--accent); margin-bottom: 1.2rem;
}
.card-icon svg { width: 24px; height: 24px; }
.card h3 { margin-bottom: .5rem; }
.card p { color: var(--ink-3); font-size: 1rem; }

/* numbered step */
.step-num {
    font-family: var(--font-display); font-size: 1.05rem; font-weight: 600;
    width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
    background: var(--ink); color: #fff; margin-bottom: 1.1rem;
}

/* ---- Badges / pills ---- */
.badge {
    display: inline-flex; align-items: center; gap: .5rem; padding: .4rem .85rem;
    border-radius: var(--r-pill); background: #fff; border: 1px solid var(--line);
    font-size: .82rem; font-weight: 500; color: var(--ink-2); box-shadow: var(--shadow-xs);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: #22C55E; box-shadow: 0 0 0 3px rgba(34,197,94,.16); }

/* ---- Decorative background blobs / grain ---- */
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; z-index: 0; pointer-events: none; }
.grain::before {
    content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- Footer ---- */
.site-footer { background: var(--paper-2); border-top: 1px solid var(--line); padding-block: clamp(3rem, 6vw, 5rem) 2.5rem; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 2rem; margin-bottom: 3rem; }
.footer-col h4 { font-family: var(--font-sans); font-size: .82rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-3); font-weight: 600; margin-bottom: 1rem; }
.footer-col a { display: block; color: var(--ink-2); font-size: .98rem; padding: .3rem 0; transition: color .2s; }
.footer-col a:hover { color: var(--accent); }
.footer-brand p { color: var(--ink-3); max-width: 30ch; margin-top: .8rem; font-size: .98rem; }
.footer-bottom { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-top: 2rem; border-top: 1px solid var(--line); color: var(--ink-3); font-size: .9rem; flex-wrap: wrap; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }

/* ============================================================================
   FORM (submission) — restyled, preserves the IDs script.js needs
   ============================================================================ */
.submit-card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg); padding: clamp(1.5rem, 3.5vw, 2.75rem); position: relative; overflow: hidden;
}
.instruction-text { color: var(--ink-3); margin-bottom: 1.5rem; font-size: 1.02rem; }
.upload-area {
    border: 1.5px dashed #D6D4CA; border-radius: var(--r-lg); background: var(--paper);
    padding: clamp(2rem, 4vw, 3rem); text-align: center; cursor: pointer;
    transition: border-color .3s, background .3s, transform .3s var(--ease);
}
.upload-area:hover { border-color: var(--accent-300); background: var(--accent-tint); }
.upload-area.drag-over { border-color: var(--accent); background: var(--accent-tint); transform: scale(1.01); }
.upload-content { display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.upload-icon { color: var(--accent); margin-bottom: .4rem; }
.upload-content h3 { font-family: var(--font-sans); font-size: 1.1rem; font-weight: 600; color: var(--ink); }
.upload-content p { color: var(--ink-3); font-size: .98rem; }
.file-types { display: inline-block; margin-top: .6rem; padding: .25rem .7rem; border-radius: var(--r-pill); background: #fff; border: 1px solid var(--line); font-size: .78rem; color: var(--ink-3); }
.image-preview { position: relative; border-radius: var(--r-md); overflow: hidden; }
.image-preview img { width: 100%; border-radius: var(--r-md); }
.remove-btn { position: absolute; top: .75rem; right: .75rem; width: 38px; height: 38px; border-radius: 50%; background: rgba(12,12,13,.78); color: #fff; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(6px); transition: background .2s, transform .2s; }
.remove-btn:hover { background: #0C0C0D; transform: scale(1.06); }
.divider-or { display: flex; align-items: center; gap: 1rem; margin: 1.6rem 0; color: var(--ink-3); font-size: .85rem; font-weight: 500; letter-spacing: .04em; }
.divider-or::before, .divider-or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.text-input-area label { display: block; font-weight: 600; color: var(--ink); margin-bottom: .6rem; font-size: .98rem; }
.text-input-area textarea {
    width: 100%; border: 1.5px solid var(--line); border-radius: var(--r-md); background: var(--paper);
    padding: 1rem 1.1rem; resize: vertical; min-height: 130px; line-height: 1.55; transition: border-color .25s, box-shadow .25s, background .25s;
}
.text-input-area textarea::placeholder { color: #A8A7A0; }
.text-input-area textarea:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 4px var(--accent-tint); }
.char-count { text-align: right; font-size: .85rem; color: var(--ink-3); margin-top: .5rem; }
.submit-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .6rem; width: 100%; margin-top: 1.5rem;
    padding: 1.1rem 1.6rem; border-radius: var(--r-btn); background: var(--ink); color: #fff; font-weight: 600; font-size: 1.05rem;
    box-shadow: var(--shadow-md); transition: transform .35s var(--ease), box-shadow .35s var(--ease), background .25s; position: relative; overflow: hidden;
}
.submit-btn:not([disabled]):hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); background: var(--accent); }
.submit-btn:not([disabled]):hover .btn-icon { transform: translateX(3px); }
.submit-btn .btn-icon { transition: transform .35s var(--ease); }
.submit-btn[disabled] { opacity: .4; cursor: not-allowed; box-shadow: none; }

/* processing */
.processing { text-align: center; padding: 2rem 0; }
.processing .spinner { width: 46px; height: 46px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; margin: 0 auto 1.25rem; }
.processing h3 { font-family: var(--font-sans); font-weight: 600; color: var(--ink); }
.processing p { color: var(--ink-3); margin-top: .25rem; }
.progress-steps { display: flex; justify-content: center; gap: 2rem; margin-top: 2rem; flex-wrap: wrap; }
.progress-steps .step { display: flex; align-items: center; gap: .55rem; color: var(--ink-3); font-size: .92rem; opacity: .55; transition: opacity .3s, color .3s; }
.progress-steps .step .step-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); transition: background .3s, box-shadow .3s; }
.progress-steps .step.active { opacity: 1; color: var(--ink); }
.progress-steps .step.active .step-dot { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Scroll-reveal initial states (only when motion JS is active) ---- */
html.has-motion [data-reveal], html.has-motion [data-hero] { opacity: 0; }
html.has-motion [data-reveal] { transform: translateY(26px); }
html.has-motion [data-hero] { transform: translateY(22px); }
html.has-motion [data-reveal="fade"] { transform: none; }
html.has-motion [data-reveal="scale"] { transform: scale(.96); }
@media (prefers-reduced-motion: reduce) {
    html.has-motion [data-reveal], html.has-motion [data-hero] { opacity: 1 !important; transform: none !important; }
    * { scroll-behavior: auto !important; }
}

/* ============================================================================
   DE-BOXED editorial layouts (no card chrome — reads designed, not drag-and-drop)
   ============================================================================ */

/* How it works — big serif numerals + hairline columns */
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.how-item { padding: 0 clamp(1.4rem, 3vw, 2.75rem); border-left: 1px solid var(--line); }
.how-item:first-child { border-left: none; padding-left: 0; }
.how-num {
    font-family: var(--font-display); font-weight: 500; line-height: 1;
    font-size: clamp(3.2rem, 6vw, 5rem); color: var(--accent);
    margin-bottom: 1.1rem; letter-spacing: -0.02em;
}
.how-item h3 { font-size: clamp(1.25rem, 2.2vw, 1.55rem); margin-bottom: .55rem; }
.how-item p { color: var(--ink-3); }
@media (max-width: 760px) {
    .how-grid { grid-template-columns: 1fr; gap: 2.75rem; }
    .how-item { border-left: none; padding-left: 0; padding-top: 2.25rem; border-top: 1px solid var(--line); }
    .how-item:first-child { padding-top: 0; border-top: none; }
}

/* Features — clean grid, icon + text, no boxes; a hairline that reacts on hover */
.feature-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(2.25rem, 4vw, 3.5rem) clamp(2rem, 4vw, 3.25rem); }
@media (max-width: 900px) { .feature-list { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .feature-list { grid-template-columns: 1fr; } }
.feature-item { padding-top: 1.6rem; border-top: 1.5px solid var(--ink); position: relative; }
.feature-item::before {
    content: ''; position: absolute; top: -1.5px; left: 0; width: 0; height: 1.5px;
    background: var(--accent); transition: width .5s var(--ease);
}
.feature-item:hover::before { width: 56px; }
.ficon { color: var(--accent); margin-bottom: 1rem; transition: transform .4s var(--ease); }
.ficon svg { width: 30px; height: 30px; }
.feature-item:hover .ficon { transform: translateY(-3px); }
.feature-item h3 { font-size: 1.2rem; margin-bottom: .5rem; }
.feature-item p { color: var(--ink-3); font-size: 1rem; }

/* Kinetic headline — words rise out of a mask */
.kinetic .line { display: block; overflow: hidden; padding-bottom: .12em; margin-bottom: -.06em; }
.kinetic .w { display: inline-block; will-change: transform; }
html.has-motion .kinetic .w { transform: translateY(118%); }

/* Hero visual gets 3D depth for the mouse-tilt + scrubbed motion */
.hero-visual { perspective: 1400px; }
.hero-visual .board-mock { transform-style: preserve-3d; will-change: transform; }
.blob { will-change: transform; }
