/* ================================================
   sustaining.quest — Kintsugi Temporality
   ================================================ */

/* --- Custom Properties --- */
:root {
    --fired-clay: #1C1914;
    --kiln-ash: #2A241D;
    --ash-text: #8A8274;
    --bone-white: #D4CFC3;
    --patina-gold: #B8956A;
    --oxidized-copper: #5B8C6E;
    --fracture-amber: #C4943E;
    --deep-stratum: #0F0D0A;

    --font-display: 'Cormorant Garamond', 'Georgia', serif;
    --font-body: 'Libre Baskerville', 'Georgia', serif;
    --font-accent: 'DM Mono', 'Courier New', monospace;
}

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

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

body {
    background-color: var(--fired-clay);
    color: var(--ash-text);
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.1vw, 1.08rem);
    font-weight: 400;
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Patina Noise Texture Overlay --- */
.patina-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* --- Depth Gauge (Fixed Left Navigation) --- */
.depth-gauge {
    position: fixed;
    left: 8px;
    top: 0;
    height: 100vh;
    width: 24px;
    z-index: 100;
    pointer-events: none;
}

.depth-line {
    position: absolute;
    left: 0;
    top: 5%;
    height: 90%;
    width: 1px;
    background-color: var(--patina-gold);
    opacity: 0.4;
}

.depth-tick {
    position: absolute;
    left: 0;
    display: flex;
    align-items: center;
}

.depth-tick::before {
    content: '';
    display: block;
    width: 6px;
    height: 1px;
    background-color: var(--patina-gold);
    opacity: 0.6;
}

.depth-label {
    font-family: var(--font-accent);
    font-size: 0.65rem;
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--patina-gold);
    opacity: 0.6;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    margin-left: 4px;
    white-space: nowrap;
}

.depth-tick.active .depth-label {
    opacity: 1;
}

.depth-tick.active::before {
    opacity: 1;
    width: 10px;
}

/* --- Strata (Sections) --- */
.stratum {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.void-stratum {
    display: flex;
    align-items: center;
    justify-content: center;
}

.dense-stratum {
    line-height: 1.35;
}

/* --- Sediment Canvas --- */
.sediment-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* --- Crack Networks --- */
.crack-network {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.crack-network path {
    fill: none;
    stroke: var(--fracture-amber);
    filter: drop-shadow(0 0 4px rgba(196, 148, 62, 0.3));
}

/* --- Erosion Dividers --- */
.erosion-divider {
    position: relative;
    width: 100%;
    height: 120px;
    margin-top: -60px;
    margin-bottom: -60px;
    z-index: 10;
    pointer-events: none;
}

.erosion-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.erosion-path {
    fill: none;
    stroke: var(--fracture-amber);
    stroke-width: 1.5;
    opacity: 0.4;
}

/* --- Section 1: ORIGIN --- */
.origin-stratum {
    min-height: 100vh;
    background-color: var(--fired-clay);
}

.origin-content {
    position: relative;
    z-index: 2;
    padding-left: 8%;
    padding-top: 40vh;
    max-width: 70%;
}

.site-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(2.5rem, 6vw, 5.5rem);
    color: var(--bone-white);
    letter-spacing: 0.02em;
    text-transform: lowercase;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.origin-fragment {
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.1vw, 1.08rem);
    color: var(--ash-text);
    max-width: 520px;
    line-height: 1.75;
    opacity: 0;
    transform: translateY(12px);
    animation: fadeInUp 2s ease 1.5s forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Section 2: FRACTURE --- */
.fracture-stratum {
    min-height: 60vh;
    background-color: var(--kiln-ash);
    padding: 6rem 8% 6rem 8%;
}

.fracture-columns {
    display: grid;
    grid-template-columns: 55% 2% 35%;
    gap: 0;
    align-items: start;
    max-width: 1200px;
}

.fracture-col {
    border-left: 3px solid var(--patina-gold);
    padding-left: 1.5rem;
}

.fracture-col p {
    margin-bottom: 1.2rem;
    color: var(--ash-text);
}

.fracture-col p:last-child {
    margin-bottom: 0;
}

.fracture-crack-line {
    display: flex;
    align-items: center;
    justify-content: center;
}

.horizontal-crack {
    width: 100%;
    height: 100%;
    min-height: 200px;
}

.horizontal-crack path {
    fill: none;
    stroke: var(--fracture-amber);
    stroke-width: 1;
    filter: drop-shadow(0 0 3px rgba(196, 148, 62, 0.25));
}

/* --- Section 3: MEND --- */
.mend-stratum {
    min-height: 90vh;
    background-color: var(--deep-stratum);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mend-content {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 400px;
    height: 400px;
}

.ring-growth {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.ring-growth circle {
    fill: none;
    stroke: var(--bone-white);
    stroke-width: 0.75;
    opacity: 0;
}

.ring-growth circle.visible {
    animation: ringFadeIn 2s ease forwards;
}

@keyframes ringFadeIn {
    to {
        opacity: 0.2;
    }
}

.mend-word {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: var(--fracture-amber);
    letter-spacing: 0.02em;
    text-transform: lowercase;
    position: relative;
    z-index: 3;
    animation: mendPulse 8s ease-in-out infinite;
}

@keyframes mendPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* --- Section 4: ENDURE --- */
.endure-stratum {
    min-height: 70vh;
    background-color: var(--kiln-ash);
    padding: 6rem 8% 6rem 8%;
}

.endure-columns {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto 1fr;
    gap: 0 2rem;
    max-width: 1200px;
}

.endure-col {
    padding-left: 1.5rem;
}

.endure-col-1 {
    border-left: 3px solid var(--patina-gold);
}

.endure-col-2 {
    border-left: 3px solid var(--oxidized-copper);
}

.endure-col-3 {
    border-left: 3px solid var(--fracture-amber);
}

.endure-col p {
    margin-bottom: 1.2rem;
    color: var(--ash-text);
}

.endure-col p:last-child {
    margin-bottom: 0;
}

.endure-separator {
    width: 1px;
    background-color: var(--patina-gold);
    opacity: 0.2;
    align-self: stretch;
}

/* --- Section 5: REMAIN --- */
.remain-stratum {
    min-height: 100vh;
    background-color: var(--fired-clay);
    display: flex;
    align-items: center;
    justify-content: center;
}

.remain-content {
    position: relative;
    z-index: 2;
    max-width: 480px;
    text-align: left;
    padding: 0 1.5rem;
}

.remain-text p {
    color: var(--ash-text);
    margin-bottom: 1.2rem;
    line-height: 1.75;
}

.remain-text p:last-child {
    margin-bottom: 0;
}

/* --- Fade-in Animation --- */
.fade-in-element {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .origin-fragment {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .mend-word {
        animation: none;
        opacity: 1;
    }

    .ring-growth circle.visible {
        animation: none;
        opacity: 0.2;
    }

    .fade-in-element {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .sediment-canvas,
    .crack-network path {
        display: none;
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .origin-content {
        padding-left: 12%;
        max-width: 90%;
        padding-top: 35vh;
    }

    .fracture-columns {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .fracture-crack-line {
        display: none;
    }

    .endure-columns {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .endure-separator {
        width: 60%;
        height: 1px;
        align-self: center;
        justify-self: center;
    }

    .depth-gauge {
        display: none;
    }

    .mend-content {
        width: 280px;
        height: 280px;
    }
}
