/* =============================================
   polytics.club — Premium Political Analytics
   Neon-Electric Editorial Dashboard
   ============================================= */

/* --- Custom Properties (Editorial Type Scale) --- */
:root {
    --editorial-dark: #0A0A20;
    --neon-amber: #FFB030;
    --neon-purple: #A050FF;
    --insight-white: #F0F0F8;
    --panel-dark: #181830;
    --flare-gold: #FFD060;
    --data-gray: #505068;

    --font-primary: 'Sora', sans-serif;

    --headline-size: clamp(32px, 4vw, 60px);
    --headline-weight: 800;
    --headline-spacing: -0.01em;

    --body-size: clamp(14px, 0.9vw, 16px);
    --body-weight: 400;
    --body-line-height: 1.75;

    --metric-size: clamp(28px, 3vw, 48px);
    --metric-weight: 700;

    --label-size: 11px;
    --label-weight: 600;
    --label-spacing: 0.08em;

    --panel-gap: 12px;
    --panel-padding: 40px;
    --panel-border-width: 1px;
    --panel-glow-spread: 4px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    font-size: var(--body-size);
    font-weight: var(--body-weight);
    line-height: var(--body-line-height);
    color: var(--insight-white);
    background-color: var(--editorial-dark);
    overflow-x: hidden;
}

/* --- Masthead (100vh) --- */
#masthead {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--editorial-dark);
    overflow: hidden;
}

/* Futuristic angular geometry SVGs */
.geo-lines {
    position: absolute;
    width: 100%;
    pointer-events: none;
    z-index: 1;
}

.geo-lines-top {
    top: 0;
    height: 200px;
}

.geo-lines-bottom {
    bottom: 0;
    height: 200px;
}

.draw-line {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    opacity: 0.6;
}

.draw-line.animated {
    animation: drawLine 800ms ease-out forwards;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

/* Lens-flare elements */
.lens-flare {
    position: absolute;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transform: scale(0);
}

.lens-flare.burst {
    animation: flareBurst 600ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes flareBurst {
    0% {
        opacity: 0;
        transform: scale(0);
    }
    70% {
        opacity: 1;
        transform: scale(1.2);
    }
    100% {
        opacity: 1;
        transform: scale(1.0);
    }
}

.lens-flare-masthead {
    top: 20%;
    right: 15%;
}

.lens-flare-masthead-secondary {
    bottom: 25%;
    left: 10%;
}

/* Masthead content */
#masthead-content {
    position: relative;
    z-index: 3;
    text-align: center;
    opacity: 0;
}

#masthead-content.visible {
    animation: fadeInTitle 500ms ease-out forwards;
}

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

#site-title {
    font-family: var(--font-primary);
    font-size: var(--headline-size);
    font-weight: var(--headline-weight);
    letter-spacing: var(--headline-spacing);
    color: var(--insight-white);
    text-transform: none;
    margin-bottom: 16px;
}

#site-tagline {
    font-family: var(--font-primary);
    font-size: var(--label-size);
    font-weight: var(--label-weight);
    letter-spacing: var(--label-spacing);
    text-transform: uppercase;
    color: var(--neon-amber);
}

/* --- Dashboard Section --- */
#dashboard {
    position: relative;
    padding: 80px 40px;
    background: var(--editorial-dark);
}

.section-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
}

.section-label {
    font-family: var(--font-primary);
    font-size: var(--label-size);
    font-weight: var(--label-weight);
    letter-spacing: var(--label-spacing);
    text-transform: uppercase;
    color: var(--neon-amber);
    white-space: nowrap;
}

.section-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--neon-amber), transparent);
}

/* Dashboard Grid */
#dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--panel-gap);
    max-width: 1400px;
    margin: 0 auto;
}

/* Panel base */
.panel {
    background: var(--panel-dark);
    border: var(--panel-border-width) solid var(--data-gray);
    padding: var(--panel-padding);
    position: relative;
    opacity: 0;
    transform: scale(0.98);
    transition: opacity 200ms ease, transform 200ms ease, box-shadow 300ms ease, background-color 300ms ease;
}

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

.panel[data-accent="amber"] {
    border-color: var(--neon-amber);
    box-shadow: 0 0 4px var(--neon-amber);
}

.panel[data-accent="purple"] {
    border-color: var(--neon-purple);
    box-shadow: 0 0 4px var(--neon-purple);
}

.panel.visible.fully-visible[data-accent="amber"] {
    box-shadow: 0 0 8px var(--neon-amber);
}

.panel.visible.fully-visible[data-accent="purple"] {
    box-shadow: 0 0 8px var(--neon-purple);
}

/* Hover interactions */
.panel:hover {
    background: #1e1e3a;
}

.panel:hover[data-accent="amber"] {
    box-shadow: 0 0 calc(var(--panel-glow-spread) + 8px) var(--neon-amber);
}

.panel:hover[data-accent="purple"] {
    box-shadow: 0 0 calc(var(--panel-glow-spread) + 8px) var(--neon-purple);
}

