/* ===========================================================================
   gabs.report - fairycore field-report from a freshwater coral reef
   ---------------------------------------------------------------------------
   palette (golden-hour reef gradient):
     #FFD7B5 surface honey   #F8A2C8 coral fairy   #FFEFCB parchment cream
     #7BC4D9 photic teal     #2E4A6B deep pool     #E8B23C amber lens-flare
     #C4E5D8 spirogyra mint  #3D2A1F silt brown
   typography: Poiret One (display), Quicksand (caption), Caveat (marginalia)
   =========================================================================== */

:root {
    --c-surface-honey: #FFD7B5;
    --c-coral-fairy: #F8A2C8;
    --c-parchment: #FFEFCB;
    --c-photic-teal: #7BC4D9;
    --c-deep-pool: #2E4A6B;
    --c-amber-flare: #E8B23C;
    --c-spirogyra: #C4E5D8;
    --c-silt: #3D2A1F;

    --f-display: 'Poiret One', 'Inter', serif;
    --f-caption: 'Quicksand', 'Inter', sans-serif;
    --f-handwrite: 'Caveat', 'Inter', cursive;

    /* cursor coupling */
    --cx: 0;
    --cy: 0;

    --ease-elastic: cubic-bezier(.34, 1.56, .64, 1);
}

/* ---------- reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%;
    overflow-x: hidden;
}

html { scroll-behavior: smooth; }

body {
    /* the continuous descent: a single uninterrupted gradient wash */
    min-height: 1000vh;
    background:
        linear-gradient(
            180deg,
            #FFD7B5 0%,
            #FFD7B5 6%,
            #F8A2C8 18%,
            #FFD7B5 28%,
            #7BC4D9 42%,
            #7BC4D9 60%,
            #2E4A6B 84%,
            #2E4A6B 96%,
            #3D2A1F 100%
        );
    background-attachment: fixed;
    color: var(--c-deep-pool);
    font-family: var(--f-caption);
    font-size: clamp(0.95rem, 1vw + 0.55rem, 1.05rem);
    line-height: 1.72;
    position: relative;
}

/* gentle, almost imperceptible texture suggesting water surface refraction */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(255, 239, 203, 0.18), transparent 55%),
        radial-gradient(ellipse at 70% 80%, rgba(123, 196, 217, 0.12), transparent 60%);
    mix-blend-mode: screen;
    pointer-events: none;
    z-index: 1;
}

/* ---------- depth gauge (only persistent UI) ---------- */
.depth-gauge {
    position: fixed;
    top: 50%;
    right: clamp(1rem, 4vw, 3rem);
    transform: translateY(-50%);
    z-index: 100;
    font-family: var(--f-display);
    color: var(--c-parchment);
    text-shadow: 0 0 14px rgba(46, 74, 107, 0.4);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    letter-spacing: 0.08em;
    pointer-events: none;
    mix-blend-mode: screen;
    user-select: none;
}

.depth-gauge__label {
    font-size: 0.78rem;
    text-transform: lowercase;
    letter-spacing: 0.32em;
    opacity: 0.78;
    font-family: var(--f-caption);
    font-weight: 400;
}

.depth-gauge__value {
    font-size: clamp(2.4rem, 4vw, 3.6rem);
    font-weight: 400;
    line-height: 1;
    margin: 0.18em 0 0.05em 0;
    letter-spacing: 0.04em;
}

.depth-gauge__value.bounce {
    animation: depth-bounce 0.32s var(--ease-elastic);
}

.depth-gauge__unit {
    font-family: var(--f-caption);
    font-weight: 500;
    font-size: 0.72rem;
    text-transform: lowercase;
    letter-spacing: 0.32em;
    opacity: 0.78;
}

@keyframes depth-bounce {
    0%   { transform: translateY(-4px); }
    60%  { transform: translateY(0.5px); }
    100% { transform: translateY(0); }
}

/* ---------- bubbles (ambient) ---------- */
.bubbles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    overflow: hidden;
}

