/* ==========================================================================
   yamato.quest — MUJI-inspired stacked sections
   Palette: Rice Paper, Ink Sumi, Warm Gray, Bamboo Green, Earth Umber,
            Clay Red, Stone Light
   ========================================================================== */

:root {
    --rice-paper: #f7f3ec;
    --ink-sumi: #2c2c2c;
    --warm-gray: #9a9590;
    --bamboo-green: #7a8a6a;
    --earth-umber: #8a7a5a;
    --clay-red: #a05a40;
    --stone-light: #e8e2d8;

    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Noto Sans JP', 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'Noto Sans Mono', 'Space Mono', monospace;

    --section-pad: 120px;
    --column-width: 640px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--rice-paper);
    color: var(--ink-sumi);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Washi paper texture overlay — subtle noise via layered radial gradients */
.paper-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.35;
    background-image:
        radial-gradient(circle at 12% 18%, rgba(138,122,90,0.04) 0, transparent 2px),
        radial-gradient(circle at 38% 72%, rgba(44,44,44,0.03) 0, transparent 2px),
        radial-gradient(circle at 67% 34%, rgba(138,122,90,0.035) 0, transparent 2px),
        radial-gradient(circle at 84% 88%, rgba(44,44,44,0.025) 0, transparent 2px),
        radial-gradient(circle at 22% 56%, rgba(138,122,90,0.03) 0, transparent 2px),
        radial-gradient(circle at 92% 12%, rgba(44,44,44,0.03) 0, transparent 2px);
    background-size: 140px 140px, 180px 180px, 160px 160px, 200px 200px, 150px 150px, 170px 170px;
    mix-blend-mode: multiply;
}

main {
    position: relative;
    z-index: 2;
}

/* ==========================================================================
   Side Navigation (left-edge progress strip)
   ========================================================================== */
.side-nav {
    position: fixed;
    left: 32px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    pointer-events: none;
}

.side-nav .nav-line {
    position: absolute;
    left: 5px;
    top: 0;
    height: 100%;
    width: 2px;
    overflow: visible;
}

.nav-line-base {
    stroke: var(--warm-gray);
    stroke-width: 1;
    opacity: 0.25;
}

.nav-line-fill {
    stroke: var(--earth-umber);
    stroke-width: 1.5;
    stroke-linecap: round;
    transition: y2 240ms ease-out;
}

.nav-dots {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 72px;
    padding: 12px 0;
    position: relative;
    pointer-events: auto;
}

.nav-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--warm-gray);
    cursor: pointer;
    padding: 0;
    position: relative;
    transition: background-color 300ms ease, border-color 300ms ease, transform 300ms ease;
    outline: none;
}

.nav-dot:hover {
    border-color: var(--earth-umber);
}

.nav-dot.passed {
    background: var(--earth-umber);
    border-color: var(--earth-umber);
}

.nav-dot.active {
    background: var(--clay-red);
    border-color: var(--clay-red);
    transform: scale(1.2);
}

/* ==========================================================================
   Opening / Contemplation Header
   ========================================================================== */
.section-opening {
    position: relative;
    min-height: 100vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0 0 8vh 0;
    overflow: hidden;
}

.opening-frame {
    position: relative;
    width: 100%;
    height: 80vh;
    min-height: 520px;
}

.opening-path {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.opening-path .draw-path {
    stroke: var(--earth-umber);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.opening-title {
    position: absolute;
    left: 10vw;
    bottom: 10vh;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 1500ms ease-out, transform 1500ms ease-out;
    max-width: 520px;
}

.opening-title.revealed {
    opacity: 1;
    transform: translateY(0);
}

.opening-mark {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 1.1rem;
    color: var(--clay-red);
    letter-spacing: 0.3em;
    margin-bottom: 18px;
}

.opening-name {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 4.2rem;
    line-height: 1.05;
    letter-spacing: 0.02em;
    color: var(--ink-sumi);
    margin-bottom: 18px;
}

.opening-meta {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--warm-gray);
    letter-spacing: 0.18em;
    text-transform: lowercase;
}

.scroll-hint {
    position: absolute;
    right: 40px;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 1500ms ease-out 600ms;
}

.scroll-hint.revealed {
    opacity: 1;
}

.scroll-hint-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--warm-gray);
    letter-spacing: 0.22em;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.scroll-hint-line {
    width: 1px;
    height: 60px;
    background: linear-gradient(to bottom, transparent, var(--earth-umber));
    animation: scrollHintPulse 2.4s ease-in-out infinite;
}

