/* =============================================
   oning.stream — Liquid Kinetic Calligraphy
   =============================================
   Color Palette (CSS Custom Properties):
   --deep-ground:    #0C1117  (near-black, blue undertone)
   --stream-surface: #1A2733  (dark teal-slate)
   --current:        #B8D8E8  (pale ice-blue)
   --warmth:         #E8B4A2  (muted peach-coral)
   --foam:           #F2EDE8  (warm off-white)
   --depth:          #3A5068  (muted steel-blue)
   --glow:           #D4A843  (warm amber)
   --muted:          #7A8B9A  (body text)
   ============================================= */

@property --font-wdth {
    syntax: '<number>';
    inherits: true;
    initial-value: 75;
}

@property --breath-weight {
    syntax: '<number>';
    inherits: true;
    initial-value: 200;
}

@property --bg-shift {
    syntax: '<color>';
    inherits: true;
    initial-value: #0C1117;
}

:root {
    --deep-ground: #0C1117;
    --stream-surface: #1A2733;
    --current: #B8D8E8;
    --warmth: #E8B4A2;
    --foam: #F2EDE8;
    --depth: #3A5068;
    --glow: #D4A843;
    --muted: #7A8B9A;
}

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

html {
    scroll-behavior: smooth;
    background-color: var(--deep-ground);
    overflow-x: hidden;
}

body {
    background-color: var(--deep-ground);
    color: var(--foam);
    font-family: 'Anybody', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    letter-spacing: 0.02em;
    line-height: 1.7;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- SVG Flowing Stroke (full page) ---- */
#flowing-stroke {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 1.5s ease;
}

#flowing-stroke.visible {
    opacity: 1;
}

#stroke-path {
    stroke-dasharray: 0;
    stroke-dashoffset: 0;
    transition: none;
}

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

.ripple {
    position: absolute;
    width: 0;
    height: 0;
    border-radius: 50%;
    border: 1px solid rgba(184, 216, 232, 0.3);
    transform: translate(-50%, -50%);
    animation: ripple-expand 600ms ease-out forwards;
}

@keyframes ripple-expand {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 240px;
        height: 240px;
        opacity: 0;
    }
}

/* ---- Stream Column ---- */
#stream-column {
    position: relative;
    z-index: 1;
    max-width: 640px;
    margin: 0 auto;
    padding: 0 2rem;
}

@media (max-width: 640px) {
    #stream-column {
        max-width: 100%;
        padding: 0 1.5rem;
    }
}

/* ---- Moments (sections) ---- */
.moment {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.moment-inner {
    width: 100%;
}

/* Breathing whitespace animation on section wrappers */
.moment {
    animation: section-breathe 4s ease-in-out infinite;
}

.moment[data-moment="1"] { animation-delay: 0s; }
.moment[data-moment="2"] { animation-delay: -0.8s; }
.moment[data-moment="3"] { animation-delay: -1.6s; }
.moment[data-moment="4"] { animation-delay: -2.4s; }
.moment[data-moment="5"] { animation-delay: -3.2s; }

@keyframes section-breathe {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ---- Diagonal Connector Lines ---- */
.diagonal-line {
    display: block;
    width: 100%;
    height: 80px;
    overflow: visible;
}

.diag-line {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 0.8s ease-out;
}

.diag-line.drawn {
    stroke-dashoffset: 0;
}

/* ===========================================
   MOMENT I: THE NAME
   =========================================== */
#moment-i {
    min-height: 100vh;
}

#site-name {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(3.5rem, 11vw, 13rem);
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 0.92;
    color: var(--foam);
    opacity: 0;
    transition: opacity 3s ease;
    text-align: center;
    word-break: break-word;
}

#site-name.visible {
    opacity: 1;
}

.name-part {
    color: var(--foam);
}

.name-dot {
    color: var(--glow);
}

#becoming {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    color: var(--warmth);
    opacity: 0;
    text-align: center;
    margin-top: 1.5rem;
    transform: rotate(-2deg);
    transition: opacity 1.5s ease;
}

#becoming.visible {
    opacity: 0.7;
}

/* ===========================================
   MOMENT II: THE DEFINITION
   =========================================== */
.definition-lines {
    text-align: left;
}

.def-line {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--foam);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    margin-bottom: 0.3em;
}

