/* ========================================
   Historygrapher.com - Complete Stylesheet
   ======================================== */

/* ========================================
   CSS Custom Properties (Design Tokens)
   ======================================== */

:root {
    /* Colors - Complementary Palette */
    --primary-dark: #1A1028;
    --secondary-dark: #0F1B2E;
    --primary-warm: #D4AF37;
    --secondary-warm: #F5D0A9;
    --accent-hot: #E85D4A;
    --accent-cool: #4A7C8E;
    --bokeh-warm: #FFB347;
    --bokeh-cool: #6B5B95;
    --text-primary: #F2E8DC;
    --text-dark: #2A1F1A;
    --gold-light: #FFD700;
    --gold-glow: rgba(255, 215, 0, 0.3);
    --warm-brass: #E8C98E;
    --golden-parchment: #F0D9B5;
    --shimmer-bronze: #B8860B;
    --pure-white: #FFFFFF;

    /* Typography */
    --font-body: 'Source Sans 3', sans-serif;
    --font-display: 'Playfair Display', serif;
    --font-card: 'Alegreya Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --font-quote: 'Cormorant Garamond', serif;

    /* Spacing */
    --gap-dense: 24px;
    --gap-standard: 32px;
    --gap-large: 48px;

    /* Border Radius */
    --radius-card: 12px;

    /* Viewport heights */
    --chamber-min-height: 100vh;
}

/* ========================================
   Reset & Base Styles
   ======================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.65;
    color: var(--text-primary);
    background-color: var(--primary-dark);
    overflow-x: hidden;
    position: relative;
}

/* Custom cursor */
body {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="20"><defs><linearGradient id="flamegradient" x1="0%" y1="0%" x2="0%" y2="100%"><stop offset="0%" style="stop-color:%23FFD700;stop-opacity:1" /><stop offset="100%" style="stop-color:%23FFB347;stop-opacity:0" /></linearGradient></defs><path d="M 6 0 Q 8 6 8 10 Q 8 16 6 20 Q 4 16 4 10 Q 4 6 6 0" fill="url(%23flamegradient)" /></svg>') 6 0, auto;
}

/* ========================================
   Background Layers
   ======================================== */

.bokeh-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-dark);
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bokeh-background::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 15% 25%, rgba(255, 179, 71, 0.3) 0%, transparent 8%),
        radial-gradient(circle at 85% 35%, rgba(107, 91, 149, 0.25) 0%, transparent 10%),
        radial-gradient(circle at 25% 65%, rgba(255, 179, 71, 0.2) 0%, transparent 7%),
        radial-gradient(circle at 70% 75%, rgba(107, 91, 149, 0.2) 0%, transparent 9%),
        radial-gradient(circle at 50% 50%, rgba(255, 179, 71, 0.15) 0%, transparent 6%);
    animation: bokeh-drift 30s ease-in-out infinite;
}

@keyframes bokeh-drift {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-20px, 20px); }
    50% { transform: translate(0, -30px); }
    75% { transform: translate(20px, 10px); }
}

.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(
        0deg,
        rgba(255, 255, 255, 0.03) 0px,
        rgba(255, 255, 255, 0.03) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: overlay;
}

/* Ensure pure white is available for highlight effects */
.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    pointer-events: none;
}

/* ========================================
   Main Content Container
   ======================================== */

.main-content {
    position: relative;
    z-index: 10;
    width: 100%;
}

/* ========================================
   Chambers (Sections)
   ======================================== */

.chamber {
    min-height: var(--chamber-min-height);
    padding: 80px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    z-index: 10;
}

/* Hero Chamber */
.hero-chamber {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(26, 16, 40, 0.95) 0%, rgba(15, 27, 46, 0.95) 100%);
}

.hero-card {
    text-align: center;
    max-width: 600px;
}

