/* ============================================
   haru.club — Wabi-Sabi Editorial Styles
   ============================================ */

:root {
    --deep: #1B3A4B;
    --deep-ink: #0D1F2D;
    --teal: #4A8B96;
    --parchment: #E8DED1;
    --mist: #B8C4C2;
    --slate-teal: #6A8E94;
    --sand: #C4A882;
    --coral: #D4A07A;

    --accent: #4A8B96;
    --accent-r: 74;
    --accent-g: 139;
    --accent-b: 150;

    --font-display: 'Playfair Display', Georgia, serif;
    --font-body: 'Noto Sans JP', 'Helvetica Neue', sans-serif;
    --font-annotation: 'Caveat', cursive;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--deep-ink);
    color: var(--mist);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.75;
    overflow-x: hidden;
}

/* Grain Overlay */
.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* Scroll Indicator (Desktop) */
.scroll-indicator {
    position: fixed;
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.scroll-line {
    position: absolute;
    width: 1px;
    height: 200px;
    background: var(--teal);
    top: -10px;
    opacity: 0;
    transform-origin: top;
    transform: scaleY(0);
}

.scroll-line.drawn {
    opacity: 1;
    transform: scaleY(1);
    transition: transform 0.8s ease-out, opacity 0.3s ease;
}

.scroll-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid var(--teal);
    background: transparent;
    margin: 16px 0;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    position: relative;
    z-index: 2;
}

.scroll-dot.active {
    background: var(--teal);
    border-color: var(--teal);
}

/* Mobile Progress Bar */
.mobile-progress {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(74, 139, 150, 0.2);
    z-index: 100;
}

.mobile-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--teal);
    transition: width 0.1s linear;
}

/* Narrative Container */
.narrative {
    position: relative;
    z-index: 1;
}

/* Spread Base */
.spread {
    min-height: 100vh;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 80px;
}

/* Opening Spread */
.spread--opening {
    background: var(--deep-ink);
    overflow: hidden;
}

.spread__canvas {
    position: relative;
    text-align: left;
    width: 100%;
    max-width: 1200px;
    padding-left: 15%;
}

.gradient-orb {
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(74, 139, 150, 0.25) 0%, rgba(74, 139, 150, 0) 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

.gradient-orb.visible {
    opacity: 1;
}

.title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 72px;
    line-height: 1.1;
    color: var(--parchment);
    text-shadow: 0 1px 3px rgba(74, 139, 150, 0.15);
    position: relative;
}

.title__letter {
    display: inline-block;
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.title__letter.visible {
    opacity: 1;
    transform: translateY(0);
}

.subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 16px;
    color: var(--slate-teal);
    margin-top: 24px;
    opacity: 0;
    transition: opacity 0.6s ease;
    letter-spacing: 0.05em;
}

.subtitle.visible {
    opacity: 1;
}

.subtitle__sep {
    margin: 0 12px;
    color: var(--teal);
}

/* Wave Dividers */
.wave-divider {
    width: 100%;
    height: 60px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.wave-divider svg {
    width: 100%;
    height: 100%;
}

.wave-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1.2s ease-in-out;
}

.wave-path.drawn {
    stroke-dashoffset: 0;
}

/* Chapter Spreads */
.spread--chapter {
    background: var(--deep);
    flex-direction: column;
    align-items: flex-start;
    padding: 120px 80px;
    position: relative;
}

.chapter__numeral {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 120px;
    line-height: 1;
    color: var(--parchment);
    opacity: 0.08;
    position: absolute;
    top: 60px;
    left: 80px;
}

.chapter__grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 64px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.chapter__content {
    padding-right: 40px;
}

.chapter__heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 48px;
    line-height: 1.15;
    color: var(--parchment);
    margin-bottom: 40px;
    text-shadow: 0 1px 3px rgba(74, 139, 150, 0.15);
}

.chapter__body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.75;
    color: var(--mist);
    margin-bottom: 24px;
}

.chapter__margin {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-top: 80px;
}

.annotation {
    font-family: var(--font-annotation);
    font-size: 18px;
    color: var(--teal);
    line-height: 1.6;
    border-left: 1px solid var(--teal);
    padding-left: 20px;
    display: block;
}

/* Reveal Elements */
.reveal-element {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.2s ease, transform 0.3s ease;
}

.reveal-element.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-quote {
    opacity: 0;
    transform: translateX(40px);
    transition: opacity 0.4s ease, transform 0.5s ease;
}

.reveal-quote.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Colophon */
.spread--colophon {
    background: var(--deep-ink);
    min-height: 80vh;
    text-align: center;
    flex-direction: column;
}

.colophon__content {
    max-width: 600px;
}

.colophon__mark {
    font-family: var(--font-body);
    font-size: 80px;
    color: var(--parchment);
    opacity: 0.15;
    margin-bottom: 32px;
}

.colophon__text {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 28px;
    line-height: 1.25;
    color: var(--parchment);
    margin-bottom: 24px;
    text-shadow: 0 1px 3px rgba(74, 139, 150, 0.15);
}

.colophon__meta {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 14px;
    line-height: 1.6;
    color: var(--slate-teal);
    margin-bottom: 8px;
}

.colophon__line {
    width: 60px;
    height: 1px;
    background: var(--teal);
    margin: 40px auto;
    opacity: 0.5;
}

.colophon__closing {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 18px;
    color: var(--mist);
    line-height: 1.8;
}

.colophon__translation {
    font-family: var(--font-annotation);
    font-size: 16px;
    color: var(--slate-teal);
    font-style: italic;
}

/* Alternating chapter backgrounds */
.spread--chapter:nth-child(odd) {
    background: var(--deep);
}

.spread--chapter:nth-child(even) {
    background: var(--deep-ink);
}

/* Ceramic-style border cards (subtle wobble via box-shadow) */
.chapter__content {
    position: relative;
}

/* Seasonal accent color override via JS custom property */
body {
    --seasonal-accent: var(--teal);
}

.scroll-dot.active {
    background: var(--seasonal-accent);
    border-color: var(--seasonal-accent);
}

.wave-path {
    stroke: var(--seasonal-accent);
}

/* ============================================
   Responsive: < 768px
   ============================================ */
@media (max-width: 768px) {
    .scroll-indicator {
        display: none;
    }

    .mobile-progress {
        display: block;
    }

    .spread {
        padding: 60px 24px;
    }

    .spread__canvas {
        padding-left: 0;
        text-align: center;
    }

    .title {
        font-size: 42px;
    }

    .subtitle {
        font-size: 14px;
    }

    .spread--chapter {
        padding: 80px 24px;
    }

    .chapter__numeral {
        position: relative;
        top: 0;
        left: 0;
        font-size: 64px;
        text-align: center;
        width: 100%;
        margin-bottom: 24px;
    }

    .chapter__grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .chapter__content {
        padding-right: 0;
    }

    .chapter__heading {
        font-size: 32px;
    }

    .chapter__margin {
        padding-top: 0;
    }

    .gradient-orb {
        width: 300px;
        height: 300px;
    }

    .colophon__mark {
        font-size: 56px;
    }

    .colophon__text {
        font-size: 22px;
    }
}
