/* ============================================
   lower.bar — Submerged Academia
   ============================================ */

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

html {
    scroll-behavior: smooth;
}

body.descent {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    letter-spacing: 0.01em;
    line-height: 1.75;
    color: #3a3226;
    background-color: #f5efe0;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- Depth color states (controlled by JS) --- */
body.depth-mid {
    background-color: #0a3d4f;
    color: #e8dcc8;
}

body.depth-deep {
    background-color: #061a23;
    color: #e8dcc8;
}

/* --- Depth Gauge --- */
.depth-gauge {
    position: fixed;
    right: 20px;
    top: 0;
    bottom: 0;
    width: 30px;
    z-index: 100;
    pointer-events: none;
}

.gauge-track {
    position: absolute;
    right: 14px;
    top: 5%;
    bottom: 5%;
    width: 2px;
    background: #b8963e;
    opacity: 0.5;
}

.gauge-marker {
    position: absolute;
    right: 10px;
    top: 5%;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #00f0ff;
    box-shadow: 0 0 8px #00f0ff, 0 0 20px #00f0ff80;
    animation: pulse-glow 2s ease-in-out infinite alternate;
    transition: top 0.1s linear;
}

.gauge-label {
    position: absolute;
    right: 28px;
    font-family: 'Cormorant SC', serif;
    font-weight: 600;
    font-size: clamp(0.55rem, 1vw, 0.7rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #b8963e;
    white-space: nowrap;
    opacity: 0.7;
}

body.depth-mid .gauge-label,
body.depth-deep .gauge-label {
    color: #00f0ff;
}

@keyframes pulse-glow {
    from { box-shadow: 0 0 8px #00f0ff, 0 0 20px #00f0ff80; }
    to   { box-shadow: 0 0 14px #00f0ff, 0 0 35px #00f0ffaa; }
}

/* --- Zones --- */
.zone {
    position: relative;
    width: 100%;
}

.zone--surface {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, #f5efe0 0%, #f0e9d6 100%);
}

.zone--descent {
    padding: 6rem 0;
    background: transparent;
}

.zone--reading-room {
    padding: 6rem 0;
    background: transparent;
}

.zone--deep {
    padding: 6rem 0 10rem;
    background: transparent;
}

/* --- Hero --- */
.hero-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: #3a3226;
    text-align: center;
}

.hero-subtitle {
    font-family: 'Cormorant SC', serif;
    font-weight: 600;
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #b8963e;
    margin-top: 1rem;
}

.hero-chevron {
    font-size: 2.5rem;
    color: #b8963e;
    margin-top: 3rem;
    animation: bob 2.5s ease-in-out infinite;
    opacity: 0.6;
}

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

/* --- Content Blocks --- */
.content-block {
    max-width: 640px;
    padding: 3rem 2rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.content-block.visible {
    opacity: 1;
    transform: translateY(0);
}

.content-block--left {
    margin-left: 10%;
    margin-right: auto;
}

.content-block--right {
    margin-right: 10%;
    margin-left: auto;
}

.content-block--neon {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
    max-width: 700px;
}

.content-block--final {
    margin-top: 4rem;
}

.content-block h2 {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3.5rem);
    letter-spacing: -0.02em;
    line-height: 1.3;
    margin-bottom: 1.2rem;
    color: inherit;
}

.content-block p {
    line-height: 1.75;
    color: inherit;
}

.content-block p em {
    font-style: italic;
    color: #b8963e;
}

body.depth-mid .content-block p em,
body.depth-deep .content-block p em {
    color: #00f0ff;
}

/* --- Neon Headings (Deep zone) --- */
.neon-heading {
    color: #ff2d6f;
    text-shadow: 0 0 10px #ff2d6f, 0 0 30px #ff2d6f80, 0 0 60px #ff2d6f40;
    animation: neon-pulse 4s ease-in-out infinite alternate;
}

.neon-text {
    color: #e8dcc8;
}

@keyframes neon-pulse {
    0%   { text-shadow: 0 0 10px #ff2d6f, 0 0 30px #ff2d6f80, 0 0 60px #ff2d6f40; }
    100% { text-shadow: 0 0 20px #ff2d6f, 0 0 50px #ff2d6faa, 0 0 90px #ff2d6f60; }
}

/* --- Shelf Borders --- */
.shelf {
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(to right, transparent 5%, #b8963e 20%, #4a3508 80%, transparent 95%) 1;
    box-shadow: 0 2px 8px rgba(74, 53, 8, 0.3);
    padding-bottom: 2rem;
    margin-bottom: 2rem;
}

/* --- Spine Decorations --- */
.spine-decoration {
    width: 60%;
    margin: 3rem auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.spine-decoration::before,
.spine-decoration::after {
    content: '';
    display: block;
    width: 100%;
    height: 1px;
    background: #b8963e;
}

.spine-decoration::after {
    height: 1px;
}

/* Middle line via box-shadow trick */
.spine-decoration {
    height: 0;
    border-top: 1px solid #b8963e;
    border-bottom: 1px solid #b8963e;
    padding: 2px 0;
    background: transparent;
    position: relative;
}

.spine-decoration::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #b8963e;
    transform: translateY(-50%);
}

.spine-decoration::after {
    display: none;
}

.spine-decoration--neon {
    border-color: #ff2d6f;
}

.spine-decoration--neon::before {
    background: #ff2d6f;
    box-shadow: 0 0 8px #ff2d6f;
}

/* --- Aquarium Bands --- */
.aquarium-band {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    margin: 2rem 0;
}

.aquarium-band--dense {
    height: 300px;
}

/* --- Fish-layer containers --- */
.fish-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
    pointer-events: none;
}

.fish-layer--sparse {
    z-index: 1;
}

.fish-layer--swarm {
    position: relative;
    width: 100%;
    height: 350px;
    overflow: hidden;
    margin: 3rem 0;
}

/* --- CSS Tropical Fish --- */
.fish {
    position: absolute;
    display: flex;
    align-items: center;
}

/* Fish body */
.fish::before {
    content: '';
    display: block;
    border-radius: 50% 50% 40% 60%;
    position: relative;
}

/* Fish tail */
.fish::after {
    content: '';
    display: block;
    clip-path: polygon(0 50%, 100% 0, 100% 100%);
    position: relative;
}

/* Fish eye - via box-shadow on ::before */

/* --- Size variants --- */
.fish--small {
    width: 30px;
    height: 18px;
    opacity: 0.6;
}
.fish--small::before {
    width: 20px;
    height: 18px;
    box-shadow: inset 5px 4px 0 2px #061a23, inset 7px 4px 0 2px #fff;
}
.fish--small::after {
    width: 12px;
    height: 16px;
    margin-left: -4px;
}

.fish--medium {
    width: 50px;
    height: 30px;
    opacity: 0.75;
}
.fish--medium::before {
    width: 34px;
    height: 30px;
    box-shadow: inset 9px 7px 0 3px #061a23, inset 12px 7px 0 3px #fff;
}
.fish--medium::after {
    width: 20px;
    height: 26px;
    margin-left: -6px;
}

.fish--large {
    width: 80px;
    height: 48px;
    opacity: 0.85;
}
.fish--large::before {
    width: 54px;
    height: 48px;
    box-shadow: inset 14px 11px 0 4px #061a23, inset 18px 11px 0 4px #fff;
}
.fish--large::after {
    width: 32px;
    height: 42px;
    margin-left: -10px;
}

/* --- Color variants --- */
.fish--rose::before {
    background: #ff2d6f;
}
.fish--rose::after {
    background: #cc1a55;
}
.fish--rose {
    filter: drop-shadow(0 0 6px #ff2d6f80);
}

.fish--cyan::before {
    background: #00f0ff;
}
.fish--cyan::after {
    background: #00bfcc;
}
.fish--cyan {
    filter: drop-shadow(0 0 6px #00f0ff80);
}

.fish--chartreuse::before {
    background: #c8ff00;
}
.fish--chartreuse::after {
    background: #9ecc00;
}
.fish--chartreuse {
    filter: drop-shadow(0 0 6px #c8ff0080);
}

/* --- Direction variants --- */
.fish--ltr {
    animation: swim-ltr 22s linear infinite, swim-wobble 3s ease-in-out infinite alternate;
}
.fish--rtl {
    flex-direction: row-reverse;
    animation: swim-rtl 25s linear infinite, swim-wobble 3.5s ease-in-out infinite alternate;
}
.fish--rtl::after {
    clip-path: polygon(100% 50%, 0 0, 0 100%);
    margin-left: 0;
    margin-right: -4px;
}
.fish--rtl.fish--medium::after { margin-right: -6px; margin-left: 0; }
.fish--rtl.fish--large::after { margin-right: -10px; margin-left: 0; }

/* Deep zone fish glow intensified */
.fish--deep {
    filter: brightness(1.3);
}
.fish--deep.fish--rose {
    filter: brightness(1.3) drop-shadow(0 0 12px #ff2d6f) drop-shadow(0 0 24px #ff2d6f60);
}
.fish--deep.fish--cyan {
    filter: brightness(1.3) drop-shadow(0 0 12px #00f0ff) drop-shadow(0 0 24px #00f0ff60);
}
.fish--deep.fish--chartreuse {
    filter: brightness(1.3) drop-shadow(0 0 12px #c8ff00) drop-shadow(0 0 24px #c8ff0060);
}

/* --- Fish Animations --- */
@keyframes swim-ltr {
    from { transform: translateX(-100px); }
    to   { transform: translateX(calc(100vw + 100px)); }
}

@keyframes swim-rtl {
    from { transform: translateX(calc(100vw + 100px)); }
    to   { transform: translateX(-100px); }
}

@keyframes swim-wobble {
    0%   { margin-top: -15px; rotate: -5deg; }
    100% { margin-top: 15px; rotate: 5deg; }
}

/* --- Bubbles --- */
.bubble {
    position: fixed;
    border-radius: 50%;
    border: 1px solid rgba(0, 240, 255, 0.3);
    background: transparent;
    pointer-events: none;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.5s;
}

body.depth-mid .bubble,
body.depth-deep .bubble {
    opacity: 1;
}

.bubble--1  { width: 8px;  height: 8px;  left: 12%; animation: rise 28s linear infinite; animation-delay: -2s; }
.bubble--2  { width: 6px;  height: 6px;  left: 25%; animation: rise 35s linear infinite; animation-delay: -8s; }
.bubble--3  { width: 10px; height: 10px; left: 40%; animation: rise 22s linear infinite; animation-delay: -15s; }
.bubble--4  { width: 7px;  height: 7px;  left: 55%; animation: rise 30s linear infinite; animation-delay: -5s; }
.bubble--5  { width: 12px; height: 12px; left: 68%; animation: rise 40s linear infinite; animation-delay: -20s; }
.bubble--6  { width: 6px;  height: 6px;  left: 78%; animation: rise 25s linear infinite; animation-delay: -12s; }
.bubble--7  { width: 9px;  height: 9px;  left: 88%; animation: rise 33s linear infinite; animation-delay: -7s; }
.bubble--8  { width: 7px;  height: 7px;  left: 35%; animation: rise 38s linear infinite; animation-delay: -18s; }
.bubble--9  { width: 8px;  height: 8px;  left: 50%; animation: rise 26s linear infinite; animation-delay: -3s; }
.bubble--10 { width: 11px; height: 11px; left: 82%; animation: rise 32s linear infinite; animation-delay: -14s; }

@keyframes rise {
    0%   { bottom: -20px; opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { bottom: 100vh; opacity: 0; }
}

/* --- Shake Animation --- */
@keyframes shake {
    0%, 100% { transform: translate3d(0, 0, 0); }
    10%  { transform: translate3d(-8px, 0, 0); }
    20%  { transform: translate3d(8px, 0, 0); }
    30%  { transform: translate3d(-6px, 0, 0); }
    40%  { transform: translate3d(6px, 0, 0); }
    50%  { transform: translate3d(-4px, 0, 0); }
    60%  { transform: translate3d(4px, 0, 0); }
    70%  { transform: translate3d(-2px, 0, 0); }
    80%  { transform: translate3d(2px, 0, 0); }
    90%  { transform: translate3d(-1px, 0, 0); }
}

body.shake-active {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

body.settled {
    transition: transform 2s ease-out;
    transform: translate3d(0, 0, 0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .content-block--left,
    .content-block--right {
        margin-left: 5%;
        margin-right: 5%;
    }

    .depth-gauge {
        right: 8px;
    }

    .gauge-label {
        display: none;
    }

    .spine-decoration {
        width: 80%;
    }
}
