/* ============================================
   diplomatic.wiki - Styles
   Arctic Archive / Aurora Borealis Theme
   ============================================ */

/* CSS Custom Properties
   Typography: Interactive states via container floats within generous Minimum
   Negative Space:** used for breathing room between blocks */
:root {
    /* Backgrounds */
    --polar-night: #12121E;
    --dossier-charcoal: #1C1C2E;
    --frost-panel: #252540;

    /* Text */
    --glacial-white: #E8ECF4;
    --drift-silver: #9CA3B4;

    /* Accents */
    --aurora-teal: #38D9A9;
    --aurora-violet: #9775FA;
    --aurora-rose: #E64980;

    /* Gradients */
    --deep-magnetosphere: #0D0D2B;
    --ionosphere-green: #1A4D3E;
    --stratospheric-violet: #2D1B69;

    /* Fonts - Negative Space:** system */
    --font-display: 'Cormorant Garamond', 'Georgia', serif;
    --font-body: 'EB Garamond', 'Georgia', serif;
    --font-ui: 'DM Sans', 'Helvetica Neue', sans-serif;

    /* Aurora Gradient */
    --aurora-gradient: linear-gradient(
        135deg,
        #0D0D2B 0%,
        #1A4D3E 35%,
        #38D9A9 50%,
        #9775FA 70%,
        #2D1B69 100%
    );
}

/* ============================================
   Reset & Base
   ============================================ */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--polar-night);
    color: var(--glacial-white);
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    font-weight: 400;
    line-height: 1.72;
    letter-spacing: 0.008em;
    overflow-x: hidden;
}

a {
    color: var(--glacial-white);
    text-decoration: none;
    transition: color 600ms cubic-bezier(0.23, 1, 0.32, 1);
}

a:hover {
    color: var(--aurora-teal);
}

img {
    max-width: 100%;
    display: block;
}

/* ============================================
   Background Aurora
   ============================================ */

#aurora-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

#aurora-svg {
    width: 100%;
    height: 100%;
}

/* ============================================
   Navigation Bar
   ============================================ */

#nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(18, 18, 30, 0.7);
    border-bottom: 1px solid rgba(56, 217, 169, 0.06);
    padding: 0 3.2rem;
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 56px;
    max-width: 1400px;
    margin: 0 auto;
}

.nav-brand {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    color: var(--glacial-white);
}

.nav-links {
    display: flex;
    gap: 2.4rem;
}

.nav-link {
    font-family: var(--font-ui);
    font-weight: 400;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--drift-silver);
    position: relative;
    transition: color 400ms cubic-bezier(0.23, 1, 0.32, 1);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--aurora-teal);
    transition: width 400ms cubic-bezier(0.23, 1, 0.32, 1),
                background 400ms cubic-bezier(0.23, 1, 0.32, 1);
}

.nav-link:hover {
    color: var(--glacial-white);
}

.nav-link:hover::after {
    width: 100%;
    background: linear-gradient(90deg, var(--aurora-teal), var(--aurora-violet));
}

/* ============================================
   Scene 1: The Observation Deck (Hero)
   ============================================ */

.scene-hero {
    position: relative;
    z-index: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.hero-content {
    text-align: center;
    opacity: 0;
    animation: heroFadeIn 1.2s cubic-bezier(0.23, 1, 0.32, 1) 0.6s forwards;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(3.2rem, 8vw, 6rem);
    letter-spacing: 0.04em;
    line-height: 1.12;
    color: var(--glacial-white);
    margin-bottom: 1.2rem;
}

.hero-subtitle {
    font-family: var(--font-ui);
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--drift-silver);
    margin-bottom: 2rem;
    opacity: 0;
    animation: heroFadeIn 1s cubic-bezier(0.23, 1, 0.32, 1) 1s forwards;
}

.hero-line {
    width: 0;
    height: 1px;
    background: rgba(56, 217, 169, 0.2);
    margin: 0 auto;
    animation: lineExpand 1.2s cubic-bezier(0.23, 1, 0.32, 1) 1.4s forwards;
}

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

@keyframes lineExpand {
    from {
        width: 0;
        opacity: 0;
    }
    to {
        width: 200px;
        opacity: 1;
    }
}

.scroll-indicator {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--drift-silver);
    animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* ============================================
   Masonry Grid
   ============================================ */

.scene-archive,
.scene-deep-archive {
    position: relative;
    z-index: 1;
    padding: 4rem 3.2rem;
    max-width: 1400px;
    margin: 0 auto;
}

.masonry-grid {
    column-count: 3;
    column-gap: 2.4rem;
}

