/* ============================================
   diplomatic.day - Burnt Sunset Embassy
   Pixel-Art Diplomatic World
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --burnt-orange: #CC5500;
    --deep-ember: #8B3A00;
    --amber-glow: #FF8C42;
    --charcoal-ink: #2B2118;
    --diplomatic-cream: #FFF4E0;
    --parchment-tan: #E8D5B7;
    --embassy-teal: #2A9D8F;
    --treaty-gold: #F4A940;
    --soft-soot: #3D3226;

    --font-primary: 'Alfa Slab One', serif;
    --font-secondary: 'Roboto Slab', serif;
    --font-pixel: 'Press Start 2P', monospace;
}

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

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

body {
    background: var(--charcoal-ink);
    color: var(--diplomatic-cream);
    font-family: var(--font-secondary);
    font-weight: 300;
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    line-height: 1.8;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* --- Diagonal Zone Base --- */
.diagonal-zone {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zone-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    z-index: 0;
    opacity: 0.35;
}

.zone-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.border-path {
    stroke-dasharray: 4000;
    stroke-dashoffset: 4000;
    transition: stroke-dashoffset 2s ease-in-out;
}

.diagonal-zone.revealed .border-path {
    stroke-dashoffset: 0;
}

.zone-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1200px;
    padding: 4rem 2rem;
}

/* --- Bubbles --- */
.bubbles-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    animation: bubbleFloat var(--float-duration, 6s) ease-in-out infinite;
    animation-delay: var(--float-delay, 0s);
}

.bubble::after {
    content: '';
    position: absolute;
    top: 20%;
    left: 20%;
    width: 4px;
    height: 4px;
    background: rgba(255, 255, 255, 0.7);
}

.bubble-warm {
    background: rgba(255, 140, 66, 0.15);
    border: 1px solid var(--amber-glow);
}

.bubble-cool {
    background: rgba(42, 157, 143, 0.12);
    border: 1px solid var(--embassy-teal);
}

@keyframes bubbleFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-15px) rotate(1deg); }
    50% { transform: translateY(-8px) rotate(-1deg); }
    75% { transform: translateY(-20px) rotate(0.5deg); }
}

/* --- Pixel-Art Border Simulation (box-shadow stacking) --- */
.pixel-border {
    box-shadow:
        1px 0 0 0 var(--amber-glow),
        -1px 0 0 0 var(--amber-glow),
        0 1px 0 0 var(--amber-glow),
        0 -1px 0 0 var(--amber-glow);
}

.pixel-border-teal {
    box-shadow:
        1px 0 0 0 var(--embassy-teal),
        -1px 0 0 0 var(--embassy-teal),
        0 1px 0 0 var(--embassy-teal),
        0 -1px 0 0 var(--embassy-teal);
}

/* ============================================
   ZONE 1: THE EMBASSY (Hero)
   ============================================ */
.zone-embassy {
    background: var(--burnt-orange);
    min-height: 100vh;
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 60px), 0 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.embassy-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
}

.embassy-title {
    font-family: var(--font-primary);
    font-size: clamp(2.5rem, 7vw, 6rem);
    color: var(--diplomatic-cream);
    text-shadow: 3px 3px 0 var(--soft-soot);
    letter-spacing: 0.02em;
    overflow: hidden;
    white-space: nowrap;
    border-right: 4px solid var(--diplomatic-cream);
    width: 0;
    animation: typewriter 1.8s steps(14) 0.5s forwards, blinkCaret 0.6s steps(1) infinite;
}

.embassy-tagline {
    font-family: var(--font-pixel);
    font-size: clamp(0.6rem, 1vw, 0.8rem);
    color: var(--parchment-tan);
    margin-top: 1.5rem;
    opacity: 0;
    animation: fadeIn 0.8s ease 2.5s forwards;
}

.blink-cursor {
    animation: blinkCursor 1s steps(1) infinite;
}

@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; max-width: 14ch; }
}

@keyframes blinkCaret {
    0%, 100% { border-color: var(--diplomatic-cream); }
    50% { border-color: transparent; }
}

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.pixel-embassy-building {
    position: absolute;
    bottom: 80px;
    right: 5%;
    z-index: 2;
    image-rendering: pixelated;
}

#embassy-sprite {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ============================================
   ZONE 2: THE TREATY ROOM (About)
   ============================================ */
.zone-treaty {
    background: var(--diplomatic-cream);
    color: var(--charcoal-ink);
    clip-path: polygon(0 60px, 100% 0, 100% 100%, 0 calc(100% - 60px));
    margin-top: -60px;
    padding-top: 60px;
}

.treaty-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    max-width: 1100px;
    margin: 0 auto;
}

