/* ============================================================
   ramadan-countdown.css - homepage band: live countdown to Ramadan.
   Scoped under .rmd-countdown only (no site-wide selectors).
   Palette: black / ivory / brand red #c0392b (Rule 29).
   Fonts: IBM Plex Sans Thai (headings/UI), Sarabun (prose),
   D-DIN/Inter (numerals) via the homepage font variables (Rule 24).
   ============================================================ */

.rmd-countdown {
  --rmd-bg: #0d0b09;
  --rmd-text: #f2eadc;
  --rmd-dim: #b7ad9d;
  --rmd-mute: #8f8678;
  --rmd-rule: rgba(240, 226, 207, 0.12);
  --rmd-rule-strong: rgba(240, 226, 207, 0.24);
  --rmd-accent: #d81b37;
  --rmd-accent-bright: #d81b37; /* PREVIEW r5: was #e45938 */
  position: relative;
  background: var(--rmd-bg);
  color: var(--rmd-text);
  border-bottom: 1px solid var(--rmd-rule);
  padding: clamp(44px, 6vw, 76px) 0 clamp(36px, 5vw, 56px);
  overflow: hidden;
}
.rmd-countdown[hidden] { display: none; }

/* Soft red glow behind the numerals - decoration only. */
.rmd-countdown::before {
  content: '';
  position: absolute;
  inset: -40% -10% auto 38%;
  height: 150%;
  background: radial-gradient(closest-side, rgba(216,27,55, 0.16), transparent 70%);
  pointer-events: none;
}

.rmd-wrap {
  position: relative;
  max-width: 1460px;
  margin: 0 auto;
  padding-inline: clamp(24px, 4vw, 64px);
}

.rmd-main {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(28px, 5vw, 80px);
  align-items: center;
}

/* ---------- left: what is being counted ---------- */
.rmd-title {
  margin: 0;
  font-family: var(--serif, 'IBM Plex Sans Thai', system-ui, sans-serif);
  font-size: clamp(28px, 3.4vw, 46px);
  font-weight: 600;
  line-height: 1.3;
  color: var(--rmd-text);
  text-wrap: balance;
}
.rmd-title em { font-style: normal; font-weight: 700; color: var(--rmd-text); } /* PREVIEW: announcement text neutral, not red */

.rmd-target {
  margin: 16px 0 0;
  font-family: var(--thai, 'Sarabun', system-ui, sans-serif);
  font-size: 17px;
  line-height: 1.8;
  color: var(--rmd-dim);
}
.rmd-target strong { font-weight: 600; color: var(--rmd-text); }

/* ---------- right: the numerals ---------- */
.rmd-units {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--rmd-rule);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
}
.rmd-unit {
  padding: clamp(16px, 2vw, 28px) 8px clamp(14px, 1.6vw, 22px);
  text-align: center;
  border-inline-start: 1px solid var(--rmd-rule);
}
.rmd-unit:first-child { border-inline-start: 0; }

.rmd-num {
  display: inline-flex;
  justify-content: center;
  font-family: var(--ui, 'D-DIN', 'Inter', system-ui, sans-serif);
  font-size: clamp(38px, 5.6vw, 84px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--rmd-text);
  font-variant-numeric: tabular-nums;
}
.rmd-unit.is-seconds .rmd-num { color: var(--rmd-text); }

/* One digit = a 1em-tall window over a reel of 0-9 that slides vertically. */
.rmd-digit {
  display: inline-block;
  height: 1em;
  overflow: hidden;
}
.rmd-reel {
  display: flex;
  flex-direction: column;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.rmd-reel > span {
  display: block;
  height: 1em;
  line-height: 1;
  text-align: center;
}

.rmd-label {
  display: block;
  margin-top: 12px;
  font-family: var(--serif, 'IBM Plex Sans Thai', system-ui, sans-serif);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--rmd-mute);
}

/* ---------- lunar-month track ---------- */
.rmd-track {
  margin-top: clamp(30px, 4vw, 48px);
}
.rmd-track-bar {
  position: relative;
  height: 2px;
  background: var(--rmd-rule-strong);
  border-radius: 2px;
}
.rmd-track-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--rmd-accent);
  border-radius: 2px;
  transition: width 0.8s ease;
}
.rmd-track-fill::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -5px;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--rmd-accent-bright);
  box-shadow: 0 0 0 4px rgba(228, 89, 56, 0.2);
}
.rmd-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.rmd-step-name {
  display: block;
  font-family: var(--serif, 'IBM Plex Sans Thai', system-ui, sans-serif);
  font-size: 15px;
  font-weight: 500;
  color: var(--rmd-dim);
}
.rmd-step-note {
  display: block;
  margin-top: 2px;
  font-family: var(--thai, 'Sarabun', system-ui, sans-serif);
  font-size: 13px;
  line-height: 1.6;
  color: var(--rmd-mute);
}
.rmd-step.is-announced .rmd-step-name,
.rmd-step.is-current .rmd-step-name { color: var(--rmd-text); }
.rmd-step.is-goal { text-align: end; }
.rmd-step.is-goal .rmd-step-name { color: var(--rmd-text); font-weight: 600; }

.rmd-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .rmd-main { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .rmd-wrap { padding-inline: 16px; }
  .rmd-target { font-size: 16px; }
  .rmd-num { font-size: clamp(34px, 11vw, 48px); }
  .rmd-label { font-size: 12px; margin-top: 8px; }
  /* Narrow screens: month names only, sized to their text; the announced
     track stays on one line. */
  .rmd-steps { grid-template-columns: repeat(4, auto); justify-content: space-between; gap: 8px; }
  .rmd-step-name { font-size: 12px; white-space: nowrap; }
  .rmd-step-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .rmd-reel, .rmd-track-fill { transition: none; }
}
