/* ==========================================================================
   diplomatic.quest - Styles
   Aurora-gradient diplomatic dossier aesthetic
   Palette: Diplomatic Black #0E0E12, Charcoal Dossier #1C1C1E,
   Indigo Terminal #1A1135, Phosphor Glow #00E676, Signal Pink #FF1493,
   Diplomatic Amber #FFB300, Embassy Indigo #7C4DFF, Dossier Cream #F5F0E6,
   Faded Typescript #9E9E9E, Copper Wire #D4763B, Censor Black #111114
   Fonts: Bowlby One SC (display), Libre Baskerville (body), Share Tech Mono (accent)
   ========================================================================== */

/* ---------- CSS Custom Properties ---------- */
:root {
    --bg-primary: #0E0E12;
    --bg-secondary: #1C1C1E;
    --bg-tertiary: #1A1135;
    --aurora-green: #00E676;
    --aurora-magenta: #FF1493;
    --aurora-gold: #FFB300;
    --aurora-violet: #7C4DFF;
    --text-primary: #F5F0E6;
    --text-secondary: #9E9E9E;
    --copper: #D4763B;
    --censor-black: #111114;
    --aurora-gradient: linear-gradient(135deg, #00E676 0%, #FF1493 40%, #FFB300 70%, #7C4DFF 100%);
    --redaction-gradient: linear-gradient(90deg, #1C1C1E 0%, #0E0E12 50%, #1C1C1E 100%);
    --copper-trace: linear-gradient(90deg, #D4763B, #FFB300, #D4763B);
    --scanline: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,230,118,0.03) 2px, rgba(0,230,118,0.03) 4px);
}

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

html {
    scroll-behavior: smooth;
    background: var(--bg-primary);
}

body {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Diplomatic Seal Navigation ---------- */
.seal-nav {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1000;
    cursor: pointer;
}

.seal-icon {
    width: 48px;
    height: 48px;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 0 8px rgba(212, 118, 59, 0.3));
}

.seal-nav:hover .seal-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 0 12px rgba(212, 118, 59, 0.5));
}

.seal-nav.active .seal-icon {
    transform: rotate(90deg) scale(1.1);
}

/* Radial Menu */
.radial-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    height: 320px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.seal-nav.active .radial-menu {
    pointer-events: auto;
    opacity: 1;
}

.radial-menu-bg {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--aurora-gradient);
    opacity: 0.4;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transform: scale(0);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.seal-nav.active .radial-menu-bg {
    transform: scale(1);
}

.radial-link {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transform-origin: 0 50%;
    transform: translate(0, -50%) rotate(var(--angle)) translateX(60px);
    opacity: 0;
    transition: opacity 0.3s ease 0.15s, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s;
}

.seal-nav.active .radial-link {
    opacity: 1;
}

.radial-link .solder-point {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--aurora-green);
    box-shadow: 0 0 6px rgba(0, 230, 118, 0.4);
    flex-shrink: 0;
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}

.radial-link .link-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-primary);
    white-space: nowrap;
    transform: rotate(calc(var(--angle) * -1));
    transition: color 0.2s ease;
}

.radial-link:hover .solder-point {
    transform: scale(1.6);
    box-shadow: 0 0 12px rgba(0, 230, 118, 0.7);
}

.radial-link:hover .link-label {
    color: var(--aurora-green);
}

/* ---------- HERO SECTION ---------- */
.hero-section {
    position: relative;
    width: 100%;
    height: 120vh;
    overflow: hidden;
    background-color: var(--bg-primary);
    /* Simulated vintage photograph via radial gradients */
    background-image:
        radial-gradient(ellipse at 30% 50%, rgba(212, 118, 59, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 30%, rgba(139, 90, 43, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 70%, rgba(100, 70, 30, 0.08) 0%, transparent 50%),
        linear-gradient(180deg, rgba(14, 14, 18, 0.6) 0%, rgba(26, 17, 53, 0.4) 100%);
    background-size: cover;
}

/* Vignetting overlay */
.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 60%, rgba(14, 14, 18, 0.6) 100%);
    z-index: 5;
    pointer-events: none;
}

