@font-face { font-family: "Amiri"; src: url("fonts/amiri-arabic-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Amiri"; src: url("fonts/amiri-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; unicode-range: U+0000-00FF; }
@font-face { font-family: "Noto Kufi Arabic"; src: url("fonts/noto-kufi-arabic-arabic-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200E, U+FB50-FDFF, U+FE70-FEFC; }
@font-face { font-family: "Noto Kufi Arabic"; src: url("fonts/noto-kufi-arabic-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+2000-206F, U+2190-21FF; }

/* A night sky in every mode: the tool is about the moon */
:root {
  --night: #0b1430;
  --night-2: #13204a;
  --card: rgb(255 255 255 / 0.05);
  --ink: #eef1f8;
  --soft: rgb(238 241 248 / 0.6);
  --line: rgb(238 241 248 / 0.14);
  --moon: #f2cf6e;
  --on-moon: #1b1406;
  --ui: "Noto Kufi Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --date: "Amiri", "Noto Kufi Arabic", serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); font: 400 15px/1.6 var(--ui); -webkit-font-smoothing: antialiased;
  background: radial-gradient(1200px 600px at 85% -10%, #22357a 0%, transparent 60%), radial-gradient(2px 2px at 20% 30%, rgb(255 255 255 / 0.5), transparent), radial-gradient(1.5px 1.5px at 70% 60%, rgb(255 255 255 / 0.35), transparent), radial-gradient(1.5px 1.5px at 40% 80%, rgb(255 255 255 / 0.3), transparent), linear-gradient(var(--night), var(--night-2)); }
a { color: inherit; text-underline-offset: 3px; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--moon); outline-offset: 2px; }

.bar { display: flex; align-items: center; gap: 6px 24px; flex-wrap: wrap; padding: 16px 28px 6px; }
.brand { margin: 0; font: 700 30px/1.25 var(--date); }
.purpose { margin: 0; color: var(--moon); font-weight: 600; }
.today { flex: 1; margin: 0; text-align: center; color: var(--soft); }
.bar-meta { color: var(--soft); font-size: 13px; }
.bar-meta .lang { margin-inline-start: 12px; unicode-bidi: isolate; }
.explain { margin: 2px 0 0; color: var(--soft); font-size: 12.5px; }
.app { display: flex; flex-direction: column; min-height: 100dvh; }
.sub { font-size: 12.5px; color: var(--soft); }

.sky { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 8px 28px 18px; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card { container-type: inline-size; position: relative; display: flex; flex-direction: column; justify-content: center; gap: 14px; padding: 26px 28px 22px; border: 1px solid var(--line); border-radius: 18px; background: var(--card); }
/* The moon sits next to the Hijri date, in the shape it has on that day */
.date-line { display: flex; align-items: center; gap: 16px; min-width: 0; }
.moon { flex: none; width: 60px; height: 60px; }
.moon { overflow: visible; }
.moon-dark { fill: rgb(255 255 255 / 0.07); }
.moon-lit { fill: var(--moon); filter: drop-shadow(0 0 8px rgb(242 207 110 / 0.5)); }

/* Month and year: arrows each side, the name in the middle */
.nav { display: flex; gap: 8px; flex-wrap: wrap; }
.step { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 12px; }
.arrow { width: 32px; height: 40px; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--soft); }
.arrow:hover { color: var(--ink); background: rgb(255 255 255 / 0.06); }
.pick { min-width: 110px; height: 40px; padding: 0 10px; border: 0; border-inline: 1px solid var(--line); background: none; font-weight: 700; font-size: 16px; }
.pick::after { content: " ▾"; color: var(--soft); font-size: 12px; }
.pick:hover { background: rgb(255 255 255 / 0.06); }
.year { width: 76px; height: 40px; border: 0; border-inline: 1px solid var(--line); background: none; text-align: center; font-weight: 700; font-size: 16px; }
.year:focus { outline: none; background: rgb(255 255 255 / 0.08); }

.big { margin: 4px 0 0; font: 700 min(72px, 7cqi)/1.25 var(--date); white-space: nowrap; } /* one line, as big as the card allows: "29 Jumada al-Akhirah 1448 AH" is the longest */
:lang(ar) .big { font-size: min(72px, 9cqi); }
.hijri .big { font-size: min(72px, 5.8cqi); } /* the moon takes part of the line */
:lang(ar) .hijri .big { font-size: min(72px, 8cqi); } /* "٢٩ جمادى الآخرة ١٤٤٨ هـ" is shorter */
.hijri .big { color: var(--moon); }
.foot { display: flex; align-items: center; gap: 8px; color: var(--soft); }
.foot span { margin-inline-end: auto; }
.copy { padding: 3px 12px; border: 1px solid var(--line); border-radius: 999px; background: none; font-size: 13px; }
.copy:hover { border-color: var(--moon); color: var(--moon); }

/* Month picker: twelve buttons, one tap */
.months { width: 320px; margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #16244f; color: var(--ink); box-shadow: 0 18px 40px rgb(0 0 0 / 0.45); position: fixed; inset: auto; }
.months:popover-open { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.months button { padding: 9px 4px; border: 1px solid transparent; border-radius: 10px; background: rgb(255 255 255 / 0.05); font-size: 14px; font-weight: 600; }
.months button:hover { border-color: var(--moon); }
.months button[aria-current="true"] { background: var(--moon); color: var(--on-moon); }

/* Day picker: the month's days in a grid, one tap */
.days-pop { width: 320px; margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 14px; background: #16244f; color: var(--ink); box-shadow: 0 18px 40px rgb(0 0 0 / 0.45); position: fixed; inset: auto; }
.days-pop:popover-open { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.days-pop.hijri-days:popover-open { grid-template-columns: repeat(6, 1fr); }
.days-pop button { display: grid; justify-items: center; gap: 1px; padding: 6px 0; border: 1px solid transparent; border-radius: 9px; background: rgb(255 255 255 / 0.05); line-height: 1.2; }
.days-pop b { font: 700 17px/1.1 var(--date); }
.days-pop small { font-size: 10px; color: var(--soft); white-space: nowrap; }
.days-pop button:hover { border-color: var(--moon); }
.days-pop button.is-today { border-color: var(--ink); }
.days-pop button[aria-current="date"] { background: var(--moon); color: var(--on-moon); }
.days-pop button[aria-current="date"] small { color: inherit; opacity: 0.75; }
.day-pick { min-width: 52px; }

/* Calculator: one line */
.calc { display: flex; align-items: stretch; gap: 10px; flex-wrap: wrap; }
.calc p { display: grid; gap: 2px; flex: 1 1 200px; margin: 0; padding: 10px 16px; border: 1px solid var(--line); border-radius: 14px; }
.calc .add { flex: 2 1 320px; }
.label { font-size: 13px; color: var(--soft); }
.calc b { font: 700 20px/1.4 var(--date); }
.calc input { width: 54px; padding: 0 4px; border: 0; border-bottom: 1px solid var(--soft); background: none; text-align: center; color: var(--ink); }
.calc input:focus { outline: none; border-bottom-color: var(--moon); }
.today-btn { padding: 0 22px; border: 0; border-radius: 14px; background: var(--moon); color: var(--on-moon); font-weight: 700; }
.note { margin: 0; color: var(--soft); font-size: 13px; }

.toast { position: fixed; left: 50%; bottom: 24px; margin: 0; padding: 10px 16px; border-radius: 12px; background: var(--moon); color: var(--on-moon); font-weight: 700; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
@media (max-width: 899px) {
  .bar, .sky { padding-inline: 16px; }
  .today { flex-basis: 100%; order: 3; text-align: start; }
  .pair { grid-template-columns: 1fr; }
  .moon { width: 40px; height: 40px; }
  /* Day and year side by side, the month under them across the card */
  .nav { display: grid; grid-template-columns: 1fr 1fr; }
  .nav .step:nth-child(2) { grid-column: 1 / -1; order: 3; }
  .step { justify-content: space-between; }
  .step .pick, .step .year { flex: 1; }
  .card { padding: 18px 18px 16px; }
  .big, .hijri .big { font-size: 30px; white-space: normal; }
  /* Arabic dates are shorter: one line, so "هـ" never sits alone */
  :lang(ar) .big { font-size: min(32px, 9.5cqi); white-space: nowrap; }
  :lang(ar) .hijri .big { font-size: min(32px, 7.6cqi); }
  .today-btn { flex: 1 1 100%; padding: 10px; }
}

/* Questions under the tool: for people who scroll, and for search engines */
.faq { max-width: 920px; margin: 0 auto; padding: 56px 20px 64px; }
.faq h2 { margin: 0 0 20px; font: 700 22px/1.2 var(--date); letter-spacing: -0.02em; }
.faq-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px 32px; }
.faq h3 { margin: 0 0 6px; font-size: 15px; font-weight: 700; }
.faq p { margin: 0; color: var(--soft); line-height: 1.6; }
