/* ── Design tokens ─────────────────────────────────── */
:root {
  --accent:          #01B6D5;
  --accent-soft:     #e3f7fb;
  --accent-soft-fg:  #0097b3;
  --ring:            #01B6D5;
  --ring-track:      rgba(18, 22, 28, 0.08);
  --surface:         #ffffff;
  --surface-2:       #f4f4f7;
  --bg:              #fafafb;
  --fg:              #191920;
  --fg-muted:        #6b6b76;
  --fg-faint:        #a2a2ad;
  --border:          rgba(20, 18, 30, 0.08);
  --shadow:          0 1px 2px rgba(20,18,40,.05), 0 12px 38px rgba(20,18,40,.08);
  --skel-hi:         #e2e2e8;
}

[data-bs-theme="dark"] {
  --accent:          #5fd6ee;
  --accent-soft:     rgba(95, 214, 238, 0.13);
  --accent-soft-fg:  #7ee0f0;
  --ring:            #5fd6ee;
  --ring-track:      rgba(255, 255, 255, 0.08);
  --surface:         #1b1b1f;
  --surface-2:       #26262b;
  --bg:              #121215;
  --fg:              #ececef;
  --fg-muted:        #9b9ba4;
  --fg-faint:        #6c6c75;
  --border:          rgba(255, 255, 255, 0.09);
  --shadow:          0 1px 2px rgba(0,0,0,.4), 0 12px 38px rgba(0,0,0,.4);
  --skel-hi:         #303038;
}

/* ── Base ──────────────────────────────────────────── */
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.tnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.text-faint { color: var(--fg-faint) !important; }

/* ── Site nav ──────────────────────────────────────── */
.site-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-nav-inner {
  max-width: 1000px;
  margin-inline: auto;
  padding-inline: clamp(18px, 4vw, 44px);
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.site-nav-actions {
  display: flex;
  align-items: center;
  gap: clamp(8px, 2.5vw, 18px);
}

@media (max-width: 430px) {
  .site-brand-name { display: none; }
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--fg);
}

.site-brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
}

.site-brand-name {
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--fg);
}

/* ── Shell ─────────────────────────────────────────── */
.app-shell {
  flex: 1;
  width: 100%;
  max-width: 1000px;
  margin-inline: auto;
  padding: clamp(20px, 4vw, 40px) clamp(18px, 4vw, 44px);
}

/* ── Header ────────────────────────────────────────── */
.city-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.city-wrap .pin { color: var(--accent-soft-fg); }

.city-select {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  outline: none;
  font-size: clamp(.95rem, 2vw, 1.05rem);
  font-weight: 600;
  color: var(--fg);
  letter-spacing: -0.02em;
  cursor: pointer;
  padding: 0;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
}

.city-select option { color: #111; }

.toolbtn {
  width: 38px; height: 38px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--fg-muted);
  border: 1px solid var(--border);
  cursor: pointer;
}

.toolbtn:hover { color: var(--fg); }

/* ── Theme switch (segmented) ──────────────────────── */
.theme-switch {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.theme-opt {
  position: relative;
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  transition: color .15s ease, background-color .15s ease;
}

.theme-opt:hover { color: var(--fg); }

.theme-opt.is-active {
  background: var(--accent);
  color: #fff;
}

[data-bs-theme="dark"] .theme-opt.is-active { color: #10202a; }

/* tooltip */
.theme-opt::after,
.theme-opt::before {
  position: absolute;
  top: 100%;
  left: 50%;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
  z-index: 20;
}

.theme-opt::after {
  content: attr(data-tip);
  margin-top: 8px;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  font-size: .72rem;
  font-weight: 600;
  line-height: 1;
  padding: .4rem .55rem;
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

.theme-opt::before {
  content: "";
  margin-top: 3px;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: var(--fg);
}

.theme-opt:hover::after,
.theme-opt:hover::before { opacity: 1; }

/* in the footer the tooltip flips above the button */
.site-footer .theme-opt::after,
.site-footer .theme-opt::before {
  top: auto;
  bottom: 100%;
}

.site-footer .theme-opt::after { margin-top: 0; margin-bottom: 8px; }

.site-footer .theme-opt::before {
  margin-top: 0;
  margin-bottom: 3px;
  border-bottom-color: transparent;
  border-top-color: var(--fg);
}

.fmt-group {
  display: inline-flex;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}

.fmt-group .btn {
  --bs-btn-color:              var(--fg-muted);
  --bs-btn-border-color:       transparent;
  --bs-btn-hover-color:        var(--fg);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-hover-bg:           transparent;
  --bs-btn-active-color:       #fff;
  --bs-btn-active-bg:          var(--accent);
  --bs-btn-active-border-color:var(--accent);
  font-size: .82rem;
  font-weight: 600;
  padding: .34rem .7rem;
  border-radius: 999px;
  border: none;
}

/* ── Ring ──────────────────────────────────────────── */
.ring-wrap {
  position: relative;
  width: clamp(196px, 56vw, 290px);
  aspect-ratio: 1 / 1;
  margin-inline: auto;
}

.ring-wrap svg {
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}

.ring-track-c {
  fill: none;
  stroke: var(--ring-track);
  stroke-width: 9;
}

.ring-prog-c {
  fill: none;
  stroke: var(--ring);
  stroke-width: 9;
  stroke-linecap: round;
  transition: stroke-dashoffset .9s cubic-bezier(.4,0,.2,1);
}

.ring-center {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8%;
}

.ring-next {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent-soft-fg);
  font-weight: 600;
  font-size: clamp(.95rem, 2.2vw, 1.1rem);
  letter-spacing: -0.01em;
}

.ring-count {
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.04;
  font-size: clamp(2.05rem, 9vw, 2.9rem);
  margin-top: 2px;
  color: var(--fg);
}

.ring-until {
  font-size: clamp(.78rem, 1.8vw, .9rem);
  color: var(--fg-faint);
  margin-top: 3px;
}

/* ── Prayer pills (mobile) ─────────────────────────── */
.prayer-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(6px, 1.2vw, 12px);
}

.pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: clamp(12px, 1.6vw, 18px) 6px;
  border-radius: 18px;
  background: var(--surface-2);
  min-width: 0;
  text-align: center;
}