.logo h1 {
    font-family: var(--font-display);
    font-size: clamp(48px, 8vw, 84px);
    font-weight: 700;
    background: linear-gradient(90deg, #D4AF37, #F5D0A9, #C9B037, #D4AF37);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.08em;
    animation: shimmer-text 6s ease-in-out infinite;
    margin-bottom: 24px;
}

.logo .flame {
    font-style: normal;
    animation: flame-pulse 2s ease-in-out infinite;
    display: inline-block;
}

@keyframes flame-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.hero-tagline {
    font-size: 18px;
    font-style: italic;
    color: var(--secondary-warm);
    line-height: 1.8;
}

/* Era Chambers */
.era-chamber {
    background: linear-gradient(135deg, rgba(26, 16, 40, 0.9) 0%, rgba(15, 27, 46, 0.85) 100%);
}

.era-chamber:nth-child(odd) {
    background: linear-gradient(135deg, rgba(26, 16, 40, 0.92) 0%, rgba(15, 27, 46, 0.88) 100%);
}

.era-heading {
    font-family: var(--font-display);
    font-size: clamp(36px, 6vw, 64px);
    font-weight: 700;
    letter-spacing: 0.08em;
    background: linear-gradient(90deg, #D4AF37, #F5D0A9, #C9B037, #D4AF37);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 60px;
    animation: split-text-reveal 1.5s ease-out;
}

@keyframes split-text-reveal {
    0% { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer-text {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.1); }
}

/* Connection Chamber */
.connection-chamber {
    text-align: center;
    background: linear-gradient(135deg, rgba(26, 16, 40, 0.95) 0%, rgba(15, 27, 46, 0.95) 100%);
}

.connection-text {
    font-size: 20px;
    color: var(--secondary-warm);
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.8;
}

/* ========================================
   Card Grid System
   ======================================== */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--gap-dense);
    grid-auto-flow: dense;
    width: 100%;
}

/* Responsive grid density */
@media (min-width: 768px) and (max-width: 1023px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--gap-standard);
    }
}

@media (min-width: 1024px) {
    .card-grid {
        grid-template-columns: repeat(4, minmax(280px, 1fr));
        gap: var(--gap-dense);
    }
}

@media (max-width: 767px) {
    .card-grid {
        grid-template-columns: 1fr;
        gap: var(--gap-standard);
    }
}

/* ========================================
   Cards
   ======================================== */

.card {
    background: rgba(26, 16, 40, 0.65);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(184, 134, 11, 0.4);
    border-color: var(--shimmer-bronze);
    border-radius: var(--radius-card);
    padding: 32px;
    position: relative;
    overflow: hidden;
    transition: all 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0;
    transform: translateY(30px);
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.card.revealed {
    opacity: 1;
    transform: translateY(0);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 32px rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.8);
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 100%);
    pointer-events: none;
}

/* Date Badge */
.date-badge {
    position: absolute;
    top: -8px;
    left: 24px;
    background: linear-gradient(135deg, #FFD700, #F5D0A9);
    color: var(--primary-dark);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
    clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 0 100%, 8px 50%);
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
    text-shadow: 0 0 8px rgba(255, 215, 0, 0.3);
}

/* Card Content */
.card-heading {
    font-family: var(--font-card);
    font-size: 22px;
    font-weight: 500;
    color: var(--warm-brass);
    margin: 32px 0 16px 0;
    line-height: 1.4;
}

.card p {
    font-size: 16px;
    line-height: 1.65;
    color: var(--text-primary);
    margin: 0;
}

/* Hero Card Special Styling */
.hero-card {
    background: rgba(26, 16, 40, 0.7);
    backdrop-filter: blur(12px);
    border: 2px solid rgba(212, 175, 55, 0.5);
    border-radius: var(--radius-card);
    padding: 60px 50px;
    max-width: 700px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(212, 175, 55, 0.1);
}

