/* diplomacy.boo - Wabi-Sabi Diplomatic Codex */

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

:root {
    --umber: #3d3228;
    --vellum: #f0e8dc;
    --clay-sienna: #6b5b47;
    --antique-gold: #c4a35a;
    --diplomatic-slate: #5b6e7a;
    --patina-sage: #7a8b6e;
    --seal-red: #9b4a3a;
    --cream-white: #faf6ef;
    --dark-clay: #4a4035;
    --warm-gray: #8b7d6b;
    --gold-line: #8b7355;
    --gold-translucent: rgba(196, 163, 90, 0.4);
}

html {
    scroll-behavior: auto;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    background-color: var(--vellum);
    color: var(--dark-clay);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Noise texture overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    filter: url(#grain);
    opacity: 0.04;
    pointer-events: none;
    z-index: 9999;
}

/* === Scroll Progress === */
#scroll-progress {
    position: fixed;
    right: 0;
    top: 0;
    width: 1px;
    height: 0%;
    background: var(--antique-gold);
    z-index: 1000;
    transition: height 0.1s linear;
}

/* === Typography === */
.display-headline {
    font-family: 'Commissioner', sans-serif;
    font-weight: 300;
    font-size: clamp(2.4rem, 5.5vw, 4.8rem);
    letter-spacing: 0.04em;
    color: var(--umber);
    line-height: 1.2;
}

.section-title {
    font-family: 'Commissioner', sans-serif;
    font-weight: 500;
    font-size: clamp(1.4rem, 2.8vw, 2.2rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--clay-sienna);
    margin-bottom: 21px;
}

.body-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.15vw, 1.2rem);
    line-height: 1.75;
    color: var(--dark-clay);
    max-width: 38em;
    margin-bottom: 21px;
}

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

.annotation {
    font-family: 'Commissioner', sans-serif;
    font-weight: 200;
    font-size: clamp(0.75rem, 0.9vw, 0.88rem);
    line-height: 1.6;
    letter-spacing: 0.02em;
    color: var(--warm-gray);
}

.accent-label {
    font-family: 'Commissioner', sans-serif;
    font-weight: 700;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--antique-gold);
}

/* === Slide Reveal System === */
.slide-reveal-container {
    position: relative;
    overflow: hidden;
}

.slide-reveal-cover {
    position: absolute;
    inset: 0;
    background: var(--vellum);
    z-index: 2;
    transition: transform 0.9s cubic-bezier(0.77, 0, 0.175, 1);
}

/* Direction variants */
[data-reveal='left'] .slide-reveal-cover {
    transform: translateX(0);
}
[data-reveal='left'].revealed .slide-reveal-cover {
    transform: translateX(101%);
}

[data-reveal='right'] .slide-reveal-cover {
    transform: translateX(0);
}
[data-reveal='right'].revealed .slide-reveal-cover {
    transform: translateX(-101%);
}

[data-reveal='up'] .slide-reveal-cover {
    transform: translateY(0);
}
[data-reveal='up'].revealed .slide-reveal-cover {
    transform: translateY(-101%);
}

[data-reveal='down'] .slide-reveal-cover {
    transform: translateY(0);
}
[data-reveal='down'].revealed .slide-reveal-cover {
    transform: translateY(101%);
}

[data-reveal='diagonal'] .slide-reveal-cover {
    transform: translateX(0) translateY(0);
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
    transition: clip-path 0.9s cubic-bezier(0.77, 0, 0.175, 1);
}
[data-reveal='diagonal'].revealed .slide-reveal-cover {
    clip-path: polygon(100% 0, 100% 0, 100% 100%, 100% 100%);
}

/* === Section Base === */
.section {
    position: relative;
    width: 100%;
}

.section-label {
    position: absolute;
    top: 34px;
    left: 8%;
    z-index: 5;
}

/* === Section I - The Threshold === */
.section-threshold {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding-left: 35%;
    padding-top: 10%;
}

