/* ---------- Word tooltip ---------- */

.word-tip {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 96px;
  max-width: 260px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  text-align: center;
  /* Auto, not none: needed for the root-word chips below to be clickable when that feature is on. */
  pointer-events: auto;
  text-shadow: none;
  -webkit-backdrop-filter: var(--panel-blur);
  backdrop-filter: var(--panel-blur);
}
.tip-ar { font-family: var(--font-quran); font-size: var(--fs-ar-l); line-height: 1.5; }
.tip-tr { font-size: var(--fs-m); color: var(--text-2); }
.tip-en { font-size: var(--fs-base); font-weight: 500; color: var(--accent); line-height: 1.35; }

/* TEST: root-word info, only present for a few chapters - see data/roots-test.js. */
.tip-root { margin-top: 6px; padding-top: 8px; border-top: 1px solid rgba(255, 255, 255, 0.14); width: 100%; }
.tip-root-label { margin: 0 0 6px; display: flex; align-items: baseline; justify-content: center; gap: 6px; font-size: var(--fs-xs); color: var(--text-3); }
.tip-root-letters { font-family: var(--font-arabic); font-size: var(--fs-ar-s); color: var(--text); }
.tip-root-examples { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.tip-root-chip {
  font-family: var(--font-arabic);
  font-size: var(--fs-m);
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
@media (hover: hover) and (pointer: fine) { .tip-root-chip:hover { background: rgba(242, 212, 147, 0.18); color: var(--accent); border-color: rgba(242, 212, 147, 0.4); } }

/* ---------- Text sections (used on the back of the card) ---------- */

.section { padding: 20px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.section:last-child { border-bottom: 0; }
.section h3 { margin: 0 0 12px; font-size: var(--fs-m); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-2); }
.section p { margin: 0 0 12px; font-size: var(--fs-base); line-height: 1.7; color: var(--text-2); max-width: 65ch; }
.section h4 { margin: 18px 0 8px; font-size: var(--fs-l); font-weight: 600; color: var(--text); line-height: 1.4; }
.section p.ar { font-family: var(--font-arabic); font-size: var(--fs-ar-m); line-height: 1.9; color: var(--text); text-align: right; }
.section .source { font-size: var(--fs-s); color: var(--text-3); line-height: 1.5; }
.section .quiet { font-size: var(--fs-base); color: var(--text-3); }

/* ---------- Revelation timeline (back of the card) ---------- */

.rev-timeline { margin: 4px 0 16px; max-width: 65ch; }

.rev-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  overflow: visible;
  display: flex;
}

.rev-seg:first-child { border-radius: 999px 0 0 999px; }
.rev-seg:last-child { border-radius: 0 999px 999px 0; }
.rev-makkah { background: rgba(242, 212, 147, 0.4); }
.rev-madinah { background: rgba(255, 255, 255, 0.22); }

.rev-dot {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--panel);
  transform: translateY(-50%);
}

.rev-caption {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: var(--fs-s);
  color: var(--text-3);
}

.reflect-list { margin: 0 0 14px; padding: 0; list-style: none; display: grid; gap: 10px; }
.reflect-list li { padding: 14px 16px; border-radius: 14px; background: rgba(255, 255, 255, 0.06); font-size: var(--fs-base); line-height: 1.6; color: var(--text); }

.link-btn {
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: var(--fs-base);
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}


.modal {
  position: fixed;
  inset: 0;
  z-index: 32;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: transparent; /* no dimming (founder, 2026-10-14): the window frosts over the softly blurred page exactly like the menus */
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-card {
  width: 100%;
  max-width: 400px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  padding: 26px;
  border-radius: 22px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
  -webkit-backdrop-filter: var(--panel-blur);
  backdrop-filter: var(--panel-blur);
}
.modal-card h2 { margin: 0 0 8px; font-size: var(--fs-xl); font-weight: 600; }
.modal-copy { margin: 0 0 18px; font-size: var(--fs-base); line-height: 1.55; color: var(--text-2); }

.or { display: flex; align-items: center; gap: 12px; margin: 18px 0 12px; font-size: var(--fs-s); color: var(--text-3); }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: rgba(255, 255, 255, 0.14); }

#cityInput {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font: 400 var(--fs-l) var(--font-ui);
}
#cityInput::placeholder { color: var(--text-3); }

.city-results { display: grid; gap: 2px; max-height: 240px; margin-top: 8px; overflow-y: auto; }
.city-result {
  display: block;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text-2);
  font-size: var(--fs-base);
  text-align: left;
  cursor: pointer;
}
.city-result:focus-visible { background: rgba(255, 255, 255, 0.1); color: var(--text); }
@media (hover: hover) and (pointer: fine) { .city-result:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); } }