/* ============================================
   Block Base Styles
   ============================================ */

.block {
    break-inside: avoid;
    margin-bottom: 2.4rem;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid transparent;
    transition: border-color 600ms cubic-bezier(0.23, 1, 0.32, 1),
                box-shadow 600ms cubic-bezier(0.23, 1, 0.32, 1);
}

.block:hover {
    border-color: rgba(56, 217, 169, 0.15);
    box-shadow: 0 4px 40px rgba(56, 217, 169, 0.04);
}

/* Fade-in animation for blocks entering viewport */
.fade-block {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 700ms cubic-bezier(0.23, 1, 0.32, 1),
                transform 700ms cubic-bezier(0.23, 1, 0.32, 1);
}

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

/* ============================================
   Atlas Blocks (Large, span 2 columns)
   ============================================ */

.atlas-block {
    column-span: all;
    background: var(--dossier-charcoal);
    position: relative;
    min-height: 480px;
    display: flex;
    flex-direction: column;
}

.atlas-image {
    position: relative;
    width: 100%;
    height: 320px;
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

.atlas-block .block-content {
    padding: 2rem 2.4rem 2.4rem;
    flex: 1;
}

.atlas-block .block-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    letter-spacing: 0.04em;
    line-height: 1.2;
    color: var(--glacial-white);
    margin-bottom: 0.8rem;
}

.atlas-block .block-text {
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.1vw, 1.05rem);
    line-height: 1.72;
    color: var(--drift-silver);
    max-width: 38em;
}

/* ============================================
   Dispatch Blocks (Medium)
   ============================================ */

.dispatch-block {
    background: var(--dossier-charcoal);
    padding: 2rem;
    min-height: 280px;
}

.dispatch-block .block-image {
    width: 100%;
    height: 180px;
    background-size: cover;
    background-position: center;
    margin: -2rem -2rem 1.6rem -2rem;
    width: calc(100% + 4rem);
    position: relative;
    overflow: hidden;
}

.dispatch-block .block-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.2rem, 2vw, 1.5rem);
    letter-spacing: 0.03em;
    line-height: 1.25;
    color: var(--glacial-white);
    margin-bottom: 0.6rem;
}

.dispatch-block .block-text {
    font-family: var(--font-body);
    font-size: clamp(0.9rem, 1vw, 1rem);
    line-height: 1.72;
    color: var(--drift-silver);
    max-width: 38em;
}

/* ============================================
   Cipher Blocks (Small)
   ============================================ */

.cipher-block {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background: rgba(37, 37, 64, 0.55);
    border: 1px solid rgba(56, 217, 169, 0.08);
    box-shadow: inset 0 0 30px rgba(151, 117, 250, 0.03);
    padding: 1.6rem;
    min-height: 160px;
}

.cipher-block:hover {
    border-color: rgba(56, 217, 169, 0.15);
}

.cipher-label {
    font-family: var(--font-ui);
    font-weight: 400;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--drift-silver);
    margin-bottom: 0.15rem;
    margin-top: 0.8rem;
}

.cipher-label:first-of-type {
    margin-top: 0.6rem;
}

.cipher-value {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.2rem;
    letter-spacing: 0.02em;
    color: var(--glacial-white);
    line-height: 1.3;
}

/* ============================================
   Block Tags
   ============================================ */

.block-tag {
    display: inline-block;
    font-family: var(--font-ui);
    font-weight: 500;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--aurora-violet);
    background: rgba(151, 117, 250, 0.08);
    padding: 0.25rem 0.6rem;
    border-radius: 2px;
    margin-bottom: 0.8rem;
}

/* ============================================
   Duotone Overlays
   ============================================ */

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

.duotone-teal {
    background: linear-gradient(135deg, rgba(13, 13, 43, 0.7), rgba(56, 217, 169, 0.3));
    mix-blend-mode: color;
}

.duotone-violet {
    background: linear-gradient(135deg, rgba(28, 28, 46, 0.7), rgba(151, 117, 250, 0.3));
    mix-blend-mode: color;
}

/* Block Aurora - Bleeding aurora edges */
.atlas-block::after,
.dispatch-block[data-duotone]::after {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background: var(--aurora-gradient);
    opacity: 0.03;
    z-index: -1;
    border-radius: 8px;
    pointer-events: none;
}

.atlas-block {
    position: relative;
}

.dispatch-block[data-duotone] {
    position: relative;
}

/* ============================================
   Scene 3: Meridian Break
   ============================================ */

