/* ==========================================================================
   ARAYA Prayer Times — component styles
   Self-contained. Mobile-first. Uses ARAYA design tokens w/ fallbacks.
   ========================================================================== */

.an-prayer {
  --maroon: var(--an-maroon, #5e1b26);
  --gold: var(--an-gold, #c6a15b);
  --gold-strong: var(--an-gold-strong, #a97c2f);
  --cream: var(--an-cream, #faf6ef);
  --cream-card: var(--an-cream-card, #fff);
  --sand: var(--an-sand, #e4d8c4);
  --ink-soft: var(--an-ink-soft, #7a6a5e);
  --font-display: var(--an-font-display, Georgia, 'Times New Roman', serif);

  --ink: #2b201b;
  --shadow-1: 0 1px 2px rgba(43, 32, 27, 0.06), 0 6px 16px -8px rgba(94, 27, 38, 0.18);
  --shadow-2: 0 2px 6px rgba(43, 32, 27, 0.08), 0 18px 40px -16px rgba(94, 27, 38, 0.28);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;

  box-sizing: border-box;
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(20px, 5vw, 40px) clamp(16px, 4vw, 28px) 32px;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.an-prayer *,
.an-prayer *::before,
.an-prayer *::after {
  box-sizing: inherit;
}

/* ARAYA site is light-only — dark-mode overrides intentionally removed so the
   widget matches the rest of the site regardless of OS/theme preference. */

/* Focus visibility, applied globally within component */
.an-prayer a:focus-visible,
.an-prayer button:focus-visible,
.an-prayer select:focus-visible,
.an-prayer input:focus-visible,
.an-prayer label:focus-visible {
  outline: 2.5px solid var(--gold-strong);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ============ HEADER ============ */
.an-header {
  text-align: center;
  margin-bottom: clamp(20px, 4vw, 32px);
}

.an-header__title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.an-header__crescent {
  color: var(--gold-strong);
  display: inline-flex;
}

.an-header h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.5rem, 4vw, 2rem);
  color: var(--maroon);
  margin: 0;
  letter-spacing: 0.01em;
}

.an-header__date {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.an-header__date-sep {
  margin: 0 6px;
  opacity: 0.6;
}

/* ============ CONTROLS ============ */
.an-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: clamp(20px, 4vw, 32px);
  background: var(--cream-card);
  border: 1px solid var(--sand);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow-1);
}

@media (min-width: 640px) {
  .an-controls {
    grid-template-columns: 1.3fr auto 1fr auto;
    align-items: end;
  }
}

.an-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  border: none;
  padding: 0;
  margin: 0;
}

.an-field label,
.an-field legend {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  padding: 0;
}

.an-prayer select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 10px 34px 10px 12px;
  font-size: 0.95rem;
  color: var(--ink);
  background-color: var(--cream);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='16' height='16'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%237a6a5e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  border: 1px solid var(--sand);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.an-prayer select:hover {
  border-color: var(--gold);
}

.an-prayer select:focus-visible {
  border-color: var(--gold-strong);
}

.an-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.an-btn:active {
  transform: translateY(1px);
}

.an-btn--ghost {
  background: var(--cream);
  border-color: var(--sand);
  color: var(--maroon);
}

.an-btn--ghost:hover {
  border-color: var(--gold);
  background: var(--sand);
}

.an-field--asr {
  gap: 6px;
}

.an-toggle {
  display: inline-flex;
  border: 1px solid var(--sand);
  border-radius: 999px;
  padding: 3px;
  background: var(--cream);
  width: fit-content;
}

.an-toggle input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.an-toggle label {
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 999px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  text-transform: none;
  letter-spacing: normal;
}

.an-toggle input[type="radio"]:checked + label {
  background: var(--maroon);
  color: #fff;
}

.an-toggle input[type="radio"]:focus-visible + label {
  outline: 2.5px solid var(--gold-strong);
  outline-offset: 2px;
}

/* ============ NEXT PRAYER HERO ============ */
.an-hero {
  position: relative;
  text-align: center;
  padding: clamp(24px, 6vw, 36px) 20px;
  margin-bottom: clamp(20px, 4vw, 32px);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, var(--maroon) 0%, #7a2634 100%);
  color: #fdf8f0;
  box-shadow: var(--shadow-2);
  overflow: hidden;
}

.an-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 85% -10%, rgba(198, 161, 91, 0.35), transparent 55%);
  pointer-events: none;
}

.an-hero__eyebrow {
  position: relative;
  margin: 0 0 6px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold);
}

.an-hero__name {
  position: relative;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 7vw, 2.8rem);
  font-weight: 600;
}

.an-hero__time {
  position: relative;
  margin: 10px 0 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 3.4rem);
  font-weight: 700;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  color: #fff;
}
.an-hero__countdown {
  position: relative;
  margin: 8px 0 0;
  font-size: 1.5rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  color: var(--gold);
  opacity: 0.95;
}


