/* ═══════════════════════════════════════════════════════════════
   CUCEU — Shared Design System · Frutiger Aero edition
   Single source of truth for brand tokens, components & utilities.
   ═══════════════════════════════════════════════════════════════ */

/* ── DESIGN TOKENS ─────────────────────────────────────────── */
:root {
    /* Brand ramp */
    --c-amber: #d07329;
    --c-amber-bright: #f0913c;
    --c-amber-hot: #ffb066;
    --c-amber-deep: #8f4a14;
    --c-amber-soft: rgba(208, 115, 41, 0.08);
    --c-amber-glow: rgba(240, 145, 60, 0.55);
    --c-amber-15: rgba(208, 115, 41, 0.15);
    --c-amber-20: rgba(208, 115, 41, 0.2);

    /* Surfaces — warm pearl Aero */
    --c-bg: #f6f1e8;
    --c-bg-deep: #ece4d6;
    --c-text: #221c14;
    --c-text-muted: #8a7f70;
    --c-text-inverse: #f6f1e8;

    /* Glass surfaces */
    --c-glass: rgba(255, 252, 246, 0.55);
    --c-glass-strong: rgba(255, 252, 246, 0.80);
    --c-glass-border: rgba(255, 255, 255, 0.65);
    --c-glass-edge: rgba(120, 90, 60, 0.16);
    --blur-glass: 28px;

    /* Aero gradients */
    --g-aurora:
        radial-gradient(75% 60% at 18% 8%, rgba(255, 176, 102, 0.09), transparent 70%),
        radial-gradient(65% 55% at 85% 18%, rgba(240, 145, 60, 0.06), transparent 70%),
        radial-gradient(80% 65% at 50% 110%, rgba(208, 115, 41, 0.08), transparent 70%);
    --g-gel: linear-gradient(180deg, var(--c-amber-bright) 0%, var(--c-amber) 45%,
                             var(--c-amber-deep) 50%, var(--c-amber) 100%);
    --g-spec: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%,
                              rgba(255, 255, 255, 0.12) 46%, rgba(255, 255, 255, 0) 52%);
    --g-shine: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.35) 50%, transparent 65%);

    /* Shadows */
    --sh-float: 0 18px 50px rgba(140, 90, 40, 0.18), 0 4px 14px rgba(0, 0, 0, 0.06);
    --sh-glow: 0 0 24px var(--c-amber-glow);
    --sh-gloss: inset 0 1px 0 rgba(255, 255, 255, 0.8), inset 0 -1px 0 rgba(0, 0, 0, 0.06);

    /* Typography */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    --fw-regular: 400;
    --fw-bold: 700;
    --fw-heavy: 800;
    --fw-black: 900;
    --ls-tight: -2px;
    --ls-normal: 0.8px;
    --ls-wide: 1.5px;
    --ls-ultra: 2px;
    --ls-mega: 3px;

    /* Spacing */
    --sp-2: 2px;
    --sp-4: 4px;
    --sp-8: 8px;
    --sp-12: 12px;
    --sp-16: 16px;
    --sp-24: 24px;
    --sp-32: 32px;

    /* Radii */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 24px;
    --r-pill: 9999px;

    /* Timing */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-snappy: cubic-bezier(0.5, 0, 0.1, 1);
    --dur-fast: 0.3s;
    --dur-medium: 0.55s;
    --dur-slow: 0.8s;
    --dur-glacial: 1.2s;
}