.scene-meridian {
    position: relative;
    z-index: 1;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.meridian-aurora {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

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

.meridian-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 800px;
    padding: 0 3.2rem;
}

.meridian-quote {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(1.8rem, 4vw, 3rem);
    line-height: 1.3;
    color: var(--glacial-white);
    letter-spacing: 0.02em;
    font-style: italic;
    border: none;
    margin-bottom: 1.2rem;
}

.meridian-attribution {
    font-family: var(--font-ui);
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    color: var(--drift-silver);
    text-transform: uppercase;
}

/* ============================================
   Divider Aurora
   ============================================ */

.divider-aurora {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 80px;
    overflow: visible;
}

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

/* ============================================
   Scene 5: The Terminus
   ============================================ */

.scene-terminus {
    position: relative;
    z-index: 1;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.terminus-meridian {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.4;
}

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

.terminus-content {
    position: relative;
    z-index: 1;
    text-align: center;
}

.terminus-brand {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 1.2rem;
    letter-spacing: 0.04em;
    color: var(--drift-silver);
    margin-bottom: 1.6rem;
}

.terminus-links {
    display: flex;
    gap: 2rem;
    justify-content: center;
}

.terminus-link {
    font-family: var(--font-ui);
    font-weight: 400;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--drift-silver);
    transition: color 400ms cubic-bezier(0.23, 1, 0.32, 1);
}

.terminus-link:hover {
    color: var(--aurora-teal);
}

.terminus-spacer {
    height: 120px;
}

/* ============================================
   Deep Archive Palette Shift
   ============================================ */

.scene-deep-archive .block-tag {
    color: var(--aurora-violet);
    background: rgba(151, 117, 250, 0.1);
}

.scene-deep-archive .cipher-block {
    background: rgba(45, 27, 105, 0.25);
    border-color: rgba(151, 117, 250, 0.08);
    box-shadow: inset 0 0 30px rgba(151, 117, 250, 0.05);
}

.scene-deep-archive .atlas-block,
.scene-deep-archive .dispatch-block {
    background: linear-gradient(180deg, var(--dossier-charcoal) 0%, rgba(45, 27, 105, 0.15) 100%);
}

/* ============================================
   Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .aurora-path animate,
    .meridian-path-1 animate,
    .meridian-path-2 animate,
    .meridian-path-3 animate,
    .meridian-path-4 animate,
    .meridian-path-5 animate,
    .divider-svg path animate,
    .terminus-svg path animate {
        animation: none;
    }

    .hero-content {
        animation: none;
        opacity: 1;
    }

    .hero-subtitle {
        animation: none;
        opacity: 1;
    }

    .hero-line {
        animation: none;
        width: 200px;
        opacity: 1;
    }

    .scroll-indicator {
        animation: none;
        opacity: 0.5;
    }

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

    .block {
        transition: none;
    }

    .nav-link::after {
        transition: none;
    }
}

/* ============================================
   Responsive: Tablet
   ============================================ */

@media (max-width: 1200px) {
    .masonry-grid {
        column-count: 2;
    }

    .scene-archive,
    .scene-deep-archive {
        padding: 3rem 2.4rem;
    }

    #nav-bar {
        padding: 0 2.4rem;
    }

    .atlas-block {
        min-height: 400px;
    }

    .atlas-image {
        height: 260px;
    }
}

/* ============================================
   Responsive: Mobile
   ============================================ */

@media (max-width: 768px) {
    .masonry-grid {
        column-count: 1;
    }

    .scene-archive,
    .scene-deep-archive {
        padding: 2rem 1.6rem;
    }

    #nav-bar {
        padding: 0 1.6rem;
    }

    .nav-links {
        gap: 1.2rem;
    }

    .nav-link {
        font-size: 0.68rem;
    }

    .hero-title {
        font-size: clamp(2.4rem, 10vw, 4rem);
    }

    .atlas-block {
        min-height: auto;
        column-span: none;
    }

    .atlas-image {
        height: 200px;
    }

    .dispatch-block {
        min-height: auto;
    }

    .cipher-block {
        min-height: auto;
    }

    .meridian-quote {
        font-size: clamp(1.4rem, 5vw, 2rem);
    }

    .terminus-links {
        flex-direction: column;
        gap: 1rem;
    }

    .dispatch-block .block-image {
        height: 140px;
    }
}

/* ============================================
   Scrollbar Styling
   ============================================ */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--polar-night);
}

::-webkit-scrollbar-thumb {
    background: var(--frost-panel);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--drift-silver);
}

/* ============================================
   Selection Color
   ============================================ */

::selection {
    background: rgba(56, 217, 169, 0.2);
    color: var(--glacial-white);
}

::-moz-selection {
    background: rgba(56, 217, 169, 0.2);
    color: var(--glacial-white);
}