/* =============================================================
   SalatiPal — Qibla calculation-method toggle
   Great Circle (shortest path / initial bearing) vs
   Rhumb Line (constant compass bearing / loxodrome).
   Paired with qibla-method.js. Gated on body[data-sp-route].
   Reuses the enhanced-theme tokens (--sp-emerald-*, --sp-gold-*,
   --sp-grad-hero, --sp-sh-*) defined in ui-lift.css.
   Safe to remove: drop the <link> from index.html.
   ============================================================= */

.sp-qm-card {
  font-family: var(--sp-font, 'Outfit', system-ui, sans-serif);
  background: var(--sp-surface, #fff);
  border: 1px solid var(--sp-line, #E4ECEA);
  border-radius: 18px;
  box-shadow: var(--sp-sh-2, 0 4px 10px -2px rgba(6,78,59,.07));
  padding: 14px 16px 16px;
  margin: 0 auto 16px;
  max-width: 28rem;            /* matches the compass card (max-w-md) */
  width: 100%;
}

/* On settings the card spans the section column */
body[data-sp-route="settings"] .sp-qm-card { max-width: none; margin-bottom: 14px; }

.sp-qm-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.sp-qm-title {
  font-family: var(--sp-font-head, var(--sp-font));
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  color: var(--sp-ink, #0F1F1C);
}
.sp-qm-ico {
  width: 18px; height: 18px;
  color: var(--sp-emerald-600, #059669);
  flex: 0 0 auto;
}
.sp-qm-sub {
  font-size: 12.5px;
  line-height: 1.5;
  color: #5b6b66;
  margin: 0 0 12px;
}

/* ---- segmented control ---- */
.sp-qm-seg {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  background: var(--sp-emerald-50, #ECFDF5);
  border: 1px solid var(--sp-line, #E4ECEA);
  border-radius: 13px;
  padding: 4px;
  isolation: isolate;
  user-select: none;
}
.sp-qm-thumb {
  position: absolute;
  z-index: 0;
  top: 4px; bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 10px;
  background: var(--sp-grad-hero, linear-gradient(140deg,#064E3B,#0F766E 40%,#14B8A6));
  box-shadow: var(--sp-sh-glow, 0 12px 32px -6px rgba(16,185,129,.28)),
              0 1px 2px rgba(6,78,59,.18);
  transition: transform .42s cubic-bezier(.34,1.56,.64,1);
  will-change: transform;
}
.sp-qm-seg[data-active="rhumb"] .sp-qm-thumb { transform: translateX(100%); }

.sp-qm-opt {
  position: relative;
  z-index: 1;
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 9px 8px 8px;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.15;
  color: var(--sp-emerald-800, #065F46);
  transition: color .28s ease, transform .15s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  -webkit-tap-highlight-color: transparent;
}
.sp-qm-opt .sp-qm-opt-hint {
  font-weight: 500;
  font-size: 10.5px;
  opacity: .72;
  letter-spacing: .01em;
}
.sp-qm-opt[aria-pressed="true"] { color: #fff; }
.sp-qm-opt[aria-pressed="true"] .sp-qm-opt-hint { opacity: .92; }
.sp-qm-opt:active { transform: scale(.97); }

/* gold focus ring for keyboard a11y */
.sp-qm-opt:focus-visible {
  outline: 2px solid var(--sp-gold-400, #E5A93F);
  outline-offset: 2px;
}

/* ---- dark mode (.dark / html.dark class strategy) ---- */
html.dark .sp-qm-card, .dark .sp-qm-card {
  background: #0F1F1C;
  border-color: rgba(255,255,255,.08);
  box-shadow: 0 4px 14px -4px rgba(0,0,0,.5);
}
html.dark .sp-qm-title, .dark .sp-qm-title { color: #ECFDF5; }
html.dark .sp-qm-sub, .dark .sp-qm-sub { color: #9bb3ac; }
html.dark .sp-qm-seg, .dark .sp-qm-seg {
  background: rgba(255,255,255,.05);
  border-color: rgba(255,255,255,.09);
}
html.dark .sp-qm-opt, .dark .sp-qm-opt { color: #6EE7B7; }
html.dark .sp-qm-opt[aria-pressed="true"],
.dark .sp-qm-opt[aria-pressed="true"] { color: #fff; }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  .sp-qm-thumb { transition: none; }
}
