/* ==========================================================================
   MESHFRONT/LAB v1.0 — STRICT SIGNAL PALETTE & INSTRUMENT DESIGN TOKENS
   ========================================================================== */
:root, :root[data-theme="dark"] {
    --bg: #141518;          /* Ink */
    --surface: #1C1E22;     /* Graphite */
    --surface-elev: rgba(28, 30, 34, 0.88);
    --border: #2C2F36;      /* Line */
    --text: #EDEAE0;        /* Bone */
    --muted: #9AA0AB;       /* Slate */
    --accent: #E8612D;      /* Signal Orange */
    --accent-text: #E8612D;
    --accent-tint-8: rgba(232, 97, 45, 0.08);
    --accent-tint-14: rgba(232, 97, 45, 0.14);
    --on-accent: #141518;   /* Ink on Signal (5.4:1 contrast) */
    --ok: #4CB782;
    --warn: #E8B931;
    --err: #F0616D;
    --info: #5AA9F0;
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #F7F5EF;          /* Paper */
    --surface: #FFFFFF;     /* White Surface */
    --surface-elev: rgba(255, 255, 255, 0.90);
    --border: #D9D5C8;      /* Rule */
    --text: #141518;        /* Ink */
    --muted: #5B606B;       /* Smoke */
    --accent: #E8612D;      /* Signal Orange */
    --accent-text: #B8431A; /* Signal Deep for text on light */
    --accent-tint-8: rgba(232, 97, 45, 0.08);
    --accent-tint-14: rgba(232, 97, 45, 0.14);
    --on-accent: #141518;
    --ok: #1F7A4D;
    --warn: #8A6200;
    --err: #B3262F;
    --info: #1C5FA8;
    color-scheme: light;
}

* {
    box-sizing: border-box;
    box-shadow: none !important; /* Strict Brand Rule: Zero drop shadows */
}

html {
    scroll-behavior: smooth;
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
    font-size: 17px;
    line-height: 1.55;
}

body {
    margin: 0;
    background-color: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Typography Helpers */
.type-display {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: clamp(40px, 6.8vw, 68px);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -0.02em;
}

.type-h1 {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: clamp(32px, 4.8vw, 48px);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.015em;
}

.type-h2 {
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: clamp(24px, 3.5vw, 34px);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
}

.type-mono {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
}

.type-label {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

/* Matte Instrument Cards & Surfaces (4px radius, 1px solid border) */
.mfl-card {
    background-color: var(--surface-elev);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 4px;
    transition: border-color 0.2s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.mfl-card-interactive:hover {
    border-color: var(--text);
}

.mfl-card-signal:hover {
    border-color: var(--accent);
}

/* Buttons — Signal Primary (#E8612D with #141518 Ink text) */
.btn-signal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background-color: var(--accent);
    color: #141518;
    font-family: 'Hanken Grotesk', sans-serif;
    font-weight: 700;
    font-size: 15px;
    padding: 12px 20px;
    border-radius: 4px;
    border: 1px solid var(--accent);
    cursor: pointer;
    transition: opacity 0.15s ease, transform 0.15s ease;
    text-decoration: none;
}

.btn-signal:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--surface);
    color: var(--text);
    font-family: 'Hanken Grotesk', sans-serif;
    font-weight: 700;
    font-size: 15px;
    padding: 11px 18px;
    border-radius: 4px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
    text-decoration: none;
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent-text);
}

/* Solution Router Pills */
.router-pill {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 8px 14px;
    border-radius: 4px;
    border: 1px solid var(--border);
    background-color: var(--surface);
    color: var(--muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.router-pill:hover {
    border-color: var(--text);
    color: var(--text);
}

.router-pill.active {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #141518;
}

/* 3D Perspective Containers for Scroll Choreography */
.stage-perspective {
    perspective: 1200px;
    transform-style: preserve-3d;
}

.product-array-grid {
    transform-style: preserve-3d;
    will-change: transform;
    transition: transform 0.12s linear;
}

.product-node-card {
    transform-style: preserve-3d;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease;
    position: relative;
    overflow: hidden;
}

.product-node-card:hover {
    transform: translateZ(22px) translateY(-4px);
    border-color: var(--accent);
}

/* Circular Iris Clip-Path Portal (Matches 00:07–00:11 Video Reference) */
#irisPortalModal {
    clip-path: circle(0% at 50% 50%);
    pointer-events: none;
    transition: clip-path 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

#irisPortalModal.open {
    clip-path: circle(150% at var(--portal-x, 50%) var(--portal-y, 50%));
    pointer-events: auto;
}

/* Magnetic Circular Lens on Product Array */
#arrayLens {
    width: 96px;
    height: 96px;
    border-radius: 9999px;
    background-color: var(--accent);
    color: #141518;
    pointer-events: none;
    position: fixed;
    z-index: 35;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

#arrayLens.visible {
    transform: translate(-50%, -50%) scale(1);
}

