/* islamicdate.today. One markup, four themes chosen in the admin:
   utility (B), mosaic (C), combo (B layout + C Arabic name and star band), ramadan. */

:root, [data-theme="utility"] {
  --bg: #ffffff; --surface: #f4f7fc; --surface-2: #ffffff; --ink: #0e1a2b; --muted: #4f5d70; --line: #dde3ec;
  --accent: #1a6b47; --accent-ink: #ffffff; --accent-soft: #e6f2ec; --accent-2: #b4540f;
  --header-bg: #ffffff; --header-ink: #0e1a2b; --header-muted: #445266; --header-line: #e3e8ef;
  --font: "IBM Plex Sans", system-ui, sans-serif; --font-ar: "IBM Plex Sans Arabic", "Noto Naskh Arabic", serif;
  --radius: 14px; --radius-lg: 18px; --day-weight: 700;
}
[data-theme="mosaic"] {
  --bg: #f3f2ef; --surface: #ffffff; --surface-2: #f8f7f4; --ink: #1c1c3a; --muted: #55557a; --line: #e2e0da;
  --accent: #23235b; --accent-ink: #ffffff; --accent-soft: #ededf7; --accent-2: #8a5a10;
  --header-bg: #23235b; --header-ink: #f3f2ef; --header-muted: #d6d6ee; --header-line: #23235b;
  --font: Outfit, system-ui, sans-serif; --font-ar: Amiri, "Noto Naskh Arabic", serif;
  --radius: 22px; --radius-lg: 28px; --day-weight: 700;
}
[data-theme="combo"] {
  --bg: #ffffff; --surface: #f5f6fb; --surface-2: #ffffff; --ink: #121a33; --muted: #4d5672; --line: #dfe2ee;
  --accent: #23235b; --accent-ink: #ffffff; --accent-soft: #eceef9; --accent-2: #8a5a10;
  --header-bg: #23235b; --header-ink: #f3f2ef; --header-muted: #d6d6ee; --header-line: #23235b;
  --font: "IBM Plex Sans", system-ui, sans-serif; --font-ar: Amiri, "Noto Naskh Arabic", serif;
  --radius: 14px; --radius-lg: 18px; --day-weight: 700;
}
[data-theme="ramadan"] {
  --bg: #14143a; --surface: #1e1e4c; --surface-2: #26265a; --ink: #f6efdf; --muted: #cfc9e8; --line: #2f2f66;
  --accent: #f3b54a; --accent-ink: #14143a; --accent-soft: #2a2a5e; --accent-2: #f8cf82;
  --header-bg: #14143a; --header-ink: #f6efdf; --header-muted: #cfc9e8; --header-line: #2a2a5e;
  --font: Outfit, system-ui, sans-serif; --font-ar: Amiri, "Noto Naskh Arabic", serif;
  --radius: 22px; --radius-lg: 26px; --day-weight: 700;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.6; }