@keyframes scrollHintPulse {
    0%, 100% { transform: scaleY(0.6); transform-origin: top; opacity: 0.5; }
    50% { transform: scaleY(1); opacity: 1; }
}

/* Opening path nodes */
.opening-path .node {
    fill: var(--earth-umber);
    opacity: 0;
    transform-origin: center;
}

.opening-path .node.revealed {
    animation: nodePulse 500ms ease-out forwards;
}

@keyframes nodePulse {
    0% { opacity: 0; r: 3; }
    40% { opacity: 1; r: 7; }
    100% { opacity: 1; r: 5; }
}

/* ==========================================================================
   Content Sections
   ========================================================================== */
.content-section {
    position: relative;
    width: 100%;
    padding: var(--section-pad) 0;
    min-height: 60vh;
}

.content-section.alt {
    background: var(--stone-light);
}

.content-section::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 60%;
    max-width: var(--column-width);
    height: 1px;
    background: var(--warm-gray);
    opacity: 0.15;
}

.section-inner {
    width: 100%;
    max-width: var(--column-width);
    margin: 0 auto;
    padding: 0 24px;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 800ms ease-out, transform 800ms ease-out;
}

.section-inner.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-meta {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--warm-gray);
    letter-spacing: 0.2em;
    text-transform: lowercase;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-meta::before {
    content: "";
    display: inline-block;
    width: 28px;
    height: 1px;
    background: var(--earth-umber);
}

.section-title {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 3rem;
    line-height: 1.15;
    letter-spacing: 0.02em;
    color: var(--ink-sumi);
    margin-bottom: 32px;
}

.section-lede {
    font-family: var(--font-heading);
    font-weight: 400;
    font-style: italic;
    font-size: 1.35rem;
    line-height: 1.55;
    color: var(--ink-sumi);
    margin-bottom: 36px;
    letter-spacing: 0.01em;
}

.section-inner p {
    font-size: 1rem;
    line-height: 1.85;
    color: var(--ink-sumi);
    margin-bottom: 24px;
}

.section-inner p + p {
    margin-top: 0;
}

.section-footnote {
    margin-top: 40px;
    display: flex;
    gap: 14px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--warm-gray);
    letter-spacing: 0.06em;
}

.footnote-mark {
    color: var(--earth-umber);
}

/* Material / color list */
.material-list {
    list-style: none;
    margin-top: 48px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 28px;
    background: var(--rice-paper);
    border: 1px solid rgba(154, 149, 144, 0.18);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.content-section.alt .material-list {
    background: var(--rice-paper);
}

.material-list li {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    align-items: center;
    gap: 18px;
    padding: 8px 4px;
    border-bottom: 1px solid rgba(154, 149, 144, 0.12);
}

.material-list li:last-child {
    border-bottom: none;
}

.swatch {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(44,44,44,0.08);
}

.swatch-label {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 1rem;
    color: var(--ink-sumi);
    letter-spacing: 0.02em;
}

.swatch-code {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--warm-gray);
    letter-spacing: 0.08em;
}

/* Process steps */
.process-steps {
    margin-top: 48px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    border-top: 1px solid rgba(154, 149, 144, 0.2);
}

.step {
    display: grid;
    grid-template-columns: 56px 1fr;
    align-items: center;
    padding: 22px 4px;
    border-bottom: 1px solid rgba(154, 149, 144, 0.2);
    gap: 20px;
}

.step-num {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 1.5rem;
    color: var(--clay-red);
    letter-spacing: 0.02em;
}

.step-label {
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--ink-sumi);
    letter-spacing: 0.01em;
}