.modal-msg { margin: 12px 0 0; font-size: var(--fs-m); line-height: 1.5; color: var(--text-2); }

.modal-close {
  width: 100%;
  min-height: 44px;
  margin-top: 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: none;
  color: var(--text-2);
  font-size: var(--fs-base);
  cursor: pointer;
}
@media (hover: hover) and (pointer: fine) { .modal-close:hover { color: var(--text); } }


/* Share window: preview on the left, choices on the right (stacked on phones). */
.modal-card-share { max-width: 860px; }
.share-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 24px; align-items: start; margin-top: 14px; }
/* The preview area is a fixed size; each image shape fits inside it, so the window never changes size
   when you pick a different app. */
.share-preview { display: flex; justify-content: center; align-items: center; height: min(560px, 62vh); }
.share-preview canvas { display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: 10px; box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45); }
.share-options { display: grid; gap: 14px; }
.share-row { display: grid; gap: 7px; }
.share-label { font-size: var(--fs-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.sky-swatches { display: flex; gap: 10px; }
.swatch { width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); }
.swatch[aria-pressed='true'] { border-color: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.18); background: transparent; color: var(--text-2); font: 500 var(--fs-m)/1 var(--font-ui); cursor: pointer; }
.chip[aria-pressed='true'] { border-color: rgba(242, 212, 147, 0.6); background: rgba(242, 212, 147, 0.12); color: var(--accent); }
.platforms { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.platform { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 9px 2px 7px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.14); background: transparent; color: var(--text-2); font: 500 var(--fs-xs) var(--font-ui); cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .platform:hover { border-color: rgba(255, 255, 255, 0.35); color: var(--text); } }
.platform span { text-align: center; line-height: 1.2; }
.platform[aria-pressed='true'] { border-color: rgba(242, 212, 147, 0.7); background: rgba(242, 212, 147, 0.12); color: var(--accent); }
@media (max-width: 420px) { .platforms { grid-template-columns: repeat(3, 1fr); } }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.share-actions .action { flex: 1; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
@media (max-width: 720px) {
  .share-layout { grid-template-columns: 1fr; }
  .share-preview { height: 42vh; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 50;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font-size: var(--fs-base);
  font-weight: 500;
  transform: translateX(-50%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  animation: toast-in 0.25s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

@media (max-width: 640px) {
}

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; }
}

/* ---------- Go to verse ---------- */

/* ---------- Pop-ups open by "materialising" (chosen 2026-10-13, option 3 of 4) ----------
   Each pop-up comes into focus from a soft blur while growing slightly out of its button and settling
   into place; it closes faster than it opens. Founder liked it slower than the usual 0.22s ("in normal
   motion you miss it"), so it runs at twice that: --pop-in / --pop-out in css/base.css. Pure CSS on the
   hidden attribute (@starting-style + allow-discrete), so no script changes; browsers without that
   support simply open instantly. The clip-path keeps an 80px margin so shadows are never cut off. */
.pop, .times-pop, .word-tip, .reciter-pop, .audio-panel, .modal, .modal-card {
  --closed-scale: 1; --closed-shift: 0 0; --closed-blur: none; --closed-clip: inset(-80px);
  transition-property: opacity, scale, translate, filter, clip-path, display;
  transition-duration: var(--pop-in);
  transition-timing-function: var(--ease-out);
  transition-behavior: allow-discrete;
  clip-path: inset(-80px);
}
/* Where each one grows from: its button. Header menus drop down; player menus rise from the bar; the
   word meaning rises from its word; windows stay centred. */
.pop, .times-pop { transform-origin: top left; --dir: -1; }
.rd-pop { transform-origin: top right; }
.word-tip, .reciter-pop, .audio-panel { transform-origin: bottom center; --dir: 1; }
.modal-card { transform-origin: center; --dir: 0; }
.modal { --closed-scale: 1 !important; --closed-shift: 0 0 !important; --closed-blur: none !important; --closed-clip: inset(-80px) !important; }

.pop[hidden], .times-pop[hidden], .word-tip[hidden], .reciter-pop[hidden], .audio-panel[hidden], .modal[hidden] {
  opacity: 0; scale: var(--closed-scale); translate: var(--closed-shift); filter: var(--closed-blur); clip-path: var(--closed-clip);
  transition-duration: var(--pop-out);
}
.modal[hidden] .modal-card { scale: var(--closed-scale); translate: var(--closed-shift); filter: var(--closed-blur); }
@starting-style {
  .pop:not([hidden]), .times-pop:not([hidden]), .word-tip:not([hidden]), .reciter-pop:not([hidden]), .audio-panel:not([hidden]), .modal:not([hidden]) {
    opacity: 0; scale: var(--closed-scale); translate: var(--closed-shift); filter: var(--closed-blur); clip-path: var(--closed-clip);
  }
  .modal:not([hidden]) .modal-card { scale: var(--closed-scale); translate: var(--closed-shift); filter: var(--closed-blur); }
}
/* Reduce motion: a plain, gentle fade only. */
@media (prefers-reduced-motion: reduce) {
  .pop, .times-pop, .word-tip, .reciter-pop, .audio-panel, .modal, .modal-card {
    --closed-scale: 1 !important; --closed-shift: 0 0 !important; --closed-blur: none !important; --closed-clip: inset(-80px) !important;
  }
}
.pop, .times-pop, .word-tip, .reciter-pop, .audio-panel, .modal-card { --closed-scale: 0.97; --closed-blur: blur(4px); --closed-shift: 0 calc(var(--dir) * 4px); }

/* ---------- Search by topic or words (js/search.js, 2026-10-14) ---------- */
.sr-label { margin: 8px 2px 2px; font-size: var(--fs-xs); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.sr-moments { display: flex; flex-wrap: wrap; gap: 6px; }
.sr-moment { display: inline-flex; align-items: baseline; gap: 8px; padding: 8px 12px; border: 1px solid rgba(242, 212, 147, 0.35); border-radius: 999px; background: rgba(242, 212, 147, 0.08); color: var(--accent); font: 500 var(--fs-m) var(--font-ui); cursor: pointer; text-align: left; transition: background 0.15s, transform 0.12s ease-out; }
@media (hover: hover) and (pointer: fine) { .sr-moment:hover { background: rgba(242, 212, 147, 0.16); } }
.sr-moment:active { transform: scale(0.97); }
.sr-moment-count { font-size: var(--fs-xs); color: var(--text-3); }
.sr-note { margin: 2px 2px 4px; padding: 8px 10px; border-left: 2px solid rgba(242, 212, 147, 0.5); font-size: var(--fs-s); line-height: 1.5; color: var(--text-2); }
.sr-topics { display: flex; flex-wrap: wrap; gap: 6px; }
.sr-topic { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.08); color: var(--text); font: 500 var(--fs-m) var(--font-ui); cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .sr-topic:hover { background: rgba(255, 255, 255, 0.14); } }
.sr-count { font-size: var(--fs-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.sr-ayahs { display: grid; gap: 2px; }
.sr-ayah { display: grid; gap: 3px; padding: 8px 10px; border: 0; border-radius: 12px; background: transparent; color: var(--text-2); font: 400 var(--fs-m)/1.5 var(--font-ui); text-align: left; cursor: pointer; }
.sr-ayah:focus-visible { background: rgba(255, 255, 255, 0.07); }
@media (hover: hover) and (pointer: fine) { .sr-ayah:hover { background: rgba(255, 255, 255, 0.07); } }
.sr-ref { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; color: var(--accent); }
.sr-text mark { background: rgba(242, 212, 147, 0.22); color: var(--text); border-radius: 3px; padding: 0 1px; }
.sr-all { justify-self: start; margin: 4px 2px; padding: 6px 12px; border: 1px solid var(--panel-border); border-radius: 999px; background: transparent; color: var(--text); font: 500 var(--fs-s) var(--font-ui); cursor: pointer; }
.sr-none { margin: 6px 2px; font-size: var(--fs-m); color: var(--text-3); }
.jump-extra { display: grid; gap: 6px; }
.jump-extra:empty { display: none; }

/* Sources window (opened from the info icon on the card). */
.sources-card { max-width: 520px; text-align: left; }
.sources-list { display: grid; gap: 4px; margin: 0 0 18px; max-height: min(60vh, 520px); overflow-y: auto; }
.sources-list dt { margin-top: 8px; font-size: var(--fs-xs); letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.sources-list dd { margin: 0; font-size: var(--fs-base); line-height: 1.55; color: var(--text-2); }
.sources-version { margin: 0 0 14px; font-size: var(--fs-xs); letter-spacing: 0.04em; color: var(--text-3); }

/* Narrow phones: the three "Show" buttons in the share window stay on one line (type scale, 2026-10-15). */
@media (max-width: 380px) { .chip { padding: 0 10px; } }
