/* ============================================================
   politics.quest — Sci-Fi HUD Command Center
   Palette: Deep Space Black #0a0e17, Tactical Charcoal #1a1f2e,
   Phosphor White #e8edf5, Accent Amber #f0a030, Signal Red #e83a30,
   Vintage Cream #f0e8d0, Scan Line Teal #30c8b0, HUD Border #2a3048
   ============================================================ */

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

:root {
    --deep-space: #0a0e17;
    --tactical: #1a1f2e;
    --phosphor: #e8edf5;
    --amber: #f0a030;
    --signal-red: #e83a30;
    --cream: #f0e8d0;
    --teal: #30c8b0;
    --hud-border: #2a3048;
    --font-display: 'Barlow Condensed', sans-serif;
    --font-body: 'IBM Plex Sans Condensed', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
}

html {
    scroll-behavior: auto;
}

body {
    background: var(--deep-space);
    color: var(--phosphor);
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.8vw, 1.15rem);
    font-weight: 400;
    line-height: 1.65;
    letter-spacing: 0.02em;
    overflow: hidden;
}

/* Scanline Overlay */
.scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(0, 0, 0, 0.04) 2px,
        rgba(0, 0, 0, 0.04) 4px
    );
    transition: opacity 150ms ease;
}

.scanline-overlay.intensify {
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(0, 0, 0, 0.12) 2px,
        rgba(0, 0, 0, 0.12) 4px
    );
}

/* ============================================================
   HUD Frame
   ============================================================ */

.hud-frame {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 500;
    pointer-events: none;
}

/* Top Ticker */
.hud-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 28px;
    background: var(--tactical);
    border-bottom: 1px solid var(--hud-border);
    overflow: hidden;
    display: flex;
    align-items: center;
    pointer-events: auto;
    z-index: 501;
}

.ticker-track {
    display: flex;
    white-space: nowrap;
    animation: tickerScroll 40s linear infinite;
}

.ticker-text {
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--amber);
    text-shadow: 0 0 8px rgba(240, 160, 48, 0.4);
    flex-shrink: 0;
}

@keyframes tickerScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* Left Navigation */
.hud-left {
    position: absolute;
    top: 28px;
    left: 0;
    width: 48px;
    height: calc(100% - 56px);
    background: var(--tactical);
    border-right: 1px solid var(--hud-border);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    z-index: 501;
}

.hex-nav {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: center;
}

.hex-link {
    display: block;
    width: 32px;
    height: 32px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.hex-icon {
    width: 32px;
    height: 32px;
}

.hex-icon polygon {
    stroke: var(--teal);
    stroke-opacity: 0.5;
    fill: transparent;
    transition: all 0.3s ease;
}

.hex-icon line,
.hex-icon rect,
.hex-icon circle {
    stroke: var(--teal);
    stroke-opacity: 0.5;
    fill: none;
    transition: all 0.3s ease;
}

.hex-link:hover .hex-icon polygon {
    fill: rgba(240, 160, 48, 0.2);
    stroke: var(--teal);
    stroke-opacity: 1;
}

.hex-link:hover .hex-icon line,
.hex-link:hover .hex-icon rect,
.hex-link:hover .hex-icon circle {
    stroke: var(--phosphor);
    stroke-opacity: 1;
}

.hex-link.active .hex-icon polygon {
    fill: rgba(240, 160, 48, 0.2);
    stroke: var(--teal);
    stroke-opacity: 1;
    animation: hexPulse 3s ease-in-out infinite;
}

.hex-link.active .hex-icon line,
.hex-link.active .hex-icon rect,
.hex-link.active .hex-icon circle {
    stroke: var(--amber);
    stroke-opacity: 1;
}

@keyframes hexPulse {
    0%, 100% { fill-opacity: 0.8; }
    50% { fill-opacity: 1; }
}

/* Glitch hover for hex links */
.hex-link:hover {
    animation: glitchHover 150ms steps(2) forwards;
}

@keyframes glitchHover {
    0% { transform: translate(0, 0); filter: none; }
    50% { transform: translate(2px, 0); filter: hue-rotate(90deg); }
    100% { transform: translate(0, 0); filter: none; }
}

/* Bottom Status Bar */
.hud-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 28px;
    background: var(--tactical);
    border-top: 1px solid var(--hud-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 60px 0 60px;
    pointer-events: auto;
    z-index: 501;
}

.status-domain {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--phosphor);
}

