/* ===========================================
   rational.quest - Styles
   Fairycore + Scholarship Underwater Library
   =========================================== */

/* --- Palette Reference ---
   #0F1B4A - Primary Deep (navy-black)
   #1A2F5C - Deep Accent (lighter navy)
   #D4AF37 - Metallic Gold
   #C0C0C0 - Metallic Silver
   #4FA8B8 - Luminous Teal
   #F5F3ED - Soft Cream
   #9B6E9F - Accent Orchid
   #D95454 - Error/Warning Red
--- */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: #0F1B4A;
    color: #F5F3ED;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 1.1rem;
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Bioluminescent Particles Canvas --- */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* --- Background Fish Layer (slowest parallax, 20-30%) --- */
.bg-fish-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    will-change: transform;
}

.bg-fish {
    position: absolute;
    animation: fishDrift 6s ease-in-out infinite;
}

.bg-fish-1 {
    width: 60px;
    top: 12%;
    left: 8%;
    animation-delay: 0s;
    animation-duration: 5s;
}

.bg-fish-2 {
    width: 50px;
    top: 28%;
    right: 12%;
    animation-delay: -1.5s;
    animation-duration: 6.5s;
}

.bg-fish-3 {
    width: 45px;
    top: 45%;
    left: 18%;
    animation-delay: -3s;
    animation-duration: 5.5s;
}

.bg-fish-4 {
    width: 55px;
    top: 62%;
    right: 7%;
    animation-delay: -0.8s;
    animation-duration: 6s;
}

.bg-fish-5 {
    width: 48px;
    top: 78%;
    left: 60%;
    animation-delay: -2.2s;
    animation-duration: 5.8s;
}

.bg-fish-6 {
    width: 42px;
    top: 88%;
    left: 30%;
    animation-delay: -4s;
    animation-duration: 6.2s;
}

@keyframes fishDrift {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-2px) rotate(0.5deg); }
    50% { transform: translateY(2px) rotate(-0.5deg); }
    75% { transform: translateY(-1px) rotate(0.3deg); }
}

/* --- Hero Section --- */
.hero {
    position: relative;
    height: 100vh;
    min-height: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    overflow: hidden;
}

.hero-mandala {
    position: absolute;
    width: min(80vw, 500px);
    height: min(80vw, 500px);
    opacity: 0.6;
    will-change: transform;
    animation: mandalaRotate 120s linear infinite;
}

@keyframes mandalaRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.mandala-svg {
    width: 100%;
    height: 100%;
}

.hero-fish {
    animation: fishDrift 5s ease-in-out infinite;
}

.hero-fish-1 { animation-delay: 0s; }
.hero-fish-2 { animation-delay: -1.8s; }
.hero-fish-3 { animation-delay: -3.5s; }

.hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    padding: 0 2rem;
}

.hero-title {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 6vw, 5.2rem);
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: #D4AF37;
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.3), 0 0 30px rgba(212, 175, 55, 0.15);
    animation: titleGlow 4s ease-in-out infinite;
    margin-bottom: 1.2rem;
    opacity: 0;
    transform: scale(0.8);
}

@keyframes titleGlow {
    0%, 100% {
        text-shadow: 0 0 8px rgba(212, 175, 55, 0.3), 0 0 30px rgba(212, 175, 55, 0.15);
    }
    50% {
        text-shadow: 0 0 12px rgba(212, 175, 55, 0.5), 0 0 50px rgba(212, 175, 55, 0.25);
    }
}

.hero-subtitle {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    letter-spacing: 0.04em;
    color: #C0C0C0;
    text-shadow: 0 0 8px rgba(192, 192, 192, 0.2);
    max-width: 600px;
    margin: 0 auto;
    opacity: 0;
    transform: translateY(20px);
}

.hero-scroll-hint {
    position: absolute;
    bottom: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    animation: scrollHintFade 2s ease-in-out 2s forwards;
}

@keyframes scrollHintFade {
    to { opacity: 0.6; }
}

.scroll-text {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    color: #D4AF37;
    text-shadow: 0 0 6px rgba(212, 175, 55, 0.3);
}

