/* ==========================================================================
   clock.bh design system — inspired by barba.js.org
   Rubik + Space Mono, electric blue #2e5bdc with a vibrant multi-accent
   palette, light-first, bold type, flat cards with soft shadows.
   ========================================================================== */

:root {
    /* Brand (barba palette) */
    --blue: #2e5bdc;
    --blue-soft: #5a82f1;
    --orange: #ffa543;
    --red: #ec4343;
    --purple: #8c44d9;
    --green: #04bf0c;
    --cyan: #38d1f1;

    --font-sans: "Rubik", system-ui, -apple-system, sans-serif;
    --font-mono: "Space Mono", ui-monospace, "SF Mono", monospace;

    --fs-eyebrow: 0.78rem;
    --fs-body: 1rem;
    --fs-h2: clamp(1.6rem, 1.3rem + 1.6vw, 2.3rem);
    --fs-clock: clamp(3.2rem, 4rem + 9vw, 8.6rem);

    --sp-1: 0.25rem; --sp-2: 0.5rem; --sp-3: 0.75rem; --sp-4: 1rem;
    --sp-6: 1.5rem; --sp-8: 2rem; --sp-12: 3rem; --sp-16: 4rem;

    --r-sm: 10px; --r-md: 16px; --r-lg: 22px; --r-pill: 999px;

    --header-h: 68px;
    --maxw: 1140px;
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ------- Theme tokens ------- */
:root, :root[data-theme="light"] {
    color-scheme: light;
    --bg: #f5f7fc;
    --bg-2: #edf1fa;
    --surface: #ffffff;
    --surface-2: #f0f3fb;
    --border: #e0e6f5;
    --text: #21252b;
    --text-dim: #5b6474;
    --text-faint: #9da5b4;
    --primary: var(--blue);
    --on-primary: #ffffff;
    --shadow: 0 2px 6px rgba(33, 37, 43, 0.04), 0 16px 40px rgba(46, 91, 220, 0.07);
    --shadow-hover: 0 4px 10px rgba(33, 37, 43, 0.06), 0 20px 48px rgba(46, 91, 220, 0.13);
    --code-bg: #21252b;
    --code-text: #e8ecf7;
    --grid-line: rgba(46, 91, 220, 0.07);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #12141c;
    --bg-2: #171a26;
    --surface: #1c1f2d;
    --surface-2: #232738;
    --border: #2c3044;
    --text: #eef1f8;
    --text-dim: #a7b0c5;
    --text-faint: #6d7791;
    --primary: var(--blue-soft);
    --on-primary: #0c0f1a;
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.25), 0 16px 40px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.3), 0 20px 48px rgba(90, 130, 241, 0.16);
    --code-bg: #0c0f1a;
    --code-text: #d8e0f5;
    --grid-line: rgba(90, 130, 241, 0.08);
}

/* ------- Base ------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--fs-body);
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    transition: background 0.35s ease, color 0.35s ease;
}

.container { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--sp-6); }

.visually-hidden {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
    position: absolute; inset-inline-start: var(--sp-4); top: -60px;
    background: var(--primary); color: var(--on-primary);
    padding: var(--sp-2) var(--sp-4); border-radius: var(--r-sm);
    z-index: 100; transition: top 0.2s ease; text-decoration: none;
}
.skip-link:focus { top: var(--sp-4); }

a { color: var(--primary); }
a:focus-visible, button:focus-visible {
    outline: 2px solid var(--primary); outline-offset: 2px; border-radius: var(--r-sm);
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
}

.pulse-dot {
    width: 9px; height: 9px; border-radius: 50%;
    background: var(--green); display: inline-block; flex: none;
    box-shadow: 0 0 0 0 rgba(4, 191, 12, 0.5);
    animation: pulse 2.2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(4, 191, 12, 0.5); }
    70% { box-shadow: 0 0 0 9px rgba(4, 191, 12, 0); }
    100% { box-shadow: 0 0 0 0 rgba(4, 191, 12, 0); }
}

/* Section eyebrows: Space Mono + colored dot, barba-docs style */
.eyebrow {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    font-family: var(--font-mono); font-size: var(--fs-eyebrow);
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--text-dim); margin: 0 0 var(--sp-3);
}
.eyebrow::before {
    content: ""; width: 9px; height: 9px; border-radius: 3px;
    background: var(--eyebrow-color, var(--primary));
}

