:root {
    --bg-deep: #0a0a14;
    --gold: #d4a853;
    --gold-bright: #f0d078;
    --emerald: #0d9488;
    --emerald-glow: #14b8a6;
    --crimson: #be123c;
    --surface-glass: rgba(20, 20, 40, 0.55);
    --surface-glass-hover: rgba(30, 30, 55, 0.7);
    --text-primary: #e8e6f0;
    --text-secondary: #b8b5cc;
    --text-gold: #e2c47a;
    --border-glass: rgba(255, 255, 255, 0.1);
    --glow-strong: rgba(212, 168, 83, 0.5);
    --glow-emerald: rgba(20, 184, 166, 0.45);
    --font-heading: 'Georgia', 'Times New Roman', serif;
    --font-body: 'Segoe UI', 'Inter', system-ui, -apple-system, sans-serif;
    --font-arabic: 'Noto Naskh Arabic', 'Traditional Arabic', 'Georgia', serif;
}

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

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    min-height: 100vh;
    background: var(--bg-deep);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow-x: hidden;
    cursor: default;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
}

/* ── Starfield Canvas – hidden on mobile ── */
#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    display: block;
}

/* ── Aurora / Nebula Layers – hidden on mobile ── */
.nebula-layer {
    position: fixed;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.25;
    pointer-events: none;
    z-index: 0;
    will-change: transform;
    transition: transform 0.05s linear;
    display: block;
}
.nebula-1 {
    width: 700px; height: 700px;
    background: radial-gradient(circle, rgba(212, 168, 83, 0.35) 0%, transparent 70%);
    top: -15%; left: -10%;
    animation: nebulaDrift1 28s ease-in-out infinite;
}
.nebula-2 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.3) 0%, transparent 70%);
    bottom: -12%; right: -8%;
    animation: nebulaDrift2 32s ease-in-out infinite;
}
.nebula-3 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(190, 18, 60, 0.2) 0%, transparent 70%);
    top: 40%; left: 50%;
    animation: nebulaDrift3 24s ease-in-out infinite;
}
.nebula-4 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(240, 208, 120, 0.2) 0%, transparent 70%);
    top: 55%; left: 15%;
    animation: nebulaDrift4 36s ease-in-out infinite;
}

@keyframes nebulaDrift1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(80px, 50px) scale(1.15); }
    50% { transform: translate(30px, -30px) scale(0.9); }
    75% { transform: translate(-50px, 20px) scale(1.1); }
}
@keyframes nebulaDrift2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-60px, -40px) scale(1.2); }
    66% { transform: translate(40px, 30px) scale(0.85); }
}
@keyframes nebulaDrift3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-30px, 60px) scale(1.25); }
}
@keyframes nebulaDrift4 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(70px, -50px) scale(1.3); }
}

/* ── Geometric Pattern Overlay – hidden on mobile ── */
.geo-pattern {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cdefs%3E%3Cpattern id='geo' x='0' y='0' width='200' height='200' patternUnits='userSpaceOnUse'%3E%3Cpath d='M0 100 L50 0 L100 100 L50 200 Z' fill='none' stroke='%23d4a853' stroke-width='1.5'/%3E%3Ccircle cx='50' cy='100' r='40' fill='none' stroke='%23d4a853' stroke-width='0.8'/%3E%3Ccircle cx='150' cy='100' r='40' fill='none' stroke='%23d4a853' stroke-width='0.8'/%3E%3Cpath d='M150 0 L200 50 L150 100 L100 50 Z' fill='none' stroke='%23d4a853' stroke-width='1'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='100%25' height='100%25' fill='url(%23geo)'/%3E%3C/svg%3E");
    background-size: 400px 400px;
    animation: geoRotate 120s linear infinite;
    will-change: transform;
    display: block;
}
@keyframes geoRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ── Cursor Glow – hidden on mobile ── */
.cursor-glow {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    width: 300px; height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212, 168, 83, 0.12) 0%, rgba(212, 168, 83, 0.03) 35%, transparent 70%);
    transform: translate(-50%, -50%);
    transition: opacity 0.3s;
    will-change: left, top;
    display: block;
}

/* ── Main Content Wrapper ── */
.main-wrapper {
    position: relative;
    z-index: 2;
    padding: 20px;
    max-width: 1100px;
    margin: 0 auto;
}

