/* SalahTime — mobile-first stylesheet. No frameworks, no external requests. */
:root {
  --emerald: #0e6b4f;
  --emerald-dark: #0a4f3b;
  --emerald-soft: #e6f2ec;
  --gold: #c9a227;
  --gold-soft: #f7f0dc;
  --cream: #faf8f2;
  --ink: #1d2b26;
  --ink-soft: #43564f;
  --line: #e3ddd0;
  --card: #ffffff;
  --danger: #b3261e;
  --radius: 14px;
  --shadow: 0 1px 4px rgba(29, 43, 38, 0.08);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  line-height: 1.6;
  font-size: 16px;
}

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------- Header ---------- */
.site-header {
  background: var(--emerald);
  color: #fff;
  padding: 14px 0 10px;
  border-bottom: 4px solid var(--gold);
}
.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
}
.brand {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0.2px;
}
.tagline {
  color: var(--gold-soft);
  font-size: 0.85rem;
  font-style: italic;
  flex-basis: 100%;
}
.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 8px;
  flex-basis: 100%;
}
.nav a {
  color: #fff;
  text-decoration: none;
  font-size: 0.95rem;
  padding: 2px 0;
  border-bottom: 2px solid transparent;
}
.nav a:hover, .nav a[aria-current="page"] { border-bottom-color: var(--gold); }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 28px 0 8px;
}
.hero h1 {
  margin: 0 0 4px;
  font-size: 2.1rem;
  color: var(--emerald-dark);
}
.hero .hijri-line {
  margin: 0;
  font-size: 1.05rem;
  color: var(--ink-soft);
  font-weight: 600;
}
.hero .greg-line { margin: 2px 0 14px; color: var(--ink-soft); font-size: 0.95rem; }

.location-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin: 12px 0;
}
.location-controls select { max-width: 260px; }

.search-wrap { position: relative; max-width: 420px; margin: 0 auto; }
.search-wrap input[type="search"] { width: 100%; }

