/* chrono.games - Sci-Fi HUD / Retro-Futuristic Time Portal */
/* Palette: #0a0a12, #1a1a2e, #b8860b, #4fc3f7, #e53935, #e8e8e8, #2e7d6e, #1a2040 */

:root {
    --void: #0a0a12;
    --face: #1a1a2e;
    --brass: #b8860b;
    --phosphor: #4fc3f7;
    --red: #e53935;
    --dial: #e8e8e8;
    --patina: #2e7d6e;
    --grid: #1a2040;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--void);
    color: var(--dial);
    font-family: 'Exo 2', sans-serif;
    font-weight: 400;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== GLOBAL SCANLINE ===== */
.scanline {
    position: fixed;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(79, 195, 247, 0.1);
    z-index: 1000;
    pointer-events: none;
    animation: scanDown 4s linear infinite;
}

@keyframes scanDown {
    0% { top: -10px; }
    100% { top: 100vh; }
}

/* ===== RADIAL LINES BACKGROUND ===== */
.radial-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.03;
}

/* ===== SECTIONS ===== */
.section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    position: relative;
    z-index: 1;
}

/* ===== HERO SECTION ===== */
.hero-section {
    background: radial-gradient(ellipse at center, rgba(26, 32, 64, 0.3) 0%, var(--void) 70%);
}

.clock-container {
    position: relative;
    opacity: 0;
    animation: clockAwaken 2s ease-out 0.5s forwards;
}

@keyframes clockAwaken {
    0% { opacity: 0; transform: scale(0.8); }
    60% { opacity: 1; transform: scale(1.02); }
    100% { opacity: 1; transform: scale(1); }
}

/* ===== CLOCK FACE ===== */
.clock-face {
    width: min(80vw, 380px);
    height: min(80vw, 380px);
    filter: drop-shadow(0 0 30px rgba(79, 195, 247, 0.08));
}

.clock-ring {
    fill: none;
    stroke: var(--brass);
    stroke-width: 3;
    stroke-dasharray: 1163;
    stroke-dashoffset: 1163;
    animation: drawRing 1.5s ease-out 0.5s forwards;
}

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

.clock-inner {
    fill: var(--face);
    stroke: none;
    opacity: 0;
    animation: fadeInEl 1s ease 1s forwards;
}

@keyframes fadeInEl {
    to { opacity: 1; }
}

.clock-grid line {
    stroke: var(--grid);
    stroke-width: 0.3;
    opacity: 0.4;
}

.clock-num {
    font-family: 'Teko', sans-serif;
    font-weight: 500;
    font-size: 22px;
    fill: var(--dial);
    text-anchor: middle;
    dominant-baseline: central;
    opacity: 0;
    animation: fadeInEl 0.5s ease forwards;
}
.clock-num[data-hour="12"] { animation-delay: 1.2s; }
.clock-num[data-hour="1"]  { animation-delay: 1.3s; }
.clock-num[data-hour="2"]  { animation-delay: 1.4s; }
.clock-num[data-hour="3"]  { animation-delay: 1.5s; }
.clock-num[data-hour="4"]  { animation-delay: 1.6s; }
.clock-num[data-hour="5"]  { animation-delay: 1.7s; }
.clock-num[data-hour="6"]  { animation-delay: 1.8s; }
.clock-num[data-hour="7"]  { animation-delay: 1.9s; }
.clock-num[data-hour="8"]  { animation-delay: 2.0s; }
.clock-num[data-hour="9"]  { animation-delay: 2.1s; }
.clock-num[data-hour="10"] { animation-delay: 2.2s; }
.clock-num[data-hour="11"] { animation-delay: 2.3s; }

.tick { stroke: var(--dial); stroke-width: 1; opacity: 0.6; }
.tick-major { stroke: var(--phosphor); stroke-width: 2; }

/* Clock Hands */
.hand {
    stroke-linecap: round;
    transform-origin: 200px 200px;
}

.hand-hour {
    stroke: var(--brass);
    stroke-width: 5;
    filter: drop-shadow(0 0 3px rgba(184, 134, 11, 0.4));
}

.hand-minute {
    stroke: var(--dial);
    stroke-width: 3;
}

.hand-second {
    stroke: var(--red);
    stroke-width: 1.5;
    filter: drop-shadow(0 0 4px rgba(229, 57, 53, 0.5));
}

.clock-center {
    fill: var(--brass);
    filter: drop-shadow(0 0 3px rgba(184, 134, 11, 0.6));
}

.clock-center-dot {
    fill: var(--void);
}

