/* ============================================================
   diplomacy.day - Diplomatic Intelligence Terminal Stylesheet
   ============================================================ */

/* CSS Custom Properties */
:root {
    --base-bg: #0D0B08;
    --primary-accent: #C9A84C;
    --secondary-accent: #8B7A3E;
    --text-primary: #D4C5A0;
    --text-secondary: #7A6F55;
    --highlight: #F0E4C4;
    --deep-layer: #1A1611;
    --alert-accent: #8B2D2D;

    --font-heading: 'Libre Baskerville', 'Georgia', serif;
    --font-body: 'Libre Baskerville', 'Georgia', serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
    --font-quote: 'Cormorant Garamond', 'Georgia', serif;

    --hud-inset: 24px;
    --content-max-width: 720px;
}

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

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

body {
    background-color: var(--base-bg);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.85;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   Scan Lines Overlay
   ============================================================ */
.scan-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 2px,
        rgba(13, 11, 8, 0.02) 2px,
        rgba(13, 11, 8, 0.02) 3px
    );
}

/* ============================================================
   Diamond Grid Background
   ============================================================ */
.diamond-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.03;
    background-image:
        linear-gradient(45deg, var(--deep-layer) 1px, transparent 1px),
        linear-gradient(-45deg, var(--deep-layer) 1px, transparent 1px);
    background-size: 40px 40px;
}