/* ── DARK MODE TOKEN OVERRIDES ─────────────────────────────── */
body.dark-mode {
    /* Strict black. --c-bg-deep is for gradient stops only, never page bg. */
    --c-bg: #000;
    --c-bg-deep: #0a0703;
    --c-text: #f4ede3;
    --c-text-muted: #9a8d7c;
    --c-text-inverse: #16100a;
    --c-glass: rgba(18, 12, 6, 0.55);
    --c-glass-strong: rgba(20, 13, 7, 0.84);
    --c-glass-border: rgba(255, 176, 102, 0.22);
    --c-glass-edge: rgba(255, 176, 102, 0.10);
    --g-aurora:
        radial-gradient(70% 55% at 15% 10%, rgba(208, 115, 41, 0.07), transparent 70%),
        radial-gradient(60% 50% at 85% 20%, rgba(240, 145, 60, 0.05), transparent 70%),
        radial-gradient(85% 65% at 50% 115%, rgba(143, 74, 20, 0.10), transparent 70%);
    --g-spec: linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0%,
                              rgba(255, 255, 255, 0.04) 46%, rgba(255, 255, 255, 0) 52%);
    --sh-float: 0 18px 50px rgba(0, 0, 0, 0.55), 0 0 30px rgba(208, 115, 41, 0.10);
    --sh-gloss: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -1px 0 rgba(0, 0, 0, 0.4);
}

/* ── RESET & BASE ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-primary);
    background: var(--c-bg);
    color: var(--c-text);
    transition: background var(--dur-slow) ease, color var(--dur-slow) ease;
}

/* ── AURORA WASH LAYER ─────────────────────────────────────── */
body::before {
    content: '';
    position: fixed;
    inset: -10%;
    z-index: 0;
    pointer-events: none;
    background: var(--g-aurora);
    animation: aero-drift 40s ease-in-out infinite alternate;
}

/* ── NOISE / GRAIN TEXTURE OVERLAY ─────────────────────────── */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 99999;
    pointer-events: none;
    opacity: 0.028;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 180px 180px;
}
body.dark-mode::after {
    mix-blend-mode: screen;
    opacity: 0.04;
}

/* ── AERO GLASS PANEL ──────────────────────────────────────── */
/* Glass card with the classic Vista top-half specular sheen.   */
.aero-panel {
    position: relative;
    background: var(--c-glass);
    backdrop-filter: blur(var(--blur-glass)) saturate(160%);
    -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(160%);
    border: 1px solid var(--c-glass-border);
    outline: 1px solid var(--c-glass-edge);
    box-shadow: var(--sh-float), var(--sh-gloss);
    border-radius: var(--r-lg);
}
.aero-panel::before {
    content: '';
    position: absolute;
    inset: 0 0 50% 0;
    background: var(--g-spec);
    border-radius: inherit;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    pointer-events: none;
}

/* ── AERO GEL BUTTON ───────────────────────────────────────── */
.aero-gel {
    position: relative;
    background: var(--g-gel);
    color: #fff;
    border: 1px solid var(--c-amber-deep);
    border-radius: var(--r-pill);
    box-shadow: var(--sh-gloss), 0 2px 10px rgba(143, 74, 20, 0.35);
    cursor: pointer;
    transition: box-shadow var(--dur-fast), transform var(--dur-fast) var(--ease-spring),
                filter var(--dur-fast);
    overflow: hidden;
}
.aero-gel::before {
    content: '';
    position: absolute;
    inset: 1px 1px 55% 1px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.08));
    border-radius: inherit;
    border-bottom-left-radius: 40%;
    border-bottom-right-radius: 40%;
    pointer-events: none;
}
.aero-gel:hover {
    box-shadow: var(--sh-gloss), var(--sh-glow);
    filter: brightness(1.08);
    transform: scale(1.05);
}
.aero-gel:active { transform: scale(0.95); }

/* ── AERO STATUS ORB ───────────────────────────────────────── */
/* Color via --dot-c, e.g. style="--dot-c:#4ade80"              */
.aero-dot {
    --dot-c: var(--c-amber-bright);
    position: relative;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.9), var(--dot-c) 45%,
                color-mix(in srgb, var(--dot-c) 60%, #000) 100%);
    box-shadow: 0 0 8px var(--dot-c), inset 0 -1px 2px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

/* ── AERO RANGE SLIDER ─────────────────────────────────────── */
.aero-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: var(--r-pill);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.06));
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(255, 255, 255, 0.4);
    outline: none;
    cursor: pointer;
}
body.dark-mode .aero-slider {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.14));
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.7), inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}
.aero-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.95), var(--c-amber-bright) 40%, var(--c-amber-deep));
    border: 1px solid var(--c-amber-deep);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35), 0 0 8px var(--c-amber-glow);
    cursor: grab;
    transition: transform var(--dur-fast) var(--ease-spring);
}
.aero-slider::-webkit-slider-thumb:hover { transform: scale(1.2); }
.aero-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.95), var(--c-amber-bright) 40%, var(--c-amber-deep));
    border: 1px solid var(--c-amber-deep);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35), 0 0 8px var(--c-amber-glow);
    cursor: grab;
}

