/* ==========================================================================
   Kavixa — custom styles (no gradients by design)
   Palette: paper #F4F2ED · bone #EAE6DE · ink #0F0F0E · graphite #3A3936
            stone #7D796F · line #D8D3C8 · signal #C23A22
   ========================================================================== */

:root {
    --paper: #F4F2ED;
    --bone: #EAE6DE;
    --ink: #0F0F0E;
    --graphite: #3A3936;
    --stone: #7D796F;
    --line: #D8D3C8;
    --signal: #C23A22;
    --ease: cubic-bezier(.2, .7, .1, 1);
}

html { scroll-padding-top: 96px; }
body { text-rendering: optimizeLegibility; font-feature-settings: "ss01", "cv11"; }

/* Subtle paper grain (SVG noise, no gradient) */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: .045;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
main, footer, header { position: relative; z-index: 2; }
header.site-header { position: fixed; z-index: 50; }

:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 3px; }

/* ---------- Header ---------- */
.site-header { transition: background-color .4s var(--ease), backdrop-filter .4s var(--ease); }
.site-header.is-scrolled { background-color: rgba(244, 242, 237, .86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.site-header.is-scrolled .header-rule { border-bottom-color: var(--line); }

.nav-link > span:last-child::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -4px;
    height: 1px;
    background: var(--ink);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .5s var(--ease);
}
.nav-link:hover > span:last-child::after { transform: scaleX(1); transform-origin: left; }

.menu-icon { position: relative; width: 16px; height: 8px; display: block; }
.menu-icon span { position: absolute; left: 0; width: 100%; height: 1.5px; background: var(--ink); transition: transform .4s var(--ease), top .4s var(--ease); }
.menu-icon span:first-child { top: 0; }
.menu-icon span:last-child { top: 6.5px; }
[aria-expanded="true"] .menu-icon span:first-child { top: 3.25px; transform: rotate(45deg); }
[aria-expanded="true"] .menu-icon span:last-child { top: 3.25px; transform: rotate(-45deg); }

.mobile-menu { background: var(--paper); border-bottom: 1px solid var(--line); }

/* ---------- Buttons & links ---------- */
.btn-primary,
.btn-ghost {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    height: 44px;
    padding: 0 1.25rem;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: .02em;
    overflow: hidden;
    isolation: isolate;
    transition: color .45s var(--ease), border-color .45s var(--ease);
}
.btn-primary { background: var(--ink); color: var(--paper); border: 1px solid var(--ink); }
.btn-ghost   { background: transparent; color: var(--ink); border: 1px solid rgba(15, 15, 14, .2); }

.btn-primary::before,
.btn-ghost::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    transform: translateY(101%);
    transition: transform .5s var(--ease);
}
.btn-primary::before { background: var(--paper); }
.btn-ghost::before   { background: var(--ink); }
.btn-primary:hover { color: var(--ink); }
.btn-ghost:hover   { color: var(--paper); border-color: var(--ink); }
.btn-primary:hover::before,
.btn-ghost:hover::before { transform: translateY(0); }

/* Light variant for dark sections */
.btn-light { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.btn-light::before { background: var(--ink); }
.btn-light:hover { color: var(--paper); border-color: var(--paper); }
.btn-primary[disabled] { opacity: .6; pointer-events: none; }

.btn-arrow { transition: transform .45s var(--ease); }
.btn-primary:hover .btn-arrow,
.btn-ghost:hover .btn-arrow { transform: translateX(4px); }

.link-underline { background: none; position: relative; }
.link-underline::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -2px;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform .45s var(--ease);
}
.link-underline:hover::after { transform: scaleX(1); transform-origin: left; }

/* ---------- Hero ---------- */
#hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.display-xl {
    font-size: clamp(3.1rem, 9.2vw, 9.5rem);
    line-height: .9;
    letter-spacing: -.045em;
    font-weight: 500;
}
.display-lg {
    font-size: clamp(2.5rem, 6vw, 5.75rem);
    line-height: .95;
    letter-spacing: -.04em;
    font-weight: 500;
}
.serif-accent { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; font-style: italic; letter-spacing: -.02em; }

.line-mask { display: block; overflow: hidden; padding-bottom: .06em; }
.line-mask > span { display: inline-block; will-change: transform; }

/* ---------- Phone mockups ---------- */
.phones { position: relative; height: 620px; }
.phone {
    position: absolute;
    width: 262px;
    aspect-ratio: 9 / 19.3;
    background: var(--ink);
    border-radius: 46px;
    padding: 9px;
    box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 40px 80px -30px rgba(15, 15, 14, .45), 0 18px 30px -18px rgba(15, 15, 14, .35);
    will-change: transform;
}
.phone::after { /* side button */
    content: "";
    position: absolute;
    right: -2px; top: 150px;
    width: 3px; height: 64px;
    border-radius: 2px;
    background: #1d1d1b;
}
.phone-screen {
    position: relative;
    height: 100%;
    border-radius: 38px;
    overflow: hidden;
    background: var(--paper);
    display: flex;
    flex-direction: column;
}
.phone-island {
    position: absolute;
    top: 10px; left: 50%;
    width: 84px; height: 24px;
    transform: translateX(-50%);
    border-radius: 20px;
    background: var(--ink);
    z-index: 3;
}
.phone-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px 0;
    height: 44px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .01em;
}
.phone-status .bars { display: flex; gap: 2px; align-items: flex-end; }
.phone-status .bars i { display: block; width: 3px; background: currentColor; border-radius: 1px; }
.phone-status .battery { width: 20px; height: 10px; border: 1px solid currentColor; border-radius: 3px; padding: 1px; opacity: .9; }
.phone-status .battery::before { content: ""; display: block; height: 100%; width: 70%; background: currentColor; border-radius: 1px; }