.brand-arc-text {
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: 14px;
    fill: var(--brass);
    letter-spacing: 0.2em;
    opacity: 0;
    animation: fadeInEl 1s ease 2.5s forwards;
}

/* ===== PENDULUM ===== */
.pendulum {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: pendulumSwing 3s ease-in-out infinite;
    transform-origin: top center;
    opacity: 0;
    animation: pendulumSwing 3s ease-in-out infinite, fadeInEl 1s ease 2.5s forwards;
}

@keyframes pendulumSwing {
    0%, 100% { transform: rotate(-15deg); }
    50% { transform: rotate(15deg); }
}

.pendulum-arm {
    width: 2px;
    height: 70px;
    background: linear-gradient(to bottom, var(--brass), rgba(184, 134, 11, 0.3));
}

.pendulum-weight {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #d4a843, var(--brass));
    box-shadow: 0 0 10px rgba(184, 134, 11, 0.3);
}

/* ===== SCROLL INDICATOR ===== */
.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    animation: fadeInEl 1s ease 3s forwards, floatUp 2s ease-in-out infinite 3s;
}

.scroll-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.55rem;
    letter-spacing: 0.2em;
    color: var(--brass);
    opacity: 0.5;
}

.scroll-arrow {
    width: 12px;
    height: 12px;
    border-right: 1.5px solid var(--brass);
    border-bottom: 1.5px solid var(--brass);
    transform: rotate(45deg);
    opacity: 0.5;
}

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

/* ===== TIMELINE RAIL ===== */
.timeline-rail {
    position: relative;
    z-index: 1;
    width: 100%;
    overflow: hidden;
    background: var(--face);
    border-top: 1px solid var(--brass);
    border-bottom: 1px solid var(--brass);
    padding: 1.5rem 0;
}

.timeline-track {
    display: flex;
    gap: 0;
    min-width: max-content;
    transition: transform 0.3s ease-out;
}

.timeline-event {
    flex: 0 0 auto;
    width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.timeline-event::before {
    content: attr(data-year);
    font-family: 'Teko', sans-serif;
    font-weight: 500;
    font-size: 1.2rem;
    color: var(--phosphor);
}

.timeline-event span {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.55rem;
    letter-spacing: 0.15em;
    color: var(--brass);
    opacity: 0.7;
}

.timeline-dial {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 1.5px solid var(--brass);
    position: relative;
    background: var(--void);
}

.timeline-dial::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 1px;
    background: var(--red);
    transform-origin: left center;
    transform: translate(0, -50%);
    animation: dialSpin 4s linear infinite;
}

@keyframes dialSpin {
    to { transform: translate(0, -50%) rotate(360deg); }
}

.timeline-event::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -50%;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, var(--brass), transparent);
    opacity: 0.3;
}

.timeline-event:last-child::after {
    display: none;
}

/* ===== GEAR BORDER ===== */
.gear-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 8px;
    background:
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 4px,
            var(--brass) 4px,
            var(--brass) 12px,
            transparent 12px,
            transparent 16px
        );
    clip-path: polygon(
        0% 100%,
        2% 0%, 4% 100%, 6% 0%, 8% 100%, 10% 0%, 12% 100%, 14% 0%, 16% 100%, 18% 0%,
        20% 100%, 22% 0%, 24% 100%, 26% 0%, 28% 100%, 30% 0%, 32% 100%, 34% 0%, 36% 100%, 38% 0%,
        40% 100%, 42% 0%, 44% 100%, 46% 0%, 48% 100%, 50% 0%, 52% 100%, 54% 0%, 56% 100%, 58% 0%,
        60% 100%, 62% 0%, 64% 100%, 66% 0%, 68% 100%, 70% 0%, 72% 100%, 74% 0%, 76% 100%, 78% 0%,
        80% 100%, 82% 0%, 84% 100%, 86% 0%, 88% 100%, 90% 0%, 92% 100%, 94% 0%, 96% 100%, 98% 0%,
        100% 100%
    );
    opacity: 0.6;
}

/* ===== CONTENT BLOCKS ===== */
.content-section {
    background: var(--void);
}

.content-block {
    max-width: 650px;
    text-align: center;
    position: relative;
}

.content-title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--phosphor);
    margin-bottom: 1rem;
    text-shadow: 0 0 20px rgba(79, 195, 247, 0.15);
    letter-spacing: 0.05em;
}

.content-body {
    font-size: 1rem;
    color: rgba(232, 232, 232, 0.65);
    line-height: 1.7;
    max-width: 550px;
    margin: 0 auto;
}