.hero-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, rgba(255, 215, 0, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

/* ========================================
   Connection Threads SVG
   ======================================== */

.connection-threads {
    width: 100%;
    min-height: 400px;
    margin-top: 40px;
}

.connection-threads line {
    stroke: url(#goldGradient);
    stroke-width: 2;
    opacity: 0.6;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    animation: draw-line 2s ease-out forwards;
}

@keyframes draw-line {
    to { stroke-dashoffset: 0; }
}

.connection-threads circle {
    fill: none;
    stroke: rgba(212, 175, 55, 0.4);
    stroke-width: 2;
    opacity: 0.5;
}

/* ========================================
   Timeline Track (Right Edge)
   ======================================== */

.timeline-track {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 16px;
    z-index: 100;
    mix-blend-mode: screen;
}

.timeline-marker {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(212, 175, 55, 0.6);
    cursor: pointer;
    transition: all 300ms ease;
    position: relative;
    flex-shrink: 0;
}

.timeline-marker:hover {
    background: var(--primary-warm);
    width: 18px;
    height: 18px;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.5);
}

.timeline-marker.active {
    background: var(--gold-light);
    box-shadow: 0 0 16px var(--gold-glow);
    width: 20px;
    height: 20px;
}

/* ========================================
   Smoke Wisps
   ======================================== */

.chamber::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: radial-gradient(ellipse at 50% 100%, rgba(255, 179, 71, 0.1) 0%, transparent 70%);
    filter: blur(30px);
    pointer-events: none;
    animation: smoke-drift-down 8s ease-in-out infinite;
}

@keyframes smoke-drift-down {
    0%, 100% { opacity: 0.1; transform: translateY(0); }
    50% { opacity: 0.2; transform: translateY(10px); }
}

.chamber:nth-child(even)::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: radial-gradient(ellipse at 50% 0%, rgba(107, 91, 149, 0.1) 0%, transparent 70%);
    filter: blur(30px);
    pointer-events: none;
    animation: smoke-drift-up 8s ease-in-out infinite;
}

@keyframes smoke-drift-up {
    0%, 100% { opacity: 0.1; transform: translateY(0); }
    50% { opacity: 0.2; transform: translateY(-10px); }
}

/* ========================================
   Sparkle Effects
   ======================================== */

.sparkle {
    position: fixed;
    pointer-events: none;
    font-size: 8px;
    color: rgba(255, 255, 255, 0.8);
}

/* ========================================
   Responsive Design
   ======================================== */

@media (max-width: 1024px) {
    .timeline-track {
        right: 12px;
    }

    .timeline-marker {
        width: 10px;
        height: 10px;
    }

    .chamber {
        padding: 60px 32px;
    }
}

@media (max-width: 768px) {
    .chamber {
        padding: 40px 24px;
        min-height: auto;
        margin-bottom: 60px;
    }

    .hero-chamber {
        min-height: 80vh;
    }

    .hero-card {
        padding: 40px 30px;
    }

    .era-heading {
        margin-bottom: 40px;
    }

    .timeline-track {
        display: none;
    }

    .card {
        min-height: auto;
        padding: 24px;
    }

    .date-badge {
        left: 16px;
        font-size: 12px;
        padding: 4px 10px;
    }

    .card-heading {
        font-size: 18px;
        margin-top: 24px;
    }

    .card p {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    :root {
        --gap-dense: 16px;
        --gap-standard: 20px;
    }

    .chamber {
        padding: 32px 16px;
        margin-bottom: 40px;
    }

    .logo h1 {
        font-size: 36px;
    }

    .era-heading {
        font-size: 28px;
        margin-bottom: 32px;
    }

    .card {
        padding: 20px;
    }

    .hero-card {
        padding: 32px 24px;
    }

    .hero-tagline {
        font-size: 16px;
    }
}

/* ========================================
   Animations
   ======================================== */

@keyframes card-ignite {
    0% {
        opacity: 0;
        box-shadow: inset 0 0 20px rgba(255, 215, 0, 0.5);
    }
    50% {
        box-shadow: inset 0 0 40px rgba(255, 215, 0, 0.3);
    }
    100% {
        opacity: 1;
        box-shadow: inset 0 0 0 rgba(255, 215, 0, 0);
    }
}

.card.ignite-animation {
    animation: card-ignite 400ms ease-out;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .timeline-track,
    .noise-overlay,
    .bokeh-background {
        display: none;
    }

    .chamber {
        page-break-inside: avoid;
    }
}
