:root {
    --kuro-ai: #1B1464;
    --kincha: #C4864C;
    --sabi-asagi: #3D7A6E;
    --shiro-neri: #F0E8D8;
    --enji: #8B2500;
    --hai: #8C8378;
    --sumi: #1A1A1A;
    --kohaku: #D4A24C;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    background: var(--sumi);
    color: var(--kuro-ai);
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Grain Overlay */
.grain-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    mix-blend-mode: overlay;
    opacity: 0.18;
    background-image:
        repeating-conic-gradient(#8C8378 0% 25%, transparent 0% 50%);
    background-size: 3px 3px;
    animation: grain-shift 0.5s steps(4) infinite;
}

@keyframes grain-shift {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-1px, 1px); }
    50% { transform: translate(1px, -1px); }
    75% { transform: translate(-1px, -1px); }
    100% { transform: translate(1px, 1px); }
}

/* Floating Sigil */
.sigil {
    position: fixed;
    top: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 1.2rem;
    color: var(--kincha);
    border: 2px solid var(--kincha);
    border-radius: 50%;
    cursor: pointer;
    z-index: 1000;
    animation: sigil-rotate 30s linear infinite;
    transition: opacity 0.3s ease;
}

.sigil:hover {
    opacity: 0.7;
}

@keyframes sigil-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Overlay Menu */
.overlay-menu {
    position: fixed;
    inset: 0;
    background: rgba(26, 26, 26, 0.96);
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.overlay-menu.open {
    opacity: 1;
    pointer-events: auto;
}

.menu-link {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    color: var(--shiro-neri);
    text-decoration: none;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: color 0.3s ease;
}

.menu-link:hover {
    color: var(--kincha);
}

/* Typography */
.display-title {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(5rem, 12vw, 12rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--shiro-neri);
    text-shadow: 1px 0 0 var(--kuro-ai);
    line-height: 1;
}

.display-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(3rem, 8vw, 8rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1;
    margin-bottom: 2rem;
}

.heading-kincha { color: var(--kincha); }
.heading-kohaku { color: var(--kohaku); }

.sub-heading {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    font-style: italic;
    color: var(--sabi-asagi);
    margin-top: 1.5rem;
}

.body-text {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    max-width: 38em;
    margin-bottom: 1.5rem;
}

.text-light { color: var(--shiro-neri); }

.pull-quote {
    font-family: 'Instrument Serif', serif;
    font-weight: 400;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    line-height: 1.5;
    color: var(--kuro-ai);
    max-width: 50ch;
    font-style: italic;
    text-align: center;
}

/* Section Counter */
.section-counter {
    position: absolute;
    left: -2%;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Fragment Mono', monospace;
    font-weight: 400;
    font-size: clamp(6rem, 15vw, 15rem);
    color: var(--hai);
    opacity: 0.15;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    pointer-events: none;
    line-height: 1;
}

.counter-light { color: var(--shiro-neri); }

.section-counter-minimal {
    font-family: 'Fragment Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--hai);
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
}

/* Strata */
.stratum {
    min-height: 85vh;
    position: relative;
    overflow: hidden;
    padding-block: clamp(4rem, 10vh, 8rem);
}

.stratum-dark {
    background:
        repeating-conic-gradient(transparent 0% 25%, rgba(0,0,0,0.03) 0% 50%) 0 0 / 4px 4px,
        var(--sumi);
    color: var(--shiro-neri);
}

.stratum-light {
    background:
        repeating-conic-gradient(transparent 0% 25%, rgba(0,0,0,0.02) 0% 50%) 0 0 / 4px 4px,
        var(--shiro-neri);
    color: var(--kuro-ai);
}

.stratum-indigo {
    background:
        repeating-conic-gradient(transparent 0% 25%, rgba(0,0,0,0.03) 0% 50%) 0 0 / 4px 4px,
        var(--kuro-ai);
    color: var(--shiro-neri);
}

.stratum-breathing {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stratum-colophon {
    background:
        linear-gradient(to bottom, var(--sumi) 60%, #000000 100%);
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

/* Pattern Backgrounds */
.pattern-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.pattern-large {
    transform: scale(2);
}

/* Content Layout */
.stratum-content {
    position: relative;
    z-index: 2;
    padding-inline: clamp(2rem, 6vw, 6rem);
    max-width: 1200px;
    margin: 0 auto;
}

.golden-offset {
    padding-left: 38.2%;
}

.two-col {
    display: flex;
    gap: clamp(2rem, 4vw, 4rem);
}

.col-major { flex: 0 0 58%; }
.col-minor { flex: 1; }

/* Accent Line */
.accent-line-left {
    position: absolute;
    left: calc(38.2% - 2rem);
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--sabi-asagi);
    opacity: 0.6;
}

/* Depth Blocks */
.depth-blocks {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.depth-block {
    border-left: 2px solid var(--sabi-asagi);
    padding-left: 2rem;
    margin-left: calc(var(--offset, 0) * 5%);
    transform: translateY(calc(var(--offset, 0) * 20px));
}

/* Resonance */
.resonance-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-left: 0;
}

.mon-row {
    display: flex;
    gap: 3rem;
    margin-top: 3rem;
}

.mon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--enji);
    position: relative;
}

.mon::before {
    content: '';
    position: absolute;
    inset: 5px;
    border-radius: 50%;
    border: 1px solid var(--enji);
    opacity: 0.6;
}

.mon::after {
    content: '';
    position: absolute;
    inset: 12px;
    border-radius: 50%;
    border: 1px solid var(--enji);
    opacity: 0.3;
}

/* Dividers */
.stratum-divider {
    height: 1px;
    background: var(--kincha);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diamond {
    width: 10px;
    height: 10px;
    background: var(--kincha);
    transform: rotate(45deg);
    position: relative;
    z-index: 1;
}

/* Colophon */
.colophon-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.colophon-label {
    font-family: 'Fragment Mono', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--shiro-neri);
    opacity: 0.7;
}

.colophon-rule {
    width: 80px;
    height: 1px;
    background: var(--kincha);
    margin: 1.5rem auto 0;
}

.colophon-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to bottom, transparent, #000000);
    pointer-events: none;
}

/* Stagger Animation */
.stagger-in {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.stagger-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .golden-offset {
        padding-left: clamp(2rem, 6vw, 4rem);
    }
    .two-col {
        flex-direction: column;
    }
    .section-counter {
        font-size: clamp(4rem, 10vw, 8rem);
        left: -5%;
    }
    .depth-block {
        margin-left: 0;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .grain-overlay { animation: none; }
    .sigil { animation: none; }
    .stagger-in {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
