/* GilTime — تقویم دیلمی
   Tokens first; seasons only change --accent. Light/dark via prefers-color-scheme or [data-theme]. */

@font-face { font-family: Vazir; src: url(../fonts/vazir/Vazir.woff2) format("woff2"), url(../fonts/vazir/Vazir.woff) format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: Vazir; src: url(../fonts/vazir/Vazir-Bold.woff2) format("woff2"), url(../fonts/vazir/Vazir-Bold.woff) format("woff"); font-weight: 700; font-display: swap; }

:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #f0ede6;
  --text: #1c2420;
  --muted: #646d68;
  --line: #e4e0d7;
  --holiday: #c62828;
  --shadow: 0 1px 2px rgba(28, 36, 32, .06), 0 6px 24px rgba(28, 36, 32, .06);
  --radius: 18px;
  --accent: #0b8fa6;
  --accent-ink: #ffffff;
  --accent-soft: rgba(11, 143, 166, .12);
  --accent-soft: color-mix(in srgb, var(--accent) 13%, transparent);
  --hero-ink: #ffffff;
  color-scheme: light;
}
[data-season="spring"] { --accent: #2f8f46; }
[data-season="summer"] { --accent: #d9580d; }
[data-season="autumn"] { --accent: #b4532a; }
[data-season="winter"] { --accent: #0b8fa6; }
[data-season="nouruz"] { --accent: #c62a2a; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1412; --surface: #161e1b; --surface-2: #1e2824; --text: #e7ece9; --muted: #9ba6a0;
    --line: #29352f; --holiday: #ff7272; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1412; --surface: #161e1b; --surface-2: #1e2824; --text: #e7ece9; --muted: #9ba6a0;
  --line: #29352f; --holiday: #ff7272; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 16px/1.75 Vazir, Tahoma, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.35; margin: 0; }
p { margin: 0; }
[lang="en"] { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.wrap { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: 10px; z-index: 50; }
.skip:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { width: 20px; height: 20px; flex: none; vertical-align: middle; }

/* ---------- controls ---------- */
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 700; padding: 10px 20px; border-radius: 12px; border: 0; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; transition: filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn--ghost { background: var(--accent-soft); color: var(--accent); }
.btn--sm { padding: 6px 12px; font-size: 14px; }
.input {
  width: 100%; font: inherit; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px; min-width: 0;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px;
  font-size: 13px; background: var(--surface-2); color: var(--muted);
}
.chip .icon { width: 15px; height: 15px; }
.chip--accent { background: var(--accent); color: var(--accent-ink); }
.chip--holiday { background: var(--holiday); color: #fff; font-size: 12px; }
.alert { padding: 10px 14px; border-radius: 12px; background: rgba(198, 40, 40, .1); color: var(--holiday); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand__mark { width: 38px; height: 38px; }
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__text b { font-size: 18px; }
.brand__text small { font-size: 12px; color: var(--muted); }
.nav { display: flex; gap: 4px; margin-inline-start: auto; }
.nav a { padding: 6px 12px; border-radius: 10px; text-decoration: none; color: var(--muted); font-size: 15px; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.theme-toggle .icon--sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon--sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon--moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon--sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon--moon { display: none; }
}

/* ---------- hero ---------- */
.hero { position: relative; color: var(--hero-ink); overflow: hidden; isolation: isolate; background: #1b2420; }
.hero__bg {
  position: absolute; inset: 0; z-index: -1; background-size: cover; background-position: center;
}
.hero__bg::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(to left, rgba(10, 14, 12, .82) 0%, rgba(10, 14, 12, .55) 55%, rgba(10, 14, 12, .3) 100%),
    linear-gradient(to top, rgba(10, 14, 12, .55), transparent 45%);
}
.hero__inner { display: flex; align-items: center; justify-content: space-between; gap: 32px; padding-block: 44px 64px; }
.hero__greet {
  display: inline-block; margin-bottom: 8px; padding: 2px 14px; border-radius: 99px;
  background: var(--accent); font-weight: 700;
}
.hero__eyebrow { font-size: 17px; opacity: .85; }
.hero__title { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 2px 0 18px; }
.hero__day { font-size: clamp(64px, 11vw, 108px); font-weight: 700; line-height: 1; letter-spacing: -1px; }
.hero__month { font-size: clamp(26px, 4.4vw, 40px); font-weight: 700; }
.hero__month span { opacity: .7; font-weight: 400; }
.hero__others { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; max-width: 640px; }
.hero__others li {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 5px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .16);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); font-size: 15px;
}
.hero__others li > span { font-size: 12px; opacity: .75; }
.hero__others li { white-space: nowrap; }
/* desktop: the other dates and the zodiac sign stay on one line */
@media (min-width: 900px) {
  .hero__date { min-width: 0; }
  .hero__others { flex-wrap: nowrap; max-width: none; }
}
.hero__event { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; font-size: 15px; max-width: 640px; }

.clock { flex: none; text-align: center; }
.clock__face { width: 210px; height: 210px; display: block; filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .35)); }
.clock__rim { fill: rgba(255, 255, 255, .94); stroke: var(--accent); stroke-width: 4; }
.clock__tick { stroke: #b9c0bc; stroke-width: 1.2; }
.clock__tick--h { stroke: #47504b; stroke-width: 2.4; }
.clock__num { font: 700 15px Vazir, sans-serif; fill: #2a322e; text-anchor: middle; }
.clock__hand { stroke-linecap: round; stroke: #1c2420; }
.clock__hand--h { stroke-width: 6; }
.clock__hand--m { stroke-width: 4; }
.clock__hand--s { stroke-width: 1.8; stroke: var(--accent); }
.clock__pin { fill: var(--accent); }
.clock__digital { margin-top: 10px; display: flex; flex-direction: column; line-height: 1.3; }
.clock__digital time { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.clock__digital small { opacity: .75; font-size: 12px; }

/* ---------- sponsor strip (ad slot) ---------- */
.sponsor { position: relative; margin-top: -30px; z-index: 2; }
.sponsor__link {
  display: flex; justify-content: center; align-items: center; padding: 10px;
  background: #121212; border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, .06);
}
.sponsor__link img { display: block; width: 100%; max-width: 585px; aspect-ratio: 585 / 75; border-radius: 8px; }
.sponsor__tag {
  position: absolute; top: 8px; inset-inline-start: 26px; font-size: 11px; line-height: 1;
  padding: 4px 8px; border-radius: 99px; color: #c9cfcb; background: rgba(255, 255, 255, .1); pointer-events: none;
}

/* ---------- layout & cards ---------- */
.layout { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 20px; margin-block: 24px 40px; align-items: start; }
.layout > * { grid-column: span 12; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card__title { font-size: 18px; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card__head .card__title { margin: 0; }
.card__title .icon { color: var(--accent); }
@media (min-width: 900px) {
  .card--calendar { grid-column: span 7; }
  .card--events { grid-column: span 5; }
  .convert { grid-column: span 7; }
  .prayer { grid-column: span 5; }
  .layout--day > * { grid-column: span 6; }
}

/* ---------- month grid ---------- */
.month { transition: opacity .2s; }
.is-loading .month, .is-loading .events { opacity: .45; pointer-events: none; }
.month__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.month__title { text-align: center; flex: 1; }
.month__title h2 { font-size: 24px; }
.month__title h2 span { color: var(--muted); font-weight: 400; }
.month__title h2 a { text-decoration: none; }
.month__title h2 a:hover { color: var(--accent); }
.month__title p { font-size: 13px; color: var(--muted); }
.month__ranges { display: flex; flex-wrap: wrap; justify-content: center; column-gap: 6px; }
.month__ranges > * { white-space: nowrap; }
.grid { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; }
.grid th { font-size: 13px; font-weight: 400; color: var(--muted); padding-bottom: 4px; }
.grid th.is-holiday { color: var(--holiday); }
.grid td { padding: 0; }
.cell {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  aspect-ratio: 1 / .9; border-radius: 12px; text-decoration: none; background: var(--surface-2);
  transition: background .12s, transform .12s;
}
.cell:hover { background: var(--accent-soft); transform: translateY(-1px); }
.cell__d { font-size: 20px; font-weight: 700; line-height: 1.1; }
.cell__sub { display: flex; gap: 6px; font-size: 11px; color: var(--muted); line-height: 1.3; }
.cell.is-holiday { color: var(--holiday); }
.cell.has-events::after {
  content: ""; position: absolute; top: 7px; inset-inline-end: 7px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}
.cell.is-holiday.has-events::after { background: var(--holiday); }
.cell.is-today { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px var(--accent-soft); }
.cell.is-today .cell__sub { color: inherit; opacity: .85; }
.cell.is-today::after { background: var(--accent-ink); }
.cell.is-vishak .cell__d { font-size: 13px; }
.month__foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.month__foot .btn { margin-inline-start: auto; }
.legend { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot--today { background: var(--accent); }
.dot--holiday { background: var(--holiday); }
.dot--event { background: transparent; border: 2px solid var(--accent); }

.month--compact .month__head { margin-bottom: 6px; }
.month--compact .month__title h2 { font-size: 18px; }
.month--compact .grid { border-spacing: 2px; }
.month--compact .cell { aspect-ratio: 1; border-radius: 8px; }
.month--compact .cell__d { font-size: 14px; font-weight: 400; }
.month--compact .cell.has-events::after { top: 3px; inset-inline-end: 3px; width: 4px; height: 4px; }

/* ---------- events ---------- */
.events__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.events__list li { display: flex; gap: 12px; align-items: flex-start; }
.events__date {
  flex: none; width: 58px; text-align: center; padding: 6px 4px; border-radius: 12px; text-decoration: none;
  background: var(--accent-soft); color: var(--accent); line-height: 1.3;
}
.events__date b { display: block; font-size: 20px; }
.events__date small { font-size: 11px; color: var(--muted); }
li.is-holiday .events__date { background: rgba(198, 40, 40, .1); color: var(--holiday); }
.events__text { padding-top: 4px; font-size: 15px; }
.events__text p + p { margin-top: 4px; }
.events__text .is-holiday, .day-events .is-holiday { color: var(--holiday); }
.card--events { max-height: 640px; overflow: auto; }
.day-events { margin: 0 0 16px; padding-inline-start: 20px; }
.day-events li + li { margin-top: 6px; }

/* ---------- converter ---------- */
.segmented { display: flex; gap: 4px; padding: 4px; margin: 0 0 14px; border: 0; border-radius: 14px; background: var(--surface-2); }
.segmented label { flex: 1; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; text-align: center; padding: 7px 4px; border-radius: 10px; cursor: pointer; color: var(--muted); font-size: 15px; }
.segmented input:checked + span { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.convert__fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 10px; align-items: end; }
.convert__fields label span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.convert__fields .input { text-align: center; font-size: 18px; }
.hint { font-size: 13px; color: var(--muted); margin-top: 10px; }
.convert__result { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.convert__result .btn { margin-top: 12px; }

.dates { margin: 0; }
.dates__row { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.dates__row:last-child { border-bottom: 0; }
.dates dt { color: var(--muted); flex: none; }
.dates dd { margin: 0; text-align: end; font-weight: 700; }
.dates__num { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.dates__row--deylami dd { color: var(--accent); }

/* ---------- prayer ---------- */
.prayer__form { display: flex; gap: 8px; margin-bottom: 12px; }
.prayer__list { list-style: none; margin: 0 0 8px; padding: 0; }
.prayer__list li { display: flex; justify-content: space-between; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.prayer__list li:last-child { border-bottom: 0; }
.prayer__list time { font-weight: 700; font-variant-numeric: tabular-nums; font-size: 17px; }

/* ---------- quote ---------- */
.quote {
  margin: 0; padding: 32px 28px; text-align: center; border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface);
  border: 1px solid var(--line);
}
.quote__mark { width: 34px; height: 34px; color: var(--accent); }
.quote blockquote { margin: 8px auto 6px; max-width: 760px; font-size: clamp(17px, 2.2vw, 21px); line-height: 1.9; }
.quote figcaption { color: var(--muted); }
.quote figcaption::before { content: "— "; }

/* ---------- family links ---------- */
.family__title { font-size: 16px; color: var(--muted); font-weight: 400; margin-bottom: 10px; }
.family__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.family__list a {
  display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); transition: border-color .15s;
}
.family__list a:hover { border-color: var(--accent); }
.family__list img { width: 44px; height: 44px; border-radius: 10px; object-fit: contain; background: #fff; }
.family__list span { display: flex; flex-direction: column; line-height: 1.35; }
.family__list small { color: var(--muted); font-size: 12px; text-align: end; }

/* ---------- inner pages ---------- */
.page-head { padding-top: 28px; }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs span { margin-inline: 4px; }
.day-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.day-head h1 { font-size: clamp(22px, 4vw, 32px); text-align: center; flex: 1; }
.page-head .muted { margin-top: 6px; }
.year-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; margin-block: 24px 40px; }
.card--mini { padding: 14px; }
/* Panjik sits between months 8 and 9 as a full-width strip, keeping the 12 months in even rows */
.card--panjik { grid-column: 1 / -1; }
.card--panjik .month { max-width: 300px; margin-inline: auto; }
.month--compact .month__ranges { flex-direction: column; align-items: center; }
.month--compact .month__ranges .sep { display: none; }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); padding-block: 22px; font-size: 14px; color: var(--muted); }
.footer__inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.footer a { color: var(--text); }
.footer__gh { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }

/* ---------- responsive ---------- */
@media (max-width: 899px) {
  .nav { display: none; }
  .theme-toggle { margin-inline-start: auto; }
}
@media (max-width: 720px) {
  .hero__inner { flex-direction: column; align-items: stretch; padding-block: 24px 52px; gap: 16px; }
  .clock { display: flex; align-items: center; gap: 14px; justify-content: flex-start; }
  .hero__others li { font-size: 14px; padding: 4px 10px; }
  .clock__face { width: 92px; height: 92px; }
  .clock__digital time { font-size: 22px; }
  .clock__digital { margin-top: 0; text-align: start; }
  .sponsor { margin-top: -26px; }
  .sponsor__link { padding: 6px; border-radius: 14px; }
  .sponsor__tag { top: -9px; inset-inline-start: 14px; background: #121212; }
  .layout { gap: 14px; margin-top: 16px; }
  .card { padding: 14px; border-radius: 16px; }
  .grid { border-spacing: 3px; }
  .cell { border-radius: 9px; aspect-ratio: 1 / 1.05; }
  .cell__d { font-size: 17px; }
  .cell__sub { font-size: 10px; gap: 3px; }
  .cell.has-events::after { top: 4px; inset-inline-end: 4px; width: 5px; height: 5px; }
  .month__ranges { flex-direction: column; align-items: center; }
  .month__ranges .sep { display: none; }
  .convert__fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .convert__fields .btn { grid-column: 1 / -1; }
  .card--events { max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