.scroll-arrow {
    width: 24px;
    height: 24px;
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* --- Breathing Spaces --- */
.breathing-space {
    position: relative;
    min-height: 40vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    overflow: visible;
}

.coral-divider {
    width: 100%;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

.coral-svg {
    width: 100%;
    height: 80px;
}

/* Floating fish in breathing spaces */
.float-fish {
    position: absolute;
    animation: fishDrift 5s ease-in-out infinite;
}

.float-fish-a { width: 25px; top: 20%; left: 15%; animation-delay: -0.5s; }
.float-fish-b { width: 20px; top: 60%; right: 20%; animation-delay: -2s; animation-duration: 6s; }
.float-fish-c { width: 22px; bottom: 15%; left: 55%; animation-delay: -3.5s; animation-duration: 5.5s; }
.float-fish-d { width: 20px; top: 30%; right: 25%; animation-delay: -1s; animation-duration: 5.8s; }
.float-fish-e { width: 18px; bottom: 25%; left: 35%; animation-delay: -2.8s; animation-duration: 6.2s; }
.float-fish-f { width: 22px; top: 40%; left: 20%; animation-delay: -1.5s; }
.float-fish-g { width: 24px; top: 25%; right: 15%; animation-delay: -3s; animation-duration: 5.5s; }
.float-fish-h { width: 20px; bottom: 30%; left: 45%; animation-delay: -0.3s; animation-duration: 6s; }
.float-fish-i { width: 22px; top: 35%; right: 30%; animation-delay: -2.5s; animation-duration: 5.2s; }

.float-fish:hover {
    transform: scale(1.1) translateY(-3px);
    transition: transform 0.4s ease;
}

/* --- Chamber Sections --- */
.chamber {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 80vh;
    padding: 4rem 2rem;
    z-index: 2;
    gap: 2rem;
}

.chamber-1 { margin-top: 0; }
.chamber-2 { margin-top: 60px; }
.chamber-3 { margin-top: 80px; }
.chamber-4 { margin-top: 70px; }
.chamber-5 { margin-top: 60px; }

/* Alternating layout */
.chamber-1, .chamber-3, .chamber-5 {
    flex-direction: row;
}

.chamber-2, .chamber-4 {
    flex-direction: row-reverse;
}

/* Visual panels (parallax at 60%) */
.chamber-visual {
    flex: 0 0 48%;
    max-width: 48%;
    will-change: transform;
    opacity: 0;
    transform: scale(0.8);
    transition: none;
}

.chamber-visual.visible {
    animation: springIn 700ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.chamber-diagram {
    width: 100%;
    max-width: 450px;
    height: auto;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 0 12px rgba(212, 175, 55, 0.1));
}

.diagram-fish {
    animation: fishDrift 5s ease-in-out infinite;
}

/* Text panels (100% scroll speed) */
.chamber-text {
    flex: 0 0 48%;
    max-width: 48%;
    padding: 2rem;
    opacity: 0;
    transform: scale(0.8);
    transition: none;
}

.chamber-text.visible {
    animation: springIn 700ms cubic-bezier(0.34, 1.56, 0.64, 1) 150ms forwards;
}

@keyframes springIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    60% {
        opacity: 1;
        transform: scale(1.02);
    }
    100% {
        opacity: 1;
        transform: scale(1.0);
    }
}

.chamber-heading {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 6vw, 5.2rem);
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: #D4AF37;
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.3);
    margin-bottom: 1.5rem;
    animation: titleGlow 3.5s ease-in-out infinite;
}

.chamber-body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 1.1rem;
    line-height: 1.7;
    color: #F5F3ED;
    margin-bottom: 1.2rem;
}

.chamber-body strong {
    font-weight: 700;
    color: #D4AF37;
}

.chamber-body em {
    font-weight: 500;
    color: #4FA8B8;
}

.chamber-caption {
    display: inline-block;
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    color: #C0C0C0;
    text-shadow: 0 0 6px rgba(192, 192, 192, 0.2);
    margin-top: 0.5rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(192, 192, 192, 0.15);
}

/* --- Tooltip System --- */
.tooltip-trigger {
    color: #4FA8B8;
    cursor: pointer;
    position: relative;
    border-bottom: 1px dotted rgba(79, 168, 184, 0.4);
    transition: color 0.3s ease;
}