.diamond-grid-elevated {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.08;
    background-image:
        linear-gradient(45deg, var(--deep-layer) 1px, transparent 1px),
        linear-gradient(-45deg, var(--deep-layer) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* ============================================================
   Parallax Map Fragments
   ============================================================ */
.parallax-maps {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    will-change: transform;
}

.map-fragment {
    position: absolute;
    width: 100%;
    pointer-events: none;
}

.map-fragment-1 {
    top: 15%;
    height: 40%;
    opacity: 0.05;
}

.map-fragment-2 {
    top: 55%;
    height: 40%;
    opacity: 0.06;
}

.map-line {
    stroke: var(--deep-layer);
    stroke-width: 1;
    fill: none;
}

.map-curve {
    stroke-width: 0.8;
}

/* ============================================================
   HUD Frame
   ============================================================ */
.hud-frame {
    position: fixed;
    top: var(--hud-inset);
    left: var(--hud-inset);
    right: var(--hud-inset);
    bottom: var(--hud-inset);
    z-index: 1000;
    pointer-events: none;
    border: 1px solid var(--primary-accent);
    transition: border-color 0.4s ease;
}

.hud-frame.pulse {
    border-color: var(--highlight);
}

/* Corner Brackets */
.hud-corner {
    position: absolute;
    width: 16px;
    height: 16px;
    pointer-events: none;
}

.hud-corner::before,
.hud-corner::after {
    content: '';
    position: absolute;
    background-color: var(--primary-accent);
    transition: background-color 0.4s ease;
}

.hud-frame.pulse .hud-corner::before,
.hud-frame.pulse .hud-corner::after {
    background-color: var(--highlight);
}

.hud-corner-tl {
    top: -1px;
    left: -1px;
}
.hud-corner-tl::before {
    top: 0;
    left: 0;
    width: 16px;
    height: 2px;
}
.hud-corner-tl::after {
    top: 0;
    left: 0;
    width: 2px;
    height: 16px;
}

.hud-corner-tr {
    top: -1px;
    right: -1px;
}
.hud-corner-tr::before {
    top: 0;
    right: 0;
    width: 16px;
    height: 2px;
}
.hud-corner-tr::after {
    top: 0;
    right: 0;
    width: 2px;
    height: 16px;
}

.hud-corner-bl {
    bottom: -1px;
    left: -1px;
}
.hud-corner-bl::before {
    bottom: 0;
    left: 0;
    width: 16px;
    height: 2px;
}
.hud-corner-bl::after {
    bottom: 0;
    left: 0;
    width: 2px;
    height: 16px;
}

.hud-corner-br {
    bottom: -1px;
    right: -1px;
}
.hud-corner-br::before {
    bottom: 0;
    right: 0;
    width: 16px;
    height: 2px;
}
.hud-corner-br::after {
    bottom: 0;
    right: 0;
    width: 2px;
    height: 16px;
}

/* Corner Crosshairs */
.hud-crosshair {
    position: absolute;
    pointer-events: none;
    opacity: 0.6;
    transition: opacity 0.4s ease;
}

.hud-frame.pulse .hud-crosshair {
    opacity: 1;
}

.hud-crosshair::before,
.hud-crosshair::after {
    content: '';
    position: absolute;
    background-color: var(--primary-accent);
    transition: background-color 0.4s ease;
}

.hud-frame.pulse .hud-crosshair::before,
.hud-frame.pulse .hud-crosshair::after {
    background-color: var(--highlight);
}

.hud-crosshair-tl {
    top: -9px;
    left: -9px;
}
.hud-crosshair-tl::before {
    top: 0;
    left: 8px;
    width: 1px;
    height: 8px;
}
.hud-crosshair-tl::after {
    top: 8px;
    left: 0;
    width: 8px;
    height: 1px;
}

.hud-crosshair-tr {
    top: -9px;
    right: -9px;
}
.hud-crosshair-tr::before {
    top: 0;
    right: 8px;
    width: 1px;
    height: 8px;
}
.hud-crosshair-tr::after {
    top: 8px;
    right: 0;
    width: 8px;
    height: 1px;
}

.hud-crosshair-bl {
    bottom: -9px;
    left: -9px;
}
.hud-crosshair-bl::before {
    bottom: 0;
    left: 8px;
    width: 1px;
    height: 8px;
}
.hud-crosshair-bl::after {
    bottom: 8px;
    left: 0;
    width: 8px;
    height: 1px;
}

.hud-crosshair-br {
    bottom: -9px;
    right: -9px;
}
.hud-crosshair-br::before {
    bottom: 0;
    right: 8px;
    width: 1px;
    height: 8px;
}
.hud-crosshair-br::after {
    bottom: 8px;
    right: 0;
    width: 8px;
    height: 1px;
}

/* HUD Labels */
.hud-label {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-secondary);
    pointer-events: none;
}

.hud-label-tl {
    top: 8px;
    left: 24px;
}

.hud-label-tr {
    top: 8px;
    right: 24px;
}

.hud-label-bl {
    bottom: 8px;
    left: 24px;
}

.hud-label-br {
    bottom: 8px;
    right: 24px;
}

/* HUD Navigation */
.hud-nav {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 20px;
    pointer-events: auto;
}

.hud-nav-item {
    font-family: var(--font-body);
    font-size: 12px;
    font-style: italic;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease, opacity 0.3s ease;
    opacity: 0.5;
    letter-spacing: 0.05em;
}

.hud-nav-item:hover {
    color: var(--highlight);
    opacity: 1;
}

.hud-nav-item.active {
    color: var(--primary-accent);
    animation: navPulse 3s ease-in-out infinite;
}

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

/* Data Ticker */
.data-ticker {
    position: absolute;
    bottom: 24px;
    left: 24px;
    right: 80px;
    overflow: hidden;
    height: 12px;
    pointer-events: none;
}

.ticker-content {
    display: inline-block;
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 8px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: 0.4;
    animation: tickerScroll 60s linear infinite;
}

@keyframes tickerScroll {
    from { transform: translateX(0); }
    to { transform: translateX(-33.33%); }
}

/* ============================================================
   Main Content Container
   ============================================================ */
.dossier-container {
    position: relative;
    z-index: 10;
}

/* Dossier Panels */
.dossier-panel {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 80px calc(var(--hud-inset) + 40px);
}

.panel-content {
    max-width: var(--content-max-width);
    width: 100%;
    text-align: center;
}

.panel-content-split {
    max-width: 960px;
    display: flex;
    gap: 60px;
    align-items: center;
    text-align: left;
}

/* ============================================================
   Section Dividers
   ============================================================ */
.section-divider {
    position: relative;
    height: 1px;
    margin: 0 calc(var(--hud-inset) + 1px);
    background-color: var(--primary-accent);
    display: flex;
    align-items: center;
    justify-content: center;
}

.divider-diamond {
    position: absolute;
    width: 8px;
    height: 8px;
    background-color: var(--primary-accent);
    transform: rotate(45deg);
    flex-shrink: 0;
}

/* ============================================================
   Dossier I: Hero
   ============================================================ */
.hero-title,
.closing-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary-accent);
    margin-bottom: 30px;
    line-height: 1.2;
}

