/* =====================================================
   kunoichi.quest — Scholarly Manuscript Design System
   Palette: Burgundy-Cream / Iron Gall / Pomegranate
   ===================================================== */

/* === Color Variables === */
:root {
    --dried-blood:      #3D0C11;
    --aged-parchment:   #F2E4C4;
    --morning-cream:    #FAF4E8;
    --deep-pomegranate: #4A0E17;
    --warm-ivory:       #F5ECD7;
    --charcoal-ink:     #2A1A14;
    --faded-claret:     #7D2535;
    --rust-oxide:       #9B3A4A;
    --warm-tan:         #B89A7A;
    --pale-silk:        #EDE0CC;
}

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

html {
    scroll-behavior: smooth;
    scroll-snap-type: y mandatory;
}

body {
    font-family: 'IM Fell English', Georgia, serif;
    background-color: var(--dried-blood);
    color: var(--charcoal-ink);
    overflow-x: hidden;
    line-height: 1.8;
}

/* === Chapter Base === */
.chapter {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    scroll-snap-align: start;
}

/* =====================================================
   CHAPTER I — THE SEAL
   Background: #3D0C11 (Dried Blood)
   Text: #F5ECD7 (Warm Ivory)
   ===================================================== */

.chapter-seal {
    background-color: var(--dried-blood);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 35vh;
}

.seal-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    z-index: 2;
    position: relative;
}

.seal-subtitle {
    font-family: 'Noto Serif JP', 'Hiragino Mincho ProN', serif;
    font-size: 2rem;
    color: var(--warm-tan);
    letter-spacing: 0.2em;
    margin-bottom: 0.5rem;
    opacity: 0.8;
}

.seal-title {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-size: clamp(3.5rem, 7vw, 7rem);
    font-weight: 300;
    color: var(--warm-ivory);
    letter-spacing: -0.025em;
    line-height: 1;
    font-variation-settings: 'wght' 300;
    opacity: 0.2;
    animation: weight-materialize 1.2s ease-out 0.3s forwards;
}

@keyframes weight-materialize {
    from {
        font-variation-settings: 'wght' 300;
        opacity: 0.2;
    }
    to {
        font-variation-settings: 'wght' 600;
        opacity: 1;
    }
}

.seal-rule {
    width: 120px;
    height: 1px;
    background: var(--warm-ivory);
    opacity: 0.2;
    margin: 1.5rem auto;
}

.seal-tagline {
    font-family: 'IM Fell English', Georgia, serif;
    font-size: 1rem;
    color: var(--warm-ivory);
    letter-spacing: 0.05em;
    opacity: 0.6;
    font-style: italic;
}

/* Mountain brushstroke horizon */
.brushstroke-horizon {
    position: absolute;
    bottom: 30vh;
    left: 0;
    width: 100%;
    height: 60px;
    pointer-events: none;
    z-index: 1;
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
}

.scroll-arrow {
    font-family: 'Noto Serif JP', serif;
    font-size: 14px;
    color: var(--warm-ivory);
    opacity: 0.4;
    animation: pulse-opacity 2s ease-in-out infinite;
    display: block;
}

@keyframes pulse-opacity {
    0%, 100% { opacity: 0.4; }
    50%       { opacity: 0.8; }
}

/* =====================================================
   CHAPTER II — THE ARCHIVE
   Background: #F2E4C4 (Aged Parchment)
   Text: #2A1A14 (Charcoal Ink)
   ===================================================== */

.chapter-archive {
    background-color: var(--aged-parchment);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Kamon hishi borders */
.kamon-border-h {
    position: absolute;
    left: 0;
    width: 100%;
    height: 12px;
    z-index: 3;
    pointer-events: none;
}

.kamon-border-top {
    top: 0;
}

.kamon-border-bottom {
    bottom: 0;
}

.archive-layout {
    display: flex;
    align-items: stretch;
    height: 100%;
    padding: 80px 0;
}

.archive-text {
    flex: 1;
    padding: 80px 5vw 80px 8vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 60%;
}

.chapter-number {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.1rem;
    color: var(--rust-oxide);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    opacity: 0.7;
    margin-bottom: 0.5rem;
    font-variation-settings: 'wght' 400;
}

.chapter-number-dark {
    color: var(--rust-oxide);
}

.chapter-number-cream {
    color: var(--warm-tan);
}

.chapter-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    letter-spacing: -0.025em;
    line-height: 1.05;
    margin-bottom: 2.5rem;
}

