/* heisei.boo - Glassmorphic Editorial Tribute to the Heisei Era */

/* ===== CSS Custom Properties ===== */
:root {
    --teal: #2a9d8f;
    --coral: #e07a5f;
    --bg-base: #f4f1eb;
    --glass-surface: rgba(244, 241, 235, 0.55);
    --ink: #1e3a3a;
    --lagoon: #88c9bf;
    --gold: #c9a84c;
    --sunset-pink: #f2c4b6;
    --glass-border: rgba(42, 157, 143, 0.2);
    --glass-shadow: rgba(30, 58, 58, 0.08);
    --glass-dark: rgba(30, 58, 58, 0.4);
}

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

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

body {
    font-family: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.125rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    color: var(--ink);
    background-color: var(--bg-base);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ===== Navigation ===== */
#chapter-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 0 20px;
    background: rgba(244, 241, 235, 0.15);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.4s ease, height 0.4s ease, padding 0.4s ease;
}

#chapter-nav.scrolled {
    background: rgba(244, 241, 235, 0.4);
    height: 24px;
    padding: 0 20px;
}

.nav-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--teal);
    background: transparent;
    transition: background 0.3s ease, transform 0.3s ease;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.4s ease, background 0.3s ease;
}

#chapter-nav.scrolled .nav-indicator {
    opacity: 1;
}

.nav-indicator.active {
    background: var(--teal);
}

.nav-indicator:hover {
    transform: scale(1.3);
}

/* ===== Background Washes ===== */
#bg-washes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.wash {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
}

.wash-1 {
    width: 80vw;
    height: 80vw;
    top: -20%;
    left: -10%;
    background: radial-gradient(circle, rgba(136, 201, 191, 0.12) 0%, transparent 70%);
}

.wash-2 {
    width: 60vw;
    height: 60vw;
    top: 30%;
    right: -15%;
    background: radial-gradient(circle, rgba(242, 196, 182, 0.1) 0%, transparent 70%);
}

.wash-3 {
    width: 70vw;
    height: 70vw;
    top: 60%;
    left: -5%;
    background: radial-gradient(circle, rgba(42, 157, 143, 0.08) 0%, transparent 70%);
}

.wash-4 {
    width: 50vw;
    height: 50vw;
    top: 85%;
    right: 10%;
    background: radial-gradient(circle, rgba(224, 122, 95, 0.08) 0%, transparent 70%);
}

/* ===== Glassmorphic Panels ===== */
.glass-panel {
    background: var(--glass-surface);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--glass-shadow);
    position: relative;
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0.4), transparent);
    border-radius: 12px 12px 0 0;
    pointer-events: none;
}

.glass-panel-dark {
    background: var(--glass-dark);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid rgba(136, 201, 191, 0.15);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(30, 58, 58, 0.15);
}

/* Ripple-entrance reveal */
[data-reveal='true'] {
    clip-path: circle(0% at 50% 50%);
    transition: clip-path 0s;
}

[data-reveal='true'].revealed {
    clip-path: circle(150% at 50% 50%);
    transition: clip-path 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===== Chapter Base ===== */
.chapter {
    position: relative;
    min-height: 120vh;
    width: 100%;
    overflow: hidden;
}

/* ===== Chapter 1: Opening Spread ===== */
#chapter-opening {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.opening-watercolor-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 80%, rgba(136, 201, 191, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 30%, rgba(42, 157, 143, 0.2) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 60%, rgba(224, 122, 95, 0.15) 0%, transparent 45%),
        radial-gradient(ellipse at 30% 20%, rgba(242, 196, 182, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(201, 168, 76, 0.1) 0%, transparent 40%),
        radial-gradient(ellipse at 60% 90%, rgba(136, 201, 191, 0.25) 0%, transparent 45%);
    z-index: 0;
}

.opening-glass-panel {
    text-align: center;
    padding: clamp(2rem, 5vw, 4rem) clamp(2rem, 6vw, 5rem);
    max-width: 700px;
    z-index: 1;
}

.kanji-cutout {
    position: relative;
    margin-bottom: 2rem;
}

.kanji-text {
    font-family: 'Noto Sans JP', 'Hiragino Kaku Gothic', sans-serif;
    font-weight: 900;
    font-size: clamp(6rem, 15vw, 12rem);
    line-height: 1;
    background: linear-gradient(135deg,
        rgba(136, 201, 191, 0.6),
        rgba(42, 157, 143, 0.4),
        rgba(224, 122, 95, 0.3),
        rgba(201, 168, 76, 0.3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 4px 12px rgba(42, 157, 143, 0.2));
}

.opening-subtitle {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: -0.01em;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.opening-years {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--teal);
    margin-bottom: 1.5rem;
}

.opening-tagline {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 500;
    font-size: clamp(0.875rem, 1.4vw, 1.05rem);
    color: var(--coral);
    opacity: 0.8;
}

/* ===== Chapter 2: Cultural Timeline ===== */
#chapter-timeline {
    min-height: 180vh;
    padding: 10vh 0;
}

.timeline-container {
    position: relative;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 clamp(1.5rem, 4vw, 3rem);
}

.timeline-line {
    position: absolute;
    left: clamp(1.5rem, 4vw, 3rem);
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--teal);
    opacity: 0.6;
}

