/* =============================================
   CONTINUA.QUEST - Drowned Palace Stylesheet
   ============================================= */

/* --- CSS Custom Properties --- */
:root {
    --abyssal-navy: #0A1628;
    --midnight-indigo: #0F1F3A;
    --antique-gold: #D4AF37;
    --pale-gold: #E8D5A3;
    --reef-teal: #2EC4B6;
    --silver-mist: #B8C4D4;
    --pewter: #8A96A8;
    --trench-black: #050D1A;

    --caustic-opacity: 0.06;
    --hud-opacity: 0.4;
    --particle-speed: 1;
}

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

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

body {
    background-color: var(--trench-black);
    color: var(--silver-mist);
    font-family: 'Newsreader', 'Georgia', serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.2vw + 0.6rem, 1.35rem);
    line-height: 1.78;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Caustic Light Background --- */
#caustic-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: var(--caustic-opacity);
}

#caustic-bg::before,
#caustic-bg::after {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
}

#caustic-bg::before {
    background:
        radial-gradient(ellipse 600px 400px at 30% 40%, var(--antique-gold) 0%, transparent 70%),
        radial-gradient(ellipse 500px 350px at 70% 60%, var(--antique-gold) 0%, transparent 70%),
        radial-gradient(ellipse 400px 300px at 50% 30%, var(--antique-gold) 0%, transparent 70%),
        radial-gradient(ellipse 550px 380px at 20% 70%, var(--antique-gold) 0%, transparent 70%);
    animation: causticDrift1 60s linear infinite;
}

#caustic-bg::after {
    background:
        radial-gradient(ellipse 450px 320px at 60% 50%, var(--antique-gold) 0%, transparent 70%),
        radial-gradient(ellipse 380px 280px at 40% 70%, var(--antique-gold) 0%, transparent 70%),
        radial-gradient(ellipse 520px 360px at 80% 30%, var(--antique-gold) 0%, transparent 70%);
    animation: causticDrift2 45s linear infinite;
}