.panel:hover .metric-value {
    transform: scale(1.05);
}

/* Wide panel */
.panel-wide {
    grid-column: span 2;
}

/* Insight flare row */
.insight-flare {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 0;
    opacity: 0;
    transition: opacity 400ms ease;
}

.insight-flare.visible {
    opacity: 1;
}

.insight-flare-svg {
    width: 100%;
    max-width: 800px;
    height: 60px;
}

.insight-label {
    font-family: var(--font-primary);
    font-size: var(--label-size);
    font-weight: var(--label-weight);
    letter-spacing: var(--label-spacing);
    text-transform: uppercase;
    color: var(--flare-gold);
    margin-top: 8px;
}

/* Panel header */
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.panel-label {
    font-family: var(--font-primary);
    font-size: var(--label-size);
    font-weight: var(--label-weight);
    letter-spacing: var(--label-spacing);
    text-transform: uppercase;
    color: var(--data-gray);
}

.panel-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-primary);
    font-size: 10px;
    font-weight: var(--label-weight);
    letter-spacing: var(--label-spacing);
    text-transform: uppercase;
    color: var(--data-gray);
}

/* Pulse-attention dots */
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.pulse-amber {
    background: var(--neon-amber);
    animation: pulseAmber 2.5s infinite;
}

.pulse-purple {
    background: var(--neon-purple);
    animation: pulsePurple 2.5s infinite;
}

@keyframes pulseAmber {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(255, 176, 48, 0.6);
    }
    50% {
        box-shadow: 0 0 8px 4px rgba(255, 176, 48, 0.0);
    }
}

@keyframes pulsePurple {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(160, 80, 255, 0.6);
    }
    50% {
        box-shadow: 0 0 8px 4px rgba(160, 80, 255, 0.0);
    }
}

/* Metric display */
.metric-display {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 8px;
}

.metric-value {
    font-family: var(--font-primary);
    font-size: var(--metric-size);
    font-weight: var(--metric-weight);
    color: var(--insight-white);
    transition: transform 300ms ease;
    display: inline-block;
}

.metric-value.small {
    font-size: clamp(20px, 2vw, 32px);
}

.metric-unit {
    font-family: var(--font-primary);
    font-size: clamp(14px, 1.2vw, 18px);
    font-weight: var(--label-weight);
    color: var(--data-gray);
}

.metric-unit.small {
    font-size: clamp(12px, 1vw, 14px);
}

.metric-label {
    font-family: var(--font-primary);
    font-size: var(--body-size);
    font-weight: var(--body-weight);
    color: var(--data-gray);
    margin-bottom: 12px;
}

.metric-trend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: var(--label-weight);
    margin-bottom: 20px;
}

.metric-trend.positive {
    color: var(--neon-amber);
}

/* Mini chart */
.mini-chart {
    height: 60px;
    position: relative;
    overflow: hidden;
}

.mini-chart canvas {
    width: 100%;
    height: 100%;
}

/* Senate bar */
.senate-bar {
    height: 8px;
    background: var(--data-gray);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.senate-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-purple), var(--neon-amber));
    border-radius: 4px;
    width: 0%;
    transition: width 1200ms ease-out;
}

.senate-labels {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-primary);
    font-size: var(--label-size);
    font-weight: var(--label-weight);
    color: var(--data-gray);
}

/* Issue list */
.issue-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.issue-item {
    display: grid;
    grid-template-columns: 90px 1fr 40px;
    align-items: center;
    gap: 12px;
}

.issue-name {
    font-family: var(--font-primary);
    font-size: 13px;
    font-weight: var(--label-weight);
    color: var(--insight-white);
}

.issue-bar-track {
    height: 4px;
    background: var(--data-gray);
    border-radius: 2px;
    overflow: hidden;
}

.issue-bar-fill {
    height: 100%;
    background: var(--neon-amber);
    border-radius: 2px;
    width: 0%;
    transition: width 1000ms ease-out;
}

.issue-pct {
    font-family: var(--font-primary);
    font-size: 12px;
    font-weight: var(--metric-weight);
    color: var(--neon-amber);
    text-align: right;
}

/* Electoral display */
.electoral-display {
    display: flex;
    align-items: center;
    gap: 24px;
}

.electoral-side {
    flex: 0 0 auto;
    text-align: center;
}

.electoral-left .metric-value {
    color: var(--neon-amber);
}

.electoral-right .metric-value {
    color: var(--neon-purple);
}

.electoral-center {
    flex: 1;
}

.electoral-bar-container {
    display: flex;
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 8px;
}

.electoral-bar-left {
    height: 100%;
    background: var(--neon-amber);
    width: 0%;
    transition: width 1200ms ease-out;
}

.electoral-bar-right {
    height: 100%;
    background: var(--neon-purple);
    width: 0%;
    transition: width 1200ms ease-out;
}