.timeline-event {
    position: relative;
    margin-left: clamp(2.5rem, 6vw, 5rem);
    margin-bottom: 4rem;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    max-width: 580px;
}

.timeline-node {
    position: absolute;
    left: calc(-1 * clamp(1.5rem, 3.5vw, 3rem) - 8px);
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--glass-surface);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 2px solid var(--teal);
    transition: transform 0.3s ease, background 0.3s ease;
}

.timeline-event:hover .timeline-node {
    transform: translateY(-50%) scale(1.4);
    background: var(--teal);
}

.timeline-year {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(0.75rem, 1.2vw, 0.9rem);
    color: var(--teal);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: block;
    margin-bottom: 0.5rem;
}

.timeline-content h3 {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    letter-spacing: -0.01em;
    line-height: 1.15;
    color: var(--ink);
    margin-bottom: 0.75rem;
}

.timeline-content p {
    font-family: 'Source Sans 3', sans-serif;
    font-size: clamp(0.875rem, 1.4vw, 1rem);
    line-height: 1.65;
    color: var(--ink);
    opacity: 0.85;
}

/* ===== Chapter 3: The Aquarium ===== */
#chapter-aquarium {
    min-height: 120vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 30% 50%, rgba(42, 157, 143, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 40%, rgba(136, 201, 191, 0.2) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 80%, rgba(30, 58, 58, 0.08) 0%, transparent 40%);
}

.aquarium-glass-layers {
    position: absolute;
    top: 10%;
    left: 5%;
    right: 5%;
    bottom: 10%;
    pointer-events: none;
}

.aquarium-glass {
    position: absolute;
    border-radius: 12px;
}

.aquarium-glass:first-child {
    top: 5%;
    left: 3%;
    width: 45%;
    height: 70%;
}

.aquarium-glass.offset {
    bottom: 8%;
    right: 5%;
    width: 40%;
    height: 55%;
}

.aquarium-haiku {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 500;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--ink);
    text-align: center;
    line-height: 2;
    z-index: 2;
    position: relative;
    padding: 2rem;
    max-width: 500px;
}

/* ===== Chapter 4: Editorial Essay ===== */
#chapter-editorial {
    min-height: 180vh;
    padding: 10vh 0;
}

.editorial-grid {
    display: grid;
    grid-template-columns: 7fr 5fr;
    gap: clamp(1.5rem, 3vw, 3rem);
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 clamp(1.5rem, 4vw, 3rem);
}

.editorial-main {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.editorial-text {
    padding: clamp(1.5rem, 3vw, 2.5rem);
}

.editorial-text h2 {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(2rem, 6vw, 4.5rem);
    letter-spacing: -0.01em;
    line-height: 1.15;
    color: var(--ink);
    margin-bottom: 2rem;
}

.editorial-text p {
    margin-bottom: 1.5rem;
}

.editorial-text p:last-child {
    margin-bottom: 0;
}

/* Drop caps */
.drop-cap::first-letter {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 3.5em;
    float: left;
    color: var(--coral);
    line-height: 0.8;
    margin-right: 0.08em;
    margin-top: 0.05em;
    text-shadow: 0 2px 8px rgba(224, 122, 95, 0.2);
}

/* Pull quotes */
.pull-quote {
    padding: clamp(1.5rem, 3vw, 2.5rem);
    border-left: 3px solid var(--teal);
}

.pull-quote blockquote p {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 500;
    font-size: 1.3em;
    line-height: 1.6;
    color: var(--ink);
}

/* Editorial Margin */
.editorial-margin {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    padding-top: 15vh;
    position: relative;
}

.margin-annotation {
    padding: 1.25rem 1.5rem;
}

.margin-annotation p {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 500;
    font-size: clamp(0.875rem, 1.4vw, 1.05rem);
    line-height: 1.55;
    color: var(--ink);
    opacity: 0.75;
}

/* ===== Chapter 5: Closing Meditation ===== */
#chapter-closing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 50% 40%, rgba(136, 201, 191, 0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 70%, rgba(42, 157, 143, 0.15) 0%, transparent 40%),
        linear-gradient(180deg, var(--bg-base) 0%, rgba(136, 201, 191, 0.15) 100%);
    transition: background 1.5s ease;
}

