/* ============================================
   haru.club — styles
   A zen-contemplative digital garden
   Palette: Cloud White, Ink Mist, Stone Gray,
   Sakura, Morning Sky, Young Leaf, Wisteria, Twilight
   Fonts: Share Tech Mono, Karla, Klee One
   ============================================ */

/* --- Custom Properties --- */
:root {
    /* Palette from DESIGN.md */
    --bg-cloud-white: #F7F3EE;
    --text-ink-mist: #3D3D3D;
    --text-stone-gray: #9B9B9B;
    --accent-sakura: #E8C4C4;
    --accent-morning-sky: #C4D4E8;
    --accent-young-leaf: #C4E8D0;
    --accent-wisteria: #D4C4E8;
    --accent-twilight: #5B5070;

    /* Current section accent (updated via JS Intersection Observer) */
    --accent-current: var(--accent-sakura);

    /* Typography */
    --font-display: 'Share Tech Mono', monospace;
    --font-body: 'Karla', sans-serif;
    --font-accent: 'Klee One', cursive;

    /* Spacing: 24px baseline x multiples */
    --baseline: 1.5rem;
    --space-4x: calc(var(--baseline) * 4);
    --space-8x: calc(var(--baseline) * 8);
    --space-16x: calc(var(--baseline) * 16);

    /* Content column */
    --content-max: 520px;
    --content-padding: clamp(1.5rem, 5vw, 3rem);
}

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

/* --- Base --- */
html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-cloud-white);
    color: var(--text-ink-mist);
    font-family: var(--font-body);
    font-weight: 300;
    line-height: 2.0;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* --- Dot Grid Background ---
   Radial gradient pattern, 2px dots at 48px spacing,
   5% opacity, drifts slowly via JS requestAnimationFrame */
.dot-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, var(--accent-current) 1px, transparent 1px);
    background-size: 48px 48px;
    opacity: 0.05;
    transition: opacity 2s ease;
}

/* --- Main Scroll Container --- */
.main-scroll {
    position: relative;
    z-index: 1;
}

/* --- Section Base ---
   Each section is at least 100vh, centered content,
   scroll-snap aligned. Breath sections are shorter. */
.section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    scroll-snap-align: start;
}

.section--breath {
    min-height: 50vh;
}

.section-content {
    max-width: var(--content-max);
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--content-padding);
    text-align: center;
    position: relative;
}

/* --- Section Progress Line ---
   1px horizontal line that draws itself across the
   bottom of each section, then fades out */
.section-line {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 1px;
    width: 0%;
    background-color: var(--accent-current);
    transition: background-color 1.5s ease;
}

.section-line.drawing {
    animation: drawLine 3s ease-out forwards;
}

@keyframes drawLine {
    from { width: 0%; }
    to { width: 100%; }
}

.section-line.drawn {
    width: 100%;
    animation: fadeLine 2s ease-out 1s forwards;
}

@keyframes fadeLine {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* --- Typography ---
   Display: Share Tech Mono — monospaced, wide-spaced, lowercase
   Body: Karla — weight 300 light, generous line-height
   Accent: Klee One — calligraphic, rare appearances */

/* Display / Headlines */
.site-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.5rem;
    letter-spacing: 0.12em;
    text-transform: lowercase;
    color: var(--text-ink-mist);
    font-feature-settings: 'ss01', 'liga';
    position: relative;
    z-index: 2;
}

.headline {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.2rem, 3vw, 2rem);
    letter-spacing: 0.12em;
    text-transform: lowercase;
    color: var(--text-ink-mist);
    font-feature-settings: 'ss01', 'liga';
    margin-bottom: var(--space-4x);
}

/* Body text — whisper-quiet, generous spacing */
.body-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.875rem, 1.2vw, 1rem);
    line-height: 2.0;
    color: var(--text-ink-mist);
    margin-top: var(--baseline);
}

.body-text--closing {
    margin-top: var(--space-4x);
}

/* Accent / Annotations — Klee One calligraphic */
.klee-text {
    font-family: var(--font-accent);
    font-size: 0.75rem;
    color: var(--text-stone-gray);
    letter-spacing: 0.05em;
}

/* Large Klee character — visual element, not text */
.klee-large {
    font-family: var(--font-accent);
    font-size: clamp(3rem, 10vw, 8rem);
    color: var(--accent-current);
    opacity: 0.6;
    line-height: 1.2;
    display: block;
}

/* Footer site mark */
.mono-small {
    font-family: var(--font-display);
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    text-transform: lowercase;
    color: var(--text-stone-gray);
}