/* ============ PRAYER GRID ============ */
.an-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

@media (min-width: 560px) {
  .an-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 900px) {
  .an-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.an-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  padding: 18px 10px;
  background: var(--cream-card);
  border: 1px solid var(--sand);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.an-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--sand);
  color: var(--maroon);
}

.an-card__label {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}

.an-card__time {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* Active / next prayer state */
.an-card.is-active,
.an-card[data-active="true"] {
  border-color: var(--gold-strong);
  background: linear-gradient(180deg, var(--cream-card) 0%, var(--sand) 140%);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}

.an-card.is-active .an-card__icon,
.an-card[data-active="true"] .an-card__icon {
  background: var(--gold);
  color: var(--maroon);
}

.an-card.is-active .an-card__time,
.an-card[data-active="true"] .an-card__time {
  color: var(--maroon);
}

/* ============ FOOTNOTE ============ */
.an-footnote {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.8rem;
  padding-top: 8px;
}

.an-footnote__dot {
  margin: 0 6px;
  opacity: 0.6;
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  .an-card,
  .an-btn {
    transition: none;
  }
}

/* Plain-language "when in the day" descriptors (founder 2026-07-19) — help non-Muslim readers */
.an-card__when { margin: 2px 0 6px; font-size: 12px; line-height: 1.35; color: var(--ink-soft); }
.an-hero__when { margin: 2px 0 0; font-size: 13.5px; color: var(--gold-strong); letter-spacing: .01em; }
.an-prayer-page { background: var(--an-cream, #faf6ef); }

/* Current time in header */
.an-header__now { margin: 4px 0 0; font-size: 0.9rem; color: var(--ink-soft); }
.an-header__now strong { color: var(--maroon); font-variant-numeric: tabular-nums; }

/* Imsak card — slightly set apart (fasting cue) */
.an-card[data-prayer="imsak"] { border-style: dashed; }

/* Extra block: qibla + 7-day */
.an-extra { display: grid; gap: 16px; margin: 20px 0; }

.an-week { background: var(--cream-card); border: 1px solid var(--sand); border-radius: var(--radius-md); box-shadow: var(--shadow-1); overflow: hidden; }
.an-week__title { margin: 0; padding: 14px 18px 12px; font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; color: var(--maroon); border-bottom: 1px solid var(--sand); }
.an-week__scroll { overflow-x: auto; }
.an-week__table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.an-week__table th, .an-week__table td { padding: 9px 10px; text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.an-week__table thead th { background: var(--cream); color: var(--ink-soft); font-size: 0.78rem; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--sand); }
.an-week__table td:first-child, .an-week__table th:first-child { text-align: left; color: var(--maroon); font-weight: 600; }
.an-week__table tbody tr:not(:last-child) td { border-bottom: 1px solid var(--cream); }
.an-week__table tr.is-today td { background: rgba(198,161,91,.12); }

/* Fard focus (founder 2026-07-19): 5 obligatory prayers are the primary grid; grid sizes for 5 */
.an-grid-lead { text-align: center; margin: 0 0 12px; font-family: var(--font-display); font-size: 1.05rem; color: var(--maroon); }
@media (min-width: 900px) { .an-grid { grid-template-columns: repeat(5, 1fr); } }
/* Reference times (imsak, sunrise) — small, muted, secondary */
.an-subtimes { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; margin: 4px 0 20px; }
.an-subtimes__lead { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); }
.an-subtime { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
  background: var(--cream-card); border: 1px dashed var(--sand); color: var(--ink-soft); font-size: 0.85rem; }
.an-subtime__icon { color: var(--gold-strong); display: inline-flex; }
.an-subtime__time { font-weight: 600; color: var(--maroon); font-variant-numeric: tabular-nums; }

/* Islamic date — state-announced per country (founder 2026-07-19); never self-computed */
.an-cal-official { margin: 12px auto 0; max-width: 560px; text-align: left; background: var(--cream-card);
  border: 1px solid var(--sand); border-radius: var(--radius-md); padding: 14px 16px; box-shadow: var(--shadow-1); }
.an-cal-official { padding: 0; }
.an-cal-official__lead { display: block; cursor: pointer; list-style: none; padding: 12px 16px; font-size: 0.85rem; font-weight: 600; color: var(--maroon); }
.an-cal-official__lead::-webkit-details-marker { display: none; }
.an-cal-official__lead::after { content: "▾"; float: right; color: var(--gold-strong); transition: transform .2s; }
.an-cal-official[open] .an-cal-official__lead::after { transform: rotate(180deg); }
.an-cal-official[open] .an-cal-official__lead { border-bottom: 1px solid var(--sand); }
.an-cal-list { padding: 12px 16px 4px; }
.an-cal-official__note { padding: 0 16px 14px; }
.an-cal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.an-cal-row { display: flex; align-items: baseline; gap: 8px; font-size: 0.92rem; flex-wrap: wrap; }
.an-cal-flag { font-size: 1rem; }
.an-cal-country { color: var(--ink); font-weight: 600; }
.an-cal-src { font-weight: 400; color: var(--ink-soft); font-size: 0.82rem; }
.an-cal-end { margin-left: auto; display: inline-flex; align-items: baseline; gap: 10px; }
.an-cal-value { color: var(--maroon); font-weight: 700; font-variant-numeric: tabular-nums; }
.an-cal-link { color: var(--gold-strong); text-decoration: none; font-size: 0.82rem; white-space: nowrap; }
.an-cal-link:hover { text-decoration: underline; }
.an-cal-official__note { display: block; margin-top: 10px; font-size: 0.78rem; line-height: 1.5; color: var(--ink-soft); }

/* Province index — internal-linking hub to all 77 per-province pages (SEO, founder 2026-07-19) */
.an-pt-index { margin: 28px auto 0; max-width: 860px; padding: 18px 20px; background: var(--cream-card);
  border: 1px solid var(--sand); border-radius: var(--radius-md); box-shadow: var(--shadow-1); }
.an-pt-index__h { margin: 0 0 12px; font-family: var(--font-display); font-size: 1.05rem; color: var(--maroon); }
.an-pt-index__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.an-pt-index__list a { color: var(--ink-soft); text-decoration: none; font-size: 0.86rem; }
.an-pt-index__list a:hover { color: var(--gold-strong); text-decoration: underline; }
.an-pt-index__list .is-active a { color: var(--maroon); font-weight: 700; }

/* Answer-first summary line (AEO) — keep it for crawlers/AI but visually quiet: the 5 cards
   below are the star; this reads as a soft one-line abstract under the title (founder 2026-07-19
   "อันนี้ไม่สวยเลย" on the raw unstyled paragraph). */
.an-answer {
  margin: 10px auto 2px;
  max-width: 640px;
  font-size: 0.88rem;
  line-height: 1.65;
  color: var(--ink-soft);
}
