:root {
    /* Premium Color Palette */
    --obsidian: #050505;
    --dark-surface: #0a0a0a;
    --glass-bg: rgba(18, 18, 18, 0.7);
    --celestial-gold: #ffae00;
    --celestial-gold-glow: rgba(255, 174, 0, 0.5);
    --copper: #b87333;
    --copper-glow: rgba(184, 115, 51, 0.4);
    --standard-blue: #00c3ff;
    --standard-blue-glow: rgba(0, 195, 255, 0.4);
    --text-primary: #f5f5f5;
    --text-secondary: #a1a1aa;
    
    /* Spacing & Transitions */
    --ease-premium: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.6s var(--ease-premium);
    --transition-med: 0.3s var(--ease-premium);
}

/* Base Styles & Smoothness */
html {
    scroll-behavior: smooth;
    background-color: var(--obsidian);
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

/* Premium Glassmorphism */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
    transition: var(--transition-med);
}

.glass-panel:hover {
    border-color: rgba(255, 174, 0, 0.2);
    box-shadow: 0 12px 48px 0 rgba(255, 174, 0, 0.05);
}


/* Reveal Animations */
[data-reveal] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
}

[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Section Spacing */
section {
    padding-top: 6rem;
    padding-bottom: 6rem;
}

@media (min-width: 768px) {
    section {
        padding-top: 10rem;
        padding-bottom: 10rem;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--obsidian);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 174, 0, 0.2);
    border-radius: 10px;
    border: 2px solid var(--obsidian);
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 174, 0, 0.5);
}

/* Typography Refinements */
.font-serif {
    letter-spacing: -0.01em;
    line-height: 1.4;
}

h1, h2, h3 {
    text-wrap: balance;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 800;
}

h2 {
    font-size: clamp(2rem, 5vw, 3.5rem);
}

/* Custom Tooltip Styling */
#sync-tooltip {
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid rgba(255, 174, 0, 0.2);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border-radius: 1rem;
    padding: 1.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

#sync-tooltip strong {
    color: var(--celestial-gold);
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-family: var(--font-serif);
}

/* Parallax & Ambient Backgrounds */
.ambient-glow {
    position: absolute;
    filter: blur(120px);
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
}

.glow-gold { background: radial-gradient(circle, var(--celestial-gold), transparent); }
.glow-copper { background: radial-gradient(circle, var(--copper), transparent); }

/* Buttons Refinement */
.btn-premium {
    position: relative;
    padding: 1rem 2.5rem;
    border-radius: 9999px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.4s var(--ease-premium);
    overflow: hidden;
    z-index: 1;
}

.btn-premium::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(45deg, var(--celestial-gold), #ffcc00);
    z-index: -1;
    transition: opacity 0.4s;
}

.btn-premium:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px var(--celestial-gold-glow);
}

/* Advanced Animations Phase 2 */
@keyframes text-shimmer {
    0% { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.shimmer-text {
    background: linear-gradient(90deg, rgba(255,174,0,0) 0%, rgba(255,174,0,1) 50%, rgba(255,174,0,0) 100%);
    background-size: 200% auto;
    color: var(--celestial-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: text-shimmer 4s linear infinite;
}

@keyframes portal-entrance {
    0% { transform: scale(0) rotate(-15deg); opacity: 0; filter: blur(20px); }
    70% { transform: scale(1.05) rotate(2deg); opacity: 1; filter: blur(0px); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

.portal-open {
    animation: portal-entrance 0.6s var(--ease-premium) forwards;
}

/* Liquid Fill Button Effect */
.btn-liquid {
    position: relative;
    overflow: hidden;
}

.btn-liquid::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--celestial-gold);
    transition: top 0.4s var(--ease-premium);
    z-index: -1;
}

.btn-liquid:hover::after {
    top: 0;
}

.btn-liquid:hover {
    color: var(--obsidian);
}

/* Starfield Parallax Layers */
.parallax-layer {
    position: absolute;
    inset: -10%;
    pointer-events: none;
    z-index: -1;
}

.star-far { opacity: 0.3; filter: blur(1px); }
.star-mid { opacity: 0.5; }
.star-near { opacity: 0.8; }

/* Reader Immersion */
.reader-grain {
    position: relative;
}

.reader-grain::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("https://www.transparenttextures.com/patterns/parchment.png");
    opacity: 0.05;
    pointer-events: none;
    z-index: 1;
}

/* Magnetic Target Utility */
.magnetic-target {
    transition: transform 0.3s var(--ease-premium);
}

/* Choreographed Reveals */
[data-choreograph] {
    opacity: 0;
    transform: translateY(20px);
}

[data-choreograph].revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.8s var(--ease-premium), transform 0.8s var(--ease-premium);
}
#preloader {
    position: fixed;
    inset: 0;
    background: var(--obsidian);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.8s var(--ease-premium), visibility 0.8s;
}

