/* ===================================================
   tanso.bar — Charcoal Kiln Descent
   Wabi-sabi industrial, zen-contemplative
   =================================================== */

/* --- CSS Custom Properties --- */
:root {
    --kiln-black: #1A1714;
    --charcoal-dense: #2C2620;
    --ember-orange: #D4652A;
    --binchotan-gray: #6B6560;
    --ash-white: #E8E2D9;
    --warm-stone: #A8A093;
    --kiln-red: #8B3A2A;
    --smoke-blue: #4A5568;

    --font-display: 'Cormorant Garamond', 'Georgia', serif;
    --font-body: 'Noto Sans JP', 'Helvetica Neue', sans-serif;
    --font-accent: 'Shippori Mincho', 'Georgia', serif;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--kiln-black);
    color: var(--ash-white);
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    letter-spacing: 0.01em;
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Charcoal Grain Texture Overlay --- */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    mix-blend-mode: multiply;
    filter: url(#grainFilter);
    background: var(--kiln-black);
}

.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Vertical Navigation Line (Left Edge) --- */
.kiln-nav {
    position: fixed;
    left: 24px;
    top: 0;
    height: 100vh;
    width: 8px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.nav-line {
    position: absolute;
    left: 50%;
    top: 10%;
    height: 80%;
    width: 1px;
    background-color: #8B7355;
    transform: translateX(-50%);
}

.nav-marker {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid #8B7355;
    background: transparent;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    transition: background-color 0.6s ease, border-color 0.6s ease;
}

.nav-marker:nth-child(2) { top: 10%; }
.nav-marker:nth-child(3) { top: 30%; }
.nav-marker:nth-child(4) { top: 50%; }
.nav-marker:nth-child(5) { top: 70%; }
.nav-marker:nth-child(6) { top: 90%; }

.nav-marker.active {
    background-color: var(--ember-orange);
    border-color: var(--ember-orange);
}

.nav-marker[data-layer="4"].active {
    background-color: var(--smoke-blue);
    border-color: var(--smoke-blue);
}

.nav-marker[data-layer="0"].active {
    background-color: var(--smoke-blue);
    border-color: var(--smoke-blue);
}

/* --- Temperature Gradient Bar (Right Edge) --- */
.temperature-bar {
    position: fixed;
    right: 0;
    top: 0;
    width: 4px;
    height: 100vh;
    z-index: 100;
    background: linear-gradient(
        to bottom,
        var(--smoke-blue) 0%,
        var(--binchotan-gray) 20%,
        var(--ember-orange) 45%,
        var(--kiln-red) 50%,
        var(--ember-orange) 55%,
        var(--binchotan-gray) 80%,
        var(--smoke-blue) 100%
    );
}

/* --- Kanji Watermark --- */
.kanji-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-accent);
    font-size: clamp(8rem, 20vw, 24rem);
    font-weight: 400;
    color: rgba(138, 115, 85, 0.04);
    mix-blend-mode: overlay;
    pointer-events: none;
    z-index: 1;
    transition: opacity 1.5s ease;
    user-select: none;
}

.kanji-watermark.visible {
    color: rgba(138, 115, 85, 0.08);
}

/* --- Kiln Layers (General) --- */
.kiln-layer {
    position: relative;
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.layer-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    padding: 80px 80px 80px 80px;
    z-index: 3;
}

/* --- Layer 1: Surface (Night Air) --- */
.layer-surface {
    background-color: var(--kiln-black);
    flex-direction: column;
}