.treaty-text-block {
    max-width: 680px;
    text-align: center;
    flex: 1 1 400px;
}

.section-title {
    font-family: var(--font-primary);
    font-size: clamp(1.5rem, 4vw, 3rem);
    margin-bottom: 1.5rem;
}

.zone-treaty .section-title {
    color: var(--charcoal-ink);
}

.treaty-description {
    color: var(--soft-soot);
    margin-bottom: 1rem;
    font-weight: 300;
}

.ambassador {
    position: relative;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.8s steps(8);
}

.ambassador-sprite {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: block;
}

.ambassador-left {
    transform: translateX(-100px);
}

.ambassador-right {
    transform: translateX(100px);
}

.ambassador.walk-in {
    opacity: 1;
    transform: translateX(0);
}

.amb-item {
    font-size: 1.8rem;
    text-align: center;
    margin-top: 0.5rem;
}

/* ============================================
   ZONE 3: THE COURIER'S PATH (Journey)
   ============================================ */
.zone-courier {
    background: var(--parchment-tan);
    color: var(--charcoal-ink);
    clip-path: polygon(0 0, 100% 60px, 100% calc(100% - 60px), 0 100%);
    margin-top: -60px;
    min-height: 120vh;
}

.courier-content {
    text-align: center;
}

.zone-courier .section-title {
    color: var(--charcoal-ink);
}

.courier-path-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 2rem auto;
    min-height: 900px;
}

.courier-path-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.courier-main-path {
    stroke-dasharray: 4000;
    stroke-dashoffset: 4000;
    transition: stroke-dashoffset 0.05s linear;
}

.milestone {
    position: absolute;
    z-index: 2;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.milestone.visible {
    opacity: 1;
    transform: scale(1);
}

.milestone-bubble {
    background: var(--diplomatic-cream);
    border-radius: clamp(24px, 5vw, 64px);
    padding: 1rem 1.5rem;
    text-align: center;
    box-shadow:
        2px 0 0 0 var(--amber-glow),
        -2px 0 0 0 var(--amber-glow),
        0 2px 0 0 var(--amber-glow),
        0 -2px 0 0 var(--amber-glow),
        3px 3px 0 0 var(--soft-soot);
}

.milestone-icon {
    font-size: 2rem;
    margin-bottom: 0.3rem;
}

.milestone-label {
    font-family: var(--font-pixel);
    font-size: clamp(0.5rem, 0.8vw, 0.7rem);
    color: var(--charcoal-ink);
    display: block;
}

/* ============================================
   ZONE 4: THE SUMMIT (Highlights)
   ============================================ */
.zone-summit {
    background: var(--deep-ember);
    clip-path: polygon(0 60px, 100% 0, 100% 100%, 0 calc(100% - 60px));
    margin-top: -60px;
}

.summit-content {
    text-align: center;
}

.summit-title {
    color: var(--diplomatic-cream);
}

.summit-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

.summit-card {
    background: var(--diplomatic-cream);
    color: var(--charcoal-ink);
    border-radius: clamp(24px, 5vw, 64px);
    padding: 2rem 1.5rem;
    text-align: center;
    position: relative;
    transition: background 0.3s ease, transform 0.2s ease;
    box-shadow:
        2px 0 0 0 var(--amber-glow),
        -2px 0 0 0 var(--amber-glow),
        0 2px 0 0 var(--amber-glow),
        0 -2px 0 0 var(--amber-glow);
    cursor: default;
}

.summit-card:hover {
    background: var(--burnt-orange);
    color: var(--diplomatic-cream);
    transform: translateY(-4px);
}

.summit-card:hover .card-title {
    color: var(--diplomatic-cream);
}

.summit-card:hover .card-text {
    color: var(--parchment-tan);
}

.card-icon-header {
    margin-bottom: 1rem;
}

.card-icon {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    display: inline-block;
}

.card-title {
    font-family: var(--font-pixel);
    font-size: clamp(0.6rem, 1vw, 0.8rem);
    color: var(--charcoal-ink);
    margin-bottom: 1rem;
    transition: color 0.3s ease;
}

.card-text {
    font-weight: 300;
    color: var(--soft-soot);
    transition: color 0.3s ease;
    font-size: 0.95rem;
}

/* ============================================
   ZONE 5: THE ARCHIVE (Details)
   ============================================ */
.zone-archive {
    background: var(--charcoal-ink);
    clip-path: polygon(0 0, 100% 60px, 100% calc(100% - 60px), 0 100%);
    margin-top: -60px;
    min-height: 100vh;
}

.archive-content {
    max-width: 800px;
    margin: 0 auto;
}

.archive-title {
    color: var(--diplomatic-cream);
    text-align: center;
    margin-bottom: 2rem;
}

.archive-scrolls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.scroll-item {
    background: rgba(61, 50, 38, 0.6);
    border-radius: 8px;
    overflow: hidden;
    box-shadow:
        1px 0 0 0 var(--embassy-teal),
        -1px 0 0 0 var(--embassy-teal),
        0 1px 0 0 var(--embassy-teal),
        0 -1px 0 0 var(--embassy-teal);
    transition: box-shadow 0.3s ease;
}

.scroll-item:hover {
    box-shadow:
        2px 0 0 0 var(--embassy-teal),
        -2px 0 0 0 var(--embassy-teal),
        0 2px 0 0 var(--embassy-teal),
        0 -2px 0 0 var(--embassy-teal);
}

.scroll-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.5rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.3s ease;
}

