/* ============================================================
   Mailable - Theme
   Tokens -> base -> components -> demo states -> a11y/motion
   ============================================================ */

:root {
    --ink: #0B1020;
    --muted: #5B6478;
    --line: #E6E8EF;
    --canvas: #F6F7FB;
    --accent: #4F46E5;
    --accent-ink: #4338CA;
    --accent-soft: #EEF0FF;
    --ok: #0F8A5F;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ---- Base ---- */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 6rem;
    -webkit-text-size-adjust: 100%;
}
body {
    background: #FAFBFF;
    color: var(--ink);
    font-family: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: clip;
}
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.skip {
    position: fixed; left: 1rem; top: -4rem; z-index: 100;
    background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: 999px;
    font-weight: 600; font-size: .875rem; transition: top .2s var(--ease);
}
.skip:focus { top: 1rem; }

/* ---- Type scale ---- */
.display {
    font-size: clamp(2.5rem, 7.2vw, 5rem);
    line-height: 1.02;
    font-weight: 600;
    letter-spacing: -0.045em;
    text-wrap: balance;
}
.h2 {
    font-size: clamp(1.9rem, 4.2vw, 3rem);
    line-height: 1.08;
    font-weight: 600;
    letter-spacing: -0.035em;
    text-wrap: balance;
}
.h3 {
    font-size: clamp(1.6rem, 3vw, 2.25rem);
    line-height: 1.12;
    font-weight: 600;
    letter-spacing: -0.03em;
}
.lead { font-size: clamp(1.0625rem, 1.6vw, 1.25rem); line-height: 1.6; color: var(--muted); text-wrap: pretty; }
.label { font-size: .875rem; font-weight: 600; color: var(--accent); letter-spacing: -0.005em; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    height: 3rem; padding: 0 1.5rem; border-radius: 999px;
    font-size: .9375rem; font-weight: 600; line-height: 1; white-space: nowrap;
    border: 1px solid transparent; cursor: pointer;
    transition: background-color .2s var(--ease), border-color .2s var(--ease),
                color .2s var(--ease), transform .2s var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #1B2340; }
.btn-line { background: #fff; color: var(--ink); border-color: #D5D8E3; }
.btn-line:hover { border-color: var(--ink); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-ink); }
.btn-white { background: #fff; color: var(--ink); }
.btn-white:hover { background: #EEF0FF; }
.btn-sm { height: 2.5rem; padding: 0 1.1rem; font-size: .875rem; }

/* ---- Navbar: one floating pill ---- */
.nav {
    background: rgba(255, 255, 255, 0.72);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    backdrop-filter: blur(16px) saturate(160%);
    border: 1px solid rgba(230, 232, 239, 0.9);
    transition: background-color .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.nav.is-scrolled {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 30px -14px rgba(11, 16, 32, 0.22);
}
.nav-link {
    padding: .5rem .9rem; border-radius: 999px; font-size: .875rem; font-weight: 500;
    color: var(--muted); transition: color .2s, background-color .2s; white-space: nowrap;
}
.nav-link:hover { color: var(--ink); background: rgba(11, 16, 32, 0.05); }
.nav-menu-panel {
    background: #fff; border: 1px solid var(--line); border-radius: 1.25rem;
    box-shadow: 0 24px 48px -20px rgba(11, 16, 32, 0.25);
}
.nav-menu-panel a:not(.btn) {
    display: block; padding: .8rem 1rem; border-radius: .75rem;
    font-weight: 500; font-size: 1rem; color: var(--ink);
}
.nav-menu-panel a:not(.btn):hover { background: var(--canvas); }

/* ---- Surfaces ---- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 1.5rem; }
.mc {   /* mock card: sits inside a .panel */
    background: #fff; border: 1px solid var(--line); border-radius: .875rem;
    box-shadow: 0 1px 2px rgba(11, 16, 32, 0.04), 0 8px 24px -12px rgba(11, 16, 32, 0.12);
}
.panel {
    background: linear-gradient(160deg, #F1F2FF 0%, #F7F8FC 100%);
    border: 1px solid #E4E6F5; border-radius: 1.75rem;
}
.avatar {
    width: 2.25rem; height: 2.25rem; border-radius: 999px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .8125rem; font-weight: 600;
}
.chip {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .3rem .7rem; border-radius: 999px; font-size: .75rem; font-weight: 550;
    background: var(--canvas); border: 1px solid var(--line); color: var(--muted);
}
.chip-accent { background: var(--accent-soft); border-color: #D9DCFF; color: var(--accent-ink); }
.icon-tile {
    width: 2.5rem; height: 2.5rem; border-radius: .75rem; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent-soft); color: var(--accent);
}
.tick {
    width: 1.25rem; height: 1.25rem; border-radius: 999px; flex-shrink: 0; margin-top: .2rem;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--accent-soft); color: var(--accent);
}
.tick svg { width: .75rem; height: .75rem; }

/* ---- Hero ---- */
.hero-wash {
    background:
        radial-gradient(60% 55% at 50% 0%, rgba(79, 70, 229, 0.11), transparent 70%),
        linear-gradient(#fff, #fff);
}
.rise { animation: rise .8s var(--ease) both; animation-delay: calc(var(--i, 0) * 90ms); }
@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}
.app-frame {
    background: #fff; border: 1px solid var(--line); border-radius: 1.25rem; overflow: hidden;
    box-shadow: 0 40px 80px -40px rgba(11, 16, 32, 0.35), 0 2px 6px rgba(11, 16, 32, 0.05);
}
.row-sel { background: var(--accent-soft); border-color: #D9DCFF; }

/* ---- FAQ (native <details>) ---- */
.faq { border: 1px solid var(--line); border-radius: 1rem; background: #fff; transition: border-color .2s; }
.faq:hover, .faq[open] { border-color: #C9CDF5; }
.faq summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: 1.25rem 1.5rem; font-weight: 600; font-size: 1.0625rem; letter-spacing: -0.01em;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary .plus { transition: transform .25s var(--ease); color: var(--accent); flex-shrink: 0; }
.faq[open] summary .plus { transform: rotate(45deg); }
.faq .faq-body { padding: 0 1.5rem 1.4rem; color: var(--muted); line-height: 1.65; max-width: 60ch; }

/* ---- Live demo states (driven by main.js) ---- */
.stage { opacity: 0; transform: translateY(12px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.stage.visible { opacity: 1; transform: none; }
.email-incoming { transform: translateX(110%); transition: transform .7s var(--ease); }
.email-incoming.arrived { transform: none; }
.scan-wave {
    position: absolute; top: 0; left: -100%; width: 100%; height: 100%; opacity: 0; pointer-events: none;
    background: linear-gradient(90deg, transparent, rgba(79, 70, 229, 0.2), transparent);
}
.scan-wave.sweeping { animation: sweep 1.3s ease-in-out forwards; }
@keyframes sweep {
    0% { left: -100%; opacity: 0; } 20%, 80% { opacity: 1; } 100% { left: 100%; opacity: 0; }
}
.pop-item { opacity: 0; transform: translateY(6px); transition: opacity .35s var(--ease), transform .35s var(--ease); }
.pop-item.in { opacity: 1; transform: none; }
.slide-event { opacity: 0; transform: translateX(16px); transition: opacity .5s var(--ease), transform .5s var(--ease); }
.slide-event.in { opacity: 1; transform: none; }
.cursor-blink::after { content: ''; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -0.12em; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.status-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--accent); animation: statusPulse 1.4s ease-in-out infinite; }
.status-dot.done { background: var(--ok); animation: none; }
@keyframes statusPulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* ---- AI spotlight ---- */
.ai-card { background: radial-gradient(70% 90% at 85% 0%, rgba(96, 165, 250, .35), transparent 60%), linear-gradient(135deg, #1D3FA8 0%, #3B35C4 100%); box-shadow: 0 40px 80px -40px rgba(29, 63, 168, .6); }
#ai-response { white-space: pre-line; }
.typing-dot { width: 7px; height: 7px; border-radius: 999px; background: #94A3B8; animation: typing 1s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: .15s; }
.typing-dot:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-4px); opacity: 1; } }

/* ---- Final CTA ---- */
.cta-card {
    background: radial-gradient(80% 120% at 50% -20%, #6D65F5 0%, transparent 60%), var(--accent);
    border-radius: 2rem; color: #fff;
}

/* ---- Scroll to top ---- */
#scroll-to-top { opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .25s, transform .25s var(--ease), background-color .2s; }
#scroll-to-top.show { opacity: 1; transform: none; pointer-events: auto; }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
        animation-delay: 0ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important;
    }
}

/* Grid children may shrink below their content width (stops mobile overflow) */
.grid > * { min-width: 0; }

/* ============================================================
   Atmosphere: blobs, orbs, grids, floating tiles, reveal
   ============================================================ */
.deco { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }

.blob {
    position: absolute; border-radius: 9999px; pointer-events: none; will-change: transform;
    filter: blur(110px);
    animation: blobFloat 36s ease-in-out infinite alternate;
}
@keyframes blobFloat { to { transform: translate3d(-30px, 28px, 0) scale(1.06); } }
@keyframes blobPulse { from { opacity: .7; } to { opacity: 1; } }
.blob.slow { animation-duration: 48s; }
.blob.rev  { animation-direction: alternate-reverse; }

.orb {
    position: absolute; border-radius: 9999px; pointer-events: none; will-change: transform;
    filter: blur(80px);
    animation: orbDrift 22s ease-in-out infinite alternate;
}
@keyframes orbDrift {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(40px, -34px, 0) scale(1.12); }
}



/* Hero floating tiles */
.float-tile {
    position: absolute; z-index: 0; display: flex; align-items: center; justify-content: center;
    pointer-events: none; opacity: .28;
    animation: floatUp 18s ease-in-out infinite;
}
.float-tile .icon-tile { background: transparent; width: auto; height: auto; }
.float-tile svg { width: 2rem; height: 2rem; stroke-width: 1.5; }
.float-tile.alt { animation-name: floatDown; }
@keyframes floatUp   { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-10px); } }
@keyframes floatDown { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(10px); } }


/* Colored icon tiles */
.tile-violet { background: #F1EAFF; color: #7C3AED; }
.tile-sky { background: #E3F4FD; color: #0284C7; }
.tile-emerald { background: #E0F6EC; color: #059669; }
.tile-blue { background: #E4ECFF; color: #2563EB; }
.tile-amber { background: #FEF1D9; color: #D97706; }

/* Card hover lift */
.lift { transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s; }
.lift:hover { transform: translateY(-3px); box-shadow: 0 18px 40px -20px rgba(11, 16, 32, .25); border-color: #D5D8F5; }

/* Scroll reveal (only when JS is present) */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s var(--ease), transform .7s var(--ease); transition-delay: var(--d, 0ms); }
.js .reveal.in { opacity: 1; transform: none; }
.js .reveal-l { transform: translateX(-18px); }
.js .reveal-r { transform: translateX(18px); }
.js .reveal-z { transform: scale(.98) translateY(14px); }

/* Navbar: narrower pill + sliding active indicator */
#nav-links { position: relative; }
#nav-ind {
    position: absolute; top: 0; left: 0; height: 100%; width: 0; border-radius: 9999px;
    background: var(--accent-soft); box-shadow: inset 0 0 0 1px #D9DCFF; opacity: 0; pointer-events: none;
    transition: transform .4s var(--ease), width .4s var(--ease), opacity .25s;
}
#nav-links .nav-link { position: relative; z-index: 1; }
#nav-links .nav-link.active { color: var(--accent-ink); }
.nav-menu-panel a.active { color: var(--accent-ink); background: var(--accent-soft); }

@media (prefers-reduced-motion: reduce) {
    .js .reveal { opacity: 1 !important; transform: none !important; }
}

/* Page blobs fade out before the footer so there is no hard seam */
.page-bg {
    -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 360px), transparent 100%);
    mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 360px), transparent 100%);
}