.def-line.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Dissolving line: per-character dissolution */
.dissolving-line span {
    display: inline-block;
    transition: opacity 0.5s ease;
}

.dissolving-line.dissolving span {
    opacity: 0;
}

/* ===========================================
   MOMENT III: THE STREAM
   =========================================== */
.body-text {
    font-family: 'Anybody', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    color: var(--muted);
    letter-spacing: 0.02em;
    line-height: 1.7;
    font-stretch: 75%;
}

.body-text.expanded {
    font-stretch: 110%;
}

.stream-paragraph {
    margin-bottom: 1.8em;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.8s ease, transform 0.8s ease, font-stretch 1.2s ease;
}

.stream-paragraph.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Breathing words */
.breath-word {
    display: inline;
    font-weight: var(--breath-weight);
    animation: weight-breathe 6s ease-in-out infinite;
}

@keyframes weight-breathe {
    0%, 100% { font-weight: 200; }
    50% { font-weight: 400; }
}

/* ===========================================
   MOMENT IV: THE BREATH
   =========================================== */
#moment-iv {
    min-height: 100vh;
    background-color: var(--bg-shift);
    animation: bg-breathe 4s ease-in-out infinite;
    transition: background-color 0.1s;
}

@keyframes bg-breathe {
    0%, 100% { background-color: var(--deep-ground); }
    50% { background-color: var(--stream-surface); }
}

.breath-now {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(3.5rem, 11vw, 13rem);
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 0.92;
    color: var(--foam);
    text-align: center;
    animation: now-breathe 4s ease-in-out infinite;
    opacity: 0;
    transition: opacity 1s ease;
}

.breath-now.visible {
    opacity: 1;
}

@keyframes now-breathe {
    0%, 100% { opacity: 0.4; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.02); }
}

/* Override opacity for the visibility class interaction */
.breath-now.visible {
    animation: now-breathe-vis 4s ease-in-out infinite;
}

@keyframes now-breathe-vis {
    0%, 100% { opacity: 0.5; transform: scale(1); letter-spacing: -0.03em; }
    50% { opacity: 1; transform: scale(1.02); letter-spacing: 0em; }
}

/* ===========================================
   MOMENT V: THE DISSOLUTION
   =========================================== */
#moment-v {
    min-height: 100vh;
}

.dissolution {
    font-family: 'Instrument Serif', serif;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--foam);
    text-align: left;
    opacity: 0;
    transition: opacity 1s ease;
}

.dissolution.visible {
    opacity: 1;
}

.dissolve-word {
    display: inline-block;
    margin-right: 0.25em;
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.dissolve-word.dissolved {
    opacity: 0;
    transform: translateY(10px);
}

/* ===========================================
   PROGRESS INDICATOR
   =========================================== */
#progress-indicator {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 999;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

#progress-circle {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--warmth);
    opacity: 0.4;
    cursor: pointer;
    transition: transform 0.3s ease, opacity 0.3s ease;
    flex-shrink: 0;
}

#progress-indicator:hover #progress-circle {
    transform: scale(1.8);
    opacity: 0.8;
}

#progress-tooltip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}

#progress-indicator:hover #progress-tooltip {
    opacity: 1;
    transform: translateX(0);
}

#progress-label {
    font-family: 'Caveat', cursive;
    font-size: 0.9rem;
    color: var(--warmth);
    opacity: 0.7;
}

#progress-bar-track {
    width: 60px;
    height: 2px;
    background-color: var(--depth);
    border-radius: 1px;
    overflow: hidden;
}

#progress-bar-fill {
    width: 0%;
    height: 100%;
    background-color: var(--current);
    border-radius: 1px;
    transition: width 0.15s ease;
}

/* ===========================================
   ANNOTATIONS (Caveat handwriting)
   =========================================== */
.annotation {
    font-family: 'Caveat', cursive;
    font-size: clamp(0.8rem, 1.2vw, 1rem);
    color: var(--warmth);
    opacity: 0.7;
}

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

    #site-name,
    #becoming,
    .def-line,
    .stream-paragraph,
    .breath-now,
    .dissolution {
        opacity: 1 !important;
        transform: none !important;
    }

    .diag-line {
        stroke-dashoffset: 0 !important;
    }

    #flowing-stroke {
        opacity: 1 !important;
    }

    .body-text {
        font-stretch: 100% !important;
    }
}