.status-scroll {
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    letter-spacing: 0.08em;
    color: var(--amber);
    text-shadow: 0 0 8px rgba(240, 160, 48, 0.4);
}

.status-time {
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    letter-spacing: 0.08em;
    color: var(--amber);
    text-shadow: 0 0 8px rgba(240, 160, 48, 0.4);
}

/* ============================================================
   Scroll Container
   ============================================================ */

.scroll-container {
    width: 100%;
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
}

.panel {
    width: 100%;
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    padding: 40px 60px 40px 60px;
    overflow: hidden;
}

/* Channel switch transition class */
.panel.channel-switch {
    animation: channelSwitch 200ms steps(3) forwards;
}

@keyframes channelSwitch {
    0% { transform: skewX(0deg); }
    33% { transform: skewX(1deg); }
    66% { transform: skewX(-0.5deg); }
    100% { transform: skewX(0deg); }
}

/* HUD border flash */
.hud-frame.border-flash .hud-left,
.hud-frame.border-flash .hud-top,
.hud-frame.border-flash .hud-bottom {
    border-color: var(--teal);
    transition: border-color 100ms ease;
}

/* ============================================================
   Hero Panel
   ============================================================ */

.hero-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--deep-space);
}

/* Radar */
.radar-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(70vw, 70vh);
    height: min(70vw, 70vh);
}

.radar-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.radar-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border: 1px solid rgba(48, 200, 176, 0.15);
    transform: translate(-50%, -50%);
}

.r1 { width: 25%; height: 25%; }
.r2 { width: 50%; height: 50%; }
.r3 { width: 75%; height: 75%; }
.r4 { width: 100%; height: 100%; }

.radar-sweep {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        rgba(48, 200, 176, 0.4) 0deg,
        rgba(48, 200, 176, 0.1) 60deg,
        transparent 120deg,
        transparent 360deg
    );
    animation: radarSweep 8s linear infinite;
}

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

/* Hero Content */
.hero-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 10rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--phosphor);
    line-height: 1;
    min-height: 1.2em;
}

.hero-title .char {
    display: inline-block;
    opacity: 0;
}

.hero-title .char.revealed {
    opacity: 1;
}

.hero-title .char.glitch-flash {
    animation: charGlitch 80ms steps(2) forwards;
}

@keyframes charGlitch {
    0% {
        opacity: 1;
        filter: hue-rotate(90deg) saturate(3) brightness(1.5);
        transform: skew(2deg);
    }
    50% {
        opacity: 1;
        filter: none;
        transform: skew(0deg);
    }
    100% {
        opacity: 1;
        filter: none;
        transform: skew(0deg);
    }
}

.hero-subtitle {
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    letter-spacing: 0.08em;
    color: var(--amber);
    text-shadow: 0 0 8px rgba(240, 160, 48, 0.4);
    margin-top: 1.5rem;
    opacity: 0;
    transition: opacity 0.5s ease;
}

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

/* Classification Stamps */
.classification-stamp {
    position: absolute;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--signal-red);
    opacity: 0.15;
    border: 2px double var(--signal-red);
    padding: 4px 12px;
    pointer-events: none;
}

.stamp-tl {
    top: 60px;
    left: 70px;
    transform: rotate(-15deg);
}

.stamp-tr {
    top: 60px;
    right: 20px;
    transform: rotate(15deg);
}

.stamp-bl {
    bottom: 60px;
    left: 70px;
    transform: rotate(15deg);
}

.stamp-br {
    bottom: 60px;
    right: 20px;
    transform: rotate(-15deg);
}

/* ============================================================
   Dossier Mode Panels
   ============================================================ */

.dossier-panel {
    background: var(--deep-space);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 60px;
}

.dossier-columns {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    max-width: 900px;
    margin: 0 auto;
    padding-left: 20px;
}

.dossier-col {
    flex: 1;
}

.dossier-col-left {
    transform: translateY(-20px);
}

.dossier-col-right {
    transform: translateY(20px);
}

.dossier-col p {
    margin-bottom: 1rem;
    color: var(--phosphor);
}

.dossier-divider {
    width: 2px;
    flex-shrink: 0;
    align-self: stretch;
}

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

.divider-svg line {
    stroke: var(--teal);
    stroke-opacity: 0.4;
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.6rem, 4vw, 3rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--phosphor);
    margin-bottom: 1.5rem;
}