.electoral-threshold {
    text-align: center;
    font-family: var(--font-primary);
    font-size: var(--label-size);
    font-weight: var(--label-weight);
    letter-spacing: var(--label-spacing);
    text-transform: uppercase;
    color: var(--data-gray);
}

/* Sentiment ring */
.sentiment-ring {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 16px;
}

.sentiment-arc {
    transition: stroke-dashoffset 1200ms ease-out;
}

.sentiment-center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: baseline;
    gap: 2px;
}

/* Swing states */
.swing-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.swing-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(80, 80, 104, 0.3);
}

.swing-item:last-child {
    border-bottom: none;
}

.swing-state {
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: var(--label-weight);
    color: var(--insight-white);
}

.swing-margin {
    font-family: var(--font-primary);
    font-size: 14px;
    font-weight: var(--metric-weight);
}

.swing-margin.amber {
    color: var(--neon-amber);
}

.swing-margin.purple {
    color: var(--neon-purple);
}

/* --- Insight Section --- */
#insight-section {
    position: relative;
    padding: 120px 40px;
    background: var(--editorial-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 500px;
}

.lens-flare-insight {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    z-index: 1;
}

.lens-flare-insight.burst {
    animation: flareBurst 600ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.insight-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 700px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 500ms ease, transform 500ms ease;
}

.insight-content.visible {
    opacity: 1;
    transform: translateY(0);
}

.insight-headline {
    font-family: var(--font-primary);
    font-size: clamp(24px, 3vw, 42px);
    font-weight: var(--headline-weight);
    letter-spacing: var(--headline-spacing);
    color: var(--flare-gold);
    margin-bottom: 20px;
}

.insight-text {
    font-family: var(--font-primary);
    font-size: var(--body-size);
    font-weight: var(--body-weight);
    line-height: var(--body-line-height);
    color: var(--data-gray);
    margin-bottom: 40px;
}

.insight-metric-row {
    display: flex;
    justify-content: center;
    gap: 60px;
}

.insight-metric {
    text-align: center;
}

.insight-metric .metric-value {
    font-size: clamp(24px, 2.5vw, 40px);
}

.insight-metric .metric-unit {
    font-size: clamp(12px, 1vw, 16px);
}

.insight-metric .metric-label {
    margin-top: 4px;
    margin-bottom: 0;
}

/* --- Executive Brief (Footer) --- */
#executive-brief {
    position: relative;
    padding: 80px 40px 40px;
    background: var(--panel-dark);
    overflow: hidden;
}

.geo-footer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100px;
    opacity: 0.4;
}

.footer-content {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    max-width: 1400px;
    margin: 0 auto;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--data-gray);
}

.footer-title {
    font-family: var(--font-primary);
    font-size: clamp(20px, 2vw, 28px);
    font-weight: var(--headline-weight);
    letter-spacing: var(--headline-spacing);
    color: var(--insight-white);
    margin-bottom: 8px;
}

.footer-subtitle {
    font-family: var(--font-primary);
    font-size: var(--label-size);
    font-weight: var(--label-weight);
    letter-spacing: var(--label-spacing);
    text-transform: uppercase;
    color: var(--neon-amber);
}

.footer-summary {
    display: flex;
    gap: 40px;
}

.footer-stat {
    text-align: center;
}

.footer-stat-value {
    display: block;
    font-family: var(--font-primary);
    font-size: clamp(20px, 2vw, 30px);
    font-weight: var(--metric-weight);
    color: var(--insight-white);
    margin-bottom: 4px;
}

.footer-stat-label {
    font-family: var(--font-primary);
    font-size: var(--label-size);
    font-weight: var(--label-weight);
    letter-spacing: var(--label-spacing);
    text-transform: uppercase;
    color: var(--data-gray);
}

.lens-flare-footer {
    position: absolute;
    bottom: 60px;
    right: 5%;
    z-index: 1;
}

.lens-flare-footer.burst {
    animation: flareBurst 600ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.footer-bottom {
    position: relative;
    z-index: 2;
    text-align: center;
    padding-top: 30px;
    max-width: 1400px;
    margin: 0 auto;
}

.footer-copy {
    font-family: var(--font-primary);
    font-size: 12px;
    font-weight: var(--body-weight);
    color: var(--data-gray);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    #dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .panel-wide {
        grid-column: span 2;
    }

    .electoral-display {
        flex-direction: column;
        gap: 16px;
    }

    .insight-metric-row {
        gap: 30px;
    }
}

@media (max-width: 768px) {
    #dashboard {
        padding: 60px 20px;
    }

    #dashboard-grid {
        grid-template-columns: 1fr;
    }

    .panel-wide {
        grid-column: span 1;
    }

    .panel {
        padding: 24px;
    }

    .footer-content {
        flex-direction: column;
        gap: 30px;
    }

    .footer-summary {
        gap: 24px;
    }

    .insight-metric-row {
        flex-direction: column;
        gap: 24px;
    }

    #insight-section {
        padding: 80px 20px;
    }

    #executive-brief {
        padding: 60px 20px 30px;
    }
}