.bubble {
    position: absolute;
    bottom: -40px;
    width: var(--size, 12px);
    height: var(--size, 12px);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255, 239, 203, 0.85), rgba(255, 239, 203, 0.18) 60%, transparent 75%);
    border: 1px solid rgba(255, 239, 203, 0.35);
    animation: bubble-rise var(--dur, 18s) linear infinite;
    animation-delay: var(--delay, 0s);
    left: var(--x, 50%);
    opacity: 0.85;
    mix-blend-mode: screen;
}

@keyframes bubble-rise {
    0%   { transform: translateY(0) translateX(0); opacity: 0; }
    8%   { opacity: 0.6; }
    50%  { transform: translateY(-50vh) translateX(8px); }
    100% { transform: translateY(-110vh) translateX(-6px); opacity: 0; }
}

/* ---------- silt particles (only on floor) ---------- */
.silt {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.silt-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--c-silt);
    opacity: 0.55;
    animation: silt-drift var(--dur, 40s) linear infinite;
    animation-delay: var(--delay, 0s);
    top: var(--y, 50%);
    left: -20px;
}

@keyframes silt-drift {
    0%   { transform: translateX(0); opacity: 0; }
    10%  { opacity: 0.6; }
    90%  { opacity: 0.6; }
    100% { transform: translateX(110vw); opacity: 0; }
}

/* ---------- six named lens-flares ---------- */
.flare {
    position: absolute;
    width: clamp(280px, 38vw, 540px);
    height: clamp(280px, 38vw, 540px);
    pointer-events: none;
    mix-blend-mode: screen;
    filter: blur(1px);
    z-index: 3;
}

.flare svg { width: 100%; height: 100%; display: block; }

/* drift animation: each flare moves slightly, none in sync */
@keyframes flare-drift-a {
    from { transform: translate(-50%, -50%) translate(-20px, -8px) rotate(0deg); }
    to   { transform: translate(-50%, -50%) translate(20px, 8px) rotate(360deg); }
}
@keyframes flare-drift-b {
    from { transform: translate(-50%, -50%) translate(18px, -6px) rotate(0deg); }
    to   { transform: translate(-50%, -50%) translate(-18px, 6px) rotate(-360deg); }
}
@keyframes flare-drift-c {
    from { transform: translate(-50%, -50%) translate(-14px, 4px) rotate(0deg); }
    to   { transform: translate(-50%, -50%) translate(14px, -4px) rotate(360deg); }
}

.flare--cordelia  { left: 18%; animation: flare-drift-a 90s linear infinite alternate; }
.flare--maribel   { left: 75%; animation: flare-drift-b 78s linear infinite alternate; }
.flare--ondine    { left: 50%; animation: flare-drift-c 82s linear infinite alternate; width: clamp(420px, 60vw, 820px); height: clamp(140px, 22vw, 300px); }
.flare--galadriel { left: 28%; animation: flare-drift-a 95s linear infinite alternate; }
.flare--pomelia   { left: 70%; animation: flare-drift-b 88s linear infinite alternate; }
.flare--sylvie    { left: 45%; animation: flare-drift-c 100s linear infinite alternate; }

/* ---------- the descent: nine zones ---------- */
.descent {
    position: relative;
    width: 100%;
    z-index: 5;
}