/* ============================================================
   Flip Cards (Punch Card Style)
   ============================================================ */

.card-cluster {
    position: absolute;
    bottom: 0;
    left: 60px;
    right: 0;
    height: 40%;
}

.flip-card {
    position: absolute;
    width: 220px;
    height: 140px;
    perspective: 800px;
    cursor: pointer;
    left: var(--card-x, 10%);
    top: var(--card-y, 50%);
    transform: rotate(var(--card-rotate, 0deg));
    z-index: 50;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 600ms cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 2px;
    padding: 24px 16px 16px;
    overflow: hidden;
}

.flip-card-front {
    background: var(--cream);
    clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 0 100%);
}

.flip-card-back {
    background: var(--tactical);
    border: 1px solid var(--hud-border);
    transform: rotateY(180deg);
    padding: 16px;
}

.flip-card-back p {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.55;
    color: var(--phosphor);
}

/* Punch holes */
.punch-holes {
    position: absolute;
    top: 4px;
    left: 12px;
    right: 28px;
    height: 10px;
    background: repeating-linear-gradient(
        to right,
        transparent 0px,
        transparent 6px,
        rgba(10, 14, 23, 0.5) 6px,
        rgba(10, 14, 23, 0.5) 10px,
        transparent 10px,
        transparent 16px
    );
    mask: repeating-linear-gradient(
        to right,
        transparent 0px,
        transparent 6px,
        black 6px,
        black 10px,
        transparent 10px,
        transparent 16px
    );
    opacity: 0.6;
}

.card-corner-cut {
    position: absolute;
    top: 0;
    right: 0;
    width: 16px;
    height: 16px;
}

.card-question {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--amber);
    line-height: 1.4;
}

/* Glitch during flip */
.flip-card.glitching .flip-card-inner {
    animation: flipGlitch 50ms steps(2) forwards;
}

@keyframes flipGlitch {
    0% {
        filter: hue-rotate(90deg) saturate(3) brightness(1.5);
        transform: rotateY(90deg) skew(2deg) translate(3px, -2px);
    }
    100% {
        filter: none;
        transform: rotateY(90deg);
    }
}

/* ============================================================
   Tactical Mode Panels
   ============================================================ */

.tactical-panel {
    background: var(--deep-space);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tactical-center {
    max-width: 700px;
    width: 100%;
    position: relative;
    z-index: 10;
}

.tactical-caption {
    position: absolute;
    font-family: var(--font-mono);
    font-size: clamp(0.6rem, 1vw, 0.75rem);
    letter-spacing: 0.08em;
    color: var(--amber);
    text-shadow: 0 0 8px rgba(240, 160, 48, 0.4);
    opacity: 0.7;
}

.caption-top { top: 50px; left: 50%; transform: translateX(-50%); }
.caption-bottom { bottom: 50px; left: 50%; transform: translateX(-50%); }
.caption-left { left: 60px; top: 50%; transform: translateY(-50%) rotate(-90deg); transform-origin: left center; }
.caption-right { right: 20px; top: 50%; transform: translateY(-50%) rotate(90deg); transform-origin: right center; }

/* Bar Chart */
.bar-chart {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 40px;
}

.bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.bar-label {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--phosphor);
    width: 180px;
    flex-shrink: 0;
    text-align: right;
}

.bar-track {
    flex: 1;
    height: 18px;
    background: rgba(42, 48, 72, 0.5);
    border: 1px solid var(--teal);
    border-radius: 1px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    width: 0%;
    background: var(--amber);
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.bar-fill.animate {
    width: calc(var(--bar-value) * 1%);
}

.bar-value {
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    letter-spacing: 0.08em;
    color: var(--amber);
    text-shadow: 0 0 8px rgba(240, 160, 48, 0.4);
    width: 40px;
    flex-shrink: 0;
}

/* Gauge */
.gauge-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.gauge {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    position: relative;
}

.gauge-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        rgba(42, 48, 72, 0.5) 0deg,
        rgba(42, 48, 72, 0.5) 360deg
    );
    border: 1px solid var(--teal);
}

.gauge-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        var(--amber) 0deg,
        var(--amber) 0deg,
        transparent 0deg,
        transparent 360deg
    );
    transition: background 1.5s ease;
    mask: radial-gradient(circle, transparent 55px, black 56px);
    -webkit-mask: radial-gradient(circle, transparent 55px, black 56px);
}

