/* ============================================================
   tanso.group — Luxury Carbon Atelier
   Five-strata parallax descent: Air → Forest → Earth → Crystal → Future
   ============================================================ */

:root {
    /* Palette — exact hex values from DESIGN.md */
    --soot-black: #0C0A08;
    --charcoal-brown: #1A1612;
    --amber-resin: #C8A06A;
    --forest-carbon: #2D4A32;
    --diamond-refraction: #A8D8EA;
    --parchment: #F5F0E8;
    --limestone: #B8AFA3;
    --iron-oxide: #3D1C00;
    --graphene-silver: #C4C9CF;
    --kiln-wash: #E8D5C4;
    --warm-text-dark: #1A1612;
    --warm-text-body-light: #3D3630;
    --muted-taupe: #7A6F63;

    /* Type families */
    --font-display: "Cormorant", Georgia, serif;
    --font-body: "Source Sans 3", system-ui, sans-serif;
    --font-mono: "DM Mono", "Menlo", monospace;

    /* Scroll-driven weight (updated by JS, defaults to 300) */
    --scroll-weight: 300;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    color: var(--limestone);
    background-color: var(--parchment);
    overflow-x: hidden;
    transition: background-color 0.4s linear;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   Sumi-e noise overlay — fixed across viewport
   ============================================================ */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    opacity: 0.04;
    mix-blend-mode: multiply;
}

/* ============================================================
   Sediment progress rail (left edge, 8px wide)
   ============================================================ */
.progress-rail {
    position: fixed;
    top: 0;
    left: 0;
    width: 8px;
    height: 100vh;
    z-index: 50;
    pointer-events: none;
}

.progress-rail__sediment {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        #F5F0E8 0%,
        #B8AFA3 18%,
        #2D4A32 36%,
        #1A1612 56%,
        #0C0A08 74%,
        #C4C9CF 92%,
        #F5F0E8 100%
    );
    opacity: 0.55;
}

.progress-rail__marker {
    position: absolute;
    left: -3px;
    top: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(200, 160, 106, 0.85);
    box-shadow:
        0 0 12px rgba(200, 160, 106, 0.5),
        inset 0 0 4px rgba(245, 240, 232, 0.4);
    transition: top 0.15s ease-out;
}

.progress-rail__labels {
    position: absolute;
    left: 18px;
    top: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 12vh 0;
}

.progress-rail__label {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.18em;
    color: var(--muted-taupe);
    text-transform: uppercase;
    opacity: 0.45;
    transition: opacity 0.5s ease, color 0.5s ease;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

.progress-rail__label.is-active {
    opacity: 1;
    color: var(--amber-resin);
}

/* ============================================================
   Ambient layers — particles & prismatic lines
   ============================================================ */
.ambient-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 4;
}

.ambient-layer--particles {
    z-index: 3;
}

.particle {
    position: absolute;
    bottom: -10vh;
    left: var(--x, 50vw);
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: rgba(184, 175, 163, 0.18);
    box-shadow: 0 0 4px rgba(184, 175, 163, 0.15);
    animation: particle-drift var(--d, 45s) linear infinite;
    animation-delay: var(--delay, 0s);
    will-change: transform, opacity;
    opacity: 0;
}

.stratum--earth ~ .ambient-layer--particles .particle,
.ambient-layer--particles .particle {
    /* particles only fully visible in earth/crystal/future strata */
}

@keyframes particle-drift {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    50% {
        transform: translateY(-50vh) translateX(8px);
        opacity: 0.5;
    }
    90% {
        opacity: 0.4;
    }
    100% {
        transform: translateY(-110vh) translateX(-6px);
        opacity: 0;
    }
}

.prismatic-line {
    position: absolute;
    top: -10vh;
    left: var(--x, 50vw);
    width: 1px;
    height: 70vh;
    background: linear-gradient(
        180deg,
        rgba(168, 216, 234, 0) 0%,
        rgba(168, 216, 234, 0.18) 30%,
        rgba(200, 160, 106, 0.12) 55%,
        rgba(168, 216, 234, 0.10) 75%,
        rgba(168, 216, 234, 0) 100%
    );
    transform: rotate(var(--angle, 0deg));
    animation: prism-drift var(--d, 24s) ease-in-out infinite alternate;
    will-change: transform;
    opacity: 0;
    transition: opacity 1s ease;
}