/* Interactive 5x5 Logo Cell Transition */
.mfl-interactive-logo rect.m-cell {
    transition: fill 0.18s ease, stroke 0.18s ease, transform 0.18s ease;
    transform-box: fill-box;
    transform-origin: center;
}

/* 5-Cell Left Rail */
.rail-cell {
    width: 10px;
    height: 10px;
    border: 1px solid var(--border);
    background-color: var(--surface);
    border-radius: 2px;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
    cursor: pointer;
}

.rail-cell.active {
    background-color: var(--accent);
    border-color: var(--accent);
    transform: scale(1.2);
}

/* Form Inputs */
.mfl-input {
    width: 100%;
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 10px 14px;
    color: var(--text);
    font-family: 'Hanken Grotesk', sans-serif;
    font-size: 15px;
}

.mfl-input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
}

/* Pulse Indicator */
@keyframes cellPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}
.signal-pulse {
    animation: cellPulse 1.4s ease-in-out infinite;
}

/* ==========================================================================
   ALWAYS-ON CUSTOM TACTICAL CURSOR RETICLE & MOVING AMBIENT SPOTLIGHT
   Unconditional CSS (no @media pointer restriction) so it always renders
   ========================================================================== */
#customCursorDot {
    position: fixed;
    top: -100px;
    left: -100px;
    width: 8px;
    height: 8px;
    background-color: #E8612D;
    border-radius: 9999px;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    transition: width 0.15s ease, height 0.15s ease, background-color 0.15s ease;
}

#customCursorRing {
    position: fixed;
    top: -100px;
    left: -100px;
    width: 40px;
    height: 40px;
    border: 1.5px solid rgba(232, 97, 45, 0.75);
    border-radius: 9999px;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%) rotate(0deg);
    transition: width 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                height 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.2s ease,
                background-color 0.2s ease,
                transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Subtle Custom Cursor Follower & Ambient Torch (Disabled on touch devices) */
@media (pointer: fine) {
    #customCursorDot {
        position: fixed;
        top: 0;
        left: 0;
        width: 6px;
        height: 6px;
        background-color: #E8612D;
        border-radius: 9999px;
        pointer-events: none;
        z-index: 60;
        transform: translate(-50%, -50%);
        transition: width 0.18s ease, height 0.18s ease, opacity 0.18s ease;
    }
    #customCursorRing {
        position: fixed;
        top: 0;
        left: 0;
        width: 32px;
        height: 32px;
        border: 1px solid rgba(232, 97, 45, 0.55);
        border-radius: 9999px;
        pointer-events: none;
        z-index: 59;
        transform: translate(-50%, -50%);
        transition: width 0.22s ease, height 0.22s ease, border-color 0.22s ease, background-color 0.22s ease;
    }
    #customCursorRing.cursor-hover {
        width: 48px;
        height: 48px;
        border-color: #E8612D;
        background-color: rgba(232, 97, 45, 0.1);
    }
    #ambientCursorTorch {
        position: fixed;
        top: 0;
        left: 0;
        width: 560px;
        height: 560px;
        border-radius: 9999px;
        background: radial-gradient(circle, rgba(232, 97, 45, 0.09) 0%, transparent 70%);
        pointer-events: none;
        z-index: 1;
        transform: translate(-50%, -50%);
        will-change: left, top;
    }
}
@media (pointer: coarse) {
    #customCursorDot, #customCursorRing, #ambientCursorTorch {
        display: none !important;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