/* ------- Barba wipe overlay ------- */
#barba-wipe {
    position: fixed; inset: 0; z-index: 200;
    background: linear-gradient(135deg, var(--blue), var(--blue-soft) 55%, var(--cyan));
    transform: translateY(101%);
    transition: transform 0.55s cubic-bezier(0.65, 0, 0.35, 1);
    pointer-events: none;
}
#barba-wipe.is-covering { transform: translateY(0); pointer-events: all; }
#barba-wipe::after {
    content: "clock.bh";
    position: absolute; inset: 0; display: grid; place-items: center;
    font-family: var(--font-mono); font-weight: 700; font-size: clamp(1.4rem, 4vw, 2.4rem);
    color: #fff; letter-spacing: -0.02em;
}

/* ------- Header ------- */
.site-header {
    position: fixed; inset-inline: 0; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease;
}
.site-header.scrolled { border-bottom-color: var(--border); }
.header-inner {
    height: var(--header-h);
    display: flex; align-items: center; gap: var(--sp-6);
}
.brand { display: flex; align-items: center; gap: var(--sp-3); text-decoration: none; color: var(--text); }
.brand-mark { width: 42px; height: 42px; color: var(--text); transition: transform 0.3s var(--ease-out); }
.brand:hover .brand-mark { transform: rotate(12deg); }
.brand-name { font-weight: 800; font-size: 1.3rem; letter-spacing: -0.03em; }
.brand-tld { color: var(--primary); }
.header-nav { display: flex; gap: var(--sp-6); margin-inline-start: auto; }
.header-nav a {
    color: var(--text-dim); text-decoration: none; font-weight: 500;
    font-size: 0.95rem; position: relative; padding: 2px 0;
}
.header-nav a::after {
    content: ""; position: absolute; inset-inline: 0; bottom: -3px; height: 2px;
    background: var(--primary); border-radius: 2px;
    transform: scaleX(0); transform-origin: center;
    transition: transform 0.25s var(--ease-out);
}
.header-nav a:hover, .header-nav a.nav-active { color: var(--text); }
.header-nav a:hover::after, .header-nav a.nav-active::after { transform: scaleX(1); }
.header-actions { display: flex; align-items: center; gap: var(--sp-3); }

.icon-btn {
    display: grid; place-items: center;
    width: 40px; height: 40px; border-radius: var(--r-pill);
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text); cursor: pointer;
    transition: transform 0.2s var(--ease-out), border-color 0.2s ease;
}
.icon-btn:hover { transform: translateY(-1px); border-color: var(--primary); }
.icon-btn svg { width: 18px; height: 18px; }
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }

/* ------- Hero ------- */
.hero {
    position: relative; overflow: clip;
    padding: calc(var(--header-h) + var(--sp-16)) 0 var(--sp-16);
    background:
        radial-gradient(1000px 460px at 85% -5%, color-mix(in srgb, var(--cyan) 14%, transparent), transparent 60%),
        radial-gradient(900px 500px at 5% 10%, color-mix(in srgb, var(--blue) 12%, transparent), transparent 60%),
        linear-gradient(180deg, var(--bg-2), var(--bg));
}
.hero-bg { position: absolute; inset: 0; pointer-events: none; }

/* Astrolabe rings — slow-turning clock-face motif */
.astrolabe {
    position: absolute; top: -200px; inset-inline-end: -180px;
    width: 660px; height: 660px; opacity: 0.5; color: var(--primary);
    animation: astrolabe-spin 160s linear infinite;
}
.astrolabe-2 {
    top: auto; inset-inline-end: auto; top: 320px; inset-inline-start: -240px;
    width: 540px; height: 540px; opacity: 0.3; color: var(--cyan);
    animation-direction: reverse; animation-duration: 210s;
}
@keyframes astrolabe-spin { to { transform: rotate(360deg); } }

/* Fine blueprint grid */
.hero::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 54px 54px;
    mask-image: radial-gradient(950px 520px at 50% 0%, rgba(0,0,0,0.65), transparent 78%);
    -webkit-mask-image: radial-gradient(950px 520px at 50% 0%, rgba(0,0,0,0.65), transparent 78%);
}

.hero-inner { position: relative; text-align: center; }
.hero-eyebrow {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    font-family: var(--font-mono); font-size: var(--fs-eyebrow); font-weight: 700;
    letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--primary); margin: 0 0 var(--sp-6);
    padding: var(--sp-2) var(--sp-4);
    background: color-mix(in srgb, var(--primary) 9%, transparent);
    border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent);
    border-radius: var(--r-pill);
}

