/* ============================================
   turingtest.club - Styles
   ============================================ */

/* CSS Custom Properties for @property counter animation */
@property --eval-count {
    syntax: '<integer>';
    initial-value: 0;
    inherits: false;
}

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(ellipse at 50% 50%, #12132A, #0B0C1A);
    color: #E8E6E1;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Dot-grid diagnostic field */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #3A3A5C 1px, transparent 1px);
    background-size: 8px 8px;
    opacity: 0.04;
    pointer-events: none;
    z-index: 1;
}

/* ============================================
   HUD OVERLAY
   ============================================ */
#hud-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 900;
    pointer-events: none;
}

#hud-dot-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #7B8CDE 1px, transparent 1px);
    background-size: 8px 8px;
    opacity: 0.06;
}

#hud-eval-counter {
    position: fixed;
    top: 16px;
    left: 16px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.12em;
    color: #7B8CDE;
    opacity: 0.7;
    z-index: 901;
    pointer-events: none;
    animation: evalCount 300s linear infinite;
    counter-reset: eval var(--eval-count);
}

@keyframes evalCount {
    from { --eval-count: 0; }
    to { --eval-count: 99999; }
}

#eval-number {
    font-variant-numeric: tabular-nums;
}

#hud-terminal-label {
    position: fixed;
    top: 16px;
    right: 16px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.12em;
    color: #7B8CDE;
    opacity: 0.7;
    z-index: 901;
    pointer-events: none;
}

/* ============================================
   PROGRESS INDICATOR
   ============================================ */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 3px;
    height: 100vh;
    background: transparent;
    z-index: 950;
    pointer-events: none;
}

#progress-fill {
    width: 100%;
    height: 0%;
    background: #C8FF00;
    transition: height 0.1s linear;
}

/* ============================================
   CURSOR SENTINEL
   ============================================ */
#cursor-sentinel {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 2rem;
    color: #C8FF00;
    z-index: 800;
    animation: cursorBlink 1.06s step-end infinite;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

#cursor-sentinel.visible {
    opacity: 1;
}

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

/* ============================================
   SECTIONS BASE
   ============================================ */
.section {
    position: relative;
    min-height: 100vh;
    z-index: 10;
}

.section-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
}

/* ============================================
   PROLOGUE
   ============================================ */
.section-prologue {
    background: #0B0C1A;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prologue-inner {
    text-align: center;
}

.prologue-title {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    font-size: clamp(2.5rem, 6vw, 5rem);
    color: #C8FF00;
    letter-spacing: 0.08em;
    line-height: 1.2;
    opacity: 0;
    animation: fadeInTitle 2s cubic-bezier(0.25, 0.1, 0.25, 1) 1.5s forwards;
}

.prologue-subtitle {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 1rem;
    color: #6B6B7B;
    margin-top: 24px;
    opacity: 0;
    animation: fadeInTitle 2s cubic-bezier(0.25, 0.1, 0.25, 1) 3.5s forwards;
}

.prologue-rule {
    width: 120px;
    height: 1px;
    background: #3A3A5C;
    margin: 32px auto 0;
    transform: scaleX(0);
    animation: drawRule 1s cubic-bezier(0.25, 0.1, 0.25, 1) 5s forwards;
}

.prologue-chevron {
    margin-top: 48px;
    opacity: 0;
    animation: fadeInTitle 1s cubic-bezier(0.25, 0.1, 0.25, 1) 6s forwards;
}

.prologue-chevron svg {
    animation: chevronBounce 2s ease-in-out infinite;
}