.hero-title .letter,
.closing-title .letter {
    display: inline-block;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hero-title .letter.visible,
.closing-title .letter.visible {
    opacity: 1;
}

.hero-title .letter.dot,
.closing-title .letter.dot {
    color: var(--alert-accent);
}

.hero-subtitle {
    font-family: var(--font-quote);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--text-primary);
    opacity: 0;
    transition: opacity 1.5s ease;
    letter-spacing: 0.05em;
}

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

/* ============================================================
   Seal Marks
   ============================================================ */
.seal-mark {
    display: block;
    margin: 0 auto 40px;
}

.seal-path {
    fill: none;
    stroke: var(--primary-accent);
    stroke-width: 1;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 3s ease;
}

.seal-mark.animated .seal-path {
    stroke-dashoffset: 0;
}

.seal-dot {
    fill: var(--primary-accent);
    opacity: 0;
    transition: opacity 1s ease 2.5s;
}

.seal-mark.animated .seal-dot {
    opacity: 1;
}

/* Per-section seal marks */
.seal-mark-3 {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
}

/* ============================================================
   Dossier II: Concept
   ============================================================ */
.dossier-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary-accent);
    margin-bottom: 40px;
}

.dossier-body {
    text-align: left;
}

.dossier-body p {
    margin-bottom: 1.5em;
    color: var(--text-primary);
}

/* Underline Draw Animation */
.underline-draw {
    background-image: linear-gradient(var(--primary-accent), var(--primary-accent));
    background-position: 0 100%;
    background-repeat: no-repeat;
    background-size: 0% 1px;
    transition: background-size 0.6s ease-out;
    padding-bottom: 2px;
}

.underline-draw.drawn {
    background-size: 100% 1px;
}

/* ============================================================
   Treaty Lines
   ============================================================ */
.treaty-line {
    position: absolute;
    left: calc(var(--hud-inset) + 1px);
    right: calc(var(--hud-inset) + 1px);
    height: 1px;
    background-color: var(--primary-accent);
    opacity: 0.3;
    pointer-events: none;
}

.treaty-line-1 { top: 25%; }
.treaty-line-2 { top: 20%; }
.treaty-line-3 { bottom: 30%; }
.treaty-line-4 { top: 15%; }
.treaty-line-5 { bottom: 25%; }

.treaty-dot {
    position: absolute;
    right: 0;
    top: -2px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--primary-accent);
    opacity: 0.3;
}

/* ============================================================
   Dossier III: Network Diagram
   ============================================================ */
.network-diagram {
    flex: 0 0 40%;
    position: relative;
}

.network-svg {
    width: 100%;
    height: auto;
    max-height: 500px;
}

.network-line {
    stroke: var(--primary-accent);
    stroke-width: 1;
    fill: none;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1.5s ease;
}

.network-svg.animated .network-line {
    stroke-dashoffset: 0;
}