/* ---- Orchestrated page load ---- */
@keyframes rise {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: none; }
}
.hero-eyebrow, .clock-card, .hero-chips .chip {
    animation: rise 0.7s var(--ease-out) both;
}
.hero-eyebrow { animation-delay: 0.05s; }
.clock-card { animation-delay: 0.18s; }
.hero-chips .chip:nth-child(1) { animation-delay: 0.38s; }
.hero-chips .chip:nth-child(2) { animation-delay: 0.47s; }
.hero-chips .chip:nth-child(3) { animation-delay: 0.56s; }
.hero-chips .chip:nth-child(4) { animation-delay: 0.65s; }

.clock-card {
    display: inline-block;
    padding: var(--sp-8) clamp(var(--sp-6), 6vw, var(--sp-16));
    margin-inline: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow);
    border-top: 4px solid var(--primary);
}
.clock-time {
    display: flex; align-items: baseline; justify-content: center;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: var(--fs-clock);
    line-height: 1;
    letter-spacing: -0.03em;
    direction: ltr;
}
.clock-hm { font-size: 1em; }
.clock-s { font-size: 0.5em; color: var(--primary); font-weight: 700; }
.clock-ms { font-size: 0.2em; color: var(--text-faint); width: 2.2ch; text-align: start; }

.clock-meta {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: var(--sp-2) var(--sp-6); margin-top: var(--sp-4);
    color: var(--text-dim); font-size: 1.02rem;
}
.clock-hijri { color: var(--orange); font-weight: 500; }
.clock-sync {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    margin-top: var(--sp-5); padding: var(--sp-2) var(--sp-4);
    border-radius: var(--r-pill); background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-dim); font-family: var(--font-mono); font-size: 0.8rem;
    white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}

.hero-chips {
    display: flex; flex-wrap: wrap; justify-content: center;
    gap: var(--sp-3); margin-top: var(--sp-8);
}
.chip {
    display: flex; flex-direction: column; align-items: center;
    padding: var(--sp-3) var(--sp-6); border-radius: var(--r-md);
    width: 150px;
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
    transition: transform 0.25s var(--ease-out), border-color 0.25s ease, box-shadow 0.25s ease;
}
.chip:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: var(--shadow-hover);
}
.chip-addr { width: 170px; }
.chip-label {
    font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em;
    text-transform: uppercase; color: var(--text-faint); white-space: nowrap;
}
.chip-value {
    font-family: var(--font-mono); font-weight: 700; font-size: 1.02rem; margin-top: 2px;
    white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis;
    min-height: 1.4em;
}
.chip-copy {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    background: none; border: none; color: var(--primary); cursor: pointer;
    font-family: var(--font-mono); font-size: 1.02rem; font-weight: 700;
}
.chip-copy svg { width: 15px; height: 15px; opacity: 0.75; }

/* ------- Sections ------- */
.section { padding: var(--sp-16) 0 var(--sp-8); }
.section-head { text-align: center; margin-bottom: var(--sp-8); }
.section-head h2 {
    font-size: var(--fs-h2); margin: 0 0 var(--sp-2);
    letter-spacing: -0.03em; font-weight: 800;
}
.section-sub { color: var(--text-dim); max-width: 620px; margin: 0 auto; }

.grid { display: grid; gap: var(--sp-4); }
.grid-metrics { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.metric-card {
    padding: var(--sp-6); text-align: center;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); box-shadow: var(--shadow);
    border-top: 4px solid var(--card-accent, var(--green));
    transition: transform 0.25s var(--ease-out), box-shadow 0.25s ease;
}
.metric-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.metric-icon { width: 32px; height: 32px; margin: 0 auto var(--sp-3); color: var(--card-accent, var(--green)); }
.metric-icon svg { width: 100%; height: 100%; }
.metric-value {
    font-family: var(--font-mono); font-variant-numeric: tabular-nums;
    font-size: 1.65rem; font-weight: 700; line-height: 1.15;
}
.metric-label { color: var(--text-dim); font-size: 0.83rem; margin-top: var(--sp-1); }
.metrics-note {
    text-align: center; color: var(--text-faint); font-size: 0.85rem;
    max-width: 640px; margin: var(--sp-6) auto 0;
}

