/* ==========================================================================
   chloengine.com — Deep-Sea Descent
   Street-style luxury meets oceanic grandeur
   ========================================================================== */

/* --- CSS Custom Properties --- */
:root {
    --deep-ocean: #0a1628;
    --abyssal-blue: #1b3a5c;
    --coral-flash: #e8706a;
    --burnished-gold: #d4a574;
    --pearl-mist: #e8edf2;
    --slate-whisper: #c8d6e5;
    --reef-teal: #1a8a7d;
    --volcanic-shadow: #060d17;
    --panel2-bg: #0d1a30;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Source Serif 4', 'Georgia', serif;
    --font-accent: 'DM Sans', 'Helvetica Neue', sans-serif;
}

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

html {
    scroll-behavior: smooth;
    overflow: hidden;
    height: 100%;
}

body {
    background-color: var(--volcanic-shadow);
    color: var(--pearl-mist);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    overflow: hidden;
    height: 100%;
    transition: background-color 0.2s ease;
}

/* --- Scroll Container (snap) --- */
#scroll-container {
    height: 100vh;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

/* --- Panel Base --- */
.panel {
    min-height: 100vh;
    width: 100%;
    position: relative;
    scroll-snap-align: start;
    overflow: hidden;
    display: flex;
}

/* --- Progress Indicator --- */
#progress-indicator {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 18px;
    z-index: 100;
}

.progress-diamond {
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.diamond-shape {
    display: block;
    width: 10px;
    height: 10px;
    border: 1.5px solid var(--burnished-gold);
    transform: rotate(45deg);
    transition: background-color 0.4s ease-out, border-color 0.4s ease-out;
    background-color: transparent;
}

.progress-diamond.active .diamond-shape {
    background-color: var(--burnished-gold);
    border-color: var(--burnished-gold);
}

/* --- Waterline Dividers --- */
.waterline-divider {
    height: 8px;
    width: 100%;
    background: linear-gradient(90deg, var(--deep-ocean), var(--abyssal-blue), var(--deep-ocean));
    position: relative;
    scroll-snap-align: none;
    flex-shrink: 0;
}

.wave-svg {
    position: absolute;
    top: -4px;
    left: 0;
    width: 100%;
    height: 16px;
}

.wave-path {
    stroke-dasharray: 20 10;
    animation: waveFlow 4s linear infinite;
}

@keyframes waveFlow {
    to {
        stroke-dashoffset: -60;
    }
}

/* --- Caustic Water Pattern --- */
.caustic-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 80% 60% at 20% 30%, rgba(27, 58, 92, 0.25) 0%, transparent 70%),
        radial-gradient(ellipse 60% 80% at 80% 70%, rgba(27, 58, 92, 0.2) 0%, transparent 70%),
        radial-gradient(ellipse 50% 50% at 50% 50%, rgba(27, 58, 92, 0.15) 0%, transparent 60%);
    animation: causticShift 60s ease-in-out infinite alternate;
}

.caustic-closing {
    animation-direction: alternate-reverse;
    animation-duration: 45s;
}

@keyframes causticShift {
    0% {
        background-position: 0% 0%, 100% 100%, 50% 50%;
    }
    33% {
        background-position: 30% 20%, 70% 80%, 40% 60%;
    }
    66% {
        background-position: 60% 40%, 40% 60%, 60% 40%;
    }
    100% {
        background-position: 100% 100%, 0% 0%, 50% 50%;
    }
}

/* --- Label Accent --- */
.label-accent {
    font-family: var(--font-accent);
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--burnished-gold);
    display: inline-block;
}

/* --- Section Headings --- */
.section-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: -0.03em;
    line-height: 0.95;
    color: var(--pearl-mist);
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

/* --- Body Text --- */
.body-text {
    font-family: var(--font-body);
    color: var(--slate-whisper);
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    line-height: 1.7;
    max-width: 540px;
}

/* ==========================================================================
   PANEL 1 — HERO
   ========================================================================== */
.panel-hero {
    background-color: var(--volcanic-shadow);
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 8% 8%;
    transition: background-color 1.2s ease-out;
}

.panel-hero.loaded {
    background-color: var(--deep-ocean);
}

/* Angelfish SVG */
.hero-angelfish {
    position: absolute;
    width: 40vw;
    min-width: 320px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%);
    z-index: 1;
    opacity: 0.85;
}

.fish-draw {
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    animation: drawFish 2.5s ease-in-out forwards;
    animation-delay: 0.3s;
}

@keyframes drawFish {
    to {
        stroke-dashoffset: 0;
    }
}

/* Hero Content */
.hero-content {
    position: relative;
    z-index: 2;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3.5rem, 10vw, 9rem);
    letter-spacing: -0.03em;
    line-height: 0.95;
    color: var(--pearl-mist);
    opacity: 0;
}