.network-node {
    fill: none;
    stroke: var(--primary-accent);
    stroke-width: 1.5;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.network-svg.animated .network-node {
    opacity: 1;
}

.network-node-center {
    fill: var(--primary-accent);
    fill-opacity: 0.2;
}

.network-label {
    fill: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.15em;
    text-anchor: middle;
    opacity: 0;
    transition: opacity 1s ease 1.2s;
}

.network-svg.animated .network-label {
    opacity: 1;
}

.network-label-center {
    fill: var(--primary-accent);
    font-size: 10px;
    text-anchor: start;
}

.network-text {
    flex: 0 0 60%;
}

.network-text .dossier-title {
    text-align: left;
}

.network-text p {
    margin-bottom: 1.5em;
    color: var(--text-primary);
}

/* ============================================================
   Dossier IV: Pull Quote
   ============================================================ */
.dossier-quote {
    position: relative;
    overflow: hidden;
}

.pull-quote {
    margin: 0 auto 40px;
    max-width: 800px;
}

.pull-quote p {
    font-family: var(--font-quote);
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    line-height: 1.6;
    color: var(--text-primary);
}

.quote-attribution {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.attribution-line {
    display: block;
    width: 40px;
    height: 1px;
    background-color: var(--secondary-accent);
}

.attribution-text {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* ============================================================
   Dossier V: Closing
   ============================================================ */
.closing-title {
    margin-bottom: 40px;
}

.closing-rule {
    width: 0;
    height: 1px;
    background-color: var(--primary-accent);
    margin: 0 auto 40px;
    transition: width 1.5s ease;
}

.closing-rule.drawn {
    width: 100%;
}

.closing-info {
    text-align: center;
}

.closing-meta {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.8;
}

.closing-contact {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--primary-accent);
    margin-top: 24px;
}

/* ============================================================
   Scroll Reveal Animations
   ============================================================ */
.reveal-element {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal-element.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delays for consecutive reveals */
.reveal-element:nth-child(2) { transition-delay: 0.15s; }
.reveal-element:nth-child(3) { transition-delay: 0.30s; }
.reveal-element:nth-child(4) { transition-delay: 0.45s; }
.reveal-element:nth-child(5) { transition-delay: 0.60s; }
.reveal-element:nth-child(6) { transition-delay: 0.75s; }

/* ============================================================
   Classified Indicator
   ============================================================ */
.dossier-panel::before {
    content: '';
    position: absolute;
    top: calc(var(--hud-inset) + 30px);
    left: calc(var(--hud-inset) + 10px);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background-color: var(--alert-accent);
    opacity: 0.6;
    box-shadow: 0 0 8px var(--alert-accent);
}

/* ============================================================
   Responsive Adjustments
   ============================================================ */
@media (max-width: 768px) {
    :root {
        --hud-inset: 12px;
    }

    .dossier-panel {
        padding: 60px calc(var(--hud-inset) + 20px);
    }

    .panel-content-split {
        flex-direction: column;
        max-width: var(--content-max-width);
    }

    .network-diagram {
        flex: none;
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }

    .network-text {
        flex: none;
    }

    .network-text .dossier-title {
        text-align: center;
    }

    .hud-nav {
        right: 4px;
        gap: 14px;
    }

    .hud-nav-item {
        font-size: 10px;
    }

    .hud-label {
        font-size: 8px;
    }

    .data-ticker {
        display: none;
    }

    .treaty-line {
        display: none;
    }

    .seal-mark-3 {
        position: relative;
        bottom: auto;
        left: auto;
        transform: none;
        margin: 20px auto;
    }

    .pull-quote p {
        font-size: clamp(1.2rem, 5vw, 1.8rem);
    }
}

@media (max-width: 480px) {
    .hero-title,
    .closing-title {
        font-size: clamp(1.8rem, 8vw, 2.5rem);
        letter-spacing: 0.08em;
    }

    .dossier-title {
        font-size: clamp(1.4rem, 6vw, 2rem);
        letter-spacing: 0.08em;
    }
}
