/* ===== Kaliki Labs — top-tier site styles ===== */

:root {
    --bg: #FAFAFB;
    --bg-warm: #F4F1EC;
    --surface: #ffffff;
    --ink: #0A0A0F;
    --text: #0F172A;
    --text-muted: #64748B;
    --text-dim: #94A3B8;
    --border: #E5E7EB;
    --border-strong: #CBD5E1;
    --accent: #6366F1;
    --accent-dark: #4F46E5;
    --accent-light: #EEF2FF;
    --grad-purple: linear-gradient(135deg, #4F46E5 0%, #8B5CF6 100%);
    --grad-text: linear-gradient(135deg, #6366F1 0%, #8B5CF6 50%, #D946EF 100%);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 6px rgba(15, 23, 42, 0.04);
    --shadow-lg: 0 20px 40px -8px rgba(15, 23, 42, 0.12), 0 8px 16px -4px rgba(15, 23, 42, 0.06);
    --shadow-xl: 0 30px 60px -15px rgba(15, 23, 42, 0.18), 0 12px 24px -6px rgba(15, 23, 42, 0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-expo: cubic-bezier(0.86, 0, 0.07, 1);
}

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

html {
    -webkit-text-size-adjust: 100%;
    /* Lenis manages smooth scroll; disable native */
}
html.lenis { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-stopped { overflow: hidden; }
.lenis.lenis-scrolling iframe { pointer-events: none; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11', 'ss01';
    overflow-x: hidden;
}

/* Custom font - editorial serif accent */
.serif {
    font-family: 'Instrument Serif', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    letter-spacing: -0.5px;
}

@media (pointer: fine) {
    ::-webkit-scrollbar { width: 10px; height: 10px; }
    ::-webkit-scrollbar-track { background: transparent; }
    ::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 100px; border: 2px solid var(--bg); }
    ::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
}
::selection { background: var(--ink); color: #fff; }

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }

.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
@media (min-width: 768px) { .container { padding: 0 48px; } }
.container-narrow { max-width: 820px; margin: 0 auto; padding: 0 24px; }
@media (min-width: 768px) { .container-narrow { padding: 0 32px; } }

.icon { width: 1em; height: 1em; flex-shrink: 0; vertical-align: -0.125em; }

/* ===== LOADING SCREEN ===== */
#loader {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--ink);
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 28px;
    pointer-events: all;
    overflow: hidden;
}
#loader::before {
    /* Subtle gradient orb behind everything */
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse 60% 50% at 50% 50%, rgba(99, 102, 241, 0.18), transparent 70%);
    pointer-events: none;
}
#loader.is-out {
    pointer-events: none;
    transition: opacity 0.5s ease, transform 1s var(--ease-expo);
    opacity: 0;
    transform: translateY(-100%);
}
.loader-content {
    position: relative; z-index: 1;
    display: flex; flex-direction: column; align-items: center; gap: 32px;
}
.loader-logo {
    width: 76px; height: 76px;
    border-radius: 18px;
    box-shadow: 0 30px 60px -15px rgba(99, 102, 241, 0.5),
                0 12px 24px -6px rgba(99, 102, 241, 0.3);
    animation: loader-pulse 2s ease-in-out infinite;
}
@keyframes loader-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.92); opacity: 0.85; }
}
.loader-name {
    display: flex; gap: 1px;
    font-size: 12px; font-weight: 700;
    letter-spacing: 6px; text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    overflow: hidden;
}
.loader-name span {
    display: inline-block;
    animation: loader-letter 1.6s ease-in-out infinite;
    animation-fill-mode: both;
}
.loader-name span:nth-child(1)  { animation-delay: 0.00s; }
.loader-name span:nth-child(2)  { animation-delay: 0.04s; }
.loader-name span:nth-child(3)  { animation-delay: 0.08s; }
.loader-name span:nth-child(4)  { animation-delay: 0.12s; }
.loader-name span:nth-child(5)  { animation-delay: 0.16s; }
.loader-name span:nth-child(6)  { animation-delay: 0.20s; }
.loader-name span:nth-child(7)  { animation-delay: 0.24s; }
.loader-name span:nth-child(8)  { animation-delay: 0.28s; }
.loader-name span:nth-child(9)  { animation-delay: 0.32s; }
.loader-name span:nth-child(10) { animation-delay: 0.36s; }
.loader-name span:nth-child(11) { animation-delay: 0.40s; }
@keyframes loader-letter {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.7; }
    40% { transform: translateY(-4px); opacity: 1; }
}
.loader-bar {
    width: 240px; height: 1px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden; position: relative;
    margin-top: 8px;
}
.loader-bar::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, #6366F1, #8B5CF6, transparent);
    animation: loader-shimmer 1.6s linear infinite;
}
@keyframes loader-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ===== CUSTOM CURSOR ===== */
@media (pointer: fine) {
    body { cursor: none; }
    a, button, .clickable { cursor: none; }
    #cursor-dot, #cursor-ring {
        position: fixed; top: 0; left: 0;
        pointer-events: none;
        z-index: 9990;
        will-change: transform;
        mix-blend-mode: difference;
    }
    #cursor-dot {
        width: 5px; height: 5px;
        background: #fff;
        border-radius: 100px;
        transform: translate(-50%, -50%);
    }
    #cursor-ring {
        width: 24px; height: 24px;
        border: 1.5px solid #fff;
        border-radius: 100px;
        transform: translate(-50%, -50%);
        transition: width 0.25s var(--ease-out), height 0.25s var(--ease-out), background 0.25s ease;
    }
    body.cursor-hover #cursor-ring {
        width: 40px; height: 40px;
        background: rgba(255, 255, 255, 0.08);
    }
}
@media (pointer: coarse) {
    #cursor-dot, #cursor-ring { display: none; }
}