.pill .pill-ico  { color: var(--fg-muted); }
.pill .pill-name { font-size: clamp(.72rem, 1.5vw, .82rem); font-weight: 600; color: var(--fg-muted); }
.pill .pill-time { font-size: clamp(.82rem, 1.7vw, .95rem); font-weight: 700; letter-spacing: -0.02em; }

.pill.is-next { background: var(--accent); }
.pill.is-next .pill-ico,
.pill.is-next .pill-name,
.pill.is-next .pill-time { color: #fff; }

[data-bs-theme="dark"] .pill.is-next .pill-ico,
[data-bs-theme="dark"] .pill.is-next .pill-name,
[data-bs-theme="dark"] .pill.is-next .pill-time { color: #10202a; }

/* ── Prayer list (desktop ≥md) ─────────────────────── */
.timelist {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timerow {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-radius: 16px;
}

.timerow .tr-ico  { color: var(--fg-muted); display: flex; flex-shrink: 0; }
.timerow .tr-name { font-size: 1.02rem; font-weight: 600; }
.timerow .tr-desc { font-size: .78rem; color: var(--fg-faint); }
.timerow .tr-time { margin-left: auto; font-size: 1.02rem; font-weight: 600; }

.timerow.is-next { background: var(--accent-soft); }
.timerow.is-next .tr-ico,
.timerow.is-next .tr-name,
.timerow.is-next .tr-time { color: var(--accent-soft-fg); }

.timerow.is-secondary .tr-name,
.timerow.is-secondary .tr-time { color: var(--fg-muted); font-weight: 400; }

/* ── Sunrise / sunset strip ────────────────────────── */
.sun-strip {
  display: flex;
  justify-content: center;
  gap: clamp(18px, 4vw, 34px);
  color: var(--fg-muted);
  font-size: clamp(.8rem, 1.7vw, .9rem);
}

.sun-strip .si {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.sun-strip .si svg { color: var(--accent-soft-fg); }

/* ── Site footer ───────────────────────────────────── */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: clamp(32px, 6vw, 56px);
}

.site-footer-inner {
  max-width: 1000px;
  margin-inline: auto;
  padding-inline: clamp(18px, 4vw, 44px);
  padding-block: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 24px;
}

.site-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.site-footer-brand .site-brand-logo { width: 20px; height: 20px; }

.site-footer-copy {
  font-size: .82rem;
  color: var(--fg-faint);
}

.site-footer .theme-switch { margin-left: auto; }

.site-footer-store {
  display: inline-flex;
  line-height: 0;
  transition: opacity .15s ease;
}

.site-footer-store img { height: 42px; width: auto; display: block; }

.site-footer-store:hover { opacity: .85; }

.site-footer-links {
  display: flex;
  gap: 20px;
}

.site-footer-links a {
  font-size: .82rem;
  color: var(--fg-muted);
  text-decoration: none;
}

.site-footer-links a:hover { color: var(--fg); }

.site-footer-source {
  font-size: .82rem;
  color: var(--fg-faint);
}

.site-footer-source a {
  color: var(--fg-muted);
  text-decoration: none;
}

.site-footer-source a:hover { color: var(--fg); }

/* Mobile: stack the footer blocks into one centered column.
   The desktop row relies on `margin-left:auto` to split left/right groups,
   which scatters the blocks once they wrap — so reset it and stack instead. */
@media (max-width: 600px) {
  .site-footer-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
  }

  .site-footer .theme-switch { margin-left: 0; }   /* no auto-push in a column */
  .site-footer-links { justify-content: center; }
  .site-footer-copy { order: 1; }                  /* copyright sits last */
}

/* ── Skeleton loading ─────────────────────────────── */
@keyframes skel-shine {
  to { background-position: -200% center; }
}

.skel {
  display: inline-block;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--skel-hi) 50%, var(--surface-2) 75%);
  background-size: 200% auto;
  animation: skel-shine 1.4s linear infinite;
}

.skel-ring-label { width: 72px; height: 15px; }
.skel-ring-count { width: 115px; height: 44px; border-radius: 10px; }
.skel-ring-until { width: 68px; height: 13px; }

.skel-p-ico  { width: 18px; height: 18px; border-radius: 4px; }
.skel-p-name { width: 34px; height: 10px; }
.skel-p-time { width: 42px; height: 12px; }

.skel-text-col { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.skel-l-ico  { width: 20px; height: 20px; border-radius: 4px; flex-shrink: 0; }
.skel-l-name { width: 72px; height: 14px; }
.skel-l-desc { width: 50px; height: 10px; }
.skel-l-time { width: 54px; height: 14px; margin-left: auto; }

.skel-sun { width: 96px; height: 14px; }

/* ── Misc ──────────────────────────────────────────── */
.eyebrow {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