.layer-surface .layer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-left: 0;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(2.5rem, 7vw, 8rem);
    letter-spacing: 0.03em;
    line-height: 1.15;
    color: transparent;
    background:
        radial-gradient(ellipse at 50% 50%, #4A4339 0%, #3D3832 30%, #2C2620 60%, #1A1714 100%),
        conic-gradient(from 0deg at 50% 50%, #3D3832 0deg, #4A4339 45deg, #2C2620 90deg, #4A4339 135deg, #3D3832 180deg, #2C2620 225deg, #4A4339 270deg, #3D3832 315deg, #4A4339 360deg),
        radial-gradient(circle at 30% 40%, #4A4339 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, #3D3832 0%, transparent 40%);
    background-size: 100% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0;
    transform: translateX(-8%);
    animation: heroFadeIn 2.5s ease-in-out 0.3s forwards;
}

.hero-subtitle {
    font-family: var(--font-accent);
    font-size: 2rem;
    font-weight: 400;
    color: var(--warm-stone);
    opacity: 0;
    animation: heroFadeIn 2s ease-in-out 1.8s forwards;
    margin-top: 1rem;
}

@keyframes heroFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Scroll Chevron */
.scroll-chevron {
    position: absolute;
    bottom: 5vh;
    left: 50%;
    transform: translateX(-50%);
    animation: chevronPulse 3s ease-in-out infinite;
    opacity: 0;
    animation: heroFadeIn 1.5s ease-in-out 3s forwards, chevronPulse 3s ease-in-out 4.5s infinite;
}

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

/* --- Layer 2: Mouth (Entry) --- */
.layer-mouth {
    background: linear-gradient(
        to bottom,
        var(--kiln-black) 0%,
        var(--charcoal-dense) 40%,
        var(--charcoal-dense) 100%
    );
}

.mouth-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 40px;
    align-items: center;
}

.mouth-text {
    grid-column: 1 / 3;
    max-width: 42ch;
    color: var(--warm-stone);
    line-height: 1.75;
}

.mouth-text p {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    letter-spacing: 0.01em;
}

.carbon-bar-element {
    grid-column: 3 / 4;
    width: 24px;
    height: 60vh;
    justify-self: center;
    background: linear-gradient(
        to bottom,
        var(--smoke-blue) 0%,
        var(--binchotan-gray) 25%,
        var(--ember-orange) 45%,
        var(--kiln-red) 50%,
        var(--ember-orange) 55%,
        var(--binchotan-gray) 75%,
        var(--smoke-blue) 100%
    );
}

/* --- Brush Stroke Dividers --- */
.brush-divider {
    position: relative;
    width: 100%;
    height: 40px;
    overflow: visible;
    z-index: 5;
}

.brush-divider svg {
    width: 80%;
    height: 40px;
    margin: 0 10%;
    display: block;
}

.brush-divider-1 svg { width: 70%; margin: 0 15%; }
.brush-divider-2 svg { width: 65%; margin: 0 17.5%; }
.brush-divider-3 svg { width: 60%; margin: 0 20%; }
.brush-divider-4 svg { width: 55%; margin: 0 22.5%; }

.brush-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s ease-out;
}

.brush-path.drawn {
    stroke-dashoffset: 0;
}

/* --- Layer 3: Chamber (Core) --- */
.layer-chamber {
    background-color: var(--charcoal-dense);
    overflow: hidden;
    min-height: 120vh;
}

.chamber-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 120%;
    transform: translate(-50%, -50%);
    background: radial-gradient(
        ellipse at 50% 50%,
        rgba(139, 58, 42, 0.15) 0%,
        rgba(139, 58, 42, 0.08) 30%,
        transparent 70%
    );
    pointer-events: none;
    z-index: 1;
}

.chamber-grid {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 40px;
    padding-top: 100px;
    padding-bottom: 100px;
}

.chamber-block {
    border-left: 2px solid var(--ember-orange);
    padding: 32px 32px 32px 28px;
    position: relative;
}

.chamber-block h2 {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.4rem, 2.5vw, 2.8rem);
    letter-spacing: 0.03em;
    line-height: 1.15;
    color: var(--ash-white);
    margin-bottom: 1rem;
}

.chamber-block p {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    color: var(--warm-stone);
    line-height: 1.75;
    letter-spacing: 0.01em;
}

.chamber-block-1 {
    grid-column: 1 / 3;
    grid-row: 1;
    margin-top: 0;
    transform: rotate(-1deg);
}

.chamber-block-2 {
    grid-column: 2 / 4;
    grid-row: 2;
    margin-top: 40px;
    transform: rotate(0.5deg);
}

