body {
    background-color: #fbfbfd; /* theme('colors.base') fallback */
    color: #1d1d1f; /* theme('colors.textMain') fallback */
    overflow-x: hidden;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.025'/%3E%3C/svg%3E");
}

/* Base styles that use Tailwind theme values need to be handled carefully or use hardcoded values if splitting from CDN Tailwind */
/* Since we are using Tailwind CDN with a config, these theme() calls work in the HTML style block but might not work in a standalone CSS file without a build step. */
/* I will replace theme() calls with their actual values from the config for the standalone CSS file. */

body {
    background-color: #fbfbfd;
    color: #1d1d1f;
}

.ambient-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    z-index: -1;
    pointer-events: none;
}

.ambient-orb {
    position: absolute;
    filter: blur(140px);
    opacity: 0.3;
    border-radius: 50%;
}

/* Context-Aware Gradient Text Utilities */
[class*="gt-"] {
    display: inline-block;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-fill-color: transparent;
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
    /* Prevent clipping of descenders (g, p, y, j) */
    padding-bottom: 0.15em;
    margin-bottom: -0.15em;
    padding-right: 0.05em;
    line-height: normal;
}

/* Hero: Deep Ocean (Teal to Blue) */
.gt-f-hero { background-image: linear-gradient(135deg, #1d1d1f 25%, #0f5279 100%); }

/* Feature 1: Signal-Blue (Matches sensing/signal blue) */
.gt-f-blue { background-image: linear-gradient(135deg, #1d1d1f 25%, #3b82f6 100%); }

/* Feature 2: Vitality-Purple (Matches breathing/vitality purple) */
.gt-f-purple { background-image: linear-gradient(135deg, #1d1d1f 25%, #a855f7 100%); }

/* Feature 3: Energy-Green (Matches energy/streak green) */
.gt-f-green { background-image: linear-gradient(135deg, #1d1d1f 25%, #10b981 100%); }

/* Feature 4: Cosmic-Indigo (Matches sleep/deep night indigo) */
.gt-f-indigo { background-image: linear-gradient(135deg, #1d1d1f 25%, #6366f1 100%); }

/* Feature 5: Sunset-Orange (Matches peak energy/clock orange) */
.gt-f-orange { background-image: linear-gradient(135deg, #1d1d1f 25%, #f97316 100%); }

/* Feature 6: Joy-Rose (Matches celebration/delight pink) */
.gt-f-rose { background-image: linear-gradient(135deg, #1d1d1f 25%, #f43f5e 100%); }

/* Feature Accent: Bio-Teal */
.gt-f-teal { background-image: linear-gradient(135deg, #1d1d1f 25%, #36b39c 100%); }

/* Large cinematic abstract panels */
.glass-panel {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    background: radial-gradient(circle at 0% 0%, rgba(147, 216, 74, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 100% 100%, rgba(54, 179, 156, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

@media (min-width: 768px) {
    .glass-panel {
        border-radius: 2.5rem;
    }
}

.glass-panel:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

/* Scroll Reveal with deep threshold for long pages */
.reveal {
    opacity: 0;
    transform: translateY(50px);
    transition: all 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.delay-100 { transition-delay: 150ms; }
.delay-200 { transition-delay: 300ms; }
.delay-300 { transition-delay: 450ms; }

/* ═══════════════════════════════════════════ */
/*  Semantic Animations for Visual Panels      */
/* ═══════════════════════════════════════════ */

/* — Neural Signal (Feature 1: Friction) — */
.neural-canvas { position: relative; width: 100%; height: 100%; }
.signal-line {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 600;
    animation: signal-travel 4s linear infinite;
}
@keyframes signal-travel {
    0%   { stroke-dashoffset: 600; }
    100% { stroke-dashoffset: -600; }
}
.signal-glow {
    filter: blur(8px);
    opacity: 0.4;
}

/* — Breathing Circle (Feature 2: Adaptive Goals) — */
.breath-ring {
    animation: breathe-ring 6s ease-in-out infinite;
    transform-origin: center;
}
@keyframes breathe-ring {
    0%, 100% { transform: scale(1); opacity: 0.15; }
    50%      { transform: scale(1.35); opacity: 0.05; }
}
.breath-ring-inner {
    animation: breathe-ring 6s ease-in-out infinite;
    animation-delay: -0.5s;
    transform-origin: center;
}
.breath-number {
    transition: all 1.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.group:hover .breath-number, .active .breath-number, .ui-loop .breath-number { transform: scale(0.8); }
.group:hover .label-tired, .active .label-tired, .ui-loop .label-tired {
    opacity: 1;
    color: #36b39c;
}

.state-rested, .state-tired, .label-rested, .label-tired {
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Default State */
.state-rested { opacity: 1; transform: translateY(0); }
.state-tired { opacity: 0; transform: translateY(10px); }
.label-rested { color: #1d1d1f; }
.label-tired { color: rgba(0, 0, 0, 0.15); }

/* Adaptive State (on scroll/hover) */
.active .state-rested, .group:hover .state-rested {
    opacity: 0;
    transform: translateY(-10px);
    transition-delay: 1.5s;
}

.active .state-tired, .group:hover .state-tired {
    opacity: 1;
    transform: translateY(0);
    transition-delay: 1.5s;
}

.active .label-rested, .group:hover .label-rested {
    color: rgba(0, 0, 0, 0.15);
    transition-delay: 1.5s;
}

.active .label-tired, .group:hover .label-tired {
    color: #36b39c;
    transition-delay: 1.5s;
}

/* Hover override: make it snappy if user interacts */
.group:hover .state-rested, .group:hover .state-tired, 
.group:hover .label-rested, .group:hover .label-tired {
    transition-delay: 0s;
}

/* — Circadian Arc (Feature 4: Sleep) — */
.circadian-arc { transform-origin: center; }
.circadian-arc-bg { opacity: 0.1; }
.circadian-arc-progress {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 1.8s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
}
.group:hover .circadian-arc-progress, .active .circadian-arc-progress { stroke-dashoffset: 150; }

/* — Energy Curve (Feature 5: Chronotype) — */
.energy-curve-fill {
    opacity: 0;
    transition: opacity 0.8s ease;
}
.group:hover .energy-curve-fill, .active .energy-curve-fill { opacity: 1; }
.energy-curve-line {
    stroke-width: 3;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.group:hover .energy-curve-line, .active .energy-curve-line { 
    stroke-dashoffset: 0; 
}
.peak-marker {
    opacity: 0;
    transition: all 0.5s ease 0.6s;
}
.group:hover .peak-marker, .active .peak-marker {
    opacity: 1;
}

.energy-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
    fill: #86868b;
}

/* — Confetti & Rewards (Feature 6: Joy) — */
.reward-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.reward-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.1);
}

.reward-ring {
    opacity: 0.1;
    transition: all 1.2s cubic-bezier(0.16, 1, 0.3, 1);
    transform: scale(0.8);
    transform-origin: center;
}

.group:hover .reward-ring {
    transform: scale(1.1);
    opacity: 0.2;
}

.reward-ring-2 {
    transform: scale(0);
    opacity: 0;
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.25s;
    transform-origin: center;
}
.group:hover .reward-ring-2, .active .reward-ring-2, .ui-loop .reward-ring-2 {
    transform: scale(1);
    opacity: 0.5;
}