@keyframes causticDrift1 {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-3%, 2%) rotate(2deg); }
    50% { transform: translate(2%, -1%) rotate(-1deg); }
    75% { transform: translate(-1%, -2%) rotate(1.5deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes causticDrift2 {
    0% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(2%, -3%) rotate(-2deg); }
    66% { transform: translate(-2%, 1%) rotate(1deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

/* --- Gold Particle Drift --- */
#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--antique-gold);
    opacity: 0;
    animation: particleRise linear infinite;
}

@keyframes particleRise {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    5% {
        opacity: var(--p-opacity, 0.2);
    }
    90% {
        opacity: var(--p-opacity, 0.2);
    }
    100% {
        transform: translateY(-20vh) rotate(180deg);
        opacity: 0;
    }
}

/* --- HUD Frame --- */
#hud-frame {
    position: fixed;
    top: 12px;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    animation: hudFadeIn 1.5s ease-out 0.3s forwards;
}

@keyframes hudFadeIn {
    to { opacity: var(--hud-opacity); }
}

/* HUD Edge Lines */
.hud-line {
    position: absolute;
    background: var(--antique-gold);
}

.hud-line-top {
    top: 0;
    left: 60px;
    right: 60px;
    height: 1px;
}

.hud-line-bottom {
    bottom: 0;
    left: 60px;
    right: 60px;
    height: 1px;
}

.hud-line-left {
    left: 0;
    top: 60px;
    bottom: 60px;
    width: 1px;
}

.hud-line-right {
    right: 0;
    top: 60px;
    bottom: 60px;
    width: 1px;
}

/* HUD Corners */
.hud-corner {
    position: absolute;
    width: 60px;
    height: 60px;
}

.hud-corner-tl { top: 0; left: 0; }
.hud-corner-tr { top: 0; right: 0; }
.hud-corner-bl { bottom: 0; left: 0; }
.hud-corner-br { bottom: 0; right: 0; }

/* HUD Readouts */
.hud-readout {
    position: absolute;
    font-family: 'Newsreader', serif;
    font-style: italic;
    font-size: 11px;
    color: var(--antique-gold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.hud-tl {
    top: 6px;
    left: 70px;
}

.hud-tr {
    top: 6px;
    right: 70px;
}

.hud-bl {
    bottom: 6px;
    left: 70px;
}

.hud-br {
    bottom: 4px;
    right: 70px;
    display: flex;
    align-items: center;
}

#compass-rose {
    transition: transform 0.1s linear;
}

/* --- Main Content --- */
#content {
    position: relative;
    z-index: 1;
}

/* --- Stratum Sections --- */
.stratum {
    position: relative;
    padding: 0 calc(12px + 60px + 24px);
}

/* Stratum 1: The Surface */
.stratum-surface {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--trench-black);
}

.surface-content {
    text-align: center;
    opacity: 0;
    animation: surfaceFadeIn 2s ease-out 1.8s forwards;
}

@keyframes surfaceFadeIn {
    to { opacity: 1; }
}

.title-main {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(2.4rem, 5vw + 1rem, 5.6rem);
    color: var(--antique-gold);
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 0.2em;
}

.title-sub {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-style: italic;
    font-size: clamp(1.4rem, 3vw + 0.4rem, 3rem);
    color: var(--reef-teal);
    letter-spacing: 0.3em;
    margin-bottom: 2em;
}

.hero-fish {
    display: flex;
    justify-content: center;
}

.discus-fish {
    width: clamp(250px, 40vw, 500px);
    height: auto;
    animation: slowRotate 30s linear infinite;
}

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

/* --- Stratum 2: The Gallery --- */
.stratum-gallery {
    padding-top: 80px;
    padding-bottom: 80px;
    background: linear-gradient(to bottom, var(--abyssal-navy), var(--midnight-indigo));
}

/* --- Stratum 3: The Throne Room --- */
.stratum-throne {
    padding-top: 80px;
    padding-bottom: 80px;
    background: var(--midnight-indigo);
}

/* --- Stratum 4: The Deep Archive --- */
.stratum-archive {
    padding-top: 80px;
    padding-bottom: 80px;
    background: linear-gradient(to bottom, var(--midnight-indigo), var(--trench-black));
}

/* --- Stratum 5: The Abyss --- */
.stratum-abyss {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 80px;
    padding-bottom: 80px;
    background: var(--trench-black);
}

.abyss-content {
    max-width: 580px;
    text-align: center;
    margin: 0 auto;
}

.text-abyss {
    color: var(--pewter);
    opacity: 0.7;
    margin-bottom: 2em;
    font-weight: 300;
}

.closing-mark {
    color: var(--antique-gold);
    opacity: 0.2;
    font-size: 2rem;
    margin-top: 3em;
}

.final-space {
    height: 30vh;
    background: var(--trench-black);
}

/* --- Content Blocks --- */
.content-block {
    position: relative;
    max-width: 55%;
    margin-bottom: 0;
}

.content-left {
    margin-right: auto;
    margin-left: 0;
}

.content-right {
    margin-left: auto;
    margin-right: 0;
}

.content-sparse {
    max-width: 48%;
}

.content-block-spacer {
    height: 200px;
}

.content-block-spacer-large {
    height: 260px;
}

/* --- Tether Lines --- */
.tether-line {
    position: absolute;
    top: 50%;
    height: 1px;
    background: var(--antique-gold);
    opacity: 0.2;
}

.tether-left {
    right: 100%;
    width: calc(12px + 60px + 24px);
    margin-right: 0;
}

.tether-right {
    left: 100%;
    width: calc(12px + 60px + 24px);
    margin-left: 0;
}

.tether-double::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--antique-gold);
    opacity: 0.15;
}

.tether-double::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--antique-gold);
    opacity: 0.15;
}

.tether-dim {
    opacity: 0.1;
}

/* --- Headings --- */
.heading-secondary {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.6rem, 3vw + 0.5rem, 3.2rem);
    color: var(--pale-gold);
    letter-spacing: 0em;
    margin-bottom: 0.8em;
    line-height: 1.2;
}

.heading-dim {
    color: var(--pale-gold);
    opacity: 0.6;
}

/* --- Body Text --- */
.body-text {
    color: var(--silver-mist);
    margin-bottom: 1.4em;
    font-weight: 300;
    transition: color 300ms ease;
}

.body-text:hover {
    color: var(--pale-gold);
}

.text-secondary {
    color: var(--pewter);
    font-weight: 300;
}

.text-secondary:hover {
    color: var(--silver-mist);
}

/* --- Anemone Border --- */
.anemone-border-top {
    margin-bottom: 1.5em;
}

.anemone-border-top svg {
    width: 100%;
    height: 30px;
}

/* --- Depth Gates --- */
.depth-gate {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(to bottom, var(--abyssal-navy), var(--trench-black), var(--abyssal-navy));
}

.depth-gate-deep {
    background: linear-gradient(to bottom, var(--midnight-indigo), var(--trench-black), var(--trench-black));
}

.depth-gate-abyss {
    background: var(--trench-black);
}

.gate-fish {
    position: absolute;
    opacity: 0;
}

