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

:root {
    /* Palette */
    --dawn-white: #f4f7fb;
    --mist-blue: #b8c9e0;
    --still-water: #7a9cc6;
    --deep-current: #3d5a80;
    --abyss-navy: #1a2a3d;
    --fog-grey: #8a9bb0;
    --cloud-blush: #e8dfd6;
    --morning-gold: #d4b896;
    --deep-ink: #2a3a52;

    /* Cursor position */
    --cursor-x: -100px;
    --cursor-y: -100px;

    /* Typography */
    --font-display: 'Nunito', sans-serif;
    --font-body: 'Quicksand', sans-serif;
    --font-mono: 'Overpass Mono', monospace;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    color: var(--deep-ink);
    background-color: var(--dawn-white);
    line-height: 1.75;
    letter-spacing: 0.015em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === GRAIN OVERLAY === */
#grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    mix-blend-mode: multiply;
}

#grain-overlay::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
}

/* === CURSOR GLOW === */
#cursor-glow {
    position: fixed;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(122, 156, 198, 0.12) 0%, transparent 70%);
    pointer-events: none;
    z-index: 9998;
    transform: translate(var(--cursor-x), var(--cursor-y));
    transition: transform 150ms ease-out;
    top: -20px;
    left: -20px;
    will-change: transform;
}

/* === NAVIGATION === */
#nav-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(122, 156, 198, 0.3);
    border: 1px solid var(--dawn-white);
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 200ms ease;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

#nav-toggle:hover {
    background: rgba(122, 156, 198, 0.5);
}

.nav-dot {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--dawn-white);
}

#nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(244, 247, 251, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
}

#nav-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

#nav-menu {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.nav-link {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: var(--deep-current);
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: color 200ms ease;
    background-image: linear-gradient(var(--still-water), var(--still-water));
    background-size: 0% 1px;
    background-repeat: no-repeat;
    background-position: left bottom;
    padding-bottom: 2px;
    transition: color 200ms ease, background-size 200ms ease;
}

.nav-link:hover {
    color: var(--still-water);
    background-size: 100% 1px;
}

/* === SECTIONS === */
.section {
    position: relative;
    width: 100%;
}

/* === HERO SECTION === */
.section--hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, var(--dawn-white) 0%, rgba(184, 201, 224, 0.08) 100%);
    overflow: hidden;
}

.hero-wave {
    position: absolute;
    top: 50%;
    left: -5%;
    width: 110%;
    height: 200px;
    transform: translateY(-50%);
    will-change: transform;
    animation: waveFloat 8s ease-in-out infinite;
}

.hero-wave-path {
    stroke-dasharray: 2400;
    stroke-dashoffset: 2400;
}

.hero-wave-path.animate {
    animation: drawWave 2s ease-out forwards;
}

@keyframes drawWave {
    to {
        stroke-dashoffset: 0;
    }
}

@keyframes waveFloat {
    0%, 100% {
        transform: translateY(-50%) translateX(0%);
    }
    50% {
        transform: translateY(-50%) translateX(-5%);
    }
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 24px;
    opacity: 0;
    transform: translateY(20px);
}

.hero-content.animate {
    animation: fadeUp 600ms ease-out forwards;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2.2rem, 6vw, 4.8rem);
    color: var(--deep-current);
    letter-spacing: 0.01em;
    line-height: 1.15;
    margin-bottom: 16px;
}

.hero-subtitle {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
    color: var(--fog-grey);
    letter-spacing: 0.015em;
    line-height: 1.75;
    opacity: 0;
    transform: translateY(20px);
}

.hero-subtitle.animate {
    animation: fadeUp 600ms ease-out forwards;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scroll Chevron */
.scroll-chevron {
    position: absolute;
    bottom: 48px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    z-index: 2;
}

.scroll-chevron.animate {
    animation: chevronFadeIn 400ms ease-out forwards, chevronBreathe 3s ease-in-out 400ms infinite;
}

@keyframes chevronFadeIn {
    to {
        opacity: 1;
    }
}

@keyframes chevronBreathe {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
    }
    50% {
        transform: translateX(-50%) translateY(6px);
    }
}

/* === WAVE DIVIDERS === */
.wave-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

/* === CONTENT SECTIONS (Tatami Blocks) === */
.section--content {
    max-width: 85vw;
    width: 100%;
    margin: 0 auto;
    padding: 40px 0 60px;
    display: flex;
    gap: 40px;
    align-items: flex-start;
}

.tatami-block {
    flex: 1;
    max-width: 680px;
    margin: 0 auto;
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.4rem, 2.8vw, 2.2rem);
    color: var(--deep-current);
    letter-spacing: 0.01em;
    line-height: 1.3;
    margin-bottom: 24px;
}

.subsection-label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: var(--deep-current);
    letter-spacing: 0.01em;
    line-height: 1.3;
    margin-top: 32px;
    margin-bottom: 12px;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
    color: var(--deep-ink);
    letter-spacing: 0.015em;
    line-height: 1.75;
    margin-bottom: 16px;
}

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

.mono-accent {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: 90%;
    color: var(--deep-ink);
}

/* === ENGAWA STRIP (Sidebar Annotations) === */
.engawa-strip {
    width: 180px;
    flex-shrink: 0;
    padding-top: 8px;
    border-left: 1px solid var(--mist-blue);
    padding-left: 16px;
    align-self: flex-start;
    margin-top: 48px;
}

.annotation {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.75rem, 1.2vw, 0.85rem);
    color: var(--fog-grey);
    letter-spacing: 0.015em;
    line-height: 1.65;
}

/* === PROTOCOL ITEMS === */
.protocol-item {
    margin-bottom: 8px;
}

/* === REVEAL ANIMATION === */
.reveal-section {
    opacity: 0.15;
    transform: translateY(12px);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.reveal-section.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* === FOOTER (Colophon Pool) === */
.section--footer {
    background-color: var(--abyss-navy);
    padding: 80px 24px 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.footer-wave {
    position: absolute;
    top: 50%;
    left: -5%;
    width: 110%;
    height: 200px;
    transform: translateY(-50%);
    will-change: transform;
    animation: waveFloat 8s ease-in-out infinite;
    animation-direction: reverse;
}

.footer-text {
    position: relative;
    z-index: 2;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.8rem, 1.4vw, 0.95rem);
    color: var(--mist-blue);
    letter-spacing: 0.015em;
    line-height: 1.75;
}

/* === LINKS === */
a {
    color: var(--still-water);
    text-decoration: none;
    background-image: linear-gradient(var(--still-water), var(--still-water));
    background-size: 0% 1px;
    background-repeat: no-repeat;
    background-position: left bottom;
    padding-bottom: 1px;
    transition: color 200ms ease, background-size 200ms ease;
}

a:hover {
    color: var(--deep-current);
    background-size: 100% 1px;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .section--content {
        flex-direction: column;
        max-width: 92vw;
        gap: 24px;
    }

    .engawa-strip {
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--mist-blue);
        padding-left: 0;
        padding-top: 16px;
        margin-top: 16px;
    }

    #nav-toggle {
        width: 32px;
        height: 32px;
    }

    #cursor-glow {
        display: none;
    }

    .hero-wave {
        animation: none;
    }

    .footer-wave {
        animation: none;
    }

    .scroll-chevron {
        bottom: 32px;
    }
}

@media (max-width: 480px) {
    .tatami-block {
        max-width: 100%;
    }

    .section--content {
        padding: 24px 0 40px;
    }

    .wave-divider {
        padding: 24px 0;
    }
}