.phone--dark .phone-screen { background: #121211; color: var(--paper); }
.phone--bone .phone-screen { background: var(--bone); }

.phone-a { left: 2%;  top: 70px;  transform: rotate(-7deg); z-index: 1; }
.phone-b { left: 32%; top: 0;     z-index: 3; }
.phone-c { left: 62%; top: 90px;  transform: rotate(6deg);  z-index: 2; }

@media (max-width: 1279px) {
    .phones { height: 560px; }
    .phone { width: 232px; border-radius: 40px; }
    .phone-screen { border-radius: 33px; }
}
@media (max-width: 767px) {
    .phones { height: 470px; }
    .phone { width: 196px; border-radius: 36px; padding: 7px; }
    .phone-screen { border-radius: 30px; }
    .phone-a { left: -4%; top: 60px; }
    .phone-b { left: 24%; }
    .phone-c { left: 52%; top: 76px; }
    .phone-island { width: 66px; height: 20px; }
}

/* Focus ring app */
.ring-track { stroke: rgba(244, 242, 237, .12); }
.ring-value { stroke: var(--paper); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }

/* ---------- Marquee ---------- */
.marquee { overflow: hidden; white-space: nowrap; }
.marquee-track { display: inline-flex; gap: 3rem; padding-right: 3rem; will-change: transform; }

/* ---------- How it works ---------- */
.step { border-top: 1px solid var(--line); }
.step-num { font-feature-settings: "tnum"; }
.step:hover .step-dot { background: var(--signal); }
.step-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); transition: background-color .3s var(--ease); }

/* ---------- Pricing ---------- */
.price-card { transition: background-color .5s var(--ease), color .5s var(--ease), border-color .5s var(--ease); }
.price-card--featured { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.price-card--featured .muted { color: rgba(244, 242, 237, .6); }
.price-card--featured .rule { border-color: rgba(244, 242, 237, .16); }
.price-card--featured .btn-primary { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.price-card--featured .btn-primary::before { background: var(--ink); }
.price-card--featured .btn-primary:hover { color: var(--paper); border-color: var(--paper); }

.check { width: 14px; height: 14px; flex: none; margin-top: 3px; }

/* ---------- Waitlist ---------- */
.field {
    width: 100%;
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(244, 242, 237, .28);
    padding: 14px 0;
    font-size: 17px;
    color: var(--paper);
    border-radius: 0;
    transition: border-color .3s var(--ease);
}
.field::placeholder { color: rgba(244, 242, 237, .4); }
.field:focus { outline: none; border-bottom-color: var(--paper); }
select.field { appearance: none; -webkit-appearance: none; cursor: pointer; }
select.field option { color: var(--ink); }
.consent input { accent-color: var(--paper); }
.hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* ---------- FAQ ---------- */
.faq-item { border-top: 1px solid var(--line); }
.faq-item:last-child { border-bottom: 1px solid var(--line); }
.faq-item summary { list-style: none; cursor: pointer; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-icon { position: relative; width: 14px; height: 14px; flex: none; }
.faq-icon::before,
.faq-icon::after { content: ""; position: absolute; left: 0; top: 50%; width: 100%; height: 1.5px; background: var(--ink); transition: transform .45s var(--ease); }
.faq-icon::after { transform: rotate(90deg); }
.faq-item[open] .faq-icon::after { transform: rotate(0deg); }
.faq-body { overflow: hidden; }

/* ---------- Footer ---------- */
.footer-wordmark {
    font-size: clamp(5rem, 22vw, 22rem);
    line-height: .78;
    letter-spacing: -.06em;
    font-weight: 600;
    color: var(--ink);
    margin: 0 0 -.02em -.04em;
    overflow: hidden;
}

/* ---------- Legal pages ---------- */
.legal-prose { font-size: 16px; line-height: 1.75; color: var(--graphite); }
.legal-prose h2 {
    font-size: 22px;
    line-height: 1.25;
    letter-spacing: -.02em;
    font-weight: 500;
    color: var(--ink);
    margin: 3.5rem 0 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 1rem;
    align-items: baseline;
}
.legal-prose h2:first-child { margin-top: 0; }
.legal-prose h2 .n { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--stone); font-weight: 400; min-width: 2rem; }
.legal-prose h3 { font-size: 16px; font-weight: 600; color: var(--ink); margin: 1.75rem 0 .5rem; }
.legal-prose p { margin: 0 0 1rem; }
.legal-prose ul { margin: 0 0 1rem; padding-left: 0; list-style: none; }
.legal-prose li { position: relative; padding-left: 1.25rem; margin-bottom: .5rem; }
.legal-prose li::before { content: ""; position: absolute; left: 0; top: .72em; width: 6px; height: 1px; background: var(--ink); }
.legal-prose a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.legal-prose strong { color: var(--ink); font-weight: 600; }
.toc a { display: flex; gap: .75rem; padding: .35rem 0; color: var(--stone); transition: color .3s var(--ease); }
.toc a:hover, .toc a.is-active { color: var(--ink); }
.toc a span { font-family: "JetBrains Mono", monospace; font-size: 11px; min-width: 1.5rem; padding-top: 2px; }

/* ---------- JS-driven reveal (only hide when JS is available) ---------- */
.js [data-reveal] { opacity: 0; transform: translateY(24px); }
.js .line-mask > span { transform: translateY(110%); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
    .js [data-reveal] { opacity: 1; transform: none; }
    .js .line-mask > span { transform: none; }
}
