/* ==========================================================================
   RRIPPL.com — Fairycore-geological elegance
   Palette:
     #0e1f14  Deep Forest Floor      (bg primary)
     #1a3325  Moss Chamber           (bg secondary)
     #c8d5cb  Lichen Silver          (text primary)
     #e8f0ea  Crystalline White      (text heading)
     #4a9e6b  Fern Glow              (accent primary)
     #b8766a  Quartz Rose            (accent secondary)
     #7b6b8a  Geode Amethyst         (accent tertiary)
     #2d5a3d  Forest Mist            (border / subtle)
     #7fa88b  Vertical nav (lighter accent)
   Fonts: Josefin Sans, Nunito Sans, DM Mono
   ========================================================================== */

:root {
    --bg-primary:   #0e1f14;
    --bg-secondary: #1a3325;
    --text-primary: #c8d5cb;
    --text-heading: #e8f0ea;
    --accent-1:     #4a9e6b;
    --accent-2:     #b8766a;
    --accent-3:     #7b6b8a;
    --border:       #2d5a3d;
    --nav-tint:     #7fa88b;
    --soft:         #c8d5cb;

    --ease-elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);

    --font-head: "Josefin Sans", "Inter", system-ui, sans-serif;
    --font-body: "Nunito Sans", "Inter", system-ui, sans-serif;
    --font-mono: "DM Mono", "Space Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.72;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

body {
    background:
        radial-gradient(ellipse at 38% 38%, #142a1c 0%, #0e1f14 55%, #0a1810 100%);
    min-height: 100vh;
    position: relative;
}

/* ---------- background marble + gradient layer ---------- */
.page-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    opacity: 0.6;
}
.marble-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ---------- fern silhouettes (edge bleeds) ---------- */
.fern {
    position: fixed;
    top: -10vh;
    height: 130vh;
    width: 240px;
    z-index: -1;
    pointer-events: none;
    opacity: 0.9;
}
.fern-left  { left: -90px; transform: rotate(-4deg); }
.fern-right { right: -90px; transform: rotate(4deg) scaleX(-1); }

/* ---------- ripple ring canvas (fixed) ---------- */
.ripple-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}
.ring {
    transition: r 1.6s var(--ease-elastic), opacity 1.2s ease;
    transform-origin: center;
}
.ring.pulse {
    animation: ringPulse 2.4s var(--ease-elastic) infinite;
}
@keyframes ringPulse {
    0%, 100% { transform: translate(380px, 380px) scale(1); }
    50%      { transform: translate(380px, 380px) scale(1.018); }
}

/* ---------- vertical right-edge navigation ---------- */
.vertical-nav {
    position: fixed;
    top: 50%;
    right: 18px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 36px;
    z-index: 30;
}
.vertical-nav a {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--nav-tint);
    text-decoration: none;
    opacity: 0.55;
    transition: opacity 0.5s var(--ease-elastic), color 0.5s ease, transform 0.6s var(--ease-elastic);
    padding: 4px 2px;
}
.vertical-nav a:hover,
.vertical-nav a.active {
    opacity: 1;
    color: var(--accent-1);
    transform: rotate(180deg) translateY(-4px);
}

/* ---------- narrative ---------- */
.narrative {
    position: relative;
    z-index: 5;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 6vw;
}

.chapter {
    min-height: 100vh;
    padding: 12vh 0;
    position: relative;
    display: flex;
    align-items: center;
}
.chapter-inner {
    position: relative;
    width: 100%;
    border: 1px solid rgba(45, 90, 61, 0.3);
    border-radius: 24px;
    background: linear-gradient(180deg,
        rgba(26, 51, 37, 0.55) 0%,
        rgba(14, 31, 20, 0.4) 100%);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    padding: 6vh 5vw;
}

/* F-pattern asymmetry */
.f-line-1 { width: 70%; margin-left: 0; }
.f-line-2 { width: 55%; margin-left: 15%; }
.f-line-3 { width: 65%; margin-left: 0; }

/* ---------- chapter markers ---------- */
.chapter-marker {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent-1);
    margin: 0 0 1.6em 0;
    opacity: 0.85;
}
.meta-label {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent-3);
    opacity: 0.8;
    margin-top: 2.2em;
}
.meta-label.center { text-align: center; margin-top: 3em; }

/* ---------- typography ---------- */
.hero-title {
    font-family: var(--font-head);
    font-weight: 300;
    font-size: clamp(2.5rem, 12vw, 8.5rem);
    line-height: 0.92;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-heading);
    margin: 0.2em 0 0.4em 0;
    text-shadow: 0 0 60px rgba(74, 158, 107, 0.08);
}
.hero-title-final {
    font-size: clamp(2.2rem, 7vw, 5.5rem);
    text-transform: none;
    text-align: center;
    letter-spacing: 0.04em;
    font-weight: 300;
}