/* Film grain noise overlay */
.hero-section::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.08;
    z-index: 6;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 200px 200px;
}

/* Layer 2: Aurora gradient overlay with 60s hue rotation */
.hero-aurora-overlay {
    position: absolute;
    inset: 0;
    background: var(--aurora-gradient);
    mix-blend-mode: screen;
    opacity: 0.7;
    z-index: 2;
    animation: aurora-shift 60s linear infinite;
}

@keyframes aurora-shift {
    0%   { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

/* Layer 3: Circuit board SVG pattern at 3% opacity */
.hero-circuit-pattern {
    position: absolute;
    inset: 0;
    z-index: 3;
    opacity: 0.03;
    pointer-events: none;
}

.circuit-bg {
    width: 100%;
    height: 100%;
}

/* Layer 4: CRT scanline overlay at 5% opacity */
.hero-scanline-overlay {
    position: absolute;
    inset: 0;
    background: var(--scanline);
    z-index: 4;
    opacity: 0.05;
    pointer-events: none;
}

/* Hero content - asymmetrically positioned left: 25%, top: 40% */
.hero-content {
    position: absolute;
    left: 25%;
    top: 40%;
    transform: translate(-25%, -50%);
    z-index: 10;
}

.hero-title {
    font-family: 'Bowlby One SC', cursive;
    font-size: clamp(4rem, 18vw, 14rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--text-primary);
    line-height: 0.95;
    text-shadow:
        0 0 40px rgba(0, 230, 118, 0.15),
        0 0 80px rgba(255, 20, 147, 0.1),
        0 4px 16px rgba(0, 0, 0, 0.6);
    text-transform: lowercase;
}

.hero-subtitle {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--aurora-green);
    margin-top: 2rem;
    animation: pulse-opacity 2s ease-in-out infinite;
}

@keyframes pulse-opacity {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 1; }
}

/* Light leak effect */
.hero-section > .hero-content::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 50vw;
    height: 50vh;
    background: linear-gradient(135deg, rgba(255, 179, 0, 0.08) 0%, transparent 40%);
    pointer-events: none;
    z-index: 1;
}

/* ---------- REDACTION BARS ---------- */
.redaction-bar {
    position: relative;
    width: 100%;
    height: 200px;
    background: var(--redaction-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.redaction-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 200%;
    height: 2px;
    background: var(--aurora-gradient);
    background-size: 200% 100%;
    transform: translateY(-50%);
    animation: redaction-scroll 8s linear infinite;
}

@keyframes redaction-scroll {
    0%   { transform: translateY(-50%) translateX(0); }
    100% { transform: translateY(-50%) translateX(-50%); }
}

.redaction-ghost-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-primary);
    opacity: 0.08;
    position: relative;
    z-index: 1;
}