@keyframes fadeInTitle {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes drawRule {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

@keyframes chevronBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

/* ============================================
   VOID SPACES
   ============================================ */
.void-space {
    height: 80vh;
    background: #0B0C1A;
    position: relative;
    overflow: hidden;
    z-index: 5;
}

.binary-rain {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    opacity: 0.02;
    color: #7B8CDE;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 12px;
    line-height: 1.5;
    pointer-events: none;
}

.binary-column {
    position: absolute;
    top: -100%;
    animation: binaryFall 20s linear infinite;
    white-space: nowrap;
    writing-mode: vertical-rl;
}

@keyframes binaryFall {
    from { transform: translateY(-100%); }
    to { transform: translateY(200%); }
}

/* ============================================
   EXCHANGES
   ============================================ */
.section-exchange {
    min-height: 120vh;
    padding: 80px 0;
    background: #1A1B2F;
}

/* Question (full-width across both panels) */
.exchange-question {
    text-align: center;
    padding: 40px 20px 60px;
    max-width: 900px;
    margin: 0 auto;
}

.question-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(1.25rem, 2vw, 1.75rem);
    color: #7B8CDE;
    letter-spacing: 0.08em;
    line-height: 1.6;
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.question-text.revealed {
    opacity: 1;
}

/* Split Screen */
.split-screen {
    display: flex;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    position: relative;
}

/* Panels */
.panel {
    flex: 1;
    padding: 40px;
    position: relative;
}

.panel-left {
    padding-right: 40px;
}

.panel-right {
    padding-left: 40px;
}

/* Panel Divider */
.panel-divider {
    width: 2px;
    background: #3A3A5C;
    flex-shrink: 0;
    position: relative;
    animation: dividerPulse 4s ease-in-out infinite;
}

/* Divider opacity decreases per exchange */
.panel-divider[data-divider="1"] { opacity: 0.7; }
.panel-divider[data-divider="2"] { opacity: 0.55; }
.panel-divider[data-divider="3"] { opacity: 0.4; }
.panel-divider[data-divider="4"] { opacity: 0.25; }
.panel-divider[data-divider="5"] { opacity: 0.12; }
.panel-divider[data-divider="6"] { opacity: 0.05; }

@keyframes dividerPulse {
    0%, 100% { opacity: inherit; }
    50% { opacity: 0.3; }
}

/* Panel Labels */
.panel-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.75rem, 1vw, 0.875rem);
    font-weight: 600;
    letter-spacing: 0.12em;
    color: #6B6B7B;
    margin-bottom: 24px;
    text-transform: uppercase;
}

/* Panel Headings */
.human-heading {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(2rem, 5vw, 4.5rem);
    color: #D4A574;
    letter-spacing: 0.01em;
    line-height: 1.2;
    margin-bottom: 24px;
}

.machine-heading {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 5rem);
    color: #C8FF00;
    letter-spacing: 0.08em;
    line-height: 1.2;
    margin-bottom: 24px;
}

/* Panel Text */
.human-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9375rem, 1.2vw, 1.125rem);
    color: #E8E6E1;
    line-height: 1.8;
    margin-bottom: 16px;
    font-variation-settings: 'opsz' 16;
}

.human-content .human-text:first-of-type {
    text-indent: 1.5em;
}

.machine-text {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9375rem, 1.2vw, 1.125rem);
    color: #E8E6E1;
    line-height: 1.65;
    margin-bottom: 16px;
    font-variation-settings: 'opsz' 14;
}