#chapter-closing.dissolving {
    background:
        radial-gradient(ellipse at 50% 40%, rgba(136, 201, 191, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 30% 70%, rgba(42, 157, 143, 0.3) 0%, transparent 40%),
        linear-gradient(180deg, rgba(136, 201, 191, 0.2) 0%, rgba(136, 201, 191, 0.35) 100%);
}

.closing-kanji-container {
    margin-bottom: 3rem;
    z-index: 1;
}

#closing-kanji-svg {
    width: clamp(280px, 50vw, 500px);
    height: auto;
}

.closing-card {
    max-width: 560px;
    padding: clamp(2rem, 4vw, 3rem);
    z-index: 2;
    text-align: center;
}

.closing-text {
    font-family: 'Source Sans 3', sans-serif;
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
    line-height: 1.72;
    color: rgba(244, 241, 235, 0.9);
    margin-bottom: 1.5rem;
}

.closing-link {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 500;
    font-size: 1.1rem;
}

.closing-link a {
    color: var(--lagoon);
    text-decoration: none;
    border-bottom: 1px solid rgba(136, 201, 191, 0.3);
    transition: border-color 0.3s ease, color 0.3s ease;
}

.closing-link a:hover {
    color: var(--sunset-pink);
    border-color: var(--sunset-pink);
}

/* ===== Fish Animations ===== */
.fish {
    position: absolute;
    pointer-events: none;
    z-index: 1;
    opacity: 0.15;
    transition: opacity 0.8s ease;
}

.fish.visible {
    opacity: 1;
}

/* Clownfish */
.fish-clownfish {
    width: clamp(60px, 8vw, 90px);
    bottom: 20%;
    right: 15%;
    animation: fishSwim1X 30s linear infinite, fishSwim1Y 10s ease-in-out infinite;
}

/* Betta Hero */
.fish-betta-hero {
    width: clamp(120px, 18vw, 200px);
    top: 15%;
    left: 8%;
    animation: fishSwim2X 35s linear infinite, fishSwim2Y 12s ease-in-out infinite;
}

/* Moorish Idol */
.fish-idol {
    width: clamp(80px, 10vw, 120px);
    top: 20%;
    right: 10%;
    animation: fishSwim3X 40s linear infinite, fishSwim3Y 9s ease-in-out infinite;
}

/* Blue Tangs */
.fish-tang-1 {
    width: clamp(70px, 9vw, 100px);
    top: 25%;
    left: 10%;
    animation: fishSwim4X 28s linear infinite, fishSwim4Y 11s ease-in-out infinite;
}

.fish-tang-2 {
    width: clamp(55px, 7vw, 80px);
    top: 45%;
    left: 30%;
    animation: fishSwim5X 33s linear infinite, fishSwim5Y 13s ease-in-out infinite;
}

.fish-tang-3 {
    width: clamp(60px, 8vw, 85px);
    bottom: 30%;
    right: 20%;
    animation: fishSwim6X 25s linear infinite, fishSwim6Y 8s ease-in-out infinite;
}

/* Angelfish */
.fish-angel {
    width: clamp(60px, 8vw, 90px);
    position: relative;
    margin: 2rem auto;
    animation: fishSwimGentleY 15s ease-in-out infinite, angelSway 8s ease-in-out infinite;
}

/* Betta Closing */
.fish-betta-closing {
    width: clamp(100px, 15vw, 170px);
    top: 10%;
    right: 12%;
    animation: fishSwim7X 38s linear infinite, fishSwim7Y 14s ease-in-out infinite;
}

/* Betta fin undulation */
.betta-fin-top {
    animation: finWave1 3s ease-in-out infinite;
    transform-origin: 70% 80%;
}

.betta-fin-bottom {
    animation: finWave2 5s ease-in-out infinite;
    transform-origin: 70% 20%;
}

.betta-fin-tail {
    animation: finWave3 7s ease-in-out infinite;
    transform-origin: 30% 50%;
}

@keyframes finWave1 {
    0%, 100% { transform: rotate(0deg) scaleY(1); }
    50% { transform: rotate(-3deg) scaleY(1.05); }
}

@keyframes finWave2 {
    0%, 100% { transform: rotate(0deg) scaleY(1); }
    50% { transform: rotate(3deg) scaleY(1.05); }
}