.hero-title.visible {
    opacity: 1;
}

.hero-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.hero-title .char.revealed {
    opacity: 1;
    transform: translateY(0);
}

.hero-subtitle {
    font-family: var(--font-body);
    font-style: italic;
    font-size: clamp(1rem, 1.8vw, 1.5rem);
    color: var(--slate-whisper);
    margin-top: 0.75rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.hero-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Scroll Prompt */
.scroll-prompt {
    position: absolute;
    bottom: 3%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.scroll-prompt.visible {
    animation: pulseAttention 2s ease-in-out infinite;
}

@keyframes pulseAttention {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* ==========================================================================
   PANEL 2 — PHILOSOPHY
   ========================================================================== */
.panel-philosophy {
    background-color: var(--panel2-bg);
    flex-direction: column;
    justify-content: space-between;
    padding: 8%;
    position: relative;
}

.philosophy-top {
    align-self: flex-end;
    text-align: right;
    max-width: 560px;
    position: relative;
    z-index: 2;
}

.philosophy-bottom {
    align-self: flex-start;
    text-align: left;
    max-width: 560px;
    position: relative;
    z-index: 2;
}

.philosophy-bottom .body-text {
    text-align: left;
}

.philosophy-top .body-text {
    text-align: right;
    margin-left: auto;
}

/* Swimming fish in philosophy section */
.swimming-fish {
    position: absolute;
    width: 18vw;
    min-width: 140px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    opacity: 0.7;
    animation: fishSwimDrift 8s ease-in-out infinite alternate;
}

@keyframes fishSwimDrift {
    0% {
        transform: translate(-60%, -50%) rotate(-2deg);
    }
    50% {
        transform: translate(-40%, -55%) rotate(1deg);
    }
    100% {
        transform: translate(-50%, -45%) rotate(-1deg);
    }
}

/* Gear backgrounds */
.gear-bg {
    position: absolute;
    opacity: 0.15;
    pointer-events: none;
    z-index: 0;
}

.gear-bg-1 {
    width: 500px;
    height: 500px;
    top: -100px;
    left: -150px;
    animation: gearSpin 120s linear infinite;
}

.gear-bg-2 {
    width: 600px;
    height: 600px;
    bottom: -150px;
    right: -200px;
    animation: gearSpin 120s linear infinite reverse;
}

@keyframes gearSpin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   PANEL 3 — SHOWCASE
   ========================================================================== */
.panel-showcase {
    background-color: var(--deep-ocean);
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 8% 8% 8% 8%;
}

.showcase-label {
    margin-bottom: 0.5rem;
}

.showcase-heading {
    margin-bottom: 2rem;
}

/* Showcase Strip */
.showcase-strip {
    display: flex;
    gap: 24px;
    width: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 16px 0;
    cursor: grab;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--abyssal-blue) transparent;
}

.showcase-strip:active {
    cursor: grabbing;
}

.showcase-strip::-webkit-scrollbar {
    height: 4px;
}

.showcase-strip::-webkit-scrollbar-track {
    background: transparent;
}

.showcase-strip::-webkit-scrollbar-thumb {
    background: var(--abyssal-blue);
    border-radius: 2px;
}

/* Showcase Cards */
.showcase-card {
    flex: 0 0 280px;
    height: 360px;
    background-color: var(--abyssal-blue);
    border-radius: 16px;
    border: 1px solid rgba(212, 165, 116, 0.3);
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: border-color 0.3s ease, transform 0.3s ease;
    scroll-snap-align: center;
}

.showcase-card:hover {
    border-color: var(--burnished-gold);
}

.showcase-card:hover .card-fish {
    animation: fishSwimCard 2s ease-in-out infinite;
}

@keyframes fishSwimCard {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(8px); }
}

.card-fish {
    width: 120px;
    height: 120px;
    margin-bottom: 16px;
    transition: transform 0.3s ease;
}

.card-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    color: var(--pearl-mist);
    margin-bottom: 8px;
}

.card-desc {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--slate-whisper);
    line-height: 1.5;
}

/* Fish School */
.fish-school {
    display: flex;
    gap: 20px;
    margin-top: 2rem;
    overflow: visible;
    width: 100%;
    justify-content: center;
}

.tiny-fish {
    width: clamp(3vw, 4vw, 5vw);
    min-width: 35px;
    opacity: 0.6;
}

.tf-1 { animation: schoolSwim 5s ease-in-out 0s infinite; }
.tf-2 { animation: schoolSwim 5s ease-in-out 0.15s infinite; }
.tf-3 { animation: schoolSwim 5s ease-in-out 0.3s infinite; }
.tf-4 { animation: schoolSwim 5s ease-in-out 0.45s infinite; }
.tf-5 { animation: schoolSwim 5s ease-in-out 0.6s infinite; }
.tf-6 { animation: schoolSwim 5s ease-in-out 0.75s infinite; }
.tf-7 { animation: schoolSwim 5s ease-in-out 0.9s infinite; }