.chamber-block-3 {
    grid-column: 1 / 3;
    grid-row: 3;
    margin-top: 80px;
    transform: rotate(-0.8deg);
}

/* --- Ember Particles --- */
.ember-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 4;
}

.ember {
    position: absolute;
    border-radius: 50%;
    background-color: var(--ember-orange);
    will-change: transform, opacity;
}

.ember-1  { width: 3px; height: 3px; left: 8%;  bottom: -10px; opacity: 0.5; animation: emberRise 12s linear -2s infinite; }
.ember-2  { width: 2px; height: 2px; left: 15%; bottom: -10px; opacity: 0.7; animation: emberRise 9s  linear -5s infinite; }
.ember-3  { width: 4px; height: 4px; left: 22%; bottom: -10px; opacity: 0.3; animation: emberRise 16s linear -8s infinite; }
.ember-4  { width: 2px; height: 2px; left: 30%; bottom: -10px; opacity: 0.6; animation: emberRise 11s linear -3s infinite; }
.ember-5  { width: 3px; height: 3px; left: 38%; bottom: -10px; opacity: 0.4; animation: emberRise 14s linear -10s infinite; }
.ember-6  { width: 2px; height: 2px; left: 45%; bottom: -10px; opacity: 0.8; animation: emberRise 8s  linear -1s infinite; }
.ember-7  { width: 3px; height: 3px; left: 52%; bottom: -10px; opacity: 0.5; animation: emberRise 13s linear -7s infinite; }
.ember-8  { width: 4px; height: 4px; left: 58%; bottom: -10px; opacity: 0.3; animation: emberRise 18s linear -12s infinite; }
.ember-9  { width: 2px; height: 2px; left: 65%; bottom: -10px; opacity: 0.6; animation: emberRise 10s linear -4s infinite; }
.ember-10 { width: 3px; height: 3px; left: 72%; bottom: -10px; opacity: 0.4; animation: emberRise 15s linear -9s infinite; }
.ember-11 { width: 2px; height: 2px; left: 78%; bottom: -10px; opacity: 0.7; animation: emberRise 11s linear -6s infinite; }
.ember-12 { width: 3px; height: 3px; left: 85%; bottom: -10px; opacity: 0.5; animation: emberRise 13s linear -2s infinite; }
.ember-13 { width: 2px; height: 2px; left: 92%; bottom: -10px; opacity: 0.4; animation: emberRise 17s linear -14s infinite; }
.ember-14 { width: 4px; height: 4px; left: 12%; bottom: -10px; opacity: 0.3; animation: emberRise 20s linear -16s infinite; }
.ember-15 { width: 2px; height: 2px; left: 48%; bottom: -10px; opacity: 0.6; animation: emberRise 9s  linear -3s infinite; }
.ember-16 { width: 3px; height: 3px; left: 35%; bottom: -10px; opacity: 0.5; animation: emberRise 12s linear -8s infinite; }
.ember-17 { width: 2px; height: 2px; left: 62%; bottom: -10px; opacity: 0.7; animation: emberRise 10s linear -5s infinite; }
.ember-18 { width: 3px; height: 3px; left: 82%; bottom: -10px; opacity: 0.4; animation: emberRise 14s linear -11s infinite; }
.ember-19 { width: 2px; height: 2px; left: 25%; bottom: -10px; opacity: 0.8; animation: emberRise 8s  linear -1s infinite; }
.ember-20 { width: 4px; height: 4px; left: 55%; bottom: -10px; opacity: 0.3; animation: emberRise 19s linear -15s infinite; }

@keyframes emberRise {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    5% {
        opacity: var(--ember-opacity, 0.5);
    }
    90% {
        opacity: var(--ember-opacity, 0.5);
    }
    100% {
        transform: translateY(-120vh) translateX(20px);
        opacity: 0;
    }
}