/* Panel Content animation states */
.human-content {
    opacity: 0;
    transition: opacity 1.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.human-content.revealed {
    opacity: 1;
}

.machine-content {
    clip-path: inset(0 100% 0 0);
    transition: clip-path 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.machine-content.revealed {
    clip-path: inset(0 0% 0 0);
}

/* Bracket SVGs */
.bracket-svg {
    position: absolute;
    top: 0;
    height: 100%;
    width: 20px;
    pointer-events: none;
}

.bracket-left {
    left: 0;
}

.bracket-right {
    right: 0;
}

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

.bracket-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.bracket-path.drawn {
    stroke-dashoffset: 0;
}

/* ============================================
   PROGRESSIVE CONVERGENCE
   Typography crossover per exchange
   ============================================ */

/* Exchange 4: fonts start to blend */
[data-exchange="4"] .human-heading {
    font-family: 'Libre Baskerville', serif;
    letter-spacing: 0.03em;
}
[data-exchange="4"] .machine-heading {
    font-family: 'IBM Plex Mono', monospace;
    letter-spacing: 0.05em;
}
[data-exchange="4"] .human-text {
    line-height: 1.75;
}
[data-exchange="4"] .machine-text {
    line-height: 1.7;
    font-weight: 350;
}

/* Exchange 5: significant convergence */
[data-exchange="5"] .human-heading {
    font-family: 'Libre Baskerville', serif;
    color: #CBAB82;
    letter-spacing: 0.04em;
}
[data-exchange="5"] .machine-heading {
    font-family: 'IBM Plex Mono', monospace;
    color: #B8E640;
    letter-spacing: 0.04em;
}
[data-exchange="5"] .human-text {
    line-height: 1.72;
    font-weight: 350;
}
[data-exchange="5"] .machine-text {
    line-height: 1.72;
    font-weight: 350;
}

/* Exchange 6: nearly identical */
[data-exchange="6"] .human-heading {
    font-family: 'Inter', sans-serif;
    color: #BDA87E;
    letter-spacing: 0.05em;
    font-weight: 600;
}
[data-exchange="6"] .machine-heading {
    font-family: 'Inter', sans-serif;
    color: #BDA87E;
    letter-spacing: 0.05em;
    font-weight: 600;
}
[data-exchange="6"] .human-text {
    line-height: 1.7;
    font-weight: 350;
    font-variation-settings: 'opsz' 15;
}
[data-exchange="6"] .machine-text {
    line-height: 1.7;
    font-weight: 350;
    font-variation-settings: 'opsz' 15;
}
[data-exchange="6"] .human-content .human-text:first-of-type {
    text-indent: 0;
}

/* ============================================
   GLITCH EFFECTS
   ============================================ */
@keyframes glitchDivider {
    0% { transform: translateX(0); }
    20% { transform: translateX(4px); }
    40% { transform: translateX(-3px); }
    60% { transform: translateX(5px); }
    80% { transform: translateX(-2px); }
    100% { transform: translateX(0); }
}

.panel-divider.glitching {
    animation: glitchDivider 150ms ease-out;
}

/* Scan line artifact */
.scan-line {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, #C8FF00, transparent);
    opacity: 0.1;
    z-index: 999;
    pointer-events: none;
    animation: scanSweep 200ms linear forwards;
}

@keyframes scanSweep {
    from { left: -100%; }
    to { left: 100%; }
}

/* ============================================
   EPILOGUE
   ============================================ */
.section-epilogue {
    background: #0B0C1A;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.epilogue-inner {
    text-align: center;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.epilogue-title {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    color: #D4A574;
    letter-spacing: 0.01em;
    line-height: 1.2;
    opacity: 0;
    transition: opacity 1.5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.epilogue-title.revealed {
    opacity: 1;
}

.epilogue-buttons {
    display: flex;
    gap: 40px;
    margin-top: 48px;
    opacity: 0;
    transition: opacity 1s cubic-bezier(0.25, 0.1, 0.25, 1) 0.5s;
}

.epilogue-buttons.revealed {
    opacity: 1;
}

.verdict-btn {
    width: 80px;
    height: 80px;
    background: transparent;
    cursor: pointer;
    font-size: 1.5rem;
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0;
}

.verdict-btn-a {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    color: #D4A574;
    border: 2px solid #D4A574;
}

.verdict-btn-a:hover {
    background: #D4A574;
    color: #0B0C1A;
}

.verdict-btn-b {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 600;
    color: #C8FF00;
    border: 2px solid #C8FF00;
}

.verdict-btn-b:hover {
    background: #C8FF00;
    color: #0B0C1A;
}

.epilogue-gap {
    height: 60vh;
}

.epilogue-final {
    font-family: 'Inter', sans-serif;
    font-weight: 300;
    font-size: 0.875rem;
    color: #6B6B7B;
    opacity: 0;
    transition: opacity 2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

.epilogue-final.revealed {
    opacity: 1;
}

.final-cursor {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 2rem;
    color: #C8FF00;
    margin-top: 24px;
    animation: cursorBlink 1.06s step-end infinite;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.final-cursor.visible {
    opacity: 1;
}

.final-cursor.frozen {
    animation: none;
    opacity: 1;
}

/* ============================================
   PREFERS REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .prologue-title,
    .prologue-subtitle,
    .prologue-rule,
    .prologue-chevron {
        opacity: 1;
        transform: none;
    }
    .human-content,
    .question-text,
    .epilogue-title,
    .epilogue-buttons,
    .epilogue-final {
        opacity: 1;
    }
    .machine-content {
        clip-path: none;
    }
    .bracket-path {
        stroke-dashoffset: 0;
    }
    #cursor-sentinel {
        opacity: 1;
    }
    /* Keep progress indicator */
    #progress-fill {
        transition: height 0.1s linear !important;
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .split-screen {
        flex-direction: column;
        padding: 0 20px;
    }

    .panel {
        padding: 24px 16px;
    }

    .panel-left {
        padding-right: 16px;
    }

    .panel-right {
        padding-left: 16px;
    }

    .panel-divider {
        width: 100%;
        height: 2px;
        margin: 16px 0;
    }

    .bracket-svg {
        display: none;
    }

    .void-space {
        height: 40vh;
    }

    .section-exchange {
        min-height: auto;
        padding: 40px 0;
    }

    .exchange-question {
        padding: 20px 16px 30px;
    }

    .epilogue-gap {
        height: 30vh;
    }

    #hud-eval-counter {
        top: 8px;
        left: 8px;
        font-size: 8px;
    }

    #hud-terminal-label {
        top: 8px;
        right: 8px;
        font-size: 8px;
    }
}