@keyframes schoolSwim {
    0%, 100% {
        transform: translateX(0) translateY(0);
    }
    25% {
        transform: translateX(12px) translateY(-4px);
    }
    50% {
        transform: translateX(24px) translateY(0);
    }
    75% {
        transform: translateX(12px) translateY(4px);
    }
}

/* ==========================================================================
   PANEL 4 — DETAIL (Typography Statement)
   ========================================================================== */
.panel-detail {
    background-color: var(--volcanic-shadow);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 8%;
    text-align: center;
}

.detail-content {
    position: relative;
    z-index: 2;
}

.detail-statement {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(4rem, 12vw, 10rem);
    letter-spacing: -0.03em;
    line-height: 0.95;
    background: linear-gradient(45deg, var(--slate-whisper), var(--burnished-gold));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 200%;
    animation: gradientShift 8s ease infinite alternate;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 100% 50%;
    }
}

/* ==========================================================================
   PANEL 5 — CLOSING
   ========================================================================== */
.panel-closing {
    background-color: var(--panel2-bg);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 8%;
}

.closing-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.closing-title {
    font-family: var(--font-display);
    font-weight: 900;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: -0.03em;
    line-height: 0.95;
    color: var(--pearl-mist);
}

.closing-text {
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.4vw, 1.3rem);
    color: var(--slate-whisper);
    max-width: 600px;
    line-height: 1.7;
}

.closing-fish-row {
    display: flex;
    gap: 40px;
    margin-top: 2rem;
}

.closing-fish {
    width: 60px;
    opacity: 0.8;
    transition: transform 0.3s ease;
}

.cf-1 { animation: closingSwim 6s ease-in-out 0s infinite; }
.cf-2 { animation: closingSwim 6s ease-in-out 0.5s infinite; }
.cf-3 { animation: closingSwim 6s ease-in-out 1s infinite; }

@keyframes closingSwim {
    0%, 100% { transform: translateY(0) translateX(0); }
    25% { transform: translateY(-6px) translateX(4px); }
    50% { transform: translateY(0) translateX(8px); }
    75% { transform: translateY(6px) translateX(4px); }
}

/* ==========================================================================
   SHAKE ANIMATION
   ========================================================================== */
@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
    100% { transform: translateX(0); }
}

.shaking {
    animation: shake 0.3s ease-in-out;
}

/* ==========================================================================
   TRANSITION FISH (spawned on scroll between panels)
   ========================================================================== */
#transition-fish-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    overflow: hidden;
}

.transition-fish-el {
    position: absolute;
    width: 40px;
    height: 25px;
    animation: dartAcross 0.8s ease-in-out forwards;
}

@keyframes dartAcross {
    0% {
        transform: translateX(-60px) translateY(0);
        opacity: 0.8;
    }
    50% {
        transform: translateX(50vw) translateY(-15px);
        opacity: 0.9;
    }
    100% {
        transform: translateX(105vw) translateY(5px);
        opacity: 0;
    }
}

/* ==========================================================================
   MOBILE ADAPTATIONS
   ========================================================================== */
@media (max-width: 768px) {
    .panel-hero {
        padding: 5%;
    }

    .hero-angelfish {
        width: 70vw;
    }

    .philosophy-top,
    .philosophy-bottom {
        max-width: 100%;
    }

    .philosophy-top {
        align-self: flex-start;
        text-align: left;
    }

    .philosophy-top .body-text {
        text-align: left;
        margin-left: 0;
    }

    .swimming-fish {
        width: 30vw;
        opacity: 0.4;
    }

    .panel-showcase {
        padding: 5%;
    }

    .showcase-strip {
        flex-direction: column;
        overflow-x: visible;
        overflow-y: visible;
        scroll-snap-type: none;
        gap: 20px;
        height: auto;
    }

    .showcase-card {
        flex: 0 0 auto;
        height: auto;
        min-height: 300px;
        width: 85%;
    }

    .showcase-card:nth-child(odd) {
        align-self: flex-start;
    }

    .showcase-card:nth-child(even) {
        align-self: flex-end;
    }

    .panel-showcase {
        min-height: auto;
        scroll-snap-align: start;
    }

    .fish-school {
        flex-wrap: wrap;
        gap: 12px;
    }

    .gear-bg-1 {
        width: 300px;
        height: 300px;
    }

    .gear-bg-2 {
        width: 350px;
        height: 350px;
    }

    .closing-fish-row {
        gap: 24px;
    }

    #progress-indicator {
        right: 12px;
        gap: 14px;
    }
}