.search-results {
  position: absolute;
  left: 0; right: 0; top: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  z-index: 20;
  max-height: 280px;
  overflow-y: auto;
  text-align: left;
  display: none;
}
.search-results.open { display: block; }
.search-results a {
  display: block;
  padding: 9px 14px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a:focus { background: var(--emerald-soft); }
.search-results .muted { color: var(--ink-soft); font-size: 0.85rem; }

/* ---------- Cards & grid ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 18px 0;
}
.card h2 { margin: 0 0 10px; color: var(--emerald-dark); font-size: 1.35rem; }
.card h3 { margin: 14px 0 6px; color: var(--emerald-dark); font-size: 1.05rem; }

.grid { display: grid; grid-template-columns: 1fr; gap: 0 18px; }
@media (min-width: 720px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .grid .card { margin: 18px 0; }
}

/* ---------- Prayer times table ---------- */
.times-table { width: 100%; border-collapse: collapse; margin: 10px 0; }
.times-table th, .times-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.times-table thead th {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.times-table tbody tr:last-child td { border-bottom: 0; }
.times-table td.time { font-variant-numeric: tabular-nums; font-weight: 700; }
.times-table tr.next td { background: var(--gold-soft); }
.times-table tr.next td:first-child { border-radius: 8px 0 0 8px; }
.times-table tr.next td:last-child { border-radius: 0 8px 8px 0; }

.countdown-big {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--emerald-dark);
  background: var(--emerald-soft);
  border: 1px solid var(--emerald);
  border-radius: var(--radius);
  padding: 12px 16px;
  text-align: center;
  margin: 12px 0;
}
.countdown-big .sub { display: block; font-size: 0.85rem; font-weight: 400; color: var(--ink-soft); }

.method-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.method-controls label { font-size: 0.9rem; color: var(--ink-soft); font-weight: 600; }
.method-controls select { display: block; margin-top: 4px; }

/* ---------- Forms ---------- */
input[type="search"], input[type="text"], input[type="email"], select, textarea {
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  max-width: 100%;
}
input:focus, select:focus, textarea:focus, button:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

.btn {
  font: inherit;
  font-weight: 700;
  border: 1px solid var(--emerald);
  background: #fff;
  color: var(--emerald-dark);
  border-radius: 10px;
  padding: 10px 18px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn:hover { background: var(--emerald-soft); }
.btn-primary { background: var(--emerald); color: #fff; border-color: var(--emerald-dark); }
.btn-primary:hover { background: var(--emerald-dark); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- Alerts, ads ---------- */
.alert {
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: var(--ink);
}
.alert.error { background: #fbeceb; border-color: var(--danger); }

.ad-slot {
  border: 1px dashed var(--line);
  background: #f4f1e8;
  color: var(--ink-soft);
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 26px 10px;
  margin: 18px 0;
  border-radius: var(--radius);
}

/* ---------- FAQ ---------- */
.faq details {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 8px 0;
  background: #fff;
}
.faq summary {
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 700;
  color: var(--emerald-dark);
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+ "; color: var(--gold); font-weight: 800; }
.faq details[open] summary::before { content: "− "; }
.faq details p, .faq details div { padding: 0 16px 14px; margin: 0; }

/* ---------- City quick links ---------- */
.city-links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.city-links a {
  display: inline-block;
  padding: 7px 14px;
  background: var(--emerald-soft);
  color: var(--emerald-dark);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}
.city-links a:hover { background: var(--emerald); color: #fff; }

/* ---------- Qibla ---------- */
.qibla-compass {
  display: block;
  margin: 12px auto;
  max-width: 320px;
  width: 100%;
  height: auto;
}
.qibla-readout { text-align: center; }
.qibla-readout .degrees {
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--emerald-dark);
  font-variant-numeric: tabular-nums;
}
.qibla-readout .dist { color: var(--ink-soft); }

/* ---------- Hijri month grid ---------- */
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin: 12px 0;
}
.month-grid .dow {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 4px 0;
  text-transform: uppercase;
}
.month-grid .day {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}
.month-grid .day .g { font-size: 0.68rem; color: var(--ink-soft); }
.month-grid .day.today {
  background: var(--emerald);
  color: #fff;
  border-color: var(--emerald-dark);
  font-weight: 800;
}
.month-grid .day.today .g { color: #e8f3ee; }
.month-grid .day.holy { background: var(--gold-soft); border-color: var(--gold); font-weight: 700; }
.month-grid .day.empty { border: 0; background: transparent; }

.hijri-big {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--emerald-dark);
  margin: 8px 0;
}

.holy-list { list-style: none; padding: 0; margin: 0; }
.holy-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}
.holy-list li:last-child { border-bottom: 0; }
.holy-list .days { font-weight: 800; color: var(--emerald-dark); white-space: nowrap; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: #cfd8d3;
  margin-top: 30px;
  padding: 22px 0 28px;
  font-size: 0.9rem;
}
.site-footer .nav { flex-basis: auto; margin: 0 0 10px; }
.site-footer .nav a { color: #fff; }
.site-footer p { margin: 6px 0; max-width: 70ch; }

/* ---------- Misc ---------- */
.muted { color: var(--ink-soft); }
.small { font-size: 0.88rem; }
.center { text-align: center; }
table.data { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.95rem; }
table.data th, table.data td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
table.data thead th { background: var(--emerald-soft); color: var(--emerald-dark); }
table.data tbody tr:nth-child(even) td { background: #fffdf7; }
.wrap-scroll { overflow-x: auto; }

.breadcrumbs { font-size: 0.88rem; color: var(--ink-soft); margin: 14px 0 0; }
.breadcrumbs a { color: var(--emerald-dark); }

.seo-copy p { max-width: 72ch; }

/* ---------- Newsletter ---------- */
.nl-panel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #0a4f3b 0%, #0e6b4f 65%, #0c5f45 100%);
  color: #fff;
  padding: 30px 26px;
  margin: 18px 0;
  box-shadow: 0 6px 24px rgba(10, 79, 59, 0.25);
}
.nl-panel::before {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23c9a227' stroke-opacity='0.16'%3E%3Crect x='22' y='22' width='28' height='28'/%3E%3Crect x='22' y='22' width='28' height='28' transform='rotate(45 36 36)'/%3E%3Ccircle cx='36' cy='36' r='3.5'/%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}
.nl-panel > * { position: relative; }
.nl-kicker {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.nl-panel h2 { color: #fff; margin: 0 0 8px; font-size: 1.6rem; }
.nl-panel p.lead { color: #e9f2ed; margin: 0 0 14px; max-width: 62ch; }
.nl-points { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
@media (min-width: 720px) { .nl-points { grid-template-columns: 1fr 1fr; } }
.nl-points li { display: flex; gap: 10px; align-items: flex-start; color: #f2f7f4; font-size: 0.95rem; }
.nl-points .tick {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--gold); color: #0a4f3b;
  font-weight: 800; font-size: 0.8rem; line-height: 22px; text-align: center;
}
.nl-form { display: flex; flex-wrap: wrap; gap: 10px; }
.nl-form input[type="email"] { flex: 2 1 220px; border: 0; }
.nl-form select { flex: 1 1 160px; border: 0; }
.btn-gold { background: var(--gold); border-color: #a8871f; color: #20302a; }
.btn-gold:hover { background: #b8941f; color: #20302a; }
.nl-note { font-size: 0.82rem; color: #cfe0d6; margin: 10px 0 0; }
.nl-note a { color: #fff; }
.nl-done { display: none; }
.nl-done.show { display: block; }
.nl-done .big { font-size: 1.2rem; font-weight: 800; color: #fff; margin: 0 0 6px; }
.nl-done p { color: #e9f2ed; margin: 0; }
.nl-soon {
  display: none;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.9rem;
  color: #fff;
  margin-top: 12px;
}
.nl-soon.show { display: block; }

/* Slide-in popup */
.nl-slidein {
  position: fixed;
  z-index: 80;
  right: 18px; bottom: 18px;
  width: min(370px, calc(100vw - 36px));
  background: #fff;
  border: 1px solid var(--line);
  border-top: 5px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(20, 40, 32, 0.22);
  padding: 20px 20px 18px;
  transform: translateY(30px);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.25, 1), opacity 0.4s ease, visibility 0s 0.5s;
}
.nl-slidein.show {
  transform: none;
  opacity: 1;
  visibility: visible;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.25, 1), opacity 0.4s ease;
}
.nl-slidein .nl-close {
  position: absolute; top: 6px; right: 6px;
  border: 0; background: transparent;
  font-size: 1.4rem; line-height: 1;
  color: var(--ink-soft); cursor: pointer; padding: 8px;
}
.nl-slidein .nl-close:hover { color: var(--ink); }
.nl-slidein h3 { margin: 0 0 6px; color: var(--emerald-dark); font-size: 1.15rem; padding-right: 26px; }
.nl-slidein p { margin: 0 0 12px; font-size: 0.92rem; color: var(--ink-soft); }
.nl-slidein .nl-form input[type="email"] { flex: 1 1 100%; border: 1px solid var(--line); }
.nl-slidein .nl-form .btn { flex: 1 1 100%; }
.nl-slidein .nl-note { color: var(--ink-soft); }
.nl-slidein .nl-done .big { color: var(--emerald-dark); }
.nl-slidein .nl-done p { color: var(--ink-soft); }
.nl-slidein .nl-soon { background: var(--gold-soft); border-color: var(--gold); color: var(--ink); }
@media (max-width: 560px) {
  .nl-slidein { left: 12px; right: 12px; bottom: 12px; width: auto; }
}

/* Sample duaa card */
.duaa {
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 16px 0;
}
.duaa .ar {
  font-size: 1.6rem;
  direction: rtl;
  text-align: right;
  color: var(--emerald-dark);
  margin: 0 0 10px;
  line-height: 2.1;
}
.duaa .tr { font-style: italic; color: var(--ink-soft); margin: 0 0 4px; }
.duaa .en { margin: 0; font-weight: 600; color: var(--ink); }
.duaa .src { font-size: 0.82rem; color: var(--ink-soft); margin: 8px 0 0; }

.lang-switch{margin-inline-start:14px;font-size:.9rem;white-space:nowrap}.lang-switch a{color:var(--gold)}

/* ===== Arabic (RTL) overrides — generated by i18n/build_ar.py ===== */
html { direction: rtl; }
body { font-family: 'Segoe UI', Tahoma, 'Noto Kufi Arabic', 'Cairo', Arial, sans-serif; }
input, select, textarea, button { font-family: inherit; }
.search-results, .times-table th, .times-table td, table.data th, table.data td { text-align: right; }
.nl-slidein { right: auto; left: 18px; }
.nl-slidein .nl-close { right: auto; left: 6px; }
.nl-slidein h3 { padding-right: 0; padding-left: 26px; }
.lang-switch { margin-inline-start: 14px; font-size: .9rem; white-space: nowrap; }
.lang-switch a { color: var(--gold); }
.breadcrumb, .breadcrumbs { direction: rtl; }
.qibla-compass text { font-family: inherit; }
.times-table thead th { text-transform: none; }
.dir-word { font-weight: 700; }

/* SalahTime monthly timetables */
.monthly-links .month-list{list-style:none;margin:.6rem 0 0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:.45rem}
.monthly-links .month-list a{display:block;padding:.55rem .8rem;border:1px solid #d8cfc0;border-radius:10px;text-decoration:none}
.monthly-links .month-list a:hover{border-color:#c9a227}
.month-nav{display:flex;justify-content:space-between;gap:1rem;margin:1rem 0;flex-wrap:wrap}
.month-table tr.friday td{background:#fdf6e3}
.print-only{display:none}

/* Duaa library */
.dua-arabic{font-size:2rem;line-height:2.3;text-align:center;margin:.25rem 0 1.25rem}
.dua-meta{text-align:center;color:var(--ink-soft);margin:-.5rem 0 1.5rem}
.dua-sec h2{margin-top:0}
.dua-nav{display:flex;justify-content:space-between;gap:1rem;margin:1.5rem 0;flex-wrap:wrap}
.dua-list{list-style:none;padding:0;margin:.75rem 0 0}
.dua-list li{margin:.45rem 0}
.cat-chip{display:inline-block;background:#0a4f3b;color:#fff;border-radius:999px;padding:.25rem .9rem;font-size:.85rem;text-decoration:none}
@media print{.dua-arabic{font-size:1.5rem;line-height:2}}

/* ---------- Qibla live compass (Azkar-style) ---------- */
.compass-card {
  background: linear-gradient(160deg, #0e4a36 0%, #082a20 60%, #061f18 100%);
  border-radius: 18px;
  padding: 26px 20px;
  color: #f2eee1;
  margin: 18px 0;
  border: 1px solid rgba(201,162,39,0.35);
  box-shadow: 0 12px 32px rgba(6,31,24,0.35);
}
.compass-card h2 { color: #f7f0dc; margin: 0 0 8px; font-size: 1.4rem; }
.compass-sub { color: rgba(242,238,225,0.78); font-size: 0.95rem; }
.compass-card .location-controls { display: flex; gap: 10px; flex-wrap: wrap; margin: 14px 0; align-items: center; }
.compass-card select {
  font: inherit; padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.08); color: #f2eee1;
  max-width: 100%;
}
.compass-card select option { color: #1d2b26; }
.qibla-stats { display: flex; gap: 10px; margin: 6px 0 4px; }
.qibla-stats .stat {
  flex: 1; background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px; padding: 10px 6px; text-align: center; min-width: 0;
}
.stat-v { display: block; font-size: 1.1rem; font-weight: 800; color: #f7f0dc; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-l { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(242,238,225,0.6); }
.compass-wrap { max-width: 360px; margin: 8px auto 0; text-align: center; }
#qibla-svg { width: 100%; height: auto; display: block; }
#qibla-svg text { font-family: inherit; }
.c-deg { font-size: 46px; font-weight: 800; fill: #f7f0dc; font-variant-numeric: tabular-nums; }
.c-label { font-size: 13px; fill: rgba(247,240,220,0.65); text-transform: uppercase; letter-spacing: 0.14em; }
#qibla-svg.aligned .c-deg { fill: #c9a227; }
#qibla-svg.aligned .kaaba-halo { animation: halo-pulse 1.6s ease-in-out infinite; }
@keyframes halo-pulse { 0%,100% { opacity: 0.95; } 50% { opacity: 0.25; } }
.align-pill {
  display: inline-block; margin: 10px auto 4px; padding: 10px 18px; border-radius: 999px;
  font-weight: 700; font-size: 0.95rem; background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16); color: #f2eee1; transition: all 0.3s;
}
.align-pill.ok { background: #c9a227; border-color: #c9a227; color: #231a05; box-shadow: 0 0 24px rgba(201,162,39,0.55); }
.align-pill.turn { background: rgba(201,162,39,0.14); border-color: rgba(201,162,39,0.5); color: #f7f0dc; }
.compass-actions { text-align: center; margin-top: 12px; }
.compass-status { text-align: center; color: rgba(242,238,225,0.7); font-size: 0.9rem; min-height: 1.4em; }
.compass-status.error { color: #f0a3a3; }
.calib-tip { text-align: center; font-size: 0.82rem; color: rgba(242,238,225,0.55); max-width: 440px; margin: 8px auto 0; }
#compass-fallback { margin-top: 14px; background: rgba(255,255,255,0.05); border-radius: 12px; padding: 16px; }
#compass-fallback h3 { color: #f7f0dc; margin-top: 0; }
#compass-fallback .alert { background: rgba(201,162,39,0.12); border: 1px solid rgba(201,162,39,0.4); color: #f7f0dc; }
#compass-fallback ol { color: rgba(242,238,225,0.85); }
#compass-fallback .small { color: rgba(242,238,225,0.6); }