/* ---------- DOSSIER SECTIONS ---------- */
.dossier-section {
    position: relative;
    min-height: 100vh;
    padding: 120px 48px;
    background: var(--bg-primary);
    background-image: var(--scanline);
    background-size: 100% 4px;
    /* Section entry animation */
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

.dossier-section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Dossier Grid: marginalia (col 1-2) + content (col 3-6) */
.dossier-grid {
    display: grid;
    grid-template-columns: 2fr 4fr;
    gap: 48px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Marginalia column */
.dossier-marginalia {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding-right: 24px;
    border-right: 1px solid rgba(212, 118, 59, 0.15);
}

.margin-circuit {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.6;
}

/* Circuit traces: stroke-dasharray animation */
.circuit-trace {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 1.2s ease-out;
}

.dossier-section.visible .circuit-trace {
    stroke-dashoffset: 0;
}

/* Solder dots pulse on circuit trace completion */
.solder-dot {
    opacity: 0;
    transform-origin: center;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

.dossier-section.visible .solder-dot {
    opacity: 1;
}

.dossier-section.visible .solder-dot.pulse {
    animation: solder-pulse 0.3s ease-out;
}

@keyframes solder-pulse {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.6); }
    100% { transform: scale(1); }
}

/* Margin stamps - Share Tech Mono */
.margin-stamp {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    position: relative;
    z-index: 2;
    padding: 4px 8px;
    display: inline-block;
    align-self: flex-start;
}

.classification-stamp {
    color: var(--aurora-gold);
    border: 1px solid var(--aurora-gold);
    opacity: 0.9;
}

.eyes-only {
    color: var(--aurora-magenta);
    border: 1px solid var(--aurora-magenta);
    opacity: 0.8;
}

.declassified {
    color: var(--aurora-green);
    border: 1px solid var(--aurora-green);
    opacity: 0.7;
}

/* Margin dates */
.margin-date {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.12em;
    color: var(--aurora-green);
    position: relative;
    z-index: 2;
}

/* Compass rose decorative element */
.margin-compass {
    width: 60px;
    height: 60px;
    position: relative;
    z-index: 2;
    align-self: flex-start;
}

/* Section watermark seal - 5% opacity, slow 120s rotation */
.section-watermark {
    width: 200px;
    height: 200px;
    opacity: 0.05;
    position: relative;
    z-index: 1;
    margin-top: auto;
    animation: seal-rotate 120s linear infinite;
}

@keyframes seal-rotate {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Content column */
.dossier-content {
    position: relative;
    z-index: 2;
}

/* Section headings - Bowlby One SC */
.section-heading {
    margin-bottom: 40px;
}

.heading-text {
    font-family: 'Bowlby One SC', cursive;
    font-size: clamp(2rem, 6vw, 4.5rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--text-primary);
    display: block;
    line-height: 1.1;
    text-transform: uppercase;
}

.heading-trace {
    display: block;
    width: 100%;
    max-width: 400px;
    height: 20px;
    margin-top: 16px;
}

.heading-trace .circuit-trace {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    transition: stroke-dashoffset 1.2s ease-out 0.3s;
}

.dossier-section.visible .heading-trace .circuit-trace {
    stroke-dashoffset: 0;
}

.heading-trace .solder-dot {
    opacity: 0;
    transition: opacity 0.3s ease-out 1.5s;
}

.dossier-section.visible .heading-trace .solder-dot {
    opacity: 1;
}

/* Body text - Libre Baskerville */
.dossier-body {
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-size: clamp(1rem, 1.1vw, 1.25rem);
    line-height: 1.75;
    letter-spacing: 0.005em;
    color: var(--text-primary);
    margin-bottom: 28px;
    max-width: 680px;
}

/* Redaction spans - censor black to transparent reveal */
.redacted {
    background: var(--censor-black);
    color: transparent;
    padding: 2px 4px;
    transition: background 1.5s ease-out, color 1.5s ease-out;
    position: relative;
    display: inline;
}

.redacted.revealed {
    background: transparent;
    color: var(--text-primary);
}

/* Micro-glitch at moment of declassification */
.redacted.glitch {
    animation: redaction-glitch 0.15s steps(2) 1;
}

@keyframes redaction-glitch {
    0%   { transform: translateX(0); }
    25%  { transform: translateX(-2px); }
    50%  { transform: translateX(1px); }
    75%  { transform: translateX(-1px); }
    100% { transform: translateX(0); }
}

/* Data blocks */
.dossier-data-block {
    display: flex;
    gap: 48px;
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid rgba(212, 118, 59, 0.2);
    flex-wrap: wrap;
}

.data-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.data-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

/* Counter values - Split-flap mechanical display */
.counter-value,
.counter-date {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
    letter-spacing: 0.12em;
    color: var(--aurora-green);
    display: inline-flex;
    overflow: hidden;
    height: 1.2em;
    align-items: center;
}

.counter-value .digit-wrapper,
.counter-date .digit-wrapper {
    display: inline-block;
    width: 0.65em;
    height: 1.2em;
    overflow: hidden;
    position: relative;
}

/* Split line across digit (the "split" in split-flap) */
.counter-value .digit-wrapper::after,
.counter-date .digit-wrapper::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(28, 28, 30, 0.6);
    z-index: 2;
    pointer-events: none;
}

.counter-value .digit-stack,
.counter-date .digit-stack {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    text-align: center;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.counter-value .digit-stack span,
.counter-date .digit-stack span {
    display: block;
    height: 1.2em;
    line-height: 1.2em;
}

.data-unit {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    align-self: flex-end;
    padding-bottom: 4px;
}

.data-unit sup {
    font-size: 0.65em;
    vertical-align: super;
}

/* ---------- TERMINAL FOOTER ---------- */
.terminal-section {
    position: relative;
    min-height: 100vh;
    background: var(--bg-tertiary);
    padding: 80px 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.terminal-scanline-overlay {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 230, 118, 0.04) 2px,
        rgba(0, 230, 118, 0.04) 4px
    );
    opacity: 0.08;
    pointer-events: none;
    z-index: 1;
}

.terminal-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
    width: 100%;
}