@keyframes finWave3 {
    0%, 100% { transform: rotate(0deg) scaleX(1); }
    50% { transform: rotate(-2deg) scaleX(1.03); }
}

/* Fish swim keyframes */
@keyframes fishSwim1X {
    0% { transform: translateX(0); }
    25% { transform: translateX(-8vw); }
    50% { transform: translateX(5vw); }
    75% { transform: translateX(-3vw); }
    100% { transform: translateX(0); }
}

@keyframes fishSwim1Y {
    0%, 100% { margin-top: 0; }
    50% { margin-top: -40px; }
}

@keyframes fishSwim2X {
    0% { transform: translateX(0) rotateZ(0deg); }
    25% { transform: translateX(10vw) rotateZ(3deg); }
    50% { transform: translateX(-5vw) rotateZ(-2deg); }
    75% { transform: translateX(7vw) rotateZ(2deg); }
    100% { transform: translateX(0) rotateZ(0deg); }
}

@keyframes fishSwim2Y {
    0%, 100% { margin-top: 0; }
    50% { margin-top: 50px; }
}

@keyframes fishSwim3X {
    0% { transform: translateX(0) rotateZ(0deg); }
    30% { transform: translateX(-12vw) rotateZ(-4deg); }
    60% { transform: translateX(8vw) rotateZ(3deg); }
    100% { transform: translateX(0) rotateZ(0deg); }
}

@keyframes fishSwim3Y {
    0%, 100% { margin-top: 0; }
    50% { margin-top: -35px; }
}

@keyframes fishSwim4X {
    0% { transform: translateX(0) rotateZ(0deg); }
    25% { transform: translateX(15vw) rotateZ(4deg); }
    50% { transform: translateX(5vw) rotateZ(-1deg); }
    75% { transform: translateX(20vw) rotateZ(3deg); }
    100% { transform: translateX(0) rotateZ(0deg); }
}

@keyframes fishSwim4Y {
    0%, 100% { margin-top: 0; }
    50% { margin-top: 45px; }
}

@keyframes fishSwim5X {
    0% { transform: translateX(0) rotateZ(0deg); }
    25% { transform: translateX(-10vw) rotateZ(-3deg); }
    50% { transform: translateX(8vw) rotateZ(2deg); }
    75% { transform: translateX(-5vw) rotateZ(-1deg); }
    100% { transform: translateX(0) rotateZ(0deg); }
}

@keyframes fishSwim5Y {
    0%, 100% { margin-top: 0; }
    50% { margin-top: -55px; }
}

@keyframes fishSwim6X {
    0% { transform: translateX(0) rotateZ(0deg); }
    30% { transform: translateX(-15vw) rotateZ(-5deg); }
    70% { transform: translateX(10vw) rotateZ(3deg); }
    100% { transform: translateX(0) rotateZ(0deg); }
}

@keyframes fishSwim6Y {
    0%, 100% { margin-top: 0; }
    50% { margin-top: 30px; }
}

@keyframes fishSwim7X {
    0% { transform: translateX(0) rotateZ(0deg); }
    20% { transform: translateX(-8vw) rotateZ(-3deg); }
    50% { transform: translateX(12vw) rotateZ(4deg); }
    80% { transform: translateX(-5vw) rotateZ(-2deg); }
    100% { transform: translateX(0) rotateZ(0deg); }
}

@keyframes fishSwim7Y {
    0%, 100% { margin-top: 0; }
    50% { margin-top: -60px; }
}

@keyframes fishSwimGentleY {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes angelSway {
    0%, 100% { margin-left: 0; }
    50% { margin-left: 15px; }
}

/* ===== Ripple Effects ===== */
#ripple-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    border: 2px solid var(--teal);
    opacity: 0.6;
    animation: rippleExpand 700ms ease-out forwards;
    pointer-events: none;
}

@keyframes rippleExpand {
    0% {
        width: 0;
        height: 0;
        opacity: 0.6;
    }
    100% {
        width: 400px;
        height: 400px;
        opacity: 0;
    }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .editorial-grid {
        grid-template-columns: 1fr;
    }

    .editorial-margin {
        padding-top: 2rem;
    }

    .timeline-line {
        left: 1rem;
    }

    .timeline-event {
        margin-left: 2.5rem;
    }

    .timeline-node {
        left: calc(-1.5rem - 8px);
    }

    .fish-betta-hero,
    .fish-idol,
    .fish-betta-closing {
        display: none;
    }
}

@media (max-width: 480px) {
    .kanji-text {
        font-size: clamp(4rem, 20vw, 8rem);
    }

    .opening-glass-panel {
        padding: 1.5rem;
    }

    .timeline-event {
        padding: 1.25rem;
    }
}