a { color: var(--accent); text-underline-offset: 3px; }
[data-theme="ramadan"] a { color: var(--accent); }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding-inline: 20px; }
.muted { color: var(--muted); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 10px 14px; border-radius: 10px; z-index: 10; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[data-theme="ramadan"] :focus-visible { outline-color: var(--accent-2); }
button, input, select, textarea { font: inherit; }

/* Header */
.site-header { background: var(--header-bg); color: var(--header-ink); border-bottom: 1px solid var(--header-line); }
.header-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding-block: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--header-ink); text-decoration: none; font-weight: 700; font-size: 19px; }
.brand-mark { display: block; flex: none; }
.brand-tld { color: var(--accent); }
[data-theme="mosaic"] .brand-tld, [data-theme="combo"] .brand-tld { color: #f0be63; }
.main-nav { display: flex; flex-wrap: wrap; gap: 2px; }
.main-nav a { color: var(--header-muted); text-decoration: none; font-size: 15px; padding: 10px 11px; border-radius: 10px; min-height: 44px; display: inline-flex; align-items: center; }
.main-nav a:hover { color: var(--header-ink); }
.main-nav a[aria-current="page"] { color: var(--header-ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
[data-theme="mosaic"] .main-nav a[aria-current="page"], [data-theme="combo"] .main-nav a[aria-current="page"] { box-shadow: inset 0 -2px 0 #f0be63; }
.star-band { display: none; }
[data-theme="mosaic"] .star-band, [data-theme="combo"] .star-band { display: block; }
.star-band path { fill: #e2a43b; opacity: .55; }

/* Hero */
.hero { padding-block: 28px 8px; }
.hero-row { display: flex; flex-wrap: wrap; gap: 24px 40px; align-items: center; }
.hero-main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.eyebrow { margin: 0; color: var(--muted); font-size: 15px; }
.hero h1 { font-size: clamp(30px, 6vw, 44px); font-weight: 700; letter-spacing: -.5px; }
[data-theme="mosaic"] .hero h1, [data-theme="ramadan"] .hero h1 { font-size: clamp(24px, 4vw, 30px); font-weight: 600; letter-spacing: 0; }
.hero-ar, .ramadan-greeting { display: none; margin: 0; font-family: var(--font-ar); line-height: 1.3; }
[data-theme="mosaic"] .hero-ar, [data-theme="combo"] .hero-ar { display: block; font-size: clamp(34px, 7vw, 48px); color: var(--accent-2); order: 3; }
[data-theme="ramadan"] .ramadan-greeting { display: block; font-size: 30px; color: var(--accent); order: -1; }
.hero-note { margin: 0; color: var(--muted); max-width: 62ch; order: 6; }
.hero-note strong { color: var(--ink); }
.hero-art { flex: 0 1 240px; display: none; justify-content: center; }
[data-theme="ramadan"] .hero-art { display: flex; }
.art-moon { display: none; }
.art-lantern { width: 200px; }
.l-gold { stroke: var(--accent); } .l-fill { fill: var(--accent); } .l-body { fill: var(--surface-2); stroke: var(--accent); } .l-flame { fill: var(--accent-2); opacity: .85; }
@media (max-width: 700px) { [data-theme="ramadan"] .hero-art { display: none; } }

/* Date cards */
.date-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; order: 4; }
@media (max-width: 560px) { .date-cards { grid-template-columns: 1fr; } }
.date-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; display: flex; flex-direction: column; gap: 4px; }
.date-card p { margin: 0; }
.date-card__label { font-size: 13px; font-weight: 600; letter-spacing: .6px; text-transform: uppercase; color: var(--accent); }
.date-card--world .date-card__label { color: var(--accent-2); }
.date-card__value { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.date-card__day { font-size: 56px; font-weight: var(--day-weight); line-height: 1; font-variant-numeric: tabular-nums; }
.date-card__month { font-size: 22px; font-weight: 600; }
.date-card__ar, .date-card__ur { font-family: var(--font-ar); font-size: 20px; color: var(--muted); }
[data-theme="utility"] .date-card--local { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 28%, transparent); }
[data-theme="utility"] .date-card--world { background: var(--surface-2); }
[data-theme="mosaic"] .date-card--local { background: var(--surface); border: 0; box-shadow: 0 1px 0 var(--line); }
[data-theme="mosaic"] .date-card--local .date-card__day { font-size: 96px; color: var(--accent); }
[data-theme="mosaic"] .date-card--world { background: var(--accent-soft); border: 0; }
[data-theme="combo"] .date-card--local { background: var(--accent-soft); border-color: #d3d6ee; }
[data-theme="combo"] .date-card--local .date-card__day { color: var(--accent); }
[data-theme="ramadan"] .date-card--local { background: var(--surface); border-color: var(--line); }
[data-theme="ramadan"] .date-card--local .date-card__day { color: var(--accent); font-size: 80px; }
[data-theme="ramadan"] .date-card--world { background: transparent; }

/* Ramadan progress */
.progress { display: flex; flex-direction: column; gap: 6px; max-width: 520px; order: 5; }
.progress__label { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.progress__bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress__bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; padding-block: 20px; }
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .tiles { grid-template-columns: 1fr; } }
.tile { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); min-height: 44px; }
a.tile:hover { border-color: var(--accent); }
.tile__label { font-size: 13px; color: var(--muted); }
.tile__value { font-size: 21px; font-weight: 600; }
.tile__meta { font-size: 14px; color: var(--accent); }
.tile.tile--accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tile--accent .tile__label, .tile--accent .tile__meta { color: var(--accent-ink); opacity: .9; }
[data-theme="utility"] .tile--accent { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
[data-theme="utility"] .tile--accent .tile__label { color: var(--muted); opacity: 1; }
[data-theme="utility"] .tile--accent .tile__meta { color: var(--accent); opacity: 1; }
.tile__row { display: flex; gap: 8px; }
.tile__row input { flex: 1 1 auto; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); min-height: 44px; }
.btn, .tile__row button, .tool button[type="submit"], .tool .btn { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 10px 16px; font-weight: 600; cursor: pointer; min-height: 44px; }
.btn--ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }

/* Sections */
.section { padding-block: 20px; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 16px; margin-bottom: 12px; }
.section-head h2 { font-size: 24px; }

/* Calendar */
.cal-wrap { overflow-x: auto; }
.cal { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; min-width: 320px; }
.cal caption { text-align: left; color: var(--muted); font-size: 14px; padding-bottom: 6px; }
.cal th { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); padding: 6px 2px; }
.cal td { background: var(--surface); border-radius: 12px; padding: 8px 6px; vertical-align: top; height: 58px; }
.cal__empty { background: transparent !important; }
.cal__h { display: block; font-size: 18px; font-weight: 700; }
.cal__g { display: block; font-size: 12px; color: var(--muted); }
.cal__fri { box-shadow: inset 0 0 0 1px var(--line); }
.cal__today { background: var(--accent) !important; color: var(--accent-ink); }
.cal__today .cal__g { color: var(--accent-ink); opacity: .85; }
[data-theme="utility"] .cal td { background: var(--surface); }
@media (max-width: 480px) { .cal { border-spacing: 2px; } .cal td { padding: 6px 3px; height: 50px; } .cal__h { font-size: 16px; } .cal__g { font-size: 10.5px; } }