/* ===== TOP SCROLL PROGRESS ===== */
#scroll-progress {
    position: fixed; top: 0; left: 0; right: 0; height: 2px;
    background: var(--grad-text);
    z-index: 100;
    transform-origin: left center;
    transform: scaleX(0);
    pointer-events: none;
}

/* ===== HEADER ===== */
header.site-header {
    position: fixed; top: 0; left: 0; right: 0;
    z-index: 50;
    padding: 18px 0;
    transition: background 0.3s ease, backdrop-filter 0.3s ease, border-color 0.3s ease;
    border-bottom: 1px solid transparent;
}
header.site-header.is-stuck {
    background: rgba(250, 250, 251, 0.78);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom-color: var(--border);
}
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; transition: opacity 0.2s ease; }
.brand:hover { opacity: 0.85; }
.brand-logo { width: 40px; height: 40px; border-radius: 11px; box-shadow: var(--shadow-sm); object-fit: cover; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-size: 16px; font-weight: 800; letter-spacing: -0.4px; color: var(--text); }
.brand-tag { font-size: 10.5px; font-weight: 700; color: var(--text-muted); letter-spacing: 1.6px; }

nav.top-nav { display: none; }
@media (min-width: 768px) {
    nav.top-nav { display: flex; gap: 36px; align-items: center; }
    nav.top-nav a {
        color: var(--text-muted); text-decoration: none;
        font-size: 14px; font-weight: 500;
        transition: color 0.15s ease;
        position: relative;
    }
    nav.top-nav a:hover, nav.top-nav a.active { color: var(--text); }
    nav.top-nav a.active::after {
        content: '';
        position: absolute; bottom: -8px; left: 0; right: 0;
        height: 2px; background: var(--ink); border-radius: 2px;
    }
}

