/* chrono.games - Temporal Control Room */

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

:root {
    --midnight: #0D0F1A;
    --control-surface: #12142A;
    --antique-gold: #C9A84C;
    --time-amber: #E8B84B;
    --paradox-cyan: #4DC9F6;
    --text-primary: #D4D0C8;
    --text-secondary: #8A8472;
    --hud-line: rgba(201, 168, 76, 0.15);
}

body {
    background-color: var(--midnight);
    color: var(--text-primary);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.1vw, 1rem);
    line-height: 1.75;
    overflow-x: hidden;
}

/* ============================
   HERO: CHRONOSPHERE
   ============================ */

#hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#star-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.star {
    position: absolute;
    border-radius: 50%;
    background-color: var(--text-primary);
}

#chronosphere {
    width: 50vmin;
    height: 50vmin;
    max-width: 400px;
    max-height: 400px;
    position: relative;
    z-index: 2;
}

.ring {
    transition: stroke-dashoffset 1.5s ease;
}

.ring.drawn {
    stroke-dashoffset: 0 !important;
}

#clock-hand {
    transform-origin: 200px 200px;
    transition: opacity 0.3s ease;
}

.position-dot {
    fill: var(--antique-gold);
    opacity: 0.4;
    transition: opacity 0.5s ease;
}

.position-dot.active {
    opacity: 1;
}

#title-chrono,
#title-games {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4rem);
    color: var(--antique-gold);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#title-chrono.visible,
#title-games.visible {
    opacity: 1;
    transform: translateY(0);
}

#title-chrono { margin-top: -1rem; }
#title-games { margin-top: 0.5rem; }

/* ============================
   TIMELINE BRANCHES
   ============================ */

#timeline-section {
    padding: 4rem 2rem;
    position: relative;
}

#timeline-container {
    max-width: 100%;
    overflow-x: auto;
    position: relative;
    -webkit-mask-image: linear-gradient(to right, transparent, black 3%, black 97%, transparent);
    mask-image: linear-gradient(to right, transparent, black 3%, black 97%, transparent);
}

#timeline-svg {
    min-width: 1200px;
    height: 400px;
}

.main-timeline {
    transition: stroke-dashoffset 2s ease;
}

.main-timeline.drawn {
    stroke-dashoffset: 0 !important;
}

.branch path {
    transition: stroke-dashoffset 0.4s ease, stroke-opacity 0.2s ease;
}

.branch path.drawn {
    stroke-dashoffset: 0 !important;
}

.branch circle {
    cursor: pointer;
    transition: fill 0.2s ease;
}

.branch:hover path {
    stroke-opacity: 1 !important;
}

.branch:hover circle {
    fill: var(--antique-gold);
}

#timeline-tooltip {
    position: absolute;
    background-color: var(--control-surface);
    border: 1px solid var(--antique-gold);
    padding: 0.75rem 1rem;
    border-radius: 4px;
    pointer-events: none;
    z-index: 10;
    font-family: 'Nunito Sans', sans-serif;
    font-size: 0.85rem;
    color: var(--text-primary);
    max-width: 250px;
}

#timeline-tooltip.tooltip-hidden {
    opacity: 0;
}

#timeline-tooltip.tooltip-visible {
    opacity: 1;
}

/* ============================
   PARADOX CARDS
   ============================ */

#paradox-grid {
    padding: 4rem 4vw;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.paradox-card {
    position: relative;
    background-color: var(--control-surface);
    border: 1px solid rgba(201, 168, 76, 0.2);
    padding: 2.5rem 2rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.paradox-card.visible {
    opacity: 1;
}

.corner-bracket {
    position: absolute;
    width: 12px;
    height: 12px;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.corner-bracket.locked {
    opacity: 1;
    transform: translate(0, 0) !important;
}

.tl {
    top: 4px;
    left: 4px;
    border-top: 1px solid var(--antique-gold);
    border-left: 1px solid var(--antique-gold);
    transform: translate(-4px, -4px);
}

.tr {
    top: 4px;
    right: 4px;
    border-top: 1px solid var(--antique-gold);
    border-right: 1px solid var(--antique-gold);
    transform: translate(4px, -4px);
}

.bl {
    bottom: 4px;
    left: 4px;
    border-bottom: 1px solid var(--antique-gold);
    border-left: 1px solid var(--antique-gold);
    transform: translate(-4px, 4px);
}

.br {
    bottom: 4px;
    right: 4px;
    border-bottom: 1px solid var(--antique-gold);
    border-right: 1px solid var(--antique-gold);
    transform: translate(4px, 4px);
}

.card-icon {
    margin-bottom: 1rem;
}

.card-inner h3 {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    letter-spacing: 0.08em;
    color: var(--antique-gold);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

.card-inner p {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 0.9rem;
    color: var(--text-primary);
    line-height: 1.75;
}

/* ============================
   CAUSALITY LOOP
   ============================ */

#causality-section {
    padding: 4rem 4vw;
    display: flex;
    justify-content: center;
}

#lemniscate {
    width: 40vw;
    min-width: 300px;
    max-width: 600px;
}

#lemniscate-path {
    transition: stroke-dashoffset 3s ease;
}

#lemniscate-path.drawn {
    stroke-dashoffset: 0 !important;
}

/* ============================
   FOOTER
   ============================ */

#control-footer {
    padding: 2rem 4vw;
    border-top: 1px solid var(--antique-gold);
    text-align: center;
}

.footer-brand {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--antique-gold);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* ============================
   RESPONSIVE
   ============================ */

@media (max-width: 768px) {
    .card-grid {
        grid-template-columns: 1fr;
    }

    #lemniscate {
        width: 80vw;
    }
}