#preloader.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-logo {
    width: 80px;
    height: 80px;
    border: 2px solid var(--celestial-gold);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1.5s linear infinite;
    position: relative;
}

.loader-logo::before {
    content: '';
    position: absolute;
    inset: 10px;
    border: 2px solid var(--copper);
    border-radius: 50%;
    border-bottom-color: transparent;
    animation: spin 2s linear infinite reverse;
}

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

/* =====================================================
   IMPROVEMENT 1: HERO CLOCK GOLDEN RING GLOW PULSE
   ===================================================== */
@keyframes clock-glow-pulse {
    0%, 100% { box-shadow: 0 0 30px rgba(255, 174, 0, 0.15), 0 0 60px rgba(255, 174, 0, 0.08), inset 0 0 30px rgba(255, 174, 0, 0.03); }
    50% { box-shadow: 0 0 60px rgba(255, 174, 0, 0.35), 0 0 120px rgba(255, 174, 0, 0.18), inset 0 0 40px rgba(255, 174, 0, 0.07); }
}
@keyframes clock-ring-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.perfect-circle-wrapper {
    position: relative;
    width: clamp(300px, 55vw, 560px);
    aspect-ratio: 1;
}
.perfect-circle-wrapper .glass-panel {
    animation: clock-glow-pulse 4s ease-in-out infinite;
    border: 1px solid rgba(255, 174, 0, 0.25);
}
.clock-outer-ring {
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 174, 0, 0.12);
    pointer-events: none;
}
.clock-outer-ring::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px dashed rgba(255, 174, 0, 0.07);
}
.clock-outer-ring::after {
    content: '';
    position: absolute;
    top: -2px; left: -2px; right: -2px; bottom: -2px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, rgba(255,174,0,0.3) 0deg, transparent 60deg, transparent 300deg, rgba(255,174,0,0.3) 360deg);
    animation: clock-ring-spin 12s linear infinite;
    pointer-events: none;
}

/* Timeline/chronology improvements removed — replaced by chron-entry system */

/* =====================================================
   MODAL: SUBTLE NEBULA BACKGROUND (CSS only, no canvas)
   ===================================================== */
.modal-nebula-bg {
    background:
        radial-gradient(ellipse at 20% 20%, rgba(255,174,0,0.04) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 80%, rgba(184,115,51,0.04) 0%, transparent 55%),
        radial-gradient(ellipse at 50% 0%, rgba(255,174,0,0.06) 0%, transparent 40%),
        #0d0d10;
}

/* =====================================================
   CHRONOLOGY: CLEAN COMPACT DESIGN
   ===================================================== */
/* =====================================================
   CHRONOLOGY: PREMIUM LONG TIMELINE DESIGN
   ===================================================== */
#chronology-list {
    background: radial-gradient(circle at 50% 0%, rgba(255, 174, 0, 0.08) 0%, transparent 80%);
    padding: 6rem 0; /* More space requested */
    border-radius: 2rem;
}

#chronology-title {
    font-size: 2.5rem;
    font-weight: 900;
    text-align: center;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff 0%, var(--celestial-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

#chronology-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 4rem;
    letter-spacing: 0.1em;
}

.chron-timeline {
    max-width: 850px;
    margin: 0 auto;
    padding: 0 1rem 5rem 1rem;
    position: relative;
}

