/* ============================================
   chrono.games — Neomorphic Clockwork Design
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --surface: #d8d8df;
    --light-shadow: #ececf2;
    --dark-shadow: #b0b0b8;
    --deep-inset: #2a2a2e;
    --text-primary: #2a2a2e;
    --text-secondary: #4a4a52;
    --text-tertiary: #6b6b75;
    --brass: #c4a882;
    --brass-dark: #a89070;
    --neo-shadow: 8px 8px 16px var(--dark-shadow), -8px -8px 16px var(--light-shadow);
    --neo-shadow-hover: 12px 12px 20px var(--dark-shadow), -12px -12px 20px var(--light-shadow);
    --neo-inset: inset 4px 4px 8px var(--dark-shadow), inset -4px -4px 8px var(--light-shadow);
    --neo-deep-inset: inset 6px 6px 12px var(--dark-shadow), inset -6px -6px 12px var(--light-shadow);
    --ease-mechanical: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-underline: cubic-bezier(0.65, 0, 0.35, 1);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--surface);
    font-family: 'DM Sans', sans-serif;
    color: var(--text-secondary);
    overflow-x: hidden;
    position: relative;
    line-height: 1.75;
}

/* --- Timeline SVG --- */
#timeline-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

#timeline-path {
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* --- Particle Canvas --- */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* ============================================
   THE DIAL - Full Viewport Clock
   ============================================ */
#the-dial {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

#clock-face {
    position: relative;
    width: min(80vw, 700px);
    height: min(80vw, 700px);
    transition: all 800ms var(--ease-mechanical);
}

#clock-rim {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: var(--neo-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    position: relative;
}

#clock-rim::after {
    content: '';
    position: absolute;
    width: 92%;
    height: 92%;
    border-radius: 50%;
    box-shadow: var(--neo-inset);
}

#clock-inner {
    width: 85%;
    height: 85%;
    border-radius: 50%;
    position: relative;
    background: var(--surface);
}

/* Tick marks */
.tick-mark {
    position: absolute;
    width: 3px;
    height: 20px;
    background: var(--text-tertiary);
    top: 0;
    left: 50%;
    transform-origin: 50% calc(50cqi);
    transform: translateX(-50%) rotate(calc(var(--tick-index) * 30deg));
    border-radius: 2px;
    container-type: size;
}

/* Use a different approach for tick positioning */
.tick-mark {
    position: absolute;
    width: 3px;
    height: 18px;
    background: var(--text-tertiary);
    border-radius: 2px;
    top: 50%;
    left: 50%;
}

/* Clock Hands */
.clock-hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom center;
    border-radius: 3px;
}

#hour-hand {
    width: 5px;
    height: 25%;
    background: var(--brass);
    margin-left: -2.5px;
    z-index: 3;
    box-shadow: 1px 1px 4px rgba(0,0,0,0.15);
}

#minute-hand {
    width: 3px;
    height: 33%;
    background: var(--brass);
    margin-left: -1.5px;
    z-index: 4;
    box-shadow: 1px 1px 3px rgba(0,0,0,0.12);
}

#second-hand {
    width: 1.5px;
    height: 38%;
    background: var(--brass-dark);
    margin-left: -0.75px;
    z-index: 5;
}

#clock-center-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--brass);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 6;
    box-shadow: 0 0 6px rgba(196, 168, 130, 0.4);
}

/* Tick pulse animation */
@keyframes tick-pulse {
    0% { box-shadow: var(--neo-shadow); }
    10% { box-shadow: 9px 9px 18px var(--dark-shadow), -9px -9px 18px var(--light-shadow); }
    100% { box-shadow: var(--neo-shadow); }
}

#clock-rim.ticking {
    animation: tick-pulse 1s steps(1) infinite;
}

/* Scroll prompt */
#scroll-prompt {
    position: absolute;
    bottom: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0;
    transition: opacity 600ms ease;
}

#scroll-prompt.visible {
    opacity: 1;
}

#scroll-prompt span {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: 0.875rem;
    color: var(--text-tertiary);
    letter-spacing: 0.04em;
}

#scroll-chevron {
    animation: bob 2s ease-in-out infinite;
}

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

/* ============================================
   MINI CLOCK - Persistent corner navigation
   ============================================ */
#mini-clock {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 80px;
    height: 80px;
    z-index: 100;
    transition: all 400ms var(--ease-mechanical);
    cursor: pointer;
}

#mini-clock.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5);
}

#mini-clock:hover {
    width: 120px;
    height: 120px;
}

#mini-clock-face {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--neo-shadow);
    position: relative;
}

/* Mini tick marks */
.mini-tick {
    position: absolute;
    width: 2px;
    height: 6px;
    background: var(--text-tertiary);
    top: 50%;
    left: 50%;
    border-radius: 1px;
}

/* Mini clock hands */
.mini-hand {
    position: absolute;
    bottom: 50%;
    left: 50%;
    transform-origin: bottom center;
    border-radius: 2px;
}

#mini-hour-hand {
    width: 3px;
    height: 22%;
    background: var(--brass);
    margin-left: -1.5px;
    z-index: 3;
}

#mini-minute-hand {
    width: 2px;
    height: 30%;
    background: var(--brass);
    margin-left: -1px;
    z-index: 4;
}

#mini-second-hand {
    width: 1px;
    height: 35%;
    background: var(--brass-dark);
    margin-left: -0.5px;
    z-index: 5;
}

#mini-center-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--brass);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 6;
}