/* ── SHARED NAVIGATION BAR ─────────────────────────────────── */
.cuceu-nav {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-12) var(--sp-24);
    z-index: 100;
}

.cuceu-nav .nav-left,
.cuceu-nav .nav-right {
    display: flex;
    align-items: center;
    gap: var(--sp-12);
}

/* ── BACK / PILL BUTTON ────────────────────────────────────── */
.aero-pill,
.back-pill {
    position: relative;
    color: var(--c-text);
    text-decoration: none;
    font-weight: var(--fw-black);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: var(--ls-wide);
    border: 1px solid var(--c-glass-border);
    outline: 1px solid var(--c-glass-edge);
    padding: var(--sp-8) var(--sp-16);
    border-radius: var(--r-pill);
    background: var(--c-glass);
    backdrop-filter: blur(12px) saturate(160%);
    -webkit-backdrop-filter: blur(12px) saturate(160%);
    box-shadow: var(--sh-gloss);
    transition: background var(--dur-fast) var(--ease-spring),
                color var(--dur-fast),
                border-color var(--dur-fast),
                box-shadow var(--dur-fast),
                transform var(--dur-fast) var(--ease-spring);
    white-space: nowrap;
    overflow: hidden;
}
.aero-pill::before,
.back-pill::before {
    content: '';
    position: absolute;
    inset: 0 0 50% 0;
    background: var(--g-spec);
    border-radius: inherit;
    pointer-events: none;
}
.aero-pill:hover,
.back-pill:hover {
    background: var(--g-gel);
    color: #fff;
    border-color: var(--c-amber-deep);
    box-shadow: var(--sh-gloss), var(--sh-glow);
    transform: scale(1.04);
}
.aero-pill:active,
.back-pill:active { transform: scale(0.96); }

/* ── CLOCK DISPLAY ─────────────────────────────────────────── */
.cuceu-clock {
    font-size: clamp(11px, 1.3vw, 14px);
    font-weight: var(--fw-black);
    letter-spacing: var(--ls-wide);
    text-transform: uppercase;
    color: var(--c-text);
    text-shadow: 0 0 8px rgba(255, 252, 246, 0.9),
                 0 0 14px var(--c-amber-soft);
    transition: color var(--dur-slow) ease,
                text-shadow var(--dur-slow) ease;
}
body.dark-mode .cuceu-clock {
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.5),
                 0 0 14px var(--c-amber-soft);
}

/* ── THEME TOGGLE BUTTON (Sun / Moon) ──────────────────────── */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--sp-4);
    color: var(--c-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--dur-fast),
                transform var(--dur-fast) var(--ease-spring);
    opacity: 0.6;
}
.theme-toggle:hover {
    color: var(--c-amber);
    transform: scale(1.15);
    opacity: 1;
}
.theme-toggle:active { transform: scale(0.9); }

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    width: 18px;
    height: 18px;
}
.theme-toggle .icon-moon { display: none; }
body.dark-mode .theme-toggle .icon-sun { display: none; }
body.dark-mode .theme-toggle .icon-moon { display: block; }