.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.terminal-prompt {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--aurora-green);
}

.terminal-status {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--aurora-green);
    animation: pulse-opacity 2s ease-in-out infinite;
}

.terminal-divider {
    width: 100%;
    height: 1px;
    background: var(--aurora-green);
    opacity: 0.3;
    margin: 16px 0;
}

.terminal-links {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 24px 0;
}

.terminal-line {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 1.8em;
}

.terminal-cursor {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.8rem, 1vw, 1rem);
    color: var(--aurora-green);
    animation: blink-cursor 1s step-end infinite;
    flex-shrink: 0;
}

@keyframes blink-cursor {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.terminal-text {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.75rem, 0.95vw, 0.9rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    transition: color 0.2s ease;
}

.terminal-text:hover {
    color: var(--aurora-magenta);
    cursor: pointer;
}

.terminal-footer-text {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.terminal-timestamp {
    font-family: 'Share Tech Mono', monospace;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.12em;
    color: var(--text-secondary);
}

.terminal-timestamp .counter-date {
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    color: var(--text-secondary);
}

/* ---------- prefers-reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .hero-aurora-overlay {
        animation: none;
    }
    .hero-subtitle {
        animation: none;
        opacity: 1;
    }
    .section-watermark {
        animation: none;
    }
    .redaction-line {
        animation: none;
    }
    .terminal-cursor {
        animation: none;
        opacity: 1;
    }
    .terminal-status {
        animation: none;
        opacity: 1;
    }
    .dossier-section {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .circuit-trace {
        stroke-dasharray: none;
        stroke-dashoffset: 0;
        transition: none;
    }
    .solder-dot {
        opacity: 1;
        transition: none;
    }
    .redacted {
        background: transparent;
        color: var(--text-primary);
        transition: none;
    }
    .counter-value .digit-stack,
    .counter-date .digit-stack {
        transition: none;
    }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 1024px) {
    .dossier-section {
        padding: 80px 32px;
    }

    .dossier-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .dossier-marginalia {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 16px;
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid rgba(212, 118, 59, 0.15);
        padding-bottom: 24px;
    }

    .margin-circuit {
        display: none;
    }

    .section-watermark {
        display: none;
    }

    .margin-compass {
        display: none;
    }

    .dossier-data-block {
        gap: 24px;
    }

    .radial-menu {
        width: 260px;
        height: 260px;
    }
}

@media (max-width: 768px) {
    .hero-content {
        left: 16px;
        top: 35%;
        transform: translate(0, -50%);
        padding-right: 16px;
    }

    .hero-title {
        font-size: clamp(3rem, 14vw, 8rem);
        word-break: break-word;
    }

    .dossier-section {
        padding: 60px 20px;
    }

    .dossier-data-block {
        flex-direction: column;
        gap: 20px;
    }

    .terminal-section {
        padding: 60px 20px;
    }

    .terminal-text {
        white-space: normal;
        word-break: break-all;
    }

    .terminal-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .redaction-bar {
        height: 120px;
    }

    .radial-menu {
        width: 220px;
        height: 220px;
    }

    .radial-link {
        transform: translate(0, -50%) rotate(var(--angle)) translateX(40px);
    }

    .radial-link .link-label {
        font-size: 0.55rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: clamp(2.5rem, 12vw, 5rem);
    }

    .heading-text {
        font-size: clamp(1.6rem, 8vw, 2.5rem);
    }

    .dossier-body {
        font-size: 0.95rem;
    }

    .seal-nav {
        top: 10px;
        right: 10px;
    }

    .seal-icon {
        width: 40px;
        height: 40px;
    }
}