body.in-crystal .prismatic-line {
    opacity: 0.85;
}

@keyframes prism-drift {
    0% {
        transform: rotate(var(--angle, 0deg)) translateY(-2vh);
    }
    100% {
        transform: rotate(var(--angle, 0deg)) translateY(2vh);
    }
}

/* ============================================================
   Strata — section base
   ============================================================ */
.strata {
    position: relative;
    z-index: 10;
}

.stratum {
    position: relative;
    min-height: 100vh;
    padding: 14vh 8vw 14vh 12vw;
    overflow: hidden;
    isolation: isolate;
}

.parallax-bg {
    position: absolute;
    inset: -10vh -5vw;
    z-index: -1;
    pointer-events: none;
    will-change: transform;
}

/* ============================================================
   Stratum 1 — Air
   ============================================================ */
.stratum--air {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 8vw;
    color: var(--warm-text-dark);
    background: linear-gradient(180deg, #F5F0E8 0%, #ECE5D8 80%, #D8CFBE 100%);
}

.parallax-bg--air {
    background: radial-gradient(
        ellipse at 50% 35%,
        rgba(245, 240, 232, 0) 0%,
        rgba(184, 175, 163, 0.18) 50%,
        rgba(184, 175, 163, 0.05) 100%
    );
    filter: blur(2px);
}

.parallax-bg--air-mist {
    background:
        radial-gradient(ellipse at 22% 70%, rgba(232, 213, 196, 0.4), transparent 60%),
        radial-gradient(ellipse at 78% 30%, rgba(196, 201, 207, 0.25), transparent 55%);
    filter: blur(8px);
}

.air-content {
    position: relative;
    text-align: center;
    z-index: 2;
}

.kanji {
    font-family: var(--font-display);
    font-size: clamp(7rem, 22vw, 18rem);
    color: var(--warm-text-dark);
    line-height: 1;
    letter-spacing: 0.04em;
    font-weight: 300;
    font-variation-settings: "wght" var(--scroll-weight, 300);
    transition: font-variation-settings 0.12s ease-out;
    opacity: 0;
    animation: kanji-emerge 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.4s forwards;
    text-shadow: 0 0 60px rgba(26, 22, 18, 0.06);
}

@keyframes kanji-emerge {
    from { opacity: 0; }
    to { opacity: 1; }
}

.hero-romaji {
    margin-top: 3rem;
    font-family: var(--font-mono);
    font-size: clamp(0.8rem, 1.1vw, 1rem);
    letter-spacing: 0.42em;
    text-transform: uppercase;
    color: var(--limestone);
    opacity: 0;
    animation: fade-in-slow 2s ease 1.4s forwards;
}

.hero-pronunciation {
    margin-top: 1.4rem;
    font-family: var(--font-display);
    font-style: italic;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    letter-spacing: 0.04em;
    color: var(--muted-taupe);
    opacity: 0;
    animation: fade-in-slow 2s ease 2s forwards;
}

@keyframes fade-in-slow {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.scroll-cue {
    position: absolute;
    bottom: 6vh;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    opacity: 0;
    animation: fade-in-slow 2s ease 2.6s forwards;
}

.scroll-cue__label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: var(--muted-taupe);
}

.scroll-cue__line {
    width: 1px;
    height: 56px;
    background: linear-gradient(180deg, var(--muted-taupe), transparent);
    animation: scroll-cue-pulse 2.4s ease-in-out infinite;
}

@keyframes scroll-cue-pulse {
    0%, 100% { transform: scaleY(1); opacity: 0.8; }
    50% { transform: scaleY(0.5); opacity: 0.3; }
}

/* ============================================================
   Stratum 2 — Forest
   ============================================================ */
.stratum--forest {
    background: linear-gradient(180deg, #D8CFBE 0%, #6E7A55 25%, #3F5238 60%, #2D4A32 100%);
    color: var(--parchment);
}

.parallax-bg--forest {
    background:
        radial-gradient(ellipse at 30% 20%, rgba(45, 74, 50, 0.6), transparent 60%),
        radial-gradient(ellipse at 70% 80%, rgba(26, 22, 18, 0.5), transparent 65%);
    filter: blur(16px);
}

.motif--tree-rings {
    position: absolute;
    width: 70vw;
    height: 70vw;
    max-width: 900px;
    max-height: 900px;
    right: -20vw;
    top: 30%;
    pointer-events: none;
    will-change: transform;
    z-index: -1;
}

/* ============================================================
   Stratum 3 — Earth
   ============================================================ */
.stratum--earth {
    background: linear-gradient(180deg, #2D4A32 0%, #3D1C00 30%, #1A1612 65%, #0C0A08 100%);
    color: var(--parchment);
}

.parallax-bg--earth {
    background:
        radial-gradient(ellipse at 18% 30%, rgba(200, 160, 106, 0.18), transparent 55%),
        radial-gradient(ellipse at 80% 70%, rgba(61, 28, 0, 0.5), transparent 60%);
    filter: blur(8px);
}

.parallax-bg--earth-vignette {
    background: radial-gradient(ellipse at 50% 30%, transparent 0%, rgba(12, 10, 8, 0.6) 80%);
    filter: blur(2px);
}

/* ============================================================
   Stratum 4 — Crystal
   ============================================================ */
.stratum--crystal {
    background: linear-gradient(180deg, #0C0A08 0%, #110F1A 50%, #0C0A08 100%);
    color: var(--parchment);
}

.parallax-bg--crystal {
    background:
        radial-gradient(ellipse at 30% 20%, rgba(168, 216, 234, 0.10), transparent 60%),
        radial-gradient(ellipse at 70% 80%, rgba(200, 160, 106, 0.08), transparent 55%);
    filter: blur(8px);
}

.parallax-bg--crystal-prism {
    background:
        linear-gradient(105deg, rgba(168, 216, 234, 0.06) 0%, transparent 30%, rgba(200, 160, 106, 0.05) 60%, transparent 100%),
        linear-gradient(75deg, transparent 20%, rgba(168, 216, 234, 0.04) 40%, transparent 80%);
    mix-blend-mode: screen;
    filter: blur(2px);
}

/* ============================================================
   Stratum 5 — Future
   ============================================================ */
.stratum--future {
    background: linear-gradient(180deg, #0C0A08 0%, #15171B 50%, #1F2126 100%);
    color: var(--parchment);
}

.parallax-bg--future {
    background:
        radial-gradient(ellipse at 50% 40%, rgba(196, 201, 207, 0.10), transparent 65%);
    filter: blur(8px);
}

.lattice {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    will-change: transform;
    opacity: 0.85;
}

/* ============================================================
   Stratum headers
   ============================================================ */
.stratum__header {
    max-width: 720px;
    margin: 4vh 0 12vh 6%;
    position: relative;
    z-index: 5;
}

.stratum__index {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--amber-resin);
    margin-bottom: 1.5rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid rgba(200, 160, 106, 0.3);
}

.stratum__title {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    font-weight: 300;
    font-variation-settings: "wght" var(--scroll-weight, 300);
    transition: font-variation-settings 0.12s ease-out;
    line-height: 1.05;
    letter-spacing: 0.02em;
    color: var(--parchment);
    margin-bottom: 1.6rem;
}

.stratum__title--carved {
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-shadow:
        0 1px 0 rgba(245, 240, 232, 0.06),
        0 -1px 0 rgba(0, 0, 0, 0.7);
}

.stratum__title--geometric {
    font-family: var(--font-body);
    font-weight: 300;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--graphene-silver);
}

.stratum__lede {
    font-family: var(--font-display);
    font-style: italic;
    font-size: clamp(1.1rem, 1.8vw, 1.55rem);
    line-height: 1.55;
    color: var(--limestone);
    max-width: 32em;
    letter-spacing: 0.01em;
}

/* ============================================================
   Cards — glassmorphic gallery
   ============================================================ */
.cards {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 18vh;
    z-index: 5;
}

.card {
    position: relative;
    width: clamp(280px, 32vw, 440px);
    margin-left: var(--offset-left, 20%);
    padding: 2.4rem 2.4rem 2.6rem;
    border-radius: 12px;
    background: rgba(26, 22, 18, 0.55);
    border: 1px solid rgba(200, 160, 106, 0.15);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(245, 240, 232, 0.05);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    transition:
        backdrop-filter 0.3s ease,
        -webkit-backdrop-filter 0.3s ease,
        border-color 0.3s ease,
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.stratum--air .card,
.stratum--forest .card:first-child {
    /* light cards if any; preserved for variation */
}

.card--obsidian {
    background: rgba(12, 10, 8, 0.62);
    border-color: rgba(200, 160, 106, 0.18);
}

.card--prismatic {
    background:
        linear-gradient(135deg, rgba(168, 216, 234, 0.08), rgba(200, 160, 106, 0.12), rgba(168, 216, 234, 0.06)),
        rgba(26, 22, 18, 0.5);
    border-color: rgba(168, 216, 234, 0.22);
}

.card--graphene {
    background: rgba(20, 22, 26, 0.55);
    border-color: rgba(196, 201, 207, 0.18);
}

.card:hover {
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border-color: rgba(200, 160, 106, 0.30);
    transform: translateY(-2px);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.36),
        inset 0 1px 0 rgba(245, 240, 232, 0.08);
}

.card--prismatic:hover {
    border-color: rgba(168, 216, 234, 0.4);
}

.card__eyebrow {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 0.9vw, 0.82rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--amber-resin);
    margin-bottom: 1rem;
}

.card--graphene .card__eyebrow {
    color: var(--graphene-silver);
}

.card--prismatic .card__eyebrow {
    color: var(--diamond-refraction);
}

.card__title {
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 2.1vw, 1.85rem);
    font-weight: 400;
    line-height: 1.25;
    color: var(--parchment);
    margin-bottom: 1.1rem;
    letter-spacing: 0.01em;
}

.card__body {
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.1vw, 1.08rem);
    line-height: 1.75;
    color: var(--limestone);
    letter-spacing: 0.01em;
}