/* ── UNIFIED ANIMATION SYSTEM ──────────────────────────────── */
@keyframes aero-rise-in {
    0%   { opacity: 0; transform: translateY(16px); filter: blur(8px); }
    100% { opacity: 1; transform: translateY(0);    filter: blur(0); }
}
@keyframes aero-rise-out {
    0%   { opacity: 1; transform: translateY(0);    filter: blur(0); }
    100% { opacity: 0; transform: translateY(16px); filter: blur(8px); }
}
@keyframes aero-drop-in {
    0%   { opacity: 0; transform: translateY(-12px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes aero-drop-out {
    0%   { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-12px); }
}
@keyframes aero-pop-in {
    0%   { opacity: 0; transform: scale(0.96); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes aero-pop-out {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.96); }
}
@keyframes aero-slideup-in {
    0%   { opacity: 0; transform: translateY(28px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes aero-slideup-out {
    0%   { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(28px); }
}
@keyframes aero-pulse {
    0%, 100% { transform: scale(0.85); opacity: 0.7; }
    50%      { transform: scale(1.25); opacity: 1; }
}
@keyframes aero-blink {
    0%   { opacity: 0.35; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1.15); }
}
@keyframes aero-shine {
    0%   { background-position: -200% 0; }
    100% { background-position: 300% 0; }
}
@keyframes aero-drift {
    0%   { transform: translate(0, 0) scale(1); }
    50%  { transform: translate(-2%, 1.5%) scale(1.06); }
    100% { transform: translate(2%, -1.5%) scale(1.02); }
}

/* Entry utility classes — stagger via inline style="--d:.2s"   */
.a-rise    { animation: aero-rise-in    var(--dur-medium) var(--ease-smooth) both; animation-delay: var(--d, 0s); }
.a-drop    { animation: aero-drop-in    var(--dur-medium) var(--ease-smooth) both; animation-delay: var(--d, 0s); }
.a-pop     { animation: aero-pop-in     var(--dur-medium) var(--ease-spring) both; animation-delay: var(--d, 0s); }
.a-slideup { animation: aero-slideup-in var(--dur-medium) var(--ease-smooth) both; animation-delay: var(--d, 0s); }

/* Exit state — applied automatically by CuceuTransitions       */
body.is-exiting .a-rise    { animation: aero-rise-out    var(--dur-fast) var(--ease-smooth) forwards; }
body.is-exiting .a-drop    { animation: aero-drop-out    var(--dur-fast) var(--ease-smooth) forwards; }
body.is-exiting .a-pop     { animation: aero-pop-out     var(--dur-fast) var(--ease-smooth) forwards; }
body.is-exiting .a-slideup { animation: aero-slideup-out var(--dur-fast) var(--ease-smooth) forwards; }
body.is-exiting .cuceu-nav { animation: aero-drop-out    var(--dur-fast) var(--ease-smooth) forwards; }

/* Legacy aliases (kept so unmigrated markup doesn't break)     */
@keyframes fadeBlurIn {
    0%   { opacity: 0; transform: translateY(12px); filter: blur(6px); }
    100% { opacity: 1; transform: translateY(0);    filter: blur(0px); }
}
@keyframes fadeBlurOut {
    0%   { opacity: 1; transform: translateY(0);    filter: blur(0px); }
    100% { opacity: 0; transform: translateY(12px); filter: blur(6px); }
}

/* ── GENIE EFFECT (td + bin windows) ───────────────────────── */
.genie-container {
    transition: transform var(--dur-slow) var(--ease-spring),
                opacity var(--dur-slow) var(--ease-smooth),
                filter var(--dur-slow) var(--ease-smooth);
    transform-origin: bottom right;
}
.genie-container.genie-state {
    transform: scale(0.05) translate(40%, 40%);
    opacity: 0;
    filter: blur(10px);
}

/* ── REDUCED MOTION ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    body::before { animation: none; }
    .a-rise, .a-drop, .a-pop, .a-slideup,
    body.is-exiting .a-rise, body.is-exiting .a-drop,
    body.is-exiting .a-pop, body.is-exiting .a-slideup {
        animation-duration: 0.01s;
    }
}

/* ── MOBILE DEFAULTS ───────────────────────────────────────── */
@media (max-width: 600px) {
    .cuceu-nav { padding: 10px 16px; }
    .aero-pill, .back-pill { padding: 6px 12px; font-size: 10px; }
    .cuceu-clock { font-size: 11px; }
    .mobile-hide { display: none !important; }
}