.threshold-content {
    position: relative;
}

.threshold-line {
    position: absolute;
    bottom: -34px;
    left: 0;
    right: 7%;
    height: 1px;
    background: var(--gold-line);
    transform-origin: left;
    transform: scaleX(0);
    transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.threshold-content.line-active .threshold-line {
    transform: scaleX(1);
}

/* === Section II - The Archive === */
.section-archive {
    min-height: 120vh;
    padding: 89px 8% 89px;
    position: relative;
}

.archive-grid {
    display: grid;
    grid-template-columns: 1fr 0.8fr 1.2fr;
    gap: 34px;
    margin-top: 55px;
}

.archive-block {
    padding: 34px;
    border-left: 1px solid rgba(196, 163, 90, 0.3);
    border-bottom: 1px solid rgba(196, 163, 90, 0.15);
}

.archive-block-1 {
    max-width: clamp(280px, 30vw, 420px);
    margin-top: 0;
}

.archive-block-2 {
    max-width: clamp(200px, 22vw, 340px);
    margin-top: 55px;
}

.archive-block-3 {
    max-width: clamp(320px, 36vw, 500px);
    margin-top: -21px;
}

/* === Section III - The Negotiation Table === */
.section-negotiation {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 89px 20%;
    position: relative;
}

.negotiation-band {
    width: 60vw;
    max-height: 70vh;
    display: grid;
    grid-template-columns: 1.618fr 1fr;
    gap: 55px;
    overflow-y: auto;
}

.negotiation-primary {
    padding: 34px 34px 34px 0;
    border-left: 2px solid var(--antique-gold);
    padding-left: 34px;
}

.negotiation-margin {
    display: flex;
    flex-direction: column;
    gap: 34px;
    padding-top: 55px;
}

.margin-note {
    padding: 21px 13px;
    border-top: 1px solid rgba(196, 163, 90, 0.3);
}

/* === Section IV - The Kintsugi Map === */
.section-kintsugi {
    min-height: 110vh;
    position: relative;
    padding: 89px 8%;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(196, 163, 90, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(91, 110, 122, 0.03) 0%, transparent 50%);
}

.map-grid {
    position: relative;
    width: 100%;
    height: 80vh;
    margin-top: 55px;
}

.map-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.map-line {
    stroke: var(--antique-gold);
    stroke-opacity: 0.4;
    stroke-width: 1;
    fill: none;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.map-grid.lines-active .map-line {
    stroke-dashoffset: 0;
}

.map-card {
    position: absolute;
    width: 200px;
    padding: 21px;
    background: rgba(240, 232, 220, 0.85);
    border-left: 1px solid rgba(196, 163, 90, 0.3);
    border-bottom: 1px solid rgba(196, 163, 90, 0.15);
    z-index: 2;
}

.map-card .body-text {
    font-size: clamp(0.8rem, 0.9vw, 0.95rem);
    max-width: none;
    margin-bottom: 0;
}

.card-1 { top: 8%; left: 10%; }
.card-2 { top: 22%; left: 42%; }
.card-3 { top: 15%; right: 8%; }
.card-4 { top: 58%; left: 25%; }
.card-5 { top: 68%; right: 18%; }

/* === Section V - The Departure === */
.section-departure {
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.departure-line-vertical {
    position: absolute;
    top: 15%;
    left: 50%;
    width: 1px;
    height: 0;
    background: var(--antique-gold);
    transform-origin: top;
    transition: height 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.departure-line-vertical.line-active {
    height: 25%;
}

.departure-content {
    position: relative;
    top: 10%;
    text-align: center;
}

.departure-text {
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    font-weight: 300;
    line-height: 1.4;
}

/* === Crystal Formations === */
.crystal {
    position: absolute;
    pointer-events: none;
    z-index: 0;
}

.crystal-facet {
    position: absolute;
    transition: opacity 1.6s cubic-bezier(0.19, 1, 0.22, 1), transform 1.6s cubic-bezier(0.19, 1, 0.22, 1);
    opacity: 0;
    transform: scale(0.85);
}

.crystal.crystal-visible .crystal-facet {
    opacity: 1;
    transform: scale(1);
}

/* Macro crystals */
.crystal-macro {
    width: 400px;
    height: 400px;
}

/* Threshold crystal */
.crystal-threshold {
    right: 8%;
    bottom: 15%;
}

.crystal-facet-1 {
    width: 180px; height: 220px;
    clip-path: polygon(50% 2%, 85% 28%, 78% 72%, 48% 98%, 15% 68%, 22% 25%);
    background: linear-gradient(135deg, rgba(196, 163, 90, 0.15), rgba(91, 110, 122, 0.1));
    border: 1px solid rgba(196, 163, 90, 0.25);
    top: 20px; left: 50px;
    transition-delay: 0ms;
}

.crystal-facet-2 {
    width: 140px; height: 180px;
    clip-path: polygon(48% 0%, 92% 32%, 80% 78%, 35% 100%, 8% 62%, 20% 18%);
    background: linear-gradient(160deg, rgba(91, 110, 122, 0.12), rgba(122, 139, 110, 0.08));
    top: 60px; left: 120px;
    transition-delay: 80ms;
}

.crystal-facet-3 {
    width: 100px; height: 150px;
    clip-path: polygon(45% 3%, 88% 35%, 72% 80%, 40% 97%, 12% 58%);
    background: linear-gradient(110deg, rgba(196, 163, 90, 0.1), rgba(91, 110, 122, 0.15));
    top: 100px; left: 30px;
    transition-delay: 160ms;
}

.crystal-facet-4 {
    width: 120px; height: 160px;
    clip-path: polygon(52% 1%, 90% 30%, 82% 75%, 42% 99%, 10% 65%, 18% 22%);
    background: linear-gradient(145deg, rgba(122, 139, 110, 0.1), rgba(196, 163, 90, 0.08));
    top: 140px; left: 160px;
    transition-delay: 240ms;
}

.crystal-facet-5 {
    width: 90px; height: 120px;
    clip-path: polygon(50% 5%, 82% 28%, 75% 75%, 45% 95%, 18% 62%);
    background: linear-gradient(170deg, rgba(91, 110, 122, 0.1), transparent);
    top: 30px; left: 180px;
    transition-delay: 320ms;
}

/* Archive crystal */
.crystal-archive {
    right: 5%;
    bottom: 10%;
    width: 350px;
    height: 350px;
}

.crystal-facet-6 {
    width: 160px; height: 200px;
    clip-path: polygon(47% 3%, 88% 30%, 80% 74%, 38% 98%, 10% 60%, 22% 20%);
    background: linear-gradient(125deg, rgba(196, 163, 90, 0.12), rgba(155, 74, 58, 0.06));
    top: 30px; left: 40px;
    transition-delay: 0ms;
}

.crystal-facet-7 {
    width: 130px; height: 170px;
    clip-path: polygon(52% 2%, 85% 35%, 75% 78%, 42% 96%, 15% 55%);
    background: linear-gradient(155deg, rgba(91, 110, 122, 0.1), rgba(196, 163, 90, 0.08));
    top: 70px; left: 110px;
    transition-delay: 80ms;
}

.crystal-facet-8 {
    width: 110px; height: 140px;
    clip-path: polygon(50% 4%, 82% 32%, 70% 80%, 38% 95%, 12% 58%);
    background: linear-gradient(140deg, rgba(122, 139, 110, 0.08), rgba(91, 110, 122, 0.1));
    top: 10px; left: 150px;
    transition-delay: 160ms;
}

.crystal-facet-9 {
    width: 100px; height: 130px;
    clip-path: polygon(48% 5%, 80% 28%, 72% 76%, 40% 98%, 15% 62%);
    background: linear-gradient(120deg, rgba(196, 163, 90, 0.1), transparent);
    top: 120px; left: 20px;
    transition-delay: 240ms;
}

/* Map crystal */
.crystal-map {
    left: 3%;
    bottom: 8%;
    width: 320px;
    height: 320px;
}

.crystal-facet-10 {
    width: 150px; height: 190px;
    clip-path: polygon(50% 3%, 86% 28%, 78% 74%, 45% 97%, 14% 64%, 20% 22%);
    background: linear-gradient(130deg, rgba(196, 163, 90, 0.14), rgba(91, 110, 122, 0.08));
    top: 20px; left: 30px;
    transition-delay: 0ms;
}

.crystal-facet-11 {
    width: 120px; height: 160px;
    clip-path: polygon(48% 2%, 84% 34%, 74% 78%, 40% 96%, 12% 56%);
    background: linear-gradient(160deg, rgba(91, 110, 122, 0.1), rgba(122, 139, 110, 0.06));
    top: 50px; left: 100px;
    transition-delay: 80ms;
}

.crystal-facet-12 {
    width: 100px; height: 130px;
    clip-path: polygon(52% 4%, 82% 30%, 70% 76%, 42% 95%, 16% 60%);
    background: linear-gradient(145deg, rgba(122, 139, 110, 0.08), rgba(196, 163, 90, 0.1));
    top: 90px; left: 10px;
    transition-delay: 160ms;
}

.crystal-facet-13 {
    width: 90px; height: 120px;
    clip-path: polygon(50% 5%, 80% 28%, 72% 78%, 38% 95%, 18% 58%);
    background: linear-gradient(115deg, rgba(196, 163, 90, 0.08), transparent);
    top: 130px; left: 120px;
    transition-delay: 240ms;
}

.crystal-facet-14 {
    width: 80px; height: 110px;
    clip-path: polygon(48% 3%, 78% 32%, 68% 76%, 36% 94%, 14% 54%);
    background: linear-gradient(170deg, rgba(91, 110, 122, 0.06), rgba(196, 163, 90, 0.06));
    top: 10px; left: 160px;
    transition-delay: 320ms;
}

/* Departure crystal */
.crystal-departure {
    right: 5%;
    bottom: 8%;
    width: 380px;
    height: 380px;
    opacity: 0.7;
}

.crystal-facet-15 {
    width: 170px; height: 210px;
    clip-path: polygon(50% 2%, 87% 29%, 79% 73%, 46% 98%, 13% 66%, 21% 24%);
    background: linear-gradient(135deg, rgba(196, 163, 90, 0.12), rgba(91, 110, 122, 0.08));
    top: 30px; left: 60px;
    transition-delay: 0ms;
}

.crystal-facet-16 {
    width: 140px; height: 175px;
    clip-path: polygon(48% 1%, 84% 33%, 76% 77%, 40% 97%, 14% 58%, 22% 19%);
    background: linear-gradient(155deg, rgba(91, 110, 122, 0.08), rgba(122, 139, 110, 0.06));
    top: 70px; left: 130px;
    transition-delay: 80ms;
}

.crystal-facet-17 {
    width: 110px; height: 145px;
    clip-path: polygon(52% 3%, 82% 30%, 74% 78%, 42% 96%, 16% 60%);
    background: linear-gradient(140deg, rgba(122, 139, 110, 0.06), rgba(196, 163, 90, 0.08));
    top: 110px; left: 40px;
    transition-delay: 160ms;
}

.crystal-facet-18 {
    width: 95px; height: 125px;
    clip-path: polygon(50% 4%, 80% 28%, 70% 76%, 38% 95%, 18% 56%);
    background: linear-gradient(120deg, rgba(196, 163, 90, 0.06), transparent);
    top: 20px; left: 180px;
    transition-delay: 240ms;
}

.crystal-facet-19 {
    width: 85px; height: 115px;
    clip-path: polygon(46% 5%, 78% 32%, 68% 74%, 36% 94%, 14% 54%);
    background: linear-gradient(165deg, rgba(91, 110, 122, 0.06), rgba(196, 163, 90, 0.04));
    top: 160px; left: 150px;
    transition-delay: 320ms;
}

.crystal-facet-20 {
    width: 75px; height: 100px;
    clip-path: polygon(50% 6%, 76% 30%, 66% 78%, 40% 93%, 20% 55%);
    background: linear-gradient(150deg, rgba(122, 139, 110, 0.04), transparent);
    top: 180px; left: 90px;
    transition-delay: 400ms;
}

/* Micro crystals */
.crystal-micro {
    position: relative;
    width: 60px;
    height: 60px;
}

.crystal-cluster {
    position: absolute;
    z-index: 0;
}

.cluster-archive {
    left: 15%;
    bottom: 20%;
    display: flex;
    gap: 8px;
}

.micro-1 { transform: rotate(15deg); }
.micro-2 { transform: rotate(-8deg); margin-top: 13px; }
.micro-3 { transform: rotate(22deg); margin-top: -8px; }

.crystal-facet-m1 {
    width: 35px; height: 45px;
    clip-path: polygon(50% 2%, 85% 30%, 75% 78%, 35% 98%, 10% 55%);
    background: rgba(196, 163, 90, 0.35);
    top: 0; left: 0;
    transition-delay: 0ms;
}

.crystal-facet-m2 {
    width: 28px; height: 38px;
    clip-path: polygon(48% 4%, 82% 32%, 70% 76%, 38% 96%, 12% 58%);
    background: rgba(91, 110, 122, 0.3);
    top: 10px; left: 15px;
    transition-delay: 80ms;
}

.crystal-facet-m3 {
    width: 22px; height: 30px;
    clip-path: polygon(50% 5%, 78% 28%, 68% 75%, 40% 94%, 18% 52%);
    background: rgba(122, 139, 110, 0.35);
    top: 5px; left: 28px;
    transition-delay: 160ms;
}

.crystal-facet-m4 {
    width: 30px; height: 42px;
    clip-path: polygon(50% 3%, 80% 30%, 72% 78%, 38% 96%, 14% 56%);
    background: rgba(196, 163, 90, 0.4);
    top: 0; left: 5px;
    transition-delay: 0ms;
}

.crystal-facet-m5 {
    width: 25px; height: 35px;
    clip-path: polygon(48% 4%, 78% 32%, 68% 76%, 36% 95%, 16% 54%);
    background: rgba(91, 110, 122, 0.35);
    top: 12px; left: 20px;
    transition-delay: 80ms;
}

.crystal-facet-m6 {
    width: 32px; height: 44px;
    clip-path: polygon(52% 2%, 84% 28%, 74% 76%, 40% 97%, 12% 58%);
    background: rgba(122, 139, 110, 0.3);
    top: 0; left: 0;
    transition-delay: 0ms;
}

.crystal-facet-m7 {
    width: 26px; height: 36px;
    clip-path: polygon(50% 4%, 80% 30%, 70% 78%, 38% 95%, 16% 55%);
    background: rgba(196, 163, 90, 0.35);
    top: 8px; left: 18px;
    transition-delay: 80ms;
}

.crystal-facet-m8 {
    width: 20px; height: 28px;
    clip-path: polygon(48% 5%, 76% 32%, 66% 76%, 36% 94%, 18% 52%);
    background: rgba(91, 110, 122, 0.3);
    top: 16px; left: 8px;
    transition-delay: 160ms;
}

/* === Kintsugi Lines === */
.kintsugi-line {
    position: absolute;
    height: 2px;
    background: rgba(196, 163, 90, 0.4);
    box-shadow: 0 0 6px rgba(196, 163, 90, 0.2);
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1;
}

.kintsugi-line.line-active {
    transform: scaleX(1);
}

/* Specific kintsugi line positions and angles */
.kintsugi-1 {
    width: 200px; top: 65%; left: 5%;
    transform: scaleX(0) rotate(15deg);
}
.kintsugi-1.line-active { transform: scaleX(1) rotate(15deg); }

.kintsugi-2 {
    width: 150px; top: 30%; right: 3%; left: auto;
    transform: scaleX(0) rotate(-37deg);
    transform-origin: right center;
}
.kintsugi-2.line-active { transform: scaleX(1) rotate(-37deg); }

.kintsugi-3 {
    width: 280px; top: 25%; left: 60%;
    transform: scaleX(0) rotate(62deg);
}
.kintsugi-3.line-active { transform: scaleX(1) rotate(62deg); }

.kintsugi-4 {
    width: 180px; top: 70%; left: 8%;
    transform: scaleX(0) rotate(-15deg);
}
.kintsugi-4.line-active { transform: scaleX(1) rotate(-15deg); }

.kintsugi-5 {
    width: 120px; bottom: 12%; left: 45%;
    transform: scaleX(0) rotate(108deg);
}
.kintsugi-5.line-active { transform: scaleX(1) rotate(108deg); }

.kintsugi-6 {
    width: 250px; top: 20%; left: 3%;
    transform: scaleX(0) rotate(37deg);
}
.kintsugi-6.line-active { transform: scaleX(1) rotate(37deg); }

.kintsugi-7 {
    width: 180px; bottom: 18%; right: 5%; left: auto;
    transform: scaleX(0) rotate(-62deg);
    transform-origin: right center;
}
.kintsugi-7.line-active { transform: scaleX(1) rotate(-62deg); }

.kintsugi-8 {
    width: 320px; top: 15%; left: 40%;
    transform: scaleX(0) rotate(15deg);
}
.kintsugi-8.line-active { transform: scaleX(1) rotate(15deg); }

.kintsugi-9 {
    width: 200px; top: 55%; left: 8%;
    transform: scaleX(0) rotate(-108deg);
}
.kintsugi-9.line-active { transform: scaleX(1) rotate(-108deg); }

.kintsugi-10 {
    width: 160px; bottom: 10%; right: 12%; left: auto;
    transform: scaleX(0) rotate(37deg);
    transform-origin: right center;
}
.kintsugi-10.line-active { transform: scaleX(1) rotate(37deg); }

.kintsugi-11 {
    width: 240px; top: 40%; left: 10%;
    transform: scaleX(0) rotate(-15deg);
    opacity: 0.6;
}
.kintsugi-11.line-active { transform: scaleX(1) rotate(-15deg); }

/* === Responsive === */
@media (max-width: 768px) {
    .section-threshold {
        padding-left: 8%;
        padding-top: 30%;
    }

    .archive-grid {
        grid-template-columns: 1fr;
        gap: 34px;
    }

    .archive-block-1,
    .archive-block-2,
    .archive-block-3 {
        max-width: 100%;
        margin-top: 0;
    }

    .archive-block-1 { padding-left: 5%; }
    .archive-block-2 { padding-left: 12%; }
    .archive-block-3 { padding-left: 7%; }

    .section-negotiation {
        padding: 55px 5%;
        height: auto;
        min-height: 100vh;
    }

    .negotiation-band {
        width: 100%;
        grid-template-columns: 1fr;
        gap: 34px;
    }

    .negotiation-margin {
        padding-top: 0;
    }

    .margin-note {
        border-top: none;
        border-left: 2px solid var(--antique-gold);
        padding: 13px 21px;
    }

    .map-card {
        position: relative;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        width: 100%;
        margin-bottom: 21px;
    }

    .map-grid {
        height: auto;
        display: flex;
        flex-direction: column;
    }

    .map-lines {
        display: none;
    }

    .crystal-macro {
        transform: scale(0.6);
    }

    .crystal-cluster {
        display: none;
    }

    .display-headline {
        font-size: clamp(1.8rem, 6vw, 2.8rem);
    }

    .section-kintsugi {
        min-height: auto;
        padding: 55px 5%;
    }
}