/* ── Hero Section ── */
.hero-section {
    text-align: center;
    padding: 60px 20px 40px;
    position: relative;
    z-index: 2;
}
.crescent-container {
    position: relative;
    display: inline-block;
    margin-bottom: 10px;
}
.crescent-moon {
    width: 100px; height: 100px;
    position: relative;
    display: inline-block;
    animation: crescentFloat 6s ease-in-out infinite;
    filter: drop-shadow(0 0 40px rgba(212, 168, 83, 0.7)) drop-shadow(0 0 80px rgba(212, 168, 83, 0.35));
}
.crescent-moon::before {
    content: '';
    position: absolute;
    width: 100px; height: 100px;
    border-radius: 50%;
    background: var(--gold-bright);
    box-shadow: 0 0 60px rgba(240, 208, 120, 0.8), 0 0 120px rgba(212, 168, 83, 0.5), inset 0 0 30px rgba(255, 220, 140, 0.6);
}
.crescent-moon::after {
    content: '';
    position: absolute;
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--bg-deep);
    top: 8px; left: 22px;
    box-shadow: inset 0 0 20px rgba(10, 10, 20, 0.9);
}
@keyframes crescentFloat {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    25% { transform: translateY(-18px) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(5deg); }
    75% { transform: translateY(-22px) rotate(2deg); }
}
.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    font-weight: 700;
    background: linear-gradient(180deg, #f7e8c4 0%, #d4a853 40%, #b8861e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: none;
    letter-spacing: 0.03em;
    margin: 8px 0 4px;
    line-height: 1.2;
}
.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    letter-spacing: 0.06em;
    font-weight: 300;
    margin-bottom: 6px;
}
.hero-year {
    font-size: 5rem;
    font-weight: 900;
    background: linear-gradient(180deg, rgba(212, 168, 83, 0.5) 0%, rgba(212, 168, 83, 0.05) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.15em;
    line-height: 1;
    margin: -10px 0;
    pointer-events: none;
    user-select: none;
}

/* ── Countdown Section ── */
.countdown-section {
    position: relative;
    z-index: 2;
    margin: 30px auto 50px;
    padding: 35px 25px;
    max-width: 750px;
    background: var(--surface-glass);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border-glass);
    border-radius: 28px;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 0 80px rgba(212, 168, 83, 0.08);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.countdown-section:hover {
    transform: translateY(-4px);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08) inset,
        0 0 120px rgba(212, 168, 83, 0.15);
}
.countdown-label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-gold);
    margin-bottom: 6px;
    font-weight: 500;
}
.countdown-holiday-name {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: #f5e6c8;
    margin-bottom: 4px;
    letter-spacing: 0.02em;
}
.countdown-date-preview {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 22px;
}
.countdown-timer {
    display: flex;
    justify-content: center;
    gap: clamp(10px, 3vw, 22px);
    flex-wrap: wrap;
}
.countdown-block {
    background: rgba(10, 10, 25, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 18px clamp(14px, 3vw, 24px);
    min-width: 80px;
    text-align: center;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
    overflow: hidden;
}
.countdown-block::after {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(212, 168, 83, 0.08) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.4s;
}
.countdown-block:hover::after { opacity: 1; }
.countdown-block:hover {
    transform: translateY(-6px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(212, 168, 83, 0.3) inset,
        0 0 40px rgba(212, 168, 83, 0.2);
    border-color: rgba(212, 168, 83, 0.5);
}
.countdown-number {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 900;
    color: #fff;
    line-height: 1;
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
    font-family: 'SF Mono', 'Cascadia Code', 'Consolas', 'Monaco', monospace;
    text-shadow: 0 0 30px rgba(212, 168, 83, 0.5);
    transition: transform 0.15s ease;
}
.countdown-number.pulse {
    animation: numberPulse 0.5s ease-out;
}
@keyframes numberPulse {
    0% { transform: scale(1.25); text-shadow: 0 0 50px rgba(240, 208, 120, 1); }
    100% { transform: scale(1); text-shadow: 0 0 30px rgba(212, 168, 83, 0.5); }
}
.countdown-unit {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--text-gold);
    margin-top: 4px;
    font-weight: 500;
}

/* ── Table Section ── */
.table-section {
    position: relative;
    z-index: 2;
    margin: 20px auto 60px;
    max-width: 1050px;
    background: var(--surface-glass);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border-glass);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04) inset,
        0 0 80px rgba(20, 184, 166, 0.06);
    transition: box-shadow 0.5s ease;
}
.table-section:hover {
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.06) inset,
        0 0 140px rgba(20, 184, 166, 0.12);
}
.table-header-bar {
    padding: 22px 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.table-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: #f0e6d0;
    letter-spacing: 0.03em;
}
.table-badge {
    font-size: 0.75rem;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(20, 184, 166, 0.15);
    border: 1px solid rgba(20, 184, 166, 0.3);
    color: var(--emerald-glow);
    letter-spacing: 0.06em;
    font-weight: 500;
    animation: badgeGlow 3s ease-in-out infinite;
}
@keyframes badgeGlow {
    0%, 100% { box-shadow: 0 0 8px rgba(20, 184, 166, 0.2); }
    50% { box-shadow: 0 0 22px rgba(20, 184, 166, 0.45); }
}