/* ===== TYPOGRAPHY ===== */
.display-1 {
    font-size: clamp(56px, 10vw, 140px);
    font-weight: 700;
    letter-spacing: -3.5px;
    line-height: 1.02;
}
.display-2 {
    font-size: clamp(40px, 7vw, 92px);
    font-weight: 700;
    letter-spacing: -2.5px;
    line-height: 1.04;
}
.display-3 {
    font-size: clamp(32px, 5vw, 64px);
    font-weight: 700;
    letter-spacing: -1.5px;
    line-height: 1.08;
}
.display-4 {
    font-size: clamp(24px, 3.5vw, 40px);
    font-weight: 700;
    letter-spacing: -0.8px;
    line-height: 1.15;
}
.gradient-text {
    background: var(--grad-text);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
    /* Allow descenders without clipping inside reveal-line wrappers */
    padding-bottom: 0.08em;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 14px 24px; border-radius: 100px;
    font-size: 14.5px; font-weight: 600; text-decoration: none;
    transition: transform 0.3s var(--ease-out), background 0.2s, color 0.2s, border-color 0.2s;
    border: 1px solid transparent; cursor: none;
    position: relative;
}
@media (pointer: coarse) { .btn { cursor: pointer; } }
.btn-primary {
    background: var(--ink); color: #fff;
}
.btn-primary:hover { transform: translateY(-2px); }
.btn-secondary {
    background: var(--surface); color: var(--ink);
    border-color: var(--border-strong);
}
.btn-secondary:hover { transform: translateY(-1px); border-color: var(--ink); }
.btn .icon { width: 16px; height: 16px; transition: transform 0.3s var(--ease-out); }
.btn:hover .icon { transform: translateX(4px); }

.play-badge {
    display: inline-flex; align-items: center; gap: 12px;
    background: var(--ink); color: #fff; padding: 14px 26px;
    border-radius: 100px;
    text-decoration: none;
    transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
    box-shadow: var(--shadow-md);
    cursor: none;
}
@media (pointer: coarse) { .play-badge { cursor: pointer; } }
.play-badge:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.play-badge-icon { width: 22px; height: 24px; flex-shrink: 0; }
.play-badge-text { display: flex; flex-direction: column; line-height: 1.1; text-align: left; }
.play-badge-text small { font-size: 10px; opacity: 0.8; letter-spacing: 0.5px; text-transform: uppercase; }
.play-badge-text strong { font-size: 15px; font-weight: 600; letter-spacing: -0.3px; }