.section-heading {
    font-family: var(--font-head);
    font-weight: 600;
    font-size: clamp(1.8rem, 4vw, 3rem);
    letter-spacing: 0.04em;
    color: var(--text-heading);
    margin: 0 0 1.2em 0;
    line-height: 1.12;
}

.hero-tagline {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--text-primary);
    opacity: 0.7;
    max-width: 32em;
    margin: 0;
    line-height: 1.7;
}

.resonance-tagline {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.8;
    color: var(--text-primary);
    opacity: 0.78;
    text-align: center;
    max-width: 36em;
    margin: 1.5em auto 3em auto;
}

/* ---------- letter-stagger reveal ---------- */
.letter {
    display: inline-block;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 0.9s var(--ease-elastic), opacity 0.9s ease;
    will-change: transform, opacity;
}
.letter.visible {
    transform: translateY(0);
    opacity: 1;
}
.letter.space { width: 0.34em; }

/* ---------- chapter 1 — stillness ---------- */
.chapter-stillness .chapter-inner {
    border-color: rgba(45, 90, 61, 0.18);
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.stillness-inner {
    width: 100%;
    margin-left: 0;
    padding-top: 8vh;
}
.drop-point {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-1);
    box-shadow:
        0 0 40px rgba(74, 158, 107, 0.6),
        0 0 100px rgba(74, 158, 107, 0.25);
    left: 38%;
    top: 20%;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 1.6s ease, transform 1.6s var(--ease-elastic);
}
.drop-point.lit {
    opacity: 1;
    transform: scale(1);
    animation: dropBreathe 5s ease-in-out infinite;
}
@keyframes dropBreathe {
    0%, 100% { box-shadow: 0 0 40px rgba(74,158,107,0.55), 0 0 100px rgba(74,158,107,0.22); }
    50%      { box-shadow: 0 0 70px rgba(74,158,107,0.85), 0 0 140px rgba(74,158,107,0.35); }
}

/* prismatic light refraction lines */
.prismatic {
    position: absolute;
    left: 38%;
    top: 22%;
    width: 0;
    height: 0;
    pointer-events: none;
}
.prismatic span {
    position: absolute;
    left: 0; top: 0;
    width: 220px;
    height: 1px;
    background: linear-gradient(90deg,
        rgba(74,158,107,0) 0%,
        rgba(184,118,106,0.15) 25%,
        rgba(123,107,138,0.18) 50%,
        rgba(74,158,107,0.12) 75%,
        rgba(74,158,107,0) 100%);
    transform-origin: 0 50%;
    opacity: 0;
    transition: opacity 2s ease 1.6s;
}
.prismatic span:nth-child(1) { transform: rotate(  0deg); }
.prismatic span:nth-child(2) { transform: rotate( 36deg); }
.prismatic span:nth-child(3) { transform: rotate( 72deg); }
.prismatic span:nth-child(4) { transform: rotate(144deg); }
.prismatic span:nth-child(5) { transform: rotate(216deg); }
.lit-prismatic .prismatic span { opacity: 1; }

/* ---------- content grid (8-col sub-grid) ---------- */
.content-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 2.4rem;
    align-items: start;
}
.text-block {
    grid-column: 1 / span 5;
    max-width: 38em;
}
.text-block.narrow {
    grid-column: 1 / span 6;
    margin-top: 2rem;
}
.text-block p {
    margin: 0 0 1.2em 0;
    color: var(--text-primary);
}
.crystal-illustration {
    grid-column: 6 / span 3;
    display: flex;
    justify-content: center;
    align-items: center;
    padding-top: 0.4em;
}
.crystal {
    width: 100%;
    max-width: 220px;
    height: auto;
    overflow: visible;
}
.crystal-small { animation: floaty 9s ease-in-out infinite; }
@keyframes floaty {
    0%,100% { transform: translateY(0) rotate(-1deg); }
    50%     { transform: translateY(-10px) rotate(2deg); }
}