/* Unique ember opacities via inline-like approach */
.ember-1  { --ember-opacity: 0.5; }
.ember-2  { --ember-opacity: 0.7; }
.ember-3  { --ember-opacity: 0.3; }
.ember-4  { --ember-opacity: 0.6; }
.ember-5  { --ember-opacity: 0.4; }
.ember-6  { --ember-opacity: 0.8; }
.ember-7  { --ember-opacity: 0.5; }
.ember-8  { --ember-opacity: 0.3; }
.ember-9  { --ember-opacity: 0.6; }
.ember-10 { --ember-opacity: 0.4; }
.ember-11 { --ember-opacity: 0.7; }
.ember-12 { --ember-opacity: 0.5; }
.ember-13 { --ember-opacity: 0.4; }
.ember-14 { --ember-opacity: 0.3; }
.ember-15 { --ember-opacity: 0.6; }
.ember-16 { --ember-opacity: 0.5; }
.ember-17 { --ember-opacity: 0.7; }
.ember-18 { --ember-opacity: 0.4; }
.ember-19 { --ember-opacity: 0.8; }
.ember-20 { --ember-opacity: 0.3; }

/* --- Layer 4: Ash Bed (Settling) --- */
.layer-ashbed {
    background: linear-gradient(
        to bottom,
        var(--charcoal-dense) 0%,
        var(--kiln-black) 30%,
        var(--kiln-black) 100%
    );
}

.layer-ashbed .layer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15vh 80px;
}

.pull-quote {
    max-width: 52ch;
    text-align: center;
}

.pull-quote p {
    font-family: var(--font-accent);
    font-style: italic;
    font-size: clamp(1.1rem, 1.8vw, 1.6rem);
    font-weight: 400;
    color: var(--warm-stone);
    line-height: 1.75;
    letter-spacing: 0.01em;
}

/* --- Layer 5: Earth (Foundation) --- */
.layer-earth {
    background-color: var(--kiln-black);
    align-items: flex-end;
}

.earth-content {
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding-bottom: 12vh;
}

.earth-metadata {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.meta-line {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 300;
    color: var(--binchotan-gray);
    letter-spacing: 0.02em;
}

/* --- Fade-in-up Animations --- */
.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

/* Preserve chamber block rotations when visible */
.chamber-block-1.fade-in-up.visible {
    transform: translateY(0) rotate(-1deg);
}

.chamber-block-2.fade-in-up.visible {
    transform: translateY(0) rotate(0.5deg);
}

.chamber-block-3.fade-in-up.visible {
    transform: translateY(0) rotate(-0.8deg);
}

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
    .kiln-nav {
        left: 12px;
    }

    .layer-content {
        padding: 60px 48px 60px 48px;
    }

    .mouth-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .mouth-text {
        grid-column: 1;
        max-width: 100%;
    }

    .carbon-bar-element {
        grid-column: 1;
        width: 24px;
        height: 30vh;
        justify-self: start;
        margin-left: 20px;
    }

    .chamber-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .chamber-block-1 {
        grid-column: 1;
        grid-row: auto;
        margin-top: 0;
    }

    .chamber-block-2 {
        grid-column: 1;
        grid-row: auto;
        margin-top: 0;
        transform: rotate(-1.5deg);
    }

    .chamber-block-3 {
        grid-column: 1;
        grid-row: auto;
        margin-top: 0;
        transform: rotate(1deg);
    }

    .chamber-block-2.fade-in-up.visible {
        transform: translateY(0) rotate(-1.5deg);
    }

    .chamber-block-3.fade-in-up.visible {
        transform: translateY(0) rotate(1deg);
    }

    .hero-title {
        transform: translateX(-4%);
    }

    .layer-ashbed .layer-content {
        padding: 10vh 48px;
    }

    .pull-quote {
        max-width: 100%;
    }

    .brush-divider svg {
        width: 90%;
        margin: 0 5%;
    }

    .brush-divider-1 svg,
    .brush-divider-2 svg,
    .brush-divider-3 svg,
    .brush-divider-4 svg {
        width: 90%;
        margin: 0 5%;
    }
}

@media (max-width: 480px) {
    .layer-content {
        padding: 40px 24px;
    }

    .kiln-nav {
        left: 8px;
    }

    .chamber-block {
        padding: 20px 20px 20px 16px;
    }

    .layer-ashbed .layer-content {
        padding: 8vh 24px;
    }
}