/* ===== FLIP CLOCK DISPLAY ===== */
.flip-display {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 2rem;
    perspective: 400px;
}

.flip-unit {
    position: relative;
    width: 56px;
    height: 76px;
}

.flip-card {
    width: 100%;
    height: 100%;
    position: relative;
    font-family: 'Teko', sans-serif;
    font-weight: 700;
    font-size: 3.5rem;
    color: var(--dial);
    line-height: 1;
}

.flip-top,
.flip-bottom {
    position: absolute;
    left: 0;
    width: 100%;
    height: 50%;
    overflow: hidden;
    background: var(--face);
    border: 1px solid rgba(184, 134, 11, 0.4);
}

.flip-top {
    top: 0;
    border-radius: 4px 4px 0 0;
    border-bottom: none;
}

.flip-top span {
    display: block;
    text-align: center;
    padding-top: 6px;
}

.flip-bottom {
    bottom: 0;
    border-radius: 0 0 4px 4px;
    border-top: none;
}

.flip-bottom span {
    display: block;
    text-align: center;
    transform: translateY(-100%);
    padding-top: 6px;
}

/* Divider line */
.flip-unit::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 100%;
    height: 1px;
    background: rgba(184, 134, 11, 0.3);
    z-index: 2;
}

/* Flip animation classes */
.flip-card.flipping .flip-top {
    animation: flipTopDown 0.3s ease-in forwards;
}

@keyframes flipTopDown {
    0% { transform: rotateX(0deg); }
    100% { transform: rotateX(-90deg); transform-origin: bottom; }
}

.flip-card.flipping .flip-bottom {
    animation: flipBottomUp 0.3s ease-out 0.15s forwards;
}

@keyframes flipBottomUp {
    0% { transform: rotateX(90deg); transform-origin: top; }
    100% { transform: rotateX(0deg); transform-origin: top; }
}

/* ===== GEAR ICON ===== */
.gear-icon {
    margin-top: 2rem;
    opacity: 0.3;
}

.spin-gear {
    animation: spinSlow 20s linear infinite;
}

@keyframes spinSlow {
    to { transform: rotate(360deg); }
}

/* ===== PARADOX ZONE ===== */
.paradox-zone {
    background: var(--face);
    overflow: hidden;
    position: relative;
}

.paradox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(
            0deg,
            transparent 0px,
            transparent 2px,
            rgba(229, 57, 53, 0.02) 2px,
            rgba(229, 57, 53, 0.02) 4px
        );
    pointer-events: none;
    z-index: 2;
}

.paradox-content {
    position: relative;
    z-index: 3;
    text-align: center;
    max-width: 650px;
}

.paradox-glitch-wrapper {
    position: relative;
}

.paradox-text {
    position: relative;
    color: var(--red);
    text-shadow: 0 0 20px rgba(229, 57, 53, 0.3);
    font-size: clamp(1.2rem, 3vw, 2rem);
}

.paradox-text::before,
.paradox-text::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    opacity: 0;
    pointer-events: none;
}

.paradox-text::before {
    color: var(--phosphor);
    animation: paraGlitch1 3s ease-in-out infinite;
}

.paradox-text::after {
    color: var(--red);
    animation: paraGlitch2 3s ease-in-out infinite;
}

@keyframes paraGlitch1 {
    0%, 88%, 100% { opacity: 0; transform: translate(0); }
    90% { opacity: 0.7; transform: translate(4px, -2px); }
    92% { opacity: 0; }
    94% { opacity: 0.5; transform: translate(-3px, 1px); }
    96% { opacity: 0; }
}

@keyframes paraGlitch2 {
    0%, 85%, 100% { opacity: 0; transform: translate(0); }
    87% { opacity: 0.5; transform: translate(-4px, 2px); }
    89% { opacity: 0; }
    91% { opacity: 0; }
    93% { opacity: 0.6; transform: translate(3px, -1px); }
    95% { opacity: 0; }
}

.paradox-body {
    color: rgba(229, 57, 53, 0.55);
    margin-bottom: 2rem;
}

/* Paradox scrambling digits */
.paradox-digits {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 1.5rem;
    font-family: 'Teko', sans-serif;
    font-weight: 700;
    font-size: 2.5rem;
}

.paradox-digit {
    color: var(--red);
    text-shadow: 0 0 10px rgba(229, 57, 53, 0.5);
    min-width: 1.2ch;
    text-align: center;
}

.paradox-colon {
    color: var(--red);
    opacity: 0.5;
}