/* Radial navigation menu */
#radial-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    opacity: 0;
    transition: opacity 300ms var(--ease-mechanical);
    pointer-events: none;
}

#mini-clock:hover #radial-menu {
    opacity: 1;
    pointer-events: auto;
}

.radial-item {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
}

.radial-item:nth-child(1) { transform: translate(-50%, -50%) translate(0, -70px); }
.radial-item:nth-child(2) { transform: translate(-50%, -50%) translate(60px, -35px); }
.radial-item:nth-child(3) { transform: translate(-50%, -50%) translate(60px, 25px); }
.radial-item:nth-child(4) { transform: translate(-50%, -50%) translate(0, 70px); }
.radial-item:nth-child(5) { transform: translate(-50%, -50%) translate(-60px, 25px); }

.radial-dot {
    width: 8px;
    height: 8px;
    background: var(--brass);
    border-radius: 50%;
    display: block;
    box-shadow: 0 0 4px rgba(196, 168, 130, 0.5);
    flex-shrink: 0;
}

.radial-item::after {
    content: attr(data-label);
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    background: var(--surface);
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 2px 2px 4px var(--dark-shadow), -2px -2px 4px var(--light-shadow);
}

/* ============================================
   THE STREAM - Content Cards
   ============================================ */
#the-stream {
    position: relative;
    z-index: 2;
    padding-bottom: 80px;
}

/* Time Rose decorations */
.time-rose {
    position: absolute;
    width: 350px;
    height: 350px;
    opacity: 0.35;
    z-index: 0;
    pointer-events: none;
}

#rose-1 {
    top: 800px;
    right: 8vw;
    animation: spin-slow 120s linear infinite;
}

#rose-2 {
    top: 3200px;
    left: 5vw;
    animation: spin-slow 120s linear infinite reverse;
}

@keyframes spin-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Time Cards */
.time-card {
    position: relative;
    width: 65vw;
    max-width: 720px;
    margin-left: 15vw;
    margin-bottom: 120px;
    padding: 48px 44px;
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--neo-shadow);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 400ms var(--ease-mechanical),
                transform 400ms var(--ease-mechanical),
                box-shadow 300ms var(--ease-mechanical);
    z-index: 1;
}

.time-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.time-card.visible.entering {
    box-shadow: 12px 12px 24px var(--dark-shadow), -12px -12px 24px var(--light-shadow);
}

.time-card:hover {
    box-shadow: 12px 12px 24px var(--dark-shadow), -12px -12px 24px var(--light-shadow);
}

/* Card Headlines */
.card-headline {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    letter-spacing: 0.12em;
    color: var(--text-primary);
    text-transform: uppercase;
    line-height: 1.1;
    margin-bottom: 24px;
    position: relative;
    display: inline-block;
    text-shadow: 1px 1px 2px var(--light-shadow), -1px -1px 1px var(--dark-shadow);
}

.headline-text {
    display: block;
}

/* Underline draw animation */
.underline-draw {
    display: block;
    height: 2px;
    background: var(--brass);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 800ms var(--ease-underline);
    margin-top: 8px;
}

.time-card.visible .underline-draw {
    transform: scaleX(1);
}

/* Card Body */
.card-body {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.75;
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 600px;
}

/* Card Timestamp */
.card-timestamp {
    display: block;
    text-align: right;
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
    position: relative;
}

.card-timestamp::before {
    content: '';
    display: inline-block;
    width: 0;
    height: 1.5px;
    background: var(--brass);
    vertical-align: middle;
    margin-right: 8px;
    transition: width 600ms var(--ease-mechanical);
}

.time-card.visible .card-timestamp::before {
    width: 24px;
}

/* ============================================
   THE REVERSE - Final Act
   ============================================ */
#the-reverse {
    position: relative;
    z-index: 2;
    padding: 80px 0 160px;
}

.reverse-card {
    direction: rtl;
    margin-left: auto;
    margin-right: 15vw;
}

.reverse-text {
    direction: rtl;
    text-align: right;
}

#end-clock {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
}

#end-clock-message {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.15em;
    color: var(--brass);
    text-transform: uppercase;
    text-shadow: 1px 1px 2px var(--light-shadow), -1px -1px 1px var(--dark-shadow);
    opacity: 0;
    transition: opacity 1200ms ease;
}

#end-clock-message.visible {
    opacity: 1;
}

/* ============================================
   Neomorphic Decorative Elements
   ============================================ */

/* Gear decorations scattered in the background */
.neo-gear {
    position: absolute;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: var(--neo-shadow);
    z-index: 0;
    pointer-events: none;
}

.neo-gear::after {
    content: '';
    position: absolute;
    top: 25%;
    left: 25%;
    width: 50%;
    height: 50%;
    border-radius: 50%;
    box-shadow: var(--neo-inset);
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .time-card {
        width: 85vw;
        margin-left: 7.5vw;
        padding: 32px 28px;
    }

    .reverse-card {
        margin-left: auto;
        margin-right: 7.5vw;
    }

    .card-headline {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    #clock-face {
        width: min(85vw, 400px);
        height: min(85vw, 400px);
    }

    #mini-clock {
        top: 16px;
        right: 16px;
        width: 60px;
        height: 60px;
    }

    #mini-clock:hover {
        width: 90px;
        height: 90px;
    }

    .radial-item::after {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .time-card {
        width: 92vw;
        margin-left: 4vw;
        padding: 24px 20px;
    }

    .reverse-card {
        margin-left: auto;
        margin-right: 4vw;
    }
}