.scroll-header:hover {
    background: rgba(42, 157, 143, 0.1);
}

.scroll-heading {
    font-family: var(--font-primary);
    font-size: clamp(1rem, 2vw, 1.4rem);
    color: var(--diplomatic-cream);
}

.scroll-toggle {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    color: var(--embassy-teal);
    transition: transform 0.3s ease;
    display: inline-block;
}

.scroll-item.expanded .scroll-toggle {
    transform: rotate(180deg);
}

.scroll-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, padding 0.5s ease;
    padding: 0 1.5rem;
}

.scroll-item.expanded .scroll-body {
    max-height: 400px;
    padding: 0 1.5rem 1.5rem;
}

.scroll-body p {
    color: var(--parchment-tan);
    font-weight: 300;
    line-height: 1.8;
}

/* ============================================
   ZONE 6: THE FAREWELL (Footer)
   ============================================ */
.zone-farewell {
    background: var(--burnt-orange);
    clip-path: polygon(0 60px, 100% 0, 100% 100%, 0 100%);
    margin-top: -60px;
    min-height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.farewell-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
}

.farewell-message {
    font-family: var(--font-primary);
    font-size: clamp(1.8rem, 5vw, 4rem);
    color: var(--diplomatic-cream);
    text-shadow: 3px 3px 0 var(--soft-soot);
    margin-bottom: 3rem;
}

.pixel-dove {
    margin-bottom: 2rem;
    position: relative;
    width: 96px;
    height: 96px;
    animation: dovefly 8s ease-in-out infinite;
}

#dove-sprite {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

@keyframes dovefly {
    0% { transform: translate(-200px, 20px); }
    25% { transform: translate(0, -30px); }
    50% { transform: translate(200px, 10px); }
    75% { transform: translate(0, -20px); }
    100% { transform: translate(-200px, 20px); }
}

.farewell-links {
    font-family: var(--font-pixel);
    font-size: clamp(0.5rem, 0.8vw, 0.7rem);
    color: var(--parchment-tan);
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.farewell-divider {
    color: var(--treaty-gold);
}

/* ============================================
   SELECTION CURSOR (hover effect)
   ============================================ */
.pixel-cursor {
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    color: var(--treaty-gold);
    animation: cursorBlink 0.5s steps(1) infinite;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}

.scroll-header:hover .pixel-cursor,
.summit-card:hover .pixel-cursor {
    opacity: 1;
}

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

/* ============================================
   PARALLAX OFFSET FOR CANVAS LAYERS
   ============================================ */
.zone-canvas {
    will-change: transform;
}

/* ============================================
   PREFERS REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    .embassy-title {
        width: 100% !important;
        max-width: 14ch;
        animation: none;
        border-right: none;
    }

    .embassy-tagline {
        opacity: 1;
        animation: none;
    }

    .blink-cursor {
        animation: none;
        display: none;
    }

    .bubble {
        animation: none !important;
    }

    .border-path {
        stroke-dashoffset: 0 !important;
        transition: none;
    }

    .courier-main-path {
        stroke-dashoffset: 0 !important;
        transition: none;
    }

    .milestone {
        opacity: 1;
        transform: scale(1);
        transition: none;
    }

    .ambassador {
        opacity: 1;
        transform: translateX(0);
        transition: none;
    }

    .pixel-dove {
        animation: none;
    }

    .scroll-body {
        transition: none;
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .treaty-content {
        flex-direction: column;
    }

    .ambassador {
        display: none;
    }

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

    .courier-path-container {
        min-height: 700px;
    }

    .milestone-bubble {
        padding: 0.7rem 1rem;
    }

    .diagonal-zone {
        clip-path: none !important;
        margin-top: 0 !important;
    }
}

@media (max-width: 480px) {
    .embassy-title {
        font-size: clamp(1.8rem, 10vw, 3rem);
    }

    .farewell-message {
        font-size: clamp(1.4rem, 6vw, 2.5rem);
    }

    .zone-content {
        padding: 3rem 1rem;
    }
}