/* Chromatic aberration when in view */
.paradox-zone.active .paradox-content {
    animation: chromatic 0.1s steps(1) infinite;
}

@keyframes chromatic {
    0% { text-shadow: 2px 0 var(--phosphor), -2px 0 var(--red); }
    25% { text-shadow: -2px 1px var(--phosphor), 2px -1px var(--red); }
    50% { text-shadow: 1px -2px var(--phosphor), -1px 2px var(--red); }
    75% { text-shadow: -1px 0 var(--phosphor), 1px 0 var(--red); }
}

.scanline-rapid {
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(229, 57, 53, 0.12);
    z-index: 4;
    pointer-events: none;
    animation: scanDown 1.5s linear infinite;
}

.scanline-rapid-2 {
    height: 2px;
    background: rgba(79, 195, 247, 0.08);
    animation-duration: 2.2s;
    animation-delay: 0.7s;
}

/* ===== DILATION ZONE ===== */
.dilation-zone .content-block {
    transition: transform 0.5s ease;
}

.dilation-zone.active .content-block {
    animation: dilate 4s ease-in-out infinite;
}

@keyframes dilate {
    0%, 100% { transform: scaleX(1); }
    25% { transform: scaleX(1.02); }
    50% { transform: scaleX(0.98); }
    75% { transform: scaleX(1.01); }
}

/* ===== FOOTER SECTION ===== */
.footer-section {
    min-height: 80vh;
    background: radial-gradient(ellipse at center bottom, rgba(26, 32, 64, 0.2) 0%, var(--void) 70%);
}

.temporal-coords {
    text-align: center;
    margin-bottom: 2rem;
}

.coord-label {
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: 0.6rem;
    letter-spacing: 0.2em;
    color: var(--brass);
    margin-bottom: 0.5rem;
}

.coord-value {
    font-family: 'Teko', sans-serif;
    font-weight: 500;
    font-size: 1.8rem;
    color: var(--phosphor);
    text-shadow: 0 0 15px rgba(79, 195, 247, 0.15);
}

.coord-sub {
    font-family: 'Teko', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    color: var(--patina);
    margin-top: 0.3rem;
    letter-spacing: 0.05em;
}

/* ===== COUNTDOWN DISPLAY ===== */
.countdown-display {
    margin: 2rem 0;
    text-align: center;
}

.countdown-digits {
    display: flex;
    justify-content: center;
    gap: 2px;
}

.countdown-digit {
    font-family: 'Teko', sans-serif;
    font-weight: 700;
    font-size: 2.5rem;
    color: var(--brass);
    min-width: 1.2ch;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.countdown-digit.revealed {
    opacity: 1;
}

.countdown-digit.brand-char {
    color: var(--phosphor);
    font-family: 'Orbitron', sans-serif;
    font-size: 1.8rem;
}

/* ===== HOURGLASS ===== */
.hourglass {
    margin: 2rem 0;
    opacity: 0.6;
    filter: drop-shadow(0 0 8px rgba(184, 134, 11, 0.15));
}

.sand-particle {
    fill: var(--brass);
    opacity: 0.8;
}

/* ===== FOOTER BRAND ===== */
.footer-brand {
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    color: rgba(184, 134, 11, 0.35);
    letter-spacing: 0.15em;
    margin-top: 1rem;
}

.footer-tagline {
    font-family: 'Exo 2', sans-serif;
    font-size: 0.7rem;
    color: rgba(232, 232, 232, 0.15);
    letter-spacing: 0.1em;
    margin-top: 0.5rem;
}

/* ===== FADE IN ===== */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.9s ease, transform 0.9s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .clock-face {
        width: min(85vw, 300px);
        height: min(85vw, 300px);
    }

    .section {
        padding: 3rem 1.5rem;
    }

    .timeline-event {
        width: 150px;
    }

    .flip-unit {
        width: 44px;
        height: 60px;
    }

    .flip-card {
        font-size: 2.5rem;
    }

    .paradox-digits {
        font-size: 2rem;
    }

    .countdown-digit {
        font-size: 1.8rem;
    }
}

@media (max-width: 480px) {
    .clock-face {
        width: min(90vw, 260px);
        height: min(90vw, 260px);
    }

    .content-title {
        font-size: clamp(1rem, 4vw, 1.5rem);
    }

    .content-body {
        font-size: 0.9rem;
    }

    .flip-unit {
        width: 36px;
        height: 50px;
    }

    .flip-card {
        font-size: 2rem;
    }
}