/* ---------- marble panel (chapter 3) ---------- */
.marble-panel {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    margin: 0 0 2.5em 0;
    border: 1px solid rgba(45, 90, 61, 0.45);
    background:
        radial-gradient(ellipse at 30% 30%, rgba(123,107,138,0.18) 0%, transparent 55%),
        radial-gradient(ellipse at 70% 70%, rgba(45,90,61,0.35) 0%, transparent 60%),
        linear-gradient(135deg, #1a3325 0%, #142a1c 50%, #1a3325 100%);
    box-shadow: 0 20px 60px rgba(0,0,0,0.35), inset 0 0 60px rgba(45,90,61,0.25);
}
.marble-panel::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 22% 18%, rgba(123,107,138,0.22) 0, transparent 40%),
        radial-gradient(circle at 80% 30%, rgba(45,90,61,0.45) 0, transparent 35%),
        radial-gradient(circle at 60% 75%, rgba(74,158,107,0.18) 0, transparent 45%),
        radial-gradient(circle at 15% 85%, rgba(123,107,138,0.18) 0, transparent 40%);
    mix-blend-mode: screen;
    pointer-events: none;
}
.marble-panel::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(112deg,
            transparent 0px, transparent 14px,
            rgba(45,90,61,0.10) 14px, rgba(45,90,61,0.10) 15px),
        repeating-linear-gradient(28deg,
            transparent 0px, transparent 22px,
            rgba(123,107,138,0.06) 22px, rgba(123,107,138,0.06) 23px);
    mix-blend-mode: overlay;
    pointer-events: none;
}
.marble-panel-inner {
    position: relative;
    z-index: 2;
    padding: 3.2em 3em;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.quote-mark {
    font-family: var(--font-head);
    font-weight: 300;
    font-size: 5rem;
    line-height: 0.4;
    color: var(--accent-1);
    opacity: 0.45;
    margin: 0 0 0.2em 0;
}
blockquote {
    font-family: var(--font-head);
    font-weight: 300;
    font-size: clamp(1.2rem, 2.2vw, 1.7rem);
    color: var(--text-heading);
    margin: 0;
    line-height: 1.4;
    letter-spacing: 0.01em;
    max-width: 28em;
}

/* ---------- card stack (chapter 4) ---------- */
.card-stack {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.6rem;
    margin-top: 1em;
}
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2.2em 1.7em;
    opacity: 0;
    transform: translateY(28px) scale(0.96);
    transition:
        opacity 0.9s ease,
        transform 1.1s var(--ease-elastic),
        border-color 0.6s ease;
    position: relative;
    overflow: hidden;
}
.card::before {
    content: "";
    position: absolute;
    top: -40%; left: -40%;
    width: 80%; height: 80%;
    background: radial-gradient(circle, rgba(74,158,107,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.card.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.card-eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent-1);
    margin: 0 0 1em 0;
    opacity: 0.9;
}
.card h3 {
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 1.3rem;
    color: var(--text-heading);
    margin: 0 0 0.7em 0;
    letter-spacing: 0.02em;
}
.card p:last-child {
    color: var(--text-primary);
    margin: 0;
    font-size: 15px;
    line-height: 1.7;
    opacity: 0.86;
}
.card:hover {
    border-color: var(--accent-3);
}

/* ---------- chapter 5 — resonance ---------- */
.chapter-resonance .chapter-inner {
    width: 100%;
    margin-left: 0;
    text-align: center;
    padding: 8vh 5vw;
}
.crystal-cluster-large {
    margin: 1.5em auto 1.5em;
    max-width: 520px;
}
.crystal-large {
    width: 100%;
    height: auto;
    animation: floaty 14s ease-in-out infinite;
}

/* ---------- floating ambient crystals (gutter zones) ---------- */
.floating-crystals {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}
.floating-crystal {
    position: absolute;
    width: 110px;
    height: 110px;
    animation: rotate 120s linear infinite;
}
.fc-1 { top: 22%; left: 76%; }
.fc-2 { top: 58%; left: 8%;  animation-duration: 160s; animation-direction: reverse; }
.fc-3 { top: 84%; left: 70%; animation-duration: 200s; }
@keyframes rotate {
    to { transform: rotate(360deg); }
}

/* ---------- dew drops ---------- */
.dew-drops {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}
.dew-drops span {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--accent-1);
    box-shadow: 0 0 6px rgba(74,158,107,0.5);
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
    .vertical-nav { display: none; }
    .f-line-1, .f-line-2, .f-line-3 { width: 100%; margin-left: 0; }
    .content-grid { grid-template-columns: 1fr; }
    .text-block, .text-block.narrow { grid-column: 1 / -1; }
    .crystal-illustration { grid-column: 1 / -1; max-width: 200px; margin: 1em auto 0; }
    .card-stack { grid-template-columns: 1fr; }
    .marble-panel-inner { padding: 2em 1.5em; }
    .fern { display: none; }
    .narrative { padding: 0 5vw; }
}

@media (max-width: 540px) {
    html, body { font-size: 16px; }
    .chapter { padding: 8vh 0; }
    .chapter-inner { padding: 5vh 5vw; border-radius: 18px; }
    .hero-title { font-size: clamp(2.4rem, 18vw, 4.5rem); }
}