.card__motif {
    position: absolute;
    pointer-events: none;
}

.card__motif--leaf {
    width: 95px;
    height: 95px;
    right: -22px;
    bottom: -22px;
    opacity: 0.6;
}

.card__motif--fern {
    width: 88px;
    height: 88px;
    left: -28px;
    top: -28px;
    transform: rotate(-12deg);
    opacity: 0.7;
}

/* ============================================================
   Closing
   ============================================================ */
.closing {
    margin: 22vh auto 4vh;
    text-align: center;
    max-width: 700px;
    padding: 0 6%;
}

.closing__line {
    font-family: var(--font-display);
    font-style: italic;
    font-size: clamp(1.2rem, 2.4vw, 1.85rem);
    line-height: 1.5;
    color: var(--parchment);
    font-weight: 300;
    letter-spacing: 0.02em;
    margin-bottom: 3rem;
}

.closing__signature {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--muted-taupe);
}

/* ============================================================
   Reveal animation (one-shot)
   ============================================================ */
[data-reveal] {
    opacity: 0;
    transform: translateY(40px);
    transition:
        opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transition-delay: calc(var(--stagger, 0) * 200ms);
}

[data-reveal].is-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    .stratum {
        padding: 12vh 6vw 12vh 9vw;
    }

    .progress-rail__labels {
        display: none;
    }

    .card {
        width: clamp(260px, 78vw, 420px);
        margin-left: clamp(8%, var(--offset-left, 12%), 14%) !important;
    }

    .stratum__header {
        margin-left: 4%;
    }

    .motif--tree-rings {
        right: -45vw;
        top: 25%;
        opacity: 0.5;
    }
}

@media (max-width: 560px) {
    .stratum {
        padding: 10vh 5vw 10vh 7vw;
    }

    .kanji {
        font-size: clamp(5rem, 36vw, 10rem);
    }

    .card {
        padding: 1.8rem 1.6rem 2rem;
    }

    .stratum__lede {
        font-size: 1.05rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    [data-reveal] {
        opacity: 1;
        transform: none;
    }
}