/* ===== BADGES ===== */
.badge-status {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 600;
    padding: 5px 12px; border-radius: 100px;
    letter-spacing: 0.2px; width: fit-content;
}
.badge-live { background: #DCFCE7; color: #166534; }
.badge-soon { background: #FEF3C7; color: #92400E; }
.badge-future { background: #E0E7FF; color: #3730A3; }
.badge-testing { background: #CFFAFE; color: #155E75; }
.badge-status .dot { width: 5px; height: 5px; border-radius: 100px; background: currentColor; }
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
.badge-live .dot { animation: pulse 2s ease-in-out infinite; }

/* ===== SECTION NUMBER ===== */
.section-number {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic;
    font-size: clamp(64px, 14vw, 200px);
    color: rgba(15, 23, 42, 0.05);
    line-height: 1;
    pointer-events: none;
    user-select: none;
    position: absolute;
    top: 32px; right: 24px;
    z-index: 0;
}
@media (min-width: 768px) {
    .section-number { right: 48px; top: 48px; }
}

/* ===== EYEBROW ===== */
.section-eyebrow {
    display: inline-flex; align-items: center; gap: 12px;
    font-size: 12px; font-weight: 700;
    color: var(--ink); letter-spacing: 2px; text-transform: uppercase;
    margin-bottom: 24px;
}
.section-eyebrow::before {
    content: '';
    width: 32px; height: 1.5px;
    background: var(--ink);
    flex-shrink: 0;
}

/* ===== MARQUEE STRIPS ===== */
.marquee {
    overflow: hidden;
    background: var(--ink);
    color: #fff;
    padding: 24px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}
.marquee.light {
    background: var(--bg-warm);
    color: var(--ink);
    border-color: var(--border);
}
.marquee-track {
    display: flex;
    gap: 56px;
    animation: marquee-roll 28s linear infinite;
    white-space: nowrap;
    align-items: center;
}
.marquee-track.reverse { animation-direction: reverse; animation-duration: 32s; }
.marquee-item {
    font-size: clamp(32px, 5vw, 64px);
    font-weight: 700;
    letter-spacing: -1.5px;
    display: flex; align-items: center; gap: 56px;
}
.marquee-item .serif { font-size: 1.05em; }
.marquee-dot {
    width: 12px; height: 12px; border-radius: 100px;
    background: currentColor; flex-shrink: 0; opacity: 0.4;
}
@keyframes marquee-roll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

/* ===== REVEAL ANIMATIONS (GSAP-driven, fallback opacity) ===== */
.reveal-line {
    display: block;
    overflow: hidden;
    /* Pad bottom so descenders (g, y, p, j) aren't clipped by the wrapper */
    padding-bottom: 0.12em;
    margin-bottom: -0.12em;
}
.reveal-line > span { display: inline-block; will-change: transform, opacity; }

.fade-up { opacity: 0; transform: translateY(40px); will-change: transform, opacity; }
.fade-up.is-in { opacity: 1; transform: translateY(0); transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out); }

.split-char { display: inline-block; }

/* ===== ORBS ===== */
.orb {
    position: absolute; border-radius: 100%;
    filter: blur(80px); pointer-events: none; will-change: transform;
}
.orb-purple { background: radial-gradient(circle, rgba(139, 92, 246, 0.45), transparent 70%); }
.orb-indigo { background: radial-gradient(circle, rgba(99, 102, 241, 0.40), transparent 70%); }
.orb-pink   { background: radial-gradient(circle, rgba(236, 72, 153, 0.30), transparent 70%); }

/* ===== FOOTER ===== */
footer.site-footer {
    padding: 80px 0 40px;
    background: var(--ink); color: #94A3B8;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.footer-top {
    display: grid; gap: 48px;
    grid-template-columns: 1fr;
    margin-bottom: 56px;
    padding-bottom: 56px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
@media (min-width: 768px) { .footer-top { grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 56px; } }

.footer-brand-block { color: rgba(255, 255, 255, 0.85); }
.footer-brand-block .logo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.footer-logo { width: 36px; height: 36px; border-radius: 9px; }
.footer-brand-block h3 { font-size: 16px; font-weight: 800; color: #fff; letter-spacing: -0.4px; }
.footer-brand-block p { font-size: 14px; line-height: 1.7; color: rgba(255, 255, 255, 0.55); margin-bottom: 16px; max-width: 360px; }

.footer-col h4 {
    font-size: 11px; font-weight: 700; color: rgba(255, 255, 255, 0.4);
    letter-spacing: 2px; text-transform: uppercase;
    margin-bottom: 16px;
}
.footer-col ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-col a {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    transition: color 0.15s ease;
}
.footer-col a:hover { color: #fff; }

.footer-bottom {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 16px;
    font-size: 13px; color: rgba(255, 255, 255, 0.5);
}

/* ===== UTILITIES ===== */
.check {
    flex-shrink: 0;
    width: 22px; height: 22px; border-radius: 100px;
    background: linear-gradient(135deg, #DCFCE7, #BBF7D0);
    color: #166534;
    display: inline-flex; align-items: center; justify-content: center;
}
.check svg { width: 13px; height: 13px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    #cursor-dot, #cursor-ring { display: none; }
    body { cursor: auto; }
}

/* ===== HORIZONTAL DIVIDER ===== */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin: 0 auto;
    max-width: 1200px;
}

/* ==================================================================
   MOBILE RESPONSIVE OVERRIDES — 80% of traffic, treat as priority
   ================================================================== */

/* Touch-device: disable everything that needs hover */
@media (pointer: coarse) {
    body { cursor: auto; }
    .magnetic { transform: none !important; }
    #loader { /* loader has its own mobile-friendly sizing */ }
}

@media (max-width: 768px) {
    /* Container padding */
    .container { padding: 0 20px; }
    .container-narrow { padding: 0 20px; }

    /* Headers / typography — softer on small screens */
    .display-1 { letter-spacing: -1.8px; line-height: 1.04; }
    .display-2 { letter-spacing: -1.2px; line-height: 1.06; }
    .display-3 { letter-spacing: -0.8px; line-height: 1.1; }

    /* Header — slightly less tall */
    header.site-header { padding: 14px 0; }
    header.site-header .brand-logo { width: 34px; height: 34px; border-radius: 9px; }

    /* Section number — smaller and corner-positioned */
    .section-number {
        font-size: clamp(56px, 16vw, 120px);
        top: 16px; right: 16px;
    }

    /* Section header default — left-aligned padding */
    .section-header { margin-bottom: 36px; }
    .section-eyebrow { font-size: 11px; gap: 8px; margin-bottom: 16px; }
    .section-eyebrow::before { width: 24px; }

    /* Buttons */
    .btn { padding: 12px 20px; font-size: 14px; }
    .play-badge { padding: 11px 18px; }
    .play-badge-text small { font-size: 9px; }
    .play-badge-text strong { font-size: 14px; }

    /* Footer */
    footer.site-footer { padding: 56px 0 32px; }
    .footer-top {
        grid-template-columns: 1fr !important;
        gap: 32px !important;
        margin-bottom: 32px;
        padding-bottom: 32px;
    }
    .footer-col h4 { margin-bottom: 12px; }
    .footer-col ul { gap: 8px; }
    .footer-col a { font-size: 13px; }
    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        font-size: 12px;
    }

    /* Marquee — slightly smaller text */
    .marquee { padding: 18px 0; }
    .marquee-item { font-size: clamp(24px, 7vw, 44px); gap: 32px; }
    .marquee-track { gap: 32px; }

    /* Loader sizing */
    .loader-logo { width: 64px; height: 64px; }
    .loader-name { font-size: 11px; letter-spacing: 4px; }
    .loader-bar { width: 180px; }
}

/* Very small phones (≤390px) — extra tightening */
@media (max-width: 390px) {
    .container { padding: 0 16px; }
    .container-narrow { padding: 0 16px; }
    .section-number { font-size: 56px; }
    .display-1 { letter-spacing: -1.4px; }
}

/* Mobile nav — burger menu (replaces top-nav on mobile) */
@media (max-width: 768px) {
    nav.top-nav { display: none; }
    .mobile-menu-btn {
        display: flex; align-items: center; justify-content: center;
        width: 40px; height: 40px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 10px;
        cursor: pointer;
        padding: 0;
    }
    .mobile-menu-btn svg { width: 18px; height: 18px; color: var(--ink); }
    .mobile-menu {
        position: fixed; inset: 60px 0 0 0;
        background: rgba(250, 250, 251, 0.95);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 49;
        display: none;
        flex-direction: column;
        padding: 32px 24px;
        gap: 4px;
        border-top: 1px solid var(--border);
    }
    .mobile-menu.is-open { display: flex; }
    .mobile-menu a {
        display: flex; align-items: center; justify-content: space-between;
        font-size: 24px; font-weight: 700;
        color: var(--ink);
        padding: 18px 0;
        border-bottom: 1px solid var(--border);
        text-decoration: none;
        letter-spacing: -0.4px;
    }
    .mobile-menu a::after {
        content: '\2192'; font-size: 18px; color: var(--text-muted);
    }
    body.menu-open { overflow: hidden; }
}
@media (min-width: 769px) {
    .mobile-menu-btn, .mobile-menu { display: none !important; }
}