.archive-heading {
    font-size: clamp(3rem, 5.5vw, 5.5rem);
    color: var(--charcoal-ink);
    font-variation-settings: 'wght' 500;
    font-weight: 500;
}

.archive-body {
    font-family: 'IM Fell English', Georgia, serif;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    color: var(--charcoal-ink);
    line-height: 1.8;
    margin-bottom: 1.5rem;
    max-width: 55ch;
}

.italic-note {
    font-style: italic;
    color: var(--faded-claret);
    opacity: 0.85;
}

/* Archive right: bamboo + vertical annotation */
.archive-right {
    width: 200px;
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    overflow: hidden;
}

.bamboo-motif {
    position: absolute;
    right: 0;
    top: 0;
    width: 80px;
    height: 100%;
}

.vertical-annotation {
    position: absolute;
    right: 90px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
}

.annotation-text {
    font-family: 'Noto Serif JP', serif;
    font-size: 12px;
    color: var(--warm-tan);
    letter-spacing: 0.15em;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    opacity: 0.75;
}

/* =====================================================
   CHAPTER III — THE DISCIPLINE
   Background: #FAF4E8 (Morning Cream)
   ===================================================== */

.chapter-discipline {
    background-color: var(--morning-cream);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.ginkgo-leaves {
    position: absolute;
    top: 10%;
    right: 5%;
    width: 200px;
    height: 200px;
    pointer-events: none;
    z-index: 1;
}

.discipline-inner {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1100px;
    padding: 0 8.33%;
}

.discipline-heading {
    font-size: clamp(2.5rem, 5.5vw, 5rem);
    color: var(--charcoal-ink);
    font-variation-settings: 'wght' 500;
    margin-bottom: 3rem;
}

.discipline-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.discipline-card {
    position: relative;
    border: 1px solid var(--pale-silk);
    padding: 32px;
    background: transparent;
    border-radius: 2px;
    min-height: 260px;
    overflow: hidden;
}

/* Skeleton state */
.card-skeleton-wrap {
    position: absolute;
    inset: 32px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-skeleton-line {
    border-radius: 2px;
    background: linear-gradient(90deg, var(--pale-silk) 25%, var(--warm-ivory) 50%, var(--pale-silk) 75%);
    background-size: 400% 100%;
    animation: shimmer 1.2s infinite linear;
}

.skeleton-title {
    height: 22px;
    width: 60%;
}

.skeleton-body1 {
    height: 14px;
    width: 100%;
}

.skeleton-body2 {
    height: 14px;
    width: 90%;
}

.skeleton-body3 {
    height: 14px;
    width: 75%;
}

@keyframes shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Card content (hidden until skeleton resolves) */
.card-content {
    position: relative;
    z-index: 2;
    transition: opacity 0.4s ease;
}

.card-heading {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.4rem;
    color: var(--charcoal-ink);
    font-variation-settings: 'wght' 500;
    margin-bottom: 0.75rem;
    letter-spacing: -0.01em;
}

.card-rule {
    width: 100%;
    height: 2px;
    background: var(--rust-oxide);
    margin-bottom: 1rem;
    opacity: 0.4;
}

.card-body {
    font-family: 'IM Fell English', Georgia, serif;
    font-size: 0.92rem;
    color: var(--charcoal-ink);
    line-height: 1.75;
    opacity: 0.85;
}

/* Card revealed state */
.discipline-card.revealed .card-skeleton-wrap {
    display: none;
}

.discipline-card.revealed .card-content {
    opacity: 1 !important;
}

/* =====================================================
   CHAPTER IV — THE METHOD
   Background: #4A0E17 (Deep Pomegranate)
   Text: #F5ECD7 (Warm Ivory)
   ===================================================== */

.chapter-method {
    background-color: var(--deep-pomegranate);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Kamon circle border frame */
.kamon-border-frame {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
}

.kamon-border-v {
    position: absolute;
    top: 0;
    height: 100%;
}

.kamon-border-left {
    left: 0;
}

.kamon-border-right {
    right: 0;
}

.kamon-border-h2 {
    position: absolute;
    left: 0;
    width: 100%;
    height: 12px;
}

.kamon-border-top2 {
    top: 0;
}

.kamon-border-bottom2 {
    bottom: 0;
}

.method-inner {
    position: relative;
    z-index: 3;
    display: flex;
    width: 100%;
    max-width: 1100px;
    padding: 0 8vw;
    gap: 4rem;
    align-items: center;
}

.method-left {
    flex: 1;
}

.method-heading {
    font-size: clamp(3rem, 5.5vw, 5.5rem);
    color: var(--warm-ivory);
    font-variation-settings: 'wght' 500;
    margin-bottom: 2.5rem;
}

.method-body {
    font-family: 'IM Fell English', Georgia, serif;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    color: var(--warm-ivory);
    line-height: 1.8;
    opacity: 0.85;
    margin-bottom: 1.5rem;
    max-width: 52ch;
}

.method-right {
    width: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.method-annotation {
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    align-items: center;
}

.method-annotation-text {
    font-family: 'Noto Serif JP', serif;
    font-size: 12px;
    color: var(--warm-tan);
    letter-spacing: 0.15em;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    opacity: 0.6;
}

.method-annotation-label {
    font-family: 'IM Fell English', serif;
    font-size: 11px;
    color: var(--warm-ivory);
    opacity: 0.35;
    letter-spacing: 0.1em;
}

/* =====================================================
   CHAPTER V — THE INDEX
   Background: #FAF4E8 (Morning Cream)
   Text: #2A1A14 (Charcoal Ink)
   ===================================================== */

.chapter-index {
    background-color: var(--warm-ivory);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.bamboo-motif-index {
    position: absolute;
    right: 0;
    top: 0;
    width: 80px;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.index-inner {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 700px;
    padding: 0 8.33%;
}

.index-heading {
    font-size: clamp(3rem, 5.5vw, 5rem);
    color: var(--charcoal-ink);
    font-variation-settings: 'wght' 500;
    margin-bottom: 2rem;
}

.index-rule {
    width: 100%;
    height: 1px;
    background: var(--faded-claret);
    opacity: 0.3;
    margin-bottom: 2.5rem;
}

.index-list {
    list-style: none;
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-size: 14px;
    color: var(--charcoal-ink);
}

.index-entry {
    display: flex;
    align-items: baseline;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--pale-silk);
}

.index-term {
    color: var(--charcoal-ink);
    text-shadow: 1px 1px 0 var(--faded-claret);
    letter-spacing: 0.04em;
    min-width: 160px;
}

.index-dots {
    flex: 1;
    border-bottom: 1px dotted var(--rust-oxide);
    opacity: 0.35;
    margin: 0 0.75rem;
    position: relative;
    top: -3px;
}

.index-ref {
    font-size: 12px;
    color: var(--rust-oxide);
    letter-spacing: 0.08em;
    opacity: 0.7;
}

/* =====================================================
   SECTION CHAPTER REVEAL ANIMATIONS
   ===================================================== */

.chapter-archive,
.chapter-discipline,
.chapter-method,
.chapter-index {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.chapter-archive.visible,
.chapter-discipline.visible,
.chapter-method.visible,
.chapter-index.visible {
    opacity: 1;
}

/* weight animation for chapter titles (triggered via JS) */
.chapter-title.animate-weight {
    animation: weight-materialize-chapter 1s ease-out forwards;
}

@keyframes weight-materialize-chapter {
    from {
        font-variation-settings: 'wght' 300;
        opacity: 0.1;
    }
    to {
        font-variation-settings: 'wght' 500;
        opacity: 1;
    }
}

/* Initial state for chapter titles in non-seal chapters */
.archive-heading,
.discipline-heading,
.method-heading,
.index-heading {
    font-variation-settings: 'wght' 300;
    opacity: 0.1;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */

@media (max-width: 900px) {
    .archive-layout {
        flex-direction: column;
    }

    .archive-text {
        max-width: 100%;
        padding: 60px 6vw 40px 6vw;
    }

    .archive-right {
        width: 100%;
        height: 80px;
    }

    .bamboo-motif {
        display: none;
    }

    .vertical-annotation {
        flex-direction: row;
        writing-mode: horizontal-tb;
        right: auto;
        top: auto;
        transform: none;
        position: static;
    }

    .annotation-text {
        writing-mode: horizontal-tb;
    }

    .discipline-cards {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }

    .discipline-inner {
        padding: 0 5vw;
        overflow-y: auto;
    }

    .method-right {
        display: none;
    }

    .method-inner {
        flex-direction: column;
        padding: 0 5vw;
    }

    html {
        scroll-snap-type: none;
    }
}