/* Section accent assignments */
#metrics { --eyebrow-color: var(--green); }
#weather { --eyebrow-color: var(--orange); }
#setup { --eyebrow-color: var(--purple); }
#about { --eyebrow-color: var(--cyan); }

/* ------- Weather ------- */
.grid-weather { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.w-card {
    padding: var(--sp-6);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); box-shadow: var(--shadow);
    transition: transform 0.25s var(--ease-out), box-shadow 0.25s ease;
}
.w-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.w-card h3 { margin: 0 0 var(--sp-3); font-size: 1.05rem; font-weight: 700; }

.w-main { border-top: 4px solid var(--orange); }
.w-wbgt { border-top: 4px solid var(--red); }
.w-tide { border-top: 4px solid var(--cyan); }

.w-main-top { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-4); }
.w-temp { font-family: var(--font-mono); font-size: 3.2rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.w-deg { font-size: 0.45em; color: var(--text-dim); font-weight: 700; }
.w-cond { font-size: 1.1rem; font-weight: 700; margin-top: var(--sp-1); }
.w-feels { color: var(--text-dim); font-size: 0.92rem; }
.w-icon { width: 64px; height: 64px; flex: none; }
.w-icon svg { width: 64px; height: 64px; }
.w-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-3);
    margin-top: var(--sp-6); padding-top: var(--sp-5);
    border-top: 1px solid var(--border);
}
.w-item { display: flex; flex-direction: column; gap: 1px; }
.w-label { font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); }
.w-val { font-family: var(--font-mono); font-weight: 700; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.weather-updated { color: var(--text-faint); font-size: 0.8rem; }

/* WBGT card */
.wbgt-head { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); }
.wbgt-flag {
    padding: 3px 12px; border-radius: var(--r-pill);
    font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
    color: #fff; background: var(--text-faint);
}
.wbgt-flag[data-flag="white"] { background: #94a3b8; color: #12141c; }
.wbgt-flag[data-flag="green"] { background: var(--green); }
.wbgt-flag[data-flag="yellow"] { background: var(--orange); color: #201a02; }
.wbgt-flag[data-flag="red"] { background: var(--red); }
.wbgt-flag[data-flag="black"] { background: #111; border: 1px solid #444; }
.wbgt-value { font-family: var(--font-mono); font-size: 2.9rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.wbgt-risk { font-weight: 700; font-size: 1.1rem; margin-bottom: var(--sp-3); }
.wbgt-note { color: var(--text-faint); font-size: 0.8rem; margin: var(--sp-2) 0 0; }

/* Tides */
.tide-next { font-size: 1.05rem; font-weight: 700; margin-bottom: var(--sp-3); }
.tide-list { list-style: none; margin: 0 0 var(--sp-3); padding: 0; display: grid; gap: var(--sp-2); min-height: 8.4em; }
.tide-list li {
    display: flex; justify-content: space-between; align-items: center;
    padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm);
    background: var(--surface-2); border: 1px solid var(--border);
    font-family: var(--font-mono); font-size: 0.9rem; font-variant-numeric: tabular-nums;
}
.tide-type-high { color: var(--blue); font-weight: 700; }
:root[data-theme="dark"] .tide-type-high { color: var(--cyan); }
.tide-type-low { color: var(--orange); font-weight: 700; }
.tide-note { color: var(--text-faint); font-size: 0.78rem; margin: 0 0 var(--sp-3); }
.sea-meta { display: flex; gap: var(--sp-6); color: var(--text-dim); font-size: 0.9rem; }
.sea-meta b { font-family: var(--font-mono); }

/* ------- Setup ------- */
.server-addr {
    display: flex; align-items: center; justify-content: center; gap: var(--sp-4);
    padding: var(--sp-5) var(--sp-6); max-width: 460px; margin: 0 auto var(--sp-8);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.server-addr code {
    font-family: var(--font-mono); font-size: 1.7rem; font-weight: 700; color: var(--primary);
    direction: ltr;
}

.copy-btn {
    display: inline-flex; align-items: center; gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-4); border-radius: var(--r-pill);
    background: var(--primary); color: #fff; border: none;
    font-weight: 700; font-size: 0.88rem; cursor: pointer;
    transition: transform 0.15s var(--ease-out), filter 0.15s ease;
}
.copy-btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.copy-btn:active { transform: scale(0.96); }
.copy-btn svg { width: 15px; height: 15px; }

.tabs {
    display: flex; flex-wrap: wrap; gap: var(--sp-1);
    padding: var(--sp-2); border-radius: var(--r-md);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
    max-width: 760px; margin: 0 auto var(--sp-4);
}
.tab {
    flex: 1 1 auto; padding: var(--sp-2) var(--sp-4);
    background: none; border: none; border-radius: var(--r-sm);
    color: var(--text-dim); font-weight: 500; font-size: 0.9rem; cursor: pointer;
    white-space: nowrap; font-family: var(--font-mono);
    transition: color 0.2s ease, background 0.25s ease;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--primary); color: #fff; font-weight: 700; }

.tab-panels { max-width: 760px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.code-block { position: relative; }
.code-block pre {
    margin: 0; padding: var(--sp-6);
    background: var(--code-bg); border: 1px solid var(--border);
    border-radius: var(--r-md); overflow-x: auto;
}
.code-block code {
    font-family: var(--font-mono); font-size: 0.88rem; line-height: 1.65;
    color: var(--code-text); direction: ltr; display: block; text-align: start;
}
.copy-block { position: absolute; top: var(--sp-3); inset-inline-end: var(--sp-3); z-index: 2; }

/* ------- About ------- */
.about-card {
    padding: var(--sp-8); max-width: 760px; margin: 0 auto;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); box-shadow: var(--shadow);
    border-top: 4px solid var(--cyan);
}
.about-card h2 { margin-top: 0; font-size: var(--fs-h2); letter-spacing: -0.03em; font-weight: 800; }
.about-card p { color: var(--text-dim); }
.about-links { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-5); }
.btn {
    display: inline-block; padding: var(--sp-3) var(--sp-6);
    border-radius: var(--r-pill); background: var(--primary);
    color: #fff; text-decoration: none; font-weight: 700;
    transition: transform 0.15s var(--ease-out), filter 0.15s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.08); }
.btn-ghost { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }

/* ------- Calendar page ------- */
.cal-hero { padding-top: calc(var(--header-h) + var(--sp-12)); }
.cal-heading {
    font-size: clamp(2rem, 1.6rem + 2.4vw, 3.2rem);
    letter-spacing: -0.03em; font-weight: 800; margin: 0 0 var(--sp-2);
}
.cal-nav {
    display: flex; align-items: center; gap: var(--sp-4);
    padding: var(--sp-4) var(--sp-6); margin: 0 auto var(--sp-6); max-width: 720px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.cal-nav-btn {
    display: grid; place-items: center; width: 42px; height: 42px;
    border-radius: var(--r-pill); border: 1px solid var(--border);
    background: var(--surface-2); color: var(--text); cursor: pointer;
    transition: transform 0.2s var(--ease-out), border-color 0.2s ease;
}
.cal-nav-btn:hover { transform: translateY(-1px); border-color: var(--primary); }
.cal-nav-btn svg { width: 18px; height: 18px; }
html[dir="rtl"] .rtl-flip { transform: scaleX(-1); }
.cal-current { flex: 1; text-align: center; }
.cal-month-greg { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.cal-month-hijri { font-family: var(--font-mono); color: var(--orange); font-size: 0.9rem; font-weight: 700; }
.cal-today-btn {
    padding: var(--sp-2) var(--sp-5); border-radius: var(--r-pill);
    background: var(--primary); color: #fff; border: none;
    font-weight: 700; cursor: pointer; font-size: 0.9rem;
}
.cal-grid-wrap {
    padding: var(--sp-4); max-width: 960px; margin: 0 auto var(--sp-6);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.cal-weekdays {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--sp-2);
    margin-bottom: var(--sp-2);
}
.cal-weekdays span {
    text-align: center; font-family: var(--font-mono); font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint);
    padding: var(--sp-2) 0;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: var(--sp-2); }
.cal-cell {
    min-height: 86px; padding: var(--sp-2);
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--r-sm);
    display: flex; flex-direction: column; gap: 2px;
}
.cal-blank { background: transparent; border-color: transparent; }
.cal-gday { font-family: var(--font-mono); font-weight: 700; font-size: 1.02rem; }
.cal-hday { font-family: var(--font-mono); font-size: 0.7rem; color: var(--orange); }
.cal-today { border-color: var(--primary); border-width: 2px; }
.cal-today .cal-gday { color: var(--primary); }
.cal-holiday { background: color-mix(in srgb, var(--red) 8%, var(--surface-2)); }
.cal-evt {
    font-size: 0.64rem; font-weight: 700; line-height: 1.25;
    padding: 2px 6px; border-radius: 6px; margin-top: 2px;
    display: block; overflow: hidden; text-overflow: ellipsis;
}
.cal-evt-holiday { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); }
.cal-evt-observance { background: color-mix(in srgb, var(--orange) 22%, transparent); color: color-mix(in srgb, var(--orange) 70%, var(--text)); }
.cal-evt-event { background: color-mix(in srgb, var(--blue) 14%, transparent); color: var(--primary); }
.cal-events {
    padding: var(--sp-6); max-width: 960px; margin: 0 auto;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.cal-events-title { margin: 0 0 var(--sp-4); font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.cal-events-list { list-style: none; margin: 0 0 var(--sp-4); padding: 0; display: grid; gap: var(--sp-2); }
.cal-events-list li {
    display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap;
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm);
}
.cal-events-empty { color: var(--text-faint); }
.cal-evt-date { font-family: var(--font-mono); font-weight: 700; min-width: 88px; }
.cal-evt-name { flex: 1; font-weight: 500; }
.cal-evt-badge {
    font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700;
    padding: 3px 10px; border-radius: var(--r-pill); text-transform: uppercase; letter-spacing: 0.06em;
}
.cal-note { color: var(--text-faint); font-size: 0.82rem; margin: 0; }

/* ------- Footer ------- */
.site-footer {
    margin-top: var(--sp-12);
    border-top: 1px solid var(--border);
    background: var(--bg-2);
    padding: var(--sp-12) 0 var(--sp-6);
}
.footer-grid {
    display: grid; gap: var(--sp-8);
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.footer-grid h3 {
    font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase;
    letter-spacing: 0.12em; color: var(--text-faint); margin: 0 0 var(--sp-3);
}
.footer-tag { color: var(--text-dim); margin-top: var(--sp-2); }
.footer-disclaimer p { color: var(--text-dim); font-size: 0.88rem; }
.footer-links a { display: block; color: var(--text-dim); text-decoration: none; margin-bottom: var(--sp-2); }
.footer-links a:hover { color: var(--text); }
.footer-bottom {
    display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-3);
    margin-top: var(--sp-8); padding-top: var(--sp-5);
    border-top: 1px solid var(--border);
    color: var(--text-faint); font-size: 0.85rem;
}
.footer-status { display: inline-flex; align-items: center; gap: var(--sp-2); }

/* ------- Toast ------- */
.toast {
    position: fixed; bottom: var(--sp-6); left: 50%;
    transform: translate(-50%, 20px);
    background: var(--text); color: var(--bg);
    padding: var(--sp-3) var(--sp-6); border-radius: var(--r-pill);
    font-weight: 700; font-size: 0.9rem; opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease; z-index: 90;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ------- Reveal (below the fold) ------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.45s ease, transform 0.45s var(--ease-out); }
.reveal.visible { opacity: 1; transform: none; }
.grid-metrics .reveal:nth-child(2), .grid-weather .reveal:nth-child(2) { transition-delay: 0.08s; }
.grid-metrics .reveal:nth-child(3), .grid-weather .reveal:nth-child(3) { transition-delay: 0.16s; }
.grid-metrics .reveal:nth-child(4) { transition-delay: 0.24s; }
.grid-metrics .reveal:nth-child(5) { transition-delay: 0.32s; }
.grid-metrics .reveal:nth-child(6) { transition-delay: 0.4s; }

/* ------- Responsive ------- */
@media (max-width: 720px) {
    .header-nav { display: none; }
    .w-grid { grid-template-columns: repeat(2, 1fr); }
    .clock-ms { display: none; }
    .section { padding: var(--sp-12) 0 var(--sp-6); }
    .cal-cell { min-height: 64px; }
    .cal-evt { display: none; }
    .cal-evt:first-of-type { display: block; }
}

/* ------- Reduced motion ------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .pulse-dot, .astrolabe { animation: none; }
    .hero-eyebrow, .clock-card, .hero-chips .chip { animation: none; }
    #barba-wipe { transition: none; }
    .reveal { opacity: 1; transform: none; transition: none; }
    * { transition-duration: 0.01ms !important; }
}