.tooltip-trigger:hover {
    color: #D4AF37;
    border-bottom-color: #9B6E9F;
}

/* --- Error State (reserved) --- */
.error-state {
    color: #D95454;
    border-color: #D95454;
}

/* --- Orchid accent for borders/hovers --- */
.chamber-heading:hover {
    text-shadow: 0 0 12px rgba(155, 110, 159, 0.3), 0 0 8px rgba(212, 175, 55, 0.3);
}

/* --- Colophon / Footer --- */
.colophon {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 8rem 2rem 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.colophon-mandala {
    width: 120px;
    height: 120px;
    opacity: 0.5;
    animation: mandalaRotate 90s linear infinite reverse;
}

.colophon-mandala svg {
    width: 100%;
    height: 100%;
}

.colophon-text {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 1.1rem;
    color: #C0C0C0;
    text-shadow: 0 0 6px rgba(192, 192, 192, 0.2);
    max-width: 500px;
    letter-spacing: 0.02em;
}

.colophon-domain {
    font-family: 'Commissioner', sans-serif;
    font-weight: 600;
    font-size: clamp(1.3rem, 3vw, 2.8rem);
    letter-spacing: 0.03em;
    color: #D4AF37;
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.3), 0 0 30px rgba(212, 175, 55, 0.15);
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .chamber {
        flex-direction: column !important;
        padding: 3rem 1.5rem;
    }

    .chamber-visual,
    .chamber-text {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .chamber-visual {
        order: 1;
    }

    .chamber-text {
        order: 2;
        padding: 1.5rem 0;
    }

    .chamber-diagram {
        max-width: 350px;
    }

    .breathing-space {
        min-height: 25vh;
    }

    .chamber-2, .chamber-4 {
        margin-top: 40px;
    }
}

@media (max-width: 600px) {
    .hero-mandala {
        width: 90vw;
        height: 90vw;
    }

    .chamber {
        padding: 2rem 1rem;
        min-height: 60vh;
    }

    .chamber-heading {
        font-size: clamp(1.8rem, 5vw, 3rem);
    }

    .breathing-space {
        min-height: 20vh;
    }

    .bg-fish {
        display: none;
    }
}

/* --- Radial gradient overlays for visual panels --- */
.chamber-visual::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 40%, #0F1B4A 85%);
    pointer-events: none;
    z-index: 1;
    opacity: 0.4;
}

.chamber-visual {
    position: relative;
}

.chamber-visual svg {
    position: relative;
    z-index: 2;
}

/* --- Custom cursor hue shift on interactive elements --- */
@media (pointer: fine) {
    .hero-title:hover,
    .chamber-heading:hover {
        cursor: default;
    }

    .float-fish:hover,
    .hero-fish:hover,
    .diagram-fish:hover {
        cursor: pointer;
    }
}

/* --- Section background gradient overlays --- */
.chamber::before {
    content: '';
    position: absolute;
    top: -10%;
    left: 0;
    width: 100%;
    height: 120%;
    background: radial-gradient(ellipse at 50% 50%, rgba(26, 47, 92, 0.3) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

.chamber-1::before { background: radial-gradient(ellipse at 30% 50%, #1A2F5C 0%, transparent 60%); }
.chamber-2::before { background: radial-gradient(ellipse at 70% 50%, #1A2F5C 0%, transparent 60%); }
.chamber-3::before { background: radial-gradient(ellipse at 30% 50%, rgba(26, 47, 92, 0.35) 0%, transparent 60%); }
.chamber-4::before { background: radial-gradient(ellipse at 70% 50%, rgba(26, 47, 92, 0.35) 0%, transparent 60%); }
.chamber-5::before { background: radial-gradient(ellipse at 30% 50%, rgba(26, 47, 92, 0.3) 0%, transparent 60%); }

/* Fish margin decorations (top/bottom of chambers) */
.chamber::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 5%;
    width: 90%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.1) 20%, rgba(192, 192, 192, 0.08) 50%, rgba(212, 175, 55, 0.1) 80%, transparent);
    pointer-events: none;
}