/* ── Desktop table (standard) ── */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px; /* ensures proper spacing on desktop, overridden on mobile */
}
thead th {
    padding: 16px 18px;
    text-align: center;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-gold);
    font-weight: 600;
    border-bottom: 2px solid rgba(212, 168, 83, 0.25);
    background: rgba(10, 10, 20, 0.3);
    position: sticky;
    top: 0;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
thead th:first-child {
    text-align: left;
}
tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: all 0.35s ease;
    position: relative;
}
tbody tr::before {
    content: '';
    position: absolute;
    left: 0; top: 0;
    height: 100%;
    width: 3px;
    background: var(--gold);
    transform: scaleY(0);
    transition: transform 0.35s ease;
    border-radius: 0 3px 3px 0;
}
tbody tr:hover::before { transform: scaleY(1); }
tbody tr:hover {
    background: var(--surface-glass-hover);
    box-shadow: 0 0 35px rgba(212, 168, 83, 0.08) inset;
}
tbody tr.passed { opacity: 0.55; }
tbody tr.passed:hover { opacity: 0.8; }
tbody td {
    padding: 15px 18px;
    font-size: 0.95rem;
    color: var(--text-primary);
    vertical-align: middle;
    letter-spacing: 0.01em;
    text-align: center;
}
.holiday-name-cell {
    font-weight: 600;
    color: #f2e4c8;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}
.holiday-icon {
    width: 34px; height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.icon-islamic { background: rgba(212, 168, 83, 0.2); color: var(--gold-bright); }
.icon-national { background: rgba(20, 184, 166, 0.2); color: var(--emerald-glow); }
.icon-international { background: rgba(190, 18, 60, 0.2); color: #f472b6; }
.islamic-date-cell {
    font-family: var(--font-arabic);
    color: var(--text-gold);
    letter-spacing: 0.02em;
    font-size: 0.95rem;
    direction: rtl;
    unicode-bidi: embed;
}
.status-badge {
    display: inline-block;
    padding: 5px 13px;
    border-radius: 14px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.status-upcoming {
    background: rgba(20, 184, 166, 0.18);
    color: #5eeadb;
    border: 1px solid rgba(20, 184, 166, 0.35);
    animation: statusPulse 2.5s ease-in-out infinite;
}
@keyframes statusPulse {
    0%, 100% { box-shadow: 0 0 6px rgba(20, 184, 166, 0.2); }
    50% { box-shadow: 0 0 18px rgba(20, 184, 166, 0.5); }
}
.status-passed {
    background: rgba(255, 255, 255, 0.05);
    color: #888;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.status-today {
    background: rgba(240, 208, 120, 0.2);
    color: #fde68a;
    border: 1px solid rgba(240, 208, 120, 0.5);
    animation: todayGlow 1.5s ease-in-out infinite;
}
@keyframes todayGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(240, 208, 120, 0.35); }
    50% { box-shadow: 0 0 28px rgba(240, 208, 120, 0.7); }
}

/* Weekend sad message badge */
.weekend-sad {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(190, 18, 60, 0.2);
    color: #f87191;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    border: 1px solid rgba(190, 18, 60, 0.35);
    vertical-align: middle;
    white-space: nowrap;
}

/* ── Shooting Star – hidden on mobile ── */
.shooting-star {
    position: fixed;
    z-index: 1;
    pointer-events: none;
    width: 2px; height: 2px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 6px 2px rgba(255, 255, 255, 0.8), 0 0 50px 10px rgba(212, 168, 83, 0.4);
    animation: shootStar var(--duration) linear forwards;
    display: block;
}
@keyframes shootStar {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    15% { transform: translate(80px, -50px) scale(1.5); opacity: 1; }
    60% { transform: translate(400px, -250px) scale(3); opacity: 0.6; }
    100% { transform: translate(700px, -440px) scale(0); opacity: 0; }
}

/* ── Sparkle Particles – hidden on mobile ── */
.sparkle {
    position: fixed;
    pointer-events: none;
    z-index: 3;
    border-radius: 50%;
    background: var(--gold-bright);
    box-shadow: 0 0 8px 3px rgba(240, 208, 120, 0.7);
    animation: sparkleRise 2.5s ease-out forwards;
    display: block;
}
@keyframes sparkleRise {
    0% { transform: translateY(0) scale(1); opacity: 1; }
    100% { transform: translateY(-180px) scale(0); opacity: 0; }
}

/* ── Footer ── */
.footer-note {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    opacity: 0.7;
    position: relative;
    z-index: 2;
}

/* ────────────────────────────────────
   MOBILE OPTIMISATIONS (width ≤ 768px)
   ──────────────────────────────────── */
@media (max-width: 768px) {
    /* Hide heavy effects */
    #starfield,
    .nebula-layer,
    .geo-pattern,
    .cursor-glow,
    .shooting-star,
    .sparkle {
        display: none !important;
    }

    body {
        background: #0a0a14;
    }

    /* Reduce blur */
    .countdown-section,
    .table-section {
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }

    /* Simplify hover states */
    .countdown-block:hover,
    .table-section:hover {
        transform: none;
        box-shadow: none;
    }
    tbody tr:hover::before { transform: scaleY(0); }
    tbody tr:hover {
        background: transparent;
        box-shadow: none;
    }
    .crescent-moon {
        filter: drop-shadow(0 0 20px rgba(212, 168, 83, 0.5));
    }

    /* ── Mobile Table: Card Layout ── */
    table {
        min-width: 0; /* remove forced min-width */
        border: 0;
    }
    thead {
        display: none; /* hide table headers */
    }
    tbody tr {
        display: block;
        margin-bottom: 20px;
        border: 1px solid var(--border-glass);
        border-radius: 14px;
        background: var(--surface-glass);
        backdrop-filter: blur(15px);
        -webkit-backdrop-filter: blur(15px);
        box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
        padding: 15px;
        position: relative;
        opacity: 1 !important; /* override passed opacity for readability */
    }
    tbody tr.passed {
        opacity: 0.7;
    }
    tbody tr::before {
        display: none; /* hide the left gold bar */
    }
    tbody td {
        display: block;
        text-align: right;
        padding: 10px 8px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        font-size: 0.9rem;
        position: relative;
        padding-left: 45%;
        white-space: normal;
        word-break: break-word;
    }
    tbody td:last-child {
        border-bottom: 0;
    }
    tbody td::before {
        content: attr(data-label);
        position: absolute;
        left: 8px;
        top: 50%;
        transform: translateY(-50%);
        font-weight: 600;
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        color: var(--text-gold);
        text-align: left;
        width: 35%;
        padding-right: 10px;
        word-break: break-word;
    }

    /* Override specific cell styles for mobile */
    .holiday-name-cell {
        display: inline; /* change from flex to inline to allow text-align right */
        text-align: right;
        justify-content: flex-end;
    }
    .holiday-name-cell .holiday-icon {
        display: inline-flex;
        margin-right: 6px;
        vertical-align: middle;
    }
    .weekend-sad {
        margin-left: 8px;
    }
    .islamic-date-cell {
        direction: ltr; /* ensure text is displayed left-to-right for the label to work */
        text-align: right;
    }
    .status-badge {
        display: inline-block;
    }
}

/* ── Reduced motion preference ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}