.gauge-fill.animate {
    background: conic-gradient(
        var(--amber) 0deg,
        var(--amber) calc(var(--gauge-deg) * 1deg),
        transparent calc(var(--gauge-deg) * 1deg),
        transparent 360deg
    );
}

.gauge-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gauge-number {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--amber);
    text-shadow: 0 0 8px rgba(240, 160, 48, 0.4);
}

.gauge-unit {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--phosphor);
    opacity: 0.6;
}

.gauge-caption {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--phosphor);
    opacity: 0.8;
}

/* Thermal Printer Output */
.thermal-output {
    margin-bottom: 40px;
    padding: 20px;
    border: 1px solid var(--hud-border);
    background: rgba(26, 31, 46, 0.5);
    mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
}

.thermal-line {
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 1.2vw, 0.9rem);
    letter-spacing: 0.08em;
    color: var(--amber);
    text-shadow: 0 0 8px rgba(240, 160, 48, 0.4);
    line-height: 2;
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: thermalWobble 0.4s ease-in-out infinite alternate;
    animation-play-state: paused;
}

.thermal-line.visible {
    opacity: 1;
    animation-play-state: running;
}

@keyframes thermalWobble {
    0% { transform: translateY(0px); }
    100% { transform: translateY(0.5px); }
}

/* Counter Grid */
.counter-grid {
    display: flex;
    justify-content: center;
    gap: 48px;
}

.counter-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.counter-number {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--amber);
    text-shadow: 0 0 8px rgba(240, 160, 48, 0.4);
}

.counter-label {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--phosphor);
    opacity: 0.7;
}

/* ============================================================
   Glitch Interaction States
   ============================================================ */

.glitch-hover {
    position: relative;
}

.glitch-hover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    mix-blend-mode: difference;
    background: var(--signal-red);
    pointer-events: none;
}

.glitch-hover:hover::before {
    animation: glitchSlice 150ms steps(2) forwards;
}

@keyframes glitchSlice {
    0% {
        opacity: 0.3;
        clip-path: inset(40% 0 50% 0);
        transform: translate(3px, -2px);
    }
    50% {
        opacity: 0.5;
        clip-path: inset(20% 0 60% 0);
        transform: translate(-2px, 1px);
    }
    100% {
        opacity: 0;
        clip-path: inset(0);
        transform: translate(0, 0);
    }
}

/* ============================================================
   Responsive — Below 768px
   ============================================================ */

@media (max-width: 768px) {
    .scanline-overlay {
        background: repeating-linear-gradient(
            to bottom,
            transparent 0px,
            transparent 2px,
            rgba(0, 0, 0, 0.02) 2px,
            rgba(0, 0, 0, 0.02) 4px
        );
    }

    .hud-left {
        top: 28px;
        left: 0;
        width: 100%;
        height: 36px;
        border-right: none;
        border-bottom: 1px solid var(--hud-border);
        overflow-x: auto;
        overflow-y: hidden;
    }

    .hex-nav {
        flex-direction: row;
        gap: 12px;
        padding: 0 12px;
    }

    .hex-link {
        width: 28px;
        height: 28px;
        flex-shrink: 0;
    }

    .hex-icon {
        width: 28px;
        height: 28px;
    }

    .hud-bottom {
        padding: 0 12px;
        height: 24px;
    }

    .panel {
        padding: 80px 16px 40px 16px;
    }

    .dossier-columns {
        flex-direction: column;
        gap: 0;
        padding-left: 0;
    }

    .dossier-col-left,
    .dossier-col-right {
        transform: none;
    }

    .dossier-divider {
        display: none;
    }

    .card-cluster {
        position: relative;
        left: 0;
        height: auto;
        display: flex;
        flex-direction: column;
        gap: 16px;
        margin-top: 24px;
    }

    .flip-card {
        position: relative;
        left: 0 !important;
        top: 0 !important;
        width: 100%;
        height: 140px;
        transform: rotate(0deg) !important;
    }

    .bar-label {
        width: 100px;
        font-size: 0.6rem;
    }

    .counter-grid {
        gap: 20px;
        flex-wrap: wrap;
    }

    .counter-number {
        font-size: 1.8rem;
    }

    .stamp-tl { left: 16px; }
    .stamp-tr { right: 16px; }
    .stamp-bl { left: 16px; }
    .stamp-br { right: 16px; }

    .tactical-caption.caption-left,
    .tactical-caption.caption-right {
        display: none;
    }
}
