/* ============================================================
   diplomacy.boo — Neubrutalist Diplomacy by Candlelight
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --bg-parchment: #F5ECD7;
    --bg-mahogany: #2C1810;
    --text-primary: #2C1810;
    --text-inverse: #F5ECD7;
    --text-body: #5C4033;
    --accent-brass: #C4956A;
    --accent-saddle: #8B4513;
    --candle-glow: #E8A317;
    --wax-red: #8B2500;
    --soft-gold: #D4C4A8;
    --border-dark: #1A1209;
    --smoke: #6B5B4F;
    --grid-gutter: #3D2B1F;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--bg-parchment);
    color: var(--text-body);
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.65;
    font-variation-settings: 'FLAR' 50;
    overflow-x: hidden;
    position: relative;
}

/* --- Parchment Texture Overlay --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3'/%3E%3CfeColorMatrix type='matrix' values='0.3 0 0 0 0.1 0.2 0 0 0 0.08 0.1 0 0 0 0.05 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- Ambient Canvas --- */
#ambient-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* --- Navigation --- */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 56px;
    background-color: transparent;
    border-bottom: 4px solid transparent;
    z-index: 1000;
    transition: background-color 0.4s ease, border-color 0.4s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-bar.nav-solid {
    background-color: var(--bg-mahogany);
    border-bottom-color: var(--accent-brass);
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    max-width: 1200px;
    width: 100%;
    padding: 0 24px;
}

.nav-flames {
    display: flex;
    align-items: center;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.nav-bar.nav-solid .nav-flames {
    opacity: 1;
}

.nav-flame-icon {
    filter: drop-shadow(0 0 4px rgba(232, 163, 23, 0.5));
}

.nav-items {
    display: flex;
    list-style: none;
    gap: 12px;
    align-items: center;
}

.nav-pill {
    display: inline-block;
    padding: 6px 16px;
    font-family: 'Anybody', sans-serif;
    font-weight: 800;
    font-size: 12px;
    font-variation-settings: 'wdth' 125;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-brass);
    text-decoration: none;
    border: 3px solid var(--border-dark);
    background-color: var(--bg-mahogany);
    box-shadow: 3px 3px 0 var(--border-dark);
    transition: transform 0.1s ease-out, box-shadow 0.1s ease-out;
    cursor: pointer;
}

.nav-pill:hover {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 var(--border-dark);
}

.nav-pill:active {
    transform: translate(3px, 3px);
    box-shadow: 0 0 0 var(--border-dark);
}

/* --- Hero Section --- */
.hero-section {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    background-color: var(--border-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 1;
}

.hero-darkness {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--border-dark);
    z-index: 10;
    pointer-events: none;
    transition: opacity 1s ease-out;
}

.hero-darkness.revealed {
    opacity: 0;
}

.hero-candle-group {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    gap: 40px;
    z-index: 5;
}

.candle {
    opacity: 0;
    transition: opacity 0.6s ease;
    position: relative;
}

.candle.lit {
    opacity: 1;
}