.gate-fish.animate-gate {
    animation: fishDriftAcross 8s ease-in-out forwards;
}

.angelfish-gate {
    width: 250px;
    height: auto;
}

.discus-gate {
    width: 350px;
    height: auto;
}

.betta-gate {
    width: clamp(600px, 80vw, 1000px);
    height: auto;
}

.betta-gate-final {
    width: 300px;
    height: auto;
    opacity: 0.15;
}

.betta-gate-final.animate-gate {
    animation: fishDriftAcrossSlow 12s ease-in-out forwards;
}

@keyframes fishDriftAcross {
    0% {
        transform: translateX(60vw);
        opacity: 0;
    }
    15% {
        opacity: 0.6;
    }
    85% {
        opacity: 0.6;
    }
    100% {
        transform: translateX(-60vw);
        opacity: 0;
    }
}

@keyframes fishDriftAcrossSlow {
    0% {
        transform: translateX(50vw);
        opacity: 0;
    }
    15% {
        opacity: 0.2;
    }
    85% {
        opacity: 0.2;
    }
    100% {
        transform: translateX(-50vw);
        opacity: 0;
    }
}

/* --- Coral Panel (Throne Room) --- */
.coral-panel {
    width: 100%;
    margin-bottom: 60px;
}

.coral-border-band {
    width: 100%;
}

.coral-border-band svg {
    width: 100%;
    height: 40px;
}

.coral-border-bottom {
    margin-top: 0;
}

/* --- Pull Quote --- */
.pull-quote-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    padding: 60px 20px;
}

.pull-quote-angelfish svg {
    width: 60px;
    height: auto;
    opacity: 0.5;
}

.pull-quote-fish-left svg {
    transform: scaleX(1);
}

.pull-quote {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-style: italic;
    font-size: clamp(1.8rem, 4vw + 0.5rem, 4rem);
    color: var(--reef-teal);
    line-height: 1.4;
    max-width: 700px;
    text-align: center;
}

/* --- Reveal Animation --- */
.reveal-block {
    opacity: 0;
    transform: translateY(30px);
}

.reveal-block.visible {
    animation: revealUp 600ms ease-out forwards;
}

@keyframes revealUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger children */
.reveal-block.visible .heading-secondary {
    animation: revealUp 600ms ease-out 0ms forwards;
    opacity: 0;
    transform: translateY(20px);
}

.reveal-block.visible .body-text:nth-child(3) {
    animation: revealUp 600ms ease-out 150ms forwards;
    opacity: 0;
    transform: translateY(20px);
}

.reveal-block.visible .body-text:nth-child(4) {
    animation: revealUp 600ms ease-out 300ms forwards;
    opacity: 0;
    transform: translateY(20px);
}

.reveal-block.visible .pull-quote {
    animation: revealUp 600ms ease-out 200ms forwards;
    opacity: 0;
    transform: translateY(20px);
}

/* --- Link Styles --- */
a {
    color: var(--silver-mist);
    text-decoration: none;
    position: relative;
    transition: color 300ms ease;
}

a:hover {
    color: var(--reef-teal);
}

a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--reef-teal);
    transition: width 400ms ease-out;
}

a:hover::after {
    width: 100%;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .stratum {
        padding: 0 calc(12px + 30px + 16px);
    }

    .content-block {
        max-width: 90%;
    }

    .content-left,
    .content-right {
        margin-left: auto;
        margin-right: auto;
    }

    .content-sparse {
        max-width: 90%;
    }

    .content-block-spacer {
        height: 120px;
    }

    .content-block-spacer-large {
        height: 160px;
    }

    .tether-line {
        display: none;
    }

    .pull-quote-panel {
        flex-direction: column;
        gap: 20px;
        padding: 40px 10px;
    }

    .pull-quote-angelfish {
        display: none;
    }

    .hud-corner {
        width: 40px;
        height: 40px;
    }

    .hud-line-top,
    .hud-line-bottom {
        left: 40px;
        right: 40px;
    }

    .hud-line-left,
    .hud-line-right {
        top: 40px;
        bottom: 40px;
    }

    .hud-readout {
        font-size: 9px;
    }

    .hud-tl { left: 48px; }
    .hud-tr { right: 48px; }
    .hud-bl { left: 48px; }
    .hud-br { right: 48px; }
}

/* --- Selection --- */
::selection {
    background: var(--reef-teal);
    color: var(--trench-black);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--trench-black);
}

::-webkit-scrollbar-thumb {
    background: var(--antique-gold);
    opacity: 0.3;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--pale-gold);
}