/* Events */
.events { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.events li + li { border-top: 1px solid var(--line); }
.events a { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; padding: 14px 16px; text-decoration: none; color: var(--ink); min-height: 44px; }
.events a:hover { background: var(--surface); }
.events__name { font-weight: 600; }
.events__date { font-size: 14px; color: var(--muted); grid-column: 1; }
.events__days { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-weight: 700; color: var(--accent); }

/* Regional list */
.regional h2 { font-size: 24px; margin-bottom: 12px; }
.regional__list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin: 0; }
@media (max-width: 640px) { .regional__list { grid-template-columns: 1fr; } }
.regional__list div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.regional__list dt { color: var(--muted); }
.regional__list dd { margin: 0; font-weight: 600; text-align: right; }
.regional__list dd[lang] { font-family: var(--font-ar); font-size: 19px; }

/* Article */
.prose { max-width: 760px; padding-block: 24px; }
.prose h2 { font-size: 26px; margin: 32px 0 12px; }
.prose h3 { font-size: 20px; margin: 24px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose li { margin-bottom: 6px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 16px; }
.prose th, .prose td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose .table-wrap { overflow-x: auto; margin-bottom: 16px; }
.prose .callout, .callout { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 16px; }
.prose code, .prose pre { font-family: ui-monospace, Consolas, monospace; font-size: 14px; }
.prose pre { background: var(--surface); padding: 14px; border-radius: 12px; overflow-x: auto; }

/* Page header for inner pages */
.page-head { padding-block: 28px 8px; display: flex; flex-direction: column; gap: 10px; }
.page-head h1 { font-size: clamp(28px, 5vw, 40px); }
.page-head .lede { margin: 0; color: var(--muted); font-size: 18px; max-width: 64ch; }
.crumbs { font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); }