/* Quote block */
.section-quote {
    margin-top: 48px;
    padding: 36px 28px;
    border-left: 2px solid var(--earth-umber);
    background: var(--rice-paper);
    font-family: var(--font-heading);
    font-style: italic;
    font-size: 1.25rem;
    line-height: 1.6;
    color: var(--ink-sumi);
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    align-items: start;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.section-quote .quote-mark {
    font-family: var(--font-heading);
    color: var(--clay-red);
    font-size: 1.6rem;
    line-height: 1;
    font-style: normal;
}

.section-quote .quote-text {
    display: block;
}

.section-quote cite {
    grid-column: 1 / -1;
    display: block;
    font-family: var(--font-mono);
    font-style: normal;
    font-size: 0.75rem;
    color: var(--warm-gray);
    letter-spacing: 0.1em;
    margin-top: 14px;
}

/* ==========================================================================
   Interstitials (path-draw between sections)
   ========================================================================== */
.interstitial {
    position: relative;
    width: 100%;
    height: 20vh;
    min-height: 140px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.interstitial::before,
.interstitial::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 28px;
    background: var(--warm-gray);
    opacity: 0.2;
}

.interstitial::before { top: 0; }
.interstitial::after { bottom: 0; }

.interstitial-path {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.draw-path {
    stroke: var(--earth-umber);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.node {
    fill: var(--earth-umber);
    transform-origin: center;
    opacity: 0;
    transition: opacity 300ms ease-out;
}

.node.small {
    r: 4;
}

.node.revealed {
    opacity: 1;
}

.node.pulse {
    animation: nodePulseSmall 420ms ease-out;
}

@keyframes nodePulseSmall {
    0% { transform: scale(1); }
    50% { transform: scale(1.35); }
    100% { transform: scale(1); }
}

/* ==========================================================================
   Index Footer
   ========================================================================== */
.index-footer {
    padding-bottom: 80px;
}

.index-grid {
    position: relative;
    margin-top: 48px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    padding: 24px 0;
}

.index-connections {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

.index-link {
    stroke: var(--earth-umber);
    stroke-width: 1;
    opacity: 0.4;
}

.index-col {
    list-style: none;
    position: relative;
    z-index: 2;
}

.index-col li {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: baseline;
    padding: 14px 0;
    border-bottom: 1px solid rgba(154, 149, 144, 0.2);
    background: var(--rice-paper);
}

.content-section.alt .index-col li {
    background: var(--stone-light);
}

.idx-num {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--warm-gray);
    letter-spacing: 0.1em;
}

.idx-label {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 1.05rem;
    color: var(--ink-sumi);
    letter-spacing: 0.02em;
}

.idx-code {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--bamboo-green);
    letter-spacing: 0.08em;
}

.site-footer {
    margin-top: 80px;
    padding-top: 28px;
    border-top: 1px solid rgba(154, 149, 144, 0.25);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--warm-gray);
    letter-spacing: 0.14em;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-mid {
    font-style: italic;
    font-family: var(--font-heading);
    letter-spacing: 0.04em;
}

/* ==========================================================================
   Reveal utility
   ========================================================================== */
.reveal {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 800ms ease-out, transform 800ms ease-out;
}

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

/* ==========================================================================
   Grid overlay (very subtle) on stone sections
   ========================================================================== */
.content-section.alt::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(154,149,144,0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(154,149,144,0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.6;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 760px) {
    :root {
        --section-pad: 60px;
    }

    .side-nav {
        left: 14px;
    }

    .nav-dots {
        gap: 44px;
    }

    .opening-name {
        font-size: 2.6rem;
    }

    .opening-title {
        left: 8vw;
        bottom: 8vh;
    }

    .section-title {
        font-size: 2.2rem;
    }

    .section-lede {
        font-size: 1.15rem;
    }

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

    .scroll-hint {
        right: 18px;
        bottom: 24px;
    }

    .site-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .section-quote {
        grid-template-columns: auto 1fr;
    }

    .section-quote .quote-mark:last-of-type {
        display: none;
    }
}

@media (max-width: 420px) {
    .opening-name {
        font-size: 2.1rem;
    }

    .section-title {
        font-size: 1.9rem;
    }
}