/* --- Annotation Block --- */
.annotation {
    margin-top: var(--baseline);
}

/* --- Typographic Watermark ---
   Large single kanji character behind section content
   at 15% opacity, acting as ghost watermark */
.typographic-watermark {
    font-family: var(--font-accent);
    font-size: clamp(5rem, 15vw, 12rem);
    color: var(--accent-current);
    opacity: 0.15;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    pointer-events: none;
    line-height: 1;
    user-select: none;
}

/* --- Single Character Moment --- */
.single-char {
    margin-bottom: var(--baseline);
}

/* --- Site Mark (footer) --- */
.site-mark {
    margin-top: var(--space-8x);
    padding-bottom: var(--space-4x);
}

/* --- Enso Circles ---
   Imperfect circles as recurring zen motif.
   Each slightly different: gap position, stroke weight */
.enso {
    display: flex;
    align-items: center;
    justify-content: center;
}

.enso--hero {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
}

.enso-svg {
    width: 200px;
    height: 200px;
}

.enso-svg--small {
    width: 80px;
    height: 80px;
}

.enso--final {
    margin-bottom: var(--baseline);
}

/* --- Nature Marks ---
   Single-stroke SVG line drawings: leaf, branch, moon.
   2-4 control points each, sumi-e quality */
.nature-mark {
    margin-top: calc(var(--baseline) * 2);
    display: flex;
    justify-content: center;
}

/* --- Vertical Text Anchors ---
   Fixed at viewport edges, slowly rotating over 120s.
   Decorative like stamps on a scroll painting */
.vertical-anchor {
    position: fixed;
    font-family: var(--font-accent);
    font-size: 1rem;
    writing-mode: vertical-rl;
    opacity: 0.08;
    z-index: 0;
    pointer-events: none;
    user-select: none;
    letter-spacing: 0.5em;
}

.vertical-anchor--left {
    left: clamp(0.5rem, 2vw, 2rem);
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-sakura);
    animation: slowRotate 120s linear infinite;
}

.vertical-anchor--right {
    right: clamp(0.5rem, 2vw, 2rem);
    top: 50%;
    transform: translateY(-50%);
    color: var(--accent-wisteria);
    animation: slowRotate 120s linear infinite reverse;
}

@keyframes slowRotate {
    from { transform: translateY(-50%) rotate(0deg); }
    to { transform: translateY(-50%) rotate(360deg); }
}

/* --- Fade Reveal Animation ---
   Elements materialize like objects in lifting fog.
   1.2s ease-out-cubic, triggered at 60% viewport position.
   No translation, no scale, no bounce — only opacity. */
@media (prefers-reduced-motion: no-preference) {
    .fade-reveal {
        opacity: 0;
        transition: opacity 1.2s cubic-bezier(0.33, 0, 0.2, 1);
    }

    .fade-reveal.visible {
        opacity: 1;
    }

    /* Watermarks fade to their reduced target opacity */
    .typographic-watermark.fade-reveal {
        opacity: 0;
        transition: opacity 1.8s cubic-bezier(0.33, 0, 0.2, 1);
    }

    .typographic-watermark.fade-reveal.visible {
        opacity: 0.15;
    }
}

/* Reduced motion: show everything immediately */
@media (prefers-reduced-motion: reduce) {
    .fade-reveal {
        opacity: 1;
    }

    .typographic-watermark.fade-reveal {
        opacity: 0.15;
    }

    .vertical-anchor--left,
    .vertical-anchor--right {
        animation: none;
    }

    .section-line.drawing {
        animation: none;
        width: 100%;
    }
}

/* --- Links (rare, Twilight color) --- */
a {
    color: var(--accent-twilight);
    text-decoration: none;
    transition: opacity 0.4s ease;
}

a:hover {
    opacity: 0.7;
}

/* --- Text Selection --- */
::selection {
    background-color: var(--accent-sakura);
    color: var(--text-ink-mist);
}

/* --- Responsive: Small Screens --- */
@media (max-width: 600px) {
    .vertical-anchor {
        display: none;
    }

    .typographic-watermark {
        font-size: clamp(4rem, 20vw, 8rem);
    }

    .enso-svg {
        width: 150px;
        height: 150px;
    }

    .klee-large {
        font-size: clamp(2.5rem, 12vw, 5rem);
    }
}

/* --- Wide Screens: Emphasize Margins ---
   On viewports wider than 1200px, the margins
   become the dominant visual element */
@media (min-width: 1200px) {
    .section-content {
        max-width: var(--content-max);
    }
}