/* Tools */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; margin-block: 12px 8px; display: flex; flex-direction: column; gap: 14px; }
.tool__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.tool label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--muted); }
.tool input, .tool select, .tool textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); min-height: 44px; }
.tool textarea { min-height: 140px; }
.tool table th, .tool table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 15px; white-space: nowrap; }
.tool table th { font-size: 13px; color: var(--muted); font-weight: 600; }
.tool table tr.is-today td { background: var(--accent-soft); font-weight: 600; }
.result { background: var(--surface-2); border-radius: var(--radius); padding: 18px; }
.result__big { font-size: clamp(26px, 5vw, 34px); font-weight: 700; margin: 0; }
.result p { margin: 4px 0 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg a { padding: 10px 14px; text-decoration: none; color: var(--muted); min-height: 44px; display: inline-flex; align-items: center; }
.seg a[aria-current="true"] { background: var(--accent); color: var(--accent-ink); }
.notice { border-radius: var(--radius); padding: 12px 16px; background: var(--accent-soft); }
.notice--bad { background: #fde8e8; color: #7a1414; }
[data-theme="ramadan"] .notice--bad { background: #4a1e2e; color: #ffd6dc; }

/* Countdown */
.countdown { display: flex; flex-wrap: wrap; gap: 10px; }
.countdown__part { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: flex; align-items: baseline; gap: 6px; }
.countdown__num { font-size: 36px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.countdown__unit { color: var(--muted); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; } }
.fact { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.fact p { margin: 0; }
.fact__label { font-size: 13px; color: var(--muted); }
.fact__value { font-size: 20px; font-weight: 600; }

/* FAQ, related */
.faq { max-width: 760px; padding-block: 8px 24px; }
.faq h2 { font-size: 26px; margin-bottom: 12px; }
.faq__item { border-bottom: 1px solid var(--line); }
.faq__item summary { cursor: pointer; padding: 14px 0; font-weight: 600; min-height: 44px; }
.faq__item p { margin: 0 0 16px; color: var(--muted); }
.related { max-width: 760px; padding-block: 8px 24px; }
.related h2 { font-size: 22px; margin-bottom: 10px; }
.related ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.related a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; background: var(--surface-2); }

/* Footer */
.site-footer { margin-top: 32px; border-top: 1px solid var(--line); background: var(--surface); }
[data-theme="mosaic"] .site-footer, [data-theme="combo"] .site-footer { background: #23235b; color: #e6e6f5; border: 0; }
[data-theme="mosaic"] .site-footer a, [data-theme="combo"] .site-footer a { color: #e6e6f5; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; padding-block: 32px; }
@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-grid nav { display: flex; flex-direction: column; gap: 2px; }
.footer-grid nav a { padding: 6px 0; text-decoration: none; font-size: 15px; }
.footer-brand { font-weight: 700; margin: 0 0 8px; }
.footer-note { margin: 0; font-size: 15px; opacity: .85; max-width: 42ch; }
.footer-title { margin: 0 0 4px; font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: .6px; opacity: .8; }
.footer-bottom { padding-block: 16px 28px; font-size: 14px; opacity: .75; }

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* Names the script of the Arabic and Urdu date lines (people search "arabic date today", "urdu date today"). */
.date-card__tag { font-family: var(--font); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; opacity: .65; margin-inline-start: 8px; vertical-align: middle; }

/* Urdu (Nastaliq) and Sindhi (Naskh) text on /urdu-date-today/ and /sindhi-date-today/. Nastaliq needs tall lines. */
.script-ur { font-family: "Noto Nastaliq Urdu", "Noto Naskh Arabic", serif; line-height: 2.2; }
.script-sd { font-family: "Noto Naskh Arabic", serif; line-height: 1.9; }
.script-date { font-size: clamp(24px, 4.2vw, 34px); font-weight: 700; margin: 0; color: var(--ink); }
.script-line { font-size: 20px; margin: 0; color: var(--muted); }
.prose td .script-ur, .prose td .script-sd { font-size: 19px; }
.prose tr.is-today td { background: var(--accent-soft, rgba(26,107,71,.08)); font-weight: 600; }

/* Share bar: WhatsApp's dark green keeps white text readable (7.6:1); "More" opens the phone's share sheet. */
.share-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; order: 7; }
.share-wa, .share-more { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: 999px; font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; }
.share-wa { background: #075e54; color: #fff; }
.share-wa:hover { background: #054c44; color: #fff; }
.share-more { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.share-more[hidden] { display: none; }

/* Daily date alert button (Web Push). Shown by site.js only where push works. */
.push-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: 999px; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; background: transparent; color: var(--accent); border: 1px solid var(--accent); order: 8; align-self: flex-start; }
.push-btn[hidden] { display: none; }
.push-btn.is-on { color: var(--muted); border-color: var(--line); }
.push-btn:disabled { opacity: .6; cursor: progress; }
.site-footer .push-btn { margin-top: 12px; }

/* Cards: tools, apps, other sites (visuals.js cards()) */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin: 8px 0 20px; }
.cards--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.cards--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); }
.card { display: flex; flex-direction: column; gap: 6px; padding: 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
a.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 24px rgb(14 26 43 / 8%); }
.card__icon { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.card__title { font-weight: 600; font-size: 17px; }
.card__text { color: var(--muted); font-size: 15px; line-height: 1.5; flex: 1; }
.card__cta { color: var(--accent); font-weight: 600; font-size: 15px; margin-top: 4px; }
.prose .cards { max-width: none; }

/* Diagrams (visuals.js); colours follow the theme */
.viz { margin: 8px 0 24px; }
.viz svg { display: block; width: 100%; height: auto; }
.viz figcaption { color: var(--muted); font-size: 14px; margin-top: 8px; text-align: center; }
.viz .panel, .viz .cell { fill: var(--surface); }
.viz .cell { stroke: var(--line); }
.viz .cell--on { fill: var(--accent); stroke: var(--accent); }
.viz .line { stroke: var(--line); stroke-width: 2; fill: none; }
.viz .dark { fill: #2b3445; }
.viz .lit { fill: #f3d48a; }
.viz .box { fill: var(--surface-2); stroke: var(--line); stroke-width: 1.5; }
.viz .box--yes { stroke: var(--accent); stroke-width: 2; }
.viz .box--no { stroke: #d19a3a; stroke-width: 2; }
.viz .decide { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.viz .flow { stroke: var(--muted); stroke-width: 1.8; fill: none; }
.viz .arrowhead { fill: var(--muted); }
.viz text { font-family: var(--font); font-size: 15px; }
.viz .t-strong { fill: var(--ink); font-weight: 600; }
.viz .t-mut { fill: var(--muted); }
.viz .t-acc { fill: var(--accent); }
.viz .t-gold { fill: #b07a1c; }
.viz .t-on { fill: var(--accent-ink); }
.viz .viz-n { display: none; }
@media (max-width: 560px) { .viz .viz-w { display: none; } .viz .viz-n { display: block; max-width: 420px; margin: 0 auto; } }

/* Homepage: the moon tonight */
.moon-today { display: grid; grid-template-columns: 180px 1fr; gap: 24px; align-items: center; background: linear-gradient(135deg, #0f2a3d, #173f33); color: #eef4f0; border-radius: var(--radius-lg); padding: 24px; margin-block: 24px; }
.moon-today h2 { color: #fff; font-size: 24px; margin: 0 0 8px; }
.moon-today p { margin: 0 0 10px; color: #d7e4dc; }
.moon-today strong { color: #f7dc8c; }
.moon-today .viz { margin: 0; }
.moon-today svg { width: 180px; height: 180px; }
@media (max-width: 600px) { .moon-today { grid-template-columns: 1fr; } .moon-today h2 { text-align: center; } .moon-today svg { margin: 0 auto; width: 140px; height: 140px; } }

/* Homepage: the 12 months */
.months-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 10px; }
.months-grid a { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "num name" "num ar" "num meaning"; column-gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--ink); text-decoration: none; height: 100%; box-sizing: border-box; }
.months-grid a:hover { border-color: var(--accent); }
.months-grid__num { grid-area: num; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 15px; }
.months-grid__name { grid-area: name; font-weight: 600; }
.months-grid__ar { grid-area: ar; font-family: var(--font-ar); color: var(--muted); font-size: 17px; text-align: left; }
.months-grid__meaning { grid-area: meaning; color: var(--muted); font-size: 13px; }
.months-grid__sacred { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: #8a5a10; background: #fbf0d9; border-radius: 999px; padding: 1px 7px; margin-left: 4px; vertical-align: 2px; }
.months-grid .is-now a { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.months-grid .is-now .months-grid__num { background: var(--accent); color: var(--accent-ink); }
.months-grid .is-now .months-grid__meaning { color: var(--accent); font-weight: 600; }

/* Header: dark mode button; on phones the menu is one row that scrolls sideways */
.main-nav { margin-left: auto; }
.mode-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none; border: 1px solid var(--header-line); border-radius: 12px; background: transparent; color: var(--header-ink); cursor: pointer; }
.mode-btn:hover { border-color: var(--accent); }
.mode-btn .i-sun { display: none; }
[data-mode="dark"] .mode-btn .i-sun { display: block; } [data-mode="dark"] .mode-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-mode="light"]) .mode-btn .i-sun { display: block; } :root:not([data-mode="light"]) .mode-btn .i-moon { display: none; } }
[data-theme="ramadan"] .mode-btn { display: none; }
@media (max-width: 760px) {
  .header-row { flex-wrap: wrap; padding-block: 10px 0; gap: 4px 12px; }
  .brand { font-size: 18px; }
  .mode-btn { width: 40px; height: 40px; margin-left: auto; }
  .main-nav { order: 3; flex: 0 0 calc(100% + 40px); margin: 0 -20px; padding: 0 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .main-nav::-webkit-scrollbar { display: none; }
  .main-nav a { flex: none; font-size: 15px; padding: 8px 10px; min-height: 44px; white-space: nowrap; }
}

/* Smaller type on phones */
@media (max-width: 560px) {
  body { font-size: 16px; }
  .wrap { padding-inline: 16px; }
  .main-nav { flex-basis: calc(100% + 32px); margin: 0 -16px; }
  .hero { padding-block: 18px 4px; }
  .hero h1 { font-size: 26px; letter-spacing: -.3px; }
  .page-head { padding-block: 18px 4px; }
  .page-head h1 { font-size: 26px; }
  .page-head .lede { font-size: 16px; }
  .prose h2, .section-head h2, .related h2, .faq h2, .moon-today h2 { font-size: 21px; }
  .prose h2 { margin-top: 26px; }
  .prose h3 { font-size: 18px; }
  .date-card { padding: 16px; }
  .date-card__day { font-size: 46px; }
  .date-card__month { font-size: 19px; }
  .date-card__ar, .date-card__ur { font-size: 18px; }
  .tile__value, .fact__value { font-size: 18px; }
  .countdown__num { font-size: 30px; }
  .result__big { font-size: 24px; }
  .card { padding: 16px; }
  .moon-today { padding: 20px 16px; }
  .footer-grid { gap: 18px; padding-block: 24px; }
}

/* Dark mode: follows the phone or computer setting, or the header button (stored in localStorage) */
[data-mode="dark"]:not([data-theme="ramadan"]) {
  --bg: #0e1512; --surface: #16211c; --surface-2: #1a2721; --ink: #e6eee9; --muted: #a2b2a9; --line: #2a3a32;
  --accent: #5cc895; --accent-ink: #08140e; --accent-soft: #173327; --accent-2: #e3a95c;
  --header-bg: #0e1512; --header-ink: #e6eee9; --header-muted: #a2b2a9; --header-line: #2a3a32;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]):not([data-theme="ramadan"]) {
    --bg: #0e1512; --surface: #16211c; --surface-2: #1a2721; --ink: #e6eee9; --muted: #a2b2a9; --line: #2a3a32;
    --accent: #5cc895; --accent-ink: #08140e; --accent-soft: #173327; --accent-2: #e3a95c;
    --header-bg: #0e1512; --header-ink: #e6eee9; --header-muted: #a2b2a9; --header-line: #2a3a32;
    color-scheme: dark;
  }
}
[data-mode="dark"] .site-footer { background: var(--surface) !important; color: var(--ink) !important; }
[data-mode="dark"] .site-footer a { color: var(--accent) !important; }
[data-mode="dark"] .notice--bad { background: #4a1e24; color: #ffd6dc; }
[data-mode="dark"] .months-grid__sacred { background: #3a2c12; color: #f0c674; }
[data-mode="dark"] .viz .t-gold { fill: #e3a95c; }
[data-mode="dark"] a.card:hover { box-shadow: 0 8px 24px rgb(0 0 0 / 35%); }
@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) .site-footer { background: var(--surface) !important; color: var(--ink) !important; }
  :root:not([data-mode="light"]) .site-footer a { color: var(--accent) !important; }
  :root:not([data-mode="light"]) .notice--bad { background: #4a1e24; color: #ffd6dc; }
  :root:not([data-mode="light"]) .months-grid__sacred { background: #3a2c12; color: #f0c674; }
  :root:not([data-mode="light"]) .viz .t-gold { fill: #e3a95c; }
}