.zone {
    position: relative;
    width: 100%;
    padding: 6vh clamp(1.5rem, 6vw, 5rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* zone min-heights are proportional to depth-range so the descent feels true */
.zone--surface     { min-height: 100vh; padding-top: 12vh; }
.zone--angelfish   { min-height: 200vh; }
.zone--betta       { min-height: 140vh; }
.zone--discus      { min-height: 100vh; }
.zone--pearlscale  { min-height: 100vh; }
.zone--tetra       { min-height: 80vh; }
.zone--loach       { min-height: 80vh; }
.zone--gourami     { min-height: 60vh; }
.zone--floor       { min-height: 80vh; padding: 18vh clamp(1.5rem, 6vw, 5rem); }

/* ---------- zone 1: surface / wordmark ---------- */
.wordmark {
    font-family: var(--f-display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(5rem, 14vw, 14rem);
    line-height: 0.95;
    letter-spacing: 0.04em;
    color: var(--c-parchment);
    text-shadow:
        0 0 28px rgba(232, 178, 60, 0.45),
        0 0 60px rgba(248, 162, 200, 0.32);
    text-align: center;
    margin-top: 6vh;
    position: relative;
}

.wordmark em { font-style: italic; }

.wordmark__suffix {
    display: inline-block;
    font-size: 0.7em;
    transform: translate(0.16em, 0.42em);
    color: var(--c-amber-flare);
    text-shadow: 0 0 18px rgba(232, 178, 60, 0.55);
    letter-spacing: 0.02em;
}

.epigraph {
    font-family: var(--f-display);
    font-size: clamp(1.3rem, 1.8vw + 0.6rem, 2rem);
    font-weight: 400;
    line-height: 1.5;
    color: var(--c-deep-pool);
    max-width: 38ch;
    text-align: center;
    margin: 8vh auto 0;
    letter-spacing: 0.04em;
    text-shadow: 0 0 18px rgba(255, 239, 203, 0.55);
}

.epigraph--hint {
    margin-top: 6vh;
    font-family: var(--f-handwrite);
    font-size: clamp(1.05rem, 1.2vw + 0.45rem, 1.4rem);
    color: rgba(46, 74, 107, 0.6);
    letter-spacing: 0.02em;
    font-style: italic;
}

/* ---------- fish zones ---------- */
.zone--fish {
    flex-direction: column;
    align-items: stretch;
    gap: 4vh;
    position: relative;
}

.fish-stage {
    position: relative;
    width: min(620px, 90vw);
    margin: 4vh 0;
    align-self: center;
    aspect-ratio: 1.6 / 1;
}

.fish-stage--wide {
    width: min(720px, 92vw);
    aspect-ratio: 1.8 / 1;
}

.fish-stage--school {
    width: min(820px, 95vw);
    aspect-ratio: 2 / 1.2;
}

/* asymmetric placement of fish per design (left/right sway) */
.zone[data-fish-side="left"]  .fish-stage { align-self: flex-start; margin-left: clamp(1rem, 6vw, 6rem); }
.zone[data-fish-side="right"] .fish-stage { align-self: flex-end;   margin-right: clamp(1rem, 6vw, 6rem); }

/* fish swim-in (triggered by JS via .is-visible) */
.fish-stage {
    opacity: 0;
    transform: translateX(40vw) translateY(20px);
    transition: opacity 1.6s var(--ease-elastic), transform 1.6s var(--ease-elastic);
}
.zone[data-fish-side="left"]  .fish-stage { transform: translateX(-40vw) translateY(20px); }
.zone[data-fish-side="right"] .fish-stage { transform: translateX( 40vw) translateY(20px); }

.zone.is-visible .fish-stage {
    opacity: 1;
    transform: translateX(0) translateY(0);
}

.fish {
    width: 100%;
    height: 100%;
    overflow: visible;
    transition: transform 0.8s var(--ease-elastic);
}

.fish--angelfish { transform: rotate(-6deg); }
.zone.is-visible .fish--angelfish { transform: rotate(6deg); }

/* fish halo - lens-flare behind each fish */
.fish-halo {
    position: absolute;
    inset: -25%;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 50%, rgba(232, 178, 60, 0.55), rgba(232, 178, 60, 0.18) 40%, transparent 65%);
    filter: blur(28px);
    mix-blend-mode: screen;
    opacity: 0;
    transition: opacity 1.2s var(--ease-elastic) 0.6s;
    pointer-events: none;
    z-index: 0;
}
.zone.is-visible .fish-halo { opacity: 0.85; }

.fish-halo--coral  { background: radial-gradient(circle at 50% 50%, rgba(248, 162, 200, 0.65), rgba(248, 162, 200, 0.18) 40%, transparent 65%); }
.fish-halo--teal   { background: radial-gradient(circle at 50% 50%, rgba(123, 196, 217, 0.6),  rgba(123, 196, 217, 0.18) 40%, transparent 65%); }
.fish-halo--peach  { background: radial-gradient(circle at 50% 50%, rgba(255, 215, 181, 0.7),  rgba(255, 215, 181, 0.2)  40%, transparent 65%); }
.fish-halo--neon   { background: radial-gradient(circle at 50% 50%, rgba(248, 162, 200, 0.55), rgba(123, 196, 217, 0.35) 40%, transparent 65%); }
.fish-halo--amber  { background: radial-gradient(circle at 50% 50%, rgba(232, 178, 60, 0.7),   rgba(232, 178, 60, 0.18)  40%, transparent 65%); }
.fish-halo--indigo { background: radial-gradient(circle at 50% 50%, rgba(196, 229, 216, 0.6),  rgba(46, 74, 107, 0.25)   40%, transparent 65%); }

/* fish svg layers above halo */
.fish { position: relative; z-index: 1; }

/* eye coupling: bound at runtime with --eye-base offset; here we shift via translate */
.fish-eye, .fish-eye-light {
    transition: transform 0.18s ease-out;
    transform: translateY(calc(var(--cy) * 3px));
}
.fish-eye-light { transform: translateY(calc(var(--cy) * 3px)) translateX(calc(var(--cx) * 2px)); }

/* ---------- quote blocks ---------- */
.quote-block {
    max-width: 36ch;
    padding: 1rem 0;
    opacity: 0;
    transform: translateY(48px) scale(0.96);
    transition: none;
}

.quote-block--right { align-self: flex-end; margin-right: clamp(1rem, 8vw, 8rem); text-align: left; }
.quote-block--left  { align-self: flex-start; margin-left: clamp(1rem, 12vw, 12rem); text-align: left; }

.zone.is-visible .quote-block {
    animation: bounce-enter 0.9s var(--ease-elastic) 0.45s forwards;
}

@keyframes bounce-enter {
    0%   { transform: translateY(48px) scale(0.96); opacity: 0; }
    60%  { transform: translateY(-6px) scale(1.01); opacity: 1; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.quote {
    font-family: var(--f-display);
    font-size: clamp(2.2rem, 5vw, 4.2rem);
    font-weight: 400;
    line-height: 1.12;
    letter-spacing: 0.04em;
    color: var(--c-deep-pool);
    text-shadow: 0 1px 14px rgba(255, 239, 203, 0.45);
    quotes: """ """;
}

/* darker zones get cream type for legibility */
.zone--tetra .quote,
.zone--loach .quote,
.zone--gourami .quote {
    color: var(--c-parchment);
    text-shadow: 0 0 22px rgba(46, 74, 107, 0.55);
}

.caption {
    font-family: var(--f-caption);
    font-weight: 400;
    font-size: clamp(0.92rem, 1vw + 0.45rem, 1.05rem);
    line-height: 1.72;
    color: rgba(61, 42, 31, 0.85);
    margin-top: 1.4rem;
    max-width: 32ch;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.9s var(--ease-elastic) 1.05s, transform 0.9s var(--ease-elastic) 1.05s;
}

.zone.is-visible .caption { opacity: 1; transform: translateY(0); }

.caption em { font-style: italic; font-weight: 500; color: var(--c-deep-pool); }
.caption strong { font-weight: 500; color: var(--c-amber-flare); }

.zone--tetra .caption,
.zone--loach .caption,
.zone--gourami .caption {
    color: rgba(255, 239, 203, 0.78);
}
.zone--tetra .caption em,
.zone--loach .caption em,
.zone--gourami .caption em { color: var(--c-parchment); }

/* ---------- reporter beti's marginalia ---------- */
.margin-note {
    font-family: var(--f-handwrite);
    color: rgba(74, 58, 124, 0.78);
    font-size: clamp(0.95rem, 1vw + 0.35rem, 1.15rem);
    line-height: 1.45;
    max-width: 22ch;
    position: relative;
    padding: 0.4rem 0;
    margin: 2rem 0;
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.9s var(--ease-elastic) 1.4s, transform 0.9s var(--ease-elastic) 1.4s;
    font-style: italic;
}

.zone.is-visible .margin-note { opacity: 1; transform: translateY(0); }

.margin-note--top   { align-self: center; text-align: center; max-width: 30ch; margin-top: 8vh; }
.margin-note--left  { align-self: flex-start; margin-left: clamp(1rem, 4vw, 3rem); }
.margin-note--right { align-self: flex-end;   margin-right: clamp(1rem, 4vw, 3rem); text-align: right; }

.margin-note__time {
    display: inline-block;
    font-family: var(--f-caption);
    font-weight: 500;
    font-size: 0.78em;
    color: rgba(74, 58, 124, 0.5);
    letter-spacing: 0.16em;
    margin-right: 0.5em;
    text-transform: lowercase;
    font-style: normal;
}

.margin-note__body { display: inline; }

.margin-note__pencil {
    display: block;
    width: 100%;
    height: 4px;
    margin-top: 0.35rem;
    stroke-dasharray: 120;
    stroke-dashoffset: 120;
    transition: stroke-dashoffset 1.2s ease 1.7s;
}
.zone.is-visible .margin-note__pencil { stroke-dashoffset: 0; }

.zone--floor .margin-note,
.zone--gourami .margin-note,
.zone--loach .margin-note {
    color: rgba(196, 229, 216, 0.85);
}
.zone--floor .margin-note__time,
.zone--gourami .margin-note__time,
.zone--loach .margin-note__time {
    color: rgba(196, 229, 216, 0.55);
}

/* ---------- zone 9: floor / silt letter ---------- */
.zone--floor {
    color: var(--c-parchment);
    text-align: center;
}

.silt-letter {
    max-width: 52ch;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    background: linear-gradient(180deg, rgba(255, 239, 203, 0.06), rgba(196, 229, 216, 0.04));
    border-top: 1px solid rgba(196, 229, 216, 0.18);
    border-bottom: 1px solid rgba(196, 229, 216, 0.18);
    position: relative;
    z-index: 5;
}

.silt-letter__heading {
    font-family: var(--f-handwrite);
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1.6rem, 2vw + 0.6rem, 2.2rem);
    color: var(--c-spirogyra);
    letter-spacing: 0.02em;
    margin-bottom: 1.5rem;
}

.silt-letter__body {
    font-family: var(--f-display);
    font-size: clamp(1.3rem, 1.8vw + 0.5rem, 2.1rem);
    line-height: 1.4;
    color: var(--c-parchment);
    letter-spacing: 0.04em;
    text-shadow: 0 0 18px rgba(232, 178, 60, 0.25);
    margin-bottom: 2.6rem;
}

.silt-letter__credits {
    font-family: var(--f-caption);
    font-size: 0.92rem;
    line-height: 1.9;
    color: rgba(196, 229, 216, 0.78);
    letter-spacing: 0.06em;
    margin-bottom: 2rem;
}
.credit {
    display: inline-block;
    margin: 0 0.5rem;
    color: var(--c-amber-flare);
    font-weight: 500;
}

.silt-letter__sign {
    font-family: var(--f-handwrite);
    font-style: italic;
    font-size: 1.4rem;
    color: var(--c-spirogyra);
}

/* ---------- responsive trims ---------- */
@media (max-width: 720px) {
    .zone[data-fish-side="left"]  .fish-stage,
    .zone[data-fish-side="right"] .fish-stage { align-self: center; margin-left: 0; margin-right: 0; }
    .quote-block--left, .quote-block--right { align-self: center; margin: 1.5rem auto; text-align: left; max-width: 92vw; padding: 0 1rem; }
    .margin-note--left, .margin-note--right { align-self: center; margin-left: 1rem; margin-right: 1rem; text-align: left; }
    .depth-gauge { right: 0.6rem; }
    .depth-gauge__value { font-size: 1.8rem; }
    .wordmark { font-size: clamp(3.5rem, 16vw, 7rem); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