/* Glowing Vertical Line */
.chron-timeline::before {
    content: '';
    position: absolute;
    left: 1.4375rem; /* Centered with 14px dot (1rem padding + 7px half-dot) */
    top: 0;
    bottom: 0;
    width: 1px;
    background: rgba(255, 174, 0, 0.2);
    z-index: 1;
}

.chron-card {
    position: relative;
    margin-bottom: 2.5rem;
    z-index: 1;
    animation: chronFadeIn 0.8s var(--ease-premium) both;
}

.chron-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    transition: all 0.3s var(--ease-premium);
    border-radius: 1rem;
}
.chron-card-header.cursor-pointer:hover {
    background: rgba(255, 174, 0, 0.05);
}

.chron-card-left {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex: 1;
}

.chron-card-dot {
    width: 14px;
    height: 14px;
    margin-top: 0.35rem; /* Align with first line of title */
    background: #0a0a0c;
    border: 2px solid var(--celestial-gold);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 174, 0, 0.2);
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}

.chron-card-title-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chron-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.3;
}

.chron-card-ref {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.6;
}

.chron-card-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-left: 1rem;
}

.chron-card-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--celestial-gold);
    white-space: nowrap;
}

.chron-card-arrow {
    color: var(--celestial-gold);
    opacity: 0.4;
    transition: transform 0.4s var(--ease-premium);
}

/* Detail Panel */
.chron-card-detail {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.8s var(--ease-premium), opacity 0.5s ease;
    opacity: 0;
}
.chron-card-detail.open {
    max-height: 1200px;
    opacity: 1;
}

.chron-card-content {
    padding: 1rem 1rem 2rem 3.5rem;
}

.chron-card-image-wrap {
    width: 100%;
    border-radius: 1rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 174, 0, 0.3);
    box-shadow: 0 15px 45px rgba(0,0,0,0.7);
}
.chron-card-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.chron-card-text {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #e5e7eb;
    margin-bottom: 1.5rem;
    text-align: justify;
    font-family: 'Inter', sans-serif;
}

.chron-card-saint {
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
    font-style: italic;
    color: var(--celestial-gold);
    border-left: 2px solid var(--celestial-gold);
    padding-left: 1rem;
    margin-top: 1rem;
}

.chron-card-text {
    font-size: 0.85rem;
    line-height: 1.8;
    color: #d1d5db;
    margin-bottom: 1rem;
    text-align: justify;
}

.chron-card-saint {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-style: italic;
    color: var(--celestial-gold);
    opacity: 0.9;
    border-left: 2px solid var(--celestial-gold);
    padding-left: 0.75rem;
}

/* =====================================================
   IMPROVEMENT 4: RTL LAYOUT HARDENING
   ===================================================== */
[dir="rtl"] .timeline-item {
    justify-content: flex-start;
    padding-right: 0;
    padding-left: calc(50% + 2rem);
}
[dir="rtl"] .timeline-item:nth-child(even) {
    justify-content: flex-end;
    padding-left: 0;
    padding-right: calc(50% + 2rem);
}
[dir="rtl"] .timeline-dot { left: auto; right: 50%; transform: translateX(50%); }
[dir="rtl"] .timeline-item:hover .timeline-dot { transform: translateX(50%) scale(1.4); }
[dir="rtl"] .glass-panel {
    text-align: right;
}
[dir="rtl"] .saint-badge, [dir="rtl"] .timeline-badge {
    flex-direction: row-reverse;
}
[dir="rtl"] #modalBox .flex.items-center.gap-4 {
    flex-direction: row-reverse;
    padding-right: 0;
    padding-left: 3rem;
}
[dir="rtl"] button.absolute.top-4.right-4,
[dir="rtl"] button.absolute.top-6.right-6 {
    right: auto;
    left: 1rem;
}
[dir="rtl"] .mobile-nav-link {
    direction: rtl;
}
[dir="rtl"] .chronology-scrollbar {
    direction: rtl;
}

/* =====================================================
   IMPROVEMENT 5: GENERAL POLISH
   ===================================================== */
@keyframes item-entrance {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.timeline-item {
    animation: item-entrance 0.5s ease both;
}