.candle-glow {
    position: absolute;
    bottom: 40%;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(ellipse at 50% 100%, rgba(232, 163, 23, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.candle-glow-main {
    width: 400px;
    height: 400px;
    background: radial-gradient(ellipse at 50% 100%, rgba(232, 163, 23, 0.18) 0%, transparent 70%);
}

/* Flame animations */
.flame-outer {
    animation: flameFlicker 2.5s ease-in-out infinite;
}

.flame-mid {
    animation: flameFlicker 2.2s ease-in-out infinite 0.3s;
}

.flame-core {
    animation: flameCoreGlow 2s ease-in-out infinite 0.1s;
}

@keyframes flameFlicker {
    0%, 100% { transform: scaleY(1) scaleX(1); }
    25% { transform: scaleY(1.04) scaleX(0.97); }
    50% { transform: scaleY(1.05) scaleX(1); }
    75% { transform: scaleY(0.98) scaleX(1.02); }
}

@keyframes flameCoreGlow {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 1; }
}

/* Wax drip animation */
.wax-drip {
    animation: waxPulse 4s ease-in-out infinite;
}

@keyframes waxPulse {
    0%, 100% { r: 3; }
    50% { r: 3.5; }
}

/* Hero content */
.hero-content {
    position: relative;
    z-index: 8;
    text-align: center;
    padding: 0 24px;
    opacity: 0;
    transition: opacity 1s ease;
}

.hero-content.visible {
    opacity: 1;
}

.hero-title {
    font-family: 'Fraunces', serif;
    font-weight: 900;
    font-size: 10vw;
    font-variation-settings: 'WONK' 1, 'opsz' 144;
    color: var(--text-inverse);
    letter-spacing: -0.02em;
    line-height: 1.1;
    text-shadow: 0 0 60px rgba(232, 163, 23, 0.2);
    margin-bottom: 24px;
}

.hero-tagline {
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-size: 24px;
    font-variation-settings: 'FLAR' 50;
    color: var(--soft-gold);
    max-width: 65ch;
    margin: 0 auto;
    opacity: 0;
    transition: opacity 0.8s ease 0.5s;
}

.hero-tagline.visible {
    opacity: 1;
}

/* Smoke wisps */
.smoke-container {
    position: absolute;
    bottom: 25%;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 400px;
    z-index: 4;
    pointer-events: none;
}

.smoke-svg {
    width: 100%;
    height: 100%;
}

.smoke-wisp {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    animation: smokeRise 8s linear infinite;
}

@keyframes smokeRise {
    0% { stroke-dashoffset: 800; opacity: 0; }
    10% { opacity: 0.3; }
    80% { opacity: 0.1; }
    100% { stroke-dashoffset: 0; opacity: 0; }
}

/* --- Candle Row Dividers --- */
.candle-row {
    background-color: var(--bg-mahogany);
    padding: 16px 0;
    border-top: 2px solid var(--grid-gutter);
    border-bottom: 2px solid var(--grid-gutter);
    overflow: hidden;
}

.candle-row-inner {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.row-candle {
    opacity: 0;
    transition: opacity 0.4s ease;
    filter: drop-shadow(0 0 8px rgba(232, 163, 23, 0.15));
}

.row-candle.lit {
    opacity: 1;
}

/* --- Secondary Band (Three Pillars) --- */
.secondary-band {
    background-color: var(--bg-parchment);
    padding: 64px 24px;
    position: relative;
    z-index: 1;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Visible grid gutters */
.grid-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

/* --- Content Cards (Neubrutalist) --- */
.content-card {
    border: 4px solid var(--border-dark);
    box-shadow: 4px 4px 0 var(--border-dark);
    padding: 32px 24px;
    position: relative;
    transform: rotate(var(--card-rotate, 0deg));
    transition: transform 0.1s ease-out, box-shadow 0.1s ease-out;
}

.content-card:hover {
    transform: rotate(var(--card-rotate, 0deg)) translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--border-dark);
}

.content-card:active {
    transform: rotate(var(--card-rotate, 0deg)) translate(4px, 4px);
    box-shadow: 0 0 0 var(--border-dark);
}

.card-dark {
    background-color: var(--bg-mahogany);
}

.card-dark .card-title {
    color: var(--text-inverse);
}

.card-dark .card-body {
    color: var(--soft-gold);
}

.card-light {
    background-color: var(--bg-parchment);
}

.card-light .card-title {
    color: var(--text-primary);
}

.card-light .card-body {
    color: var(--text-body);
}

.card-seal {
    position: absolute;
    top: 12px;
    right: 12px;
    opacity: 0.85;
}

.card-title {
    font-family: 'Fraunces', serif;
    font-weight: 700;
    font-size: 28px;
    font-variation-settings: 'WONK' 0, 'opsz' 48;
    letter-spacing: 0em;
    line-height: 1.3;
    margin-bottom: 16px;
    transition: font-variation-settings 0.8s ease;
}

.card-title.wonk-active {
    font-variation-settings: 'WONK' 1, 'opsz' 48;
}

.section-header {
    font-family: 'Fraunces', serif;
    font-weight: 700;
    font-size: 36px;
    font-variation-settings: 'WONK' 0, 'opsz' 48;
    transition: font-variation-settings 0.8s ease;
}

.section-header.wonk-active {
    font-variation-settings: 'WONK' 1, 'opsz' 48;
}

.card-body {
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-size: 18px;
    line-height: 1.65;
    font-variation-settings: 'FLAR' 50;
    max-width: 65ch;
    margin-bottom: 12px;
}

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

/* --- Vertical Cascade --- */
.vertical-cascade {
    background-color: var(--bg-parchment);
    padding: 64px 24px;
    position: relative;
    z-index: 1;
}

.cascade-grid {
    display: grid;
    grid-template-columns: 5fr 3fr;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
    /* Visible gutter line */
    position: relative;
}

.cascade-grid::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: calc(37.5% - 1px);
    width: 2px;
    background-color: var(--grid-gutter);
}

.cascade-main {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.cascade-card {
    /* Inherits content-card styles */
}

/* --- Atmospheric Sidebar --- */
.atmospheric-sidebar {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 40px;
}

.sidebar-candle-column {
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sidebar-candle .flame-outer {
    animation: flameFlicker 2.8s ease-in-out infinite 0.5s;
}

.sidebar-candle .flame-mid {
    animation: flameFlicker 2.4s ease-in-out infinite 0.8s;
}

.sidebar-smoke {
    width: 60px;
    height: 200px;
    margin-top: -20px;
}

.wax-accumulation {
    position: relative;
    width: 40px;
    min-height: 200px;
}

.wax-accumulation .wax-drip-new {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    background-color: var(--wax-red);
    border-radius: 0 0 4px 4px;
    animation: dripGrow 2s ease-out forwards;
    opacity: 0;
}

@keyframes dripGrow {
    0% { height: 0; opacity: 0; }
    10% { opacity: 1; }
    100% { height: 40px; opacity: 0.85; }
}

.wax-drip-blob {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 8px;
    background-color: var(--wax-red);
    border-radius: 50%;
    animation: blobForm 0.5s ease-out 1.8s forwards;
    opacity: 0;
}

@keyframes blobForm {
    0% { opacity: 0; transform: translateX(-50%) scale(0.5); }
    100% { opacity: 0.85; transform: translateX(-50%) scale(1); }
}

/* --- Correspondences Section --- */
.correspondences-section {
    background-color: var(--bg-mahogany);
    padding: 64px 24px;
    position: relative;
    z-index: 1;
}

.correspondences-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
}

.correspondence-card {
    /* Inherits content-card styles */
}

.correspondences-section .card-light .card-title {
    color: var(--text-primary);
}

.correspondences-section .card-light .card-body {
    color: var(--text-body);
}

/* --- Seals Section --- */
.seals-section {
    background-color: var(--bg-parchment);
    padding: 80px 24px;
    position: relative;
    z-index: 1;
}

.seals-content {
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.seals-header {
    font-family: 'Fraunces', serif;
    font-weight: 700;
    font-size: 48px;
    color: var(--text-primary);
    font-variation-settings: 'WONK' 0, 'opsz' 48;
    margin-bottom: 16px;
    transition: font-variation-settings 0.8s ease;
}

.seals-header.wonk-active {
    font-variation-settings: 'WONK' 1, 'opsz' 48;
}

.seals-intro {
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-size: 20px;
    font-variation-settings: 'FLAR' 50;
    color: var(--text-body);
    max-width: 65ch;
    margin: 0 auto 48px;
    line-height: 1.65;
}

.seals-grid {
    display: flex;
    justify-content: center;
    gap: 48px;
    flex-wrap: wrap;
}

.seal-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: default;
    transition: transform 0.2s ease;
}

.seal-item:hover {
    transform: scale(1.05);
}

.seal-emblem {
    filter: drop-shadow(3px 3px 0 var(--border-dark));
    transition: filter 0.2s ease;
}

.seal-item:hover .seal-emblem {
    filter: drop-shadow(1px 1px 0 var(--border-dark));
}

.seal-label {
    font-family: 'Anybody', sans-serif;
    font-weight: 800;
    font-size: 13px;
    font-variation-settings: 'wdth' 125;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-brass);
}

/* --- Footer --- */
.site-footer {
    background-color: var(--border-dark);
    border-top: 4px solid var(--accent-brass);
    padding: 48px 24px;
    text-align: center;
    position: relative;
    z-index: 1;
}

.footer-inner {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.footer-candles svg {
    filter: drop-shadow(0 0 6px rgba(232, 163, 23, 0.3));
}

.footer-candles .flame-outer {
    animation: flameFlicker 3s ease-in-out infinite;
}

.footer-text {
    font-family: 'Fraunces', serif;
    font-weight: 900;
    font-size: 28px;
    font-variation-settings: 'WONK' 1, 'opsz' 144;
    color: var(--text-inverse);
    letter-spacing: -0.02em;
}

.footer-subtext {
    font-family: 'Commissioner', sans-serif;
    font-weight: 400;
    font-size: 16px;
    font-variation-settings: 'FLAR' 50;
    color: var(--smoke);
    max-width: 50ch;
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .grid-container {
        grid-template-columns: 1fr;
    }

    .correspondences-grid {
        grid-template-columns: 1fr;
    }

    .cascade-grid {
        grid-template-columns: 1fr;
    }

    .cascade-grid::before {
        display: none;
    }

    .atmospheric-sidebar {
        display: none;
    }

    .hero-title {
        font-size: 14vw;
    }

    .nav-items {
        gap: 6px;
    }

    .nav-pill {
        font-size: 10px;
        padding: 4px 10px;
    }

    .seals-grid {
        gap: 32px;
    }
}

@media (max-width: 600px) {
    .hero-candle-group {
        gap: 20px;
    }

    .hero-title {
        font-size: 16vw;
    }

    .hero-tagline {
        font-size: 18px;
    }

    .card-title {
        font-size: 24px;
    }

    .section-header {
        font-size: 28px;
    }

    .seals-header {
        font-size: 36px;
    }

    .candle-row-inner {
        gap: 16px;
    }
}
