/* ============================================================
   Manzar — Qur'an presentation: the settings page + fullscreen
   stage. The slide look itself lives in quran-slides.css (frozen);
   this file only provides the picker UI and the letterboxed stage
   that wraps the engine's slides. Built on base.css design tokens.
   ============================================================ */

/* ---- Settings page ------------------------------------------------------- */
.quran-present-page { background: var(--surface-canvas); }

.qsettings {
  max-width: 1080px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-5) var(--space-7);
}
.qsettings[hidden] { display: none; }

.qsettings .backlink { margin-bottom: var(--space-5); }

.qsettings__head { text-align: center; margin-bottom: var(--space-6); }
.qsettings__eyebrow {
  margin: 0 0 var(--space-2);
  font-family: var(--font-ui);
  font-size: var(--fs-caption);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.qsettings__title { margin: 0; font-family: var(--font-serif); font-size: var(--fs-h1); color: var(--text-strong); }
.qsettings__meaning { color: var(--text-muted); font-size: 0.7em; }
.qsettings__facts { margin: var(--space-2) 0 0; font-family: var(--font-serif); font-size: var(--fs-h3); color: var(--text-muted); }
.qsettings__count { font-family: var(--font-ui); font-size: var(--fs-body-sm); color: var(--text-faint); }

.qsettings__grid { display: flex; flex-direction: column; gap: var(--space-6); }

/* 50/50: look controls on the left, the live preview pinned on the right so the
   slide updates in place as options change. Collapses to one column when narrow. */
.qsettings__split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-7);
  align-items: start;
}
.qsettings__preview-col { position: sticky; top: var(--space-5); }

/* Subtle panels: the controls and the preview each sit on a raised card (a touch
   lighter than the page canvas, hairline border) so it's clear what is what. */
.qsettings__controls,
.qpreview {
  background: var(--surface-raised);
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--radius-container);
  padding: var(--space-5);
}

@media (max-width: 880px) {
  .qsettings__split { grid-template-columns: 1fr; gap: var(--space-6); }
  .qsettings__preview-col { position: static; }
}

.qfield__label { margin: 0 0 var(--space-3); font-family: var(--font-ui); font-size: var(--fs-body-sm); font-weight: 600; color: var(--text-strong); letter-spacing: 0.02em; }
.qfield__hint { font-weight: 400; color: var(--text-faint); }

/* Palette swatches: base colour with an accent dot. The pal-* class sets
   --q-base / --q-accent on the button itself, so the swatch IS the palette. */
.qpalette { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); }
.qswatch {
  position: relative;
  width: 100%; height: 46px;
  border-radius: var(--radius-control);
  background: var(--q-base);
  border: 2px solid var(--border-default);
  cursor: pointer;
  padding: 0;
  transition: border-color var(--dur) var(--ease-calm), transform var(--dur) var(--ease-calm);
}
.qswatch::after {
  content: "";
  position: absolute; right: 7px; bottom: 7px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--q-accent);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.35);
}
.qswatch:hover { transform: translateY(-1px); }
.qswatch.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--surface-canvas), 0 0 0 4px var(--accent); }

/* Background previews: a small live .q-slide in the current palette. */
.qbgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
.qbg-opt {
  border: 2px solid var(--border-default);
  border-radius: var(--radius-control);
  overflow: hidden;
  cursor: pointer;
  background: none;
  padding: 0;
  transition: border-color var(--dur) var(--ease-calm);
}
.qbg-opt:hover { border-color: var(--border-strong); }
.qbg-opt.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--surface-canvas), 0 0 0 4px var(--accent); }
.qbg-opt .q-slide { width: 100%; }
.qbg-opt__name {
  display: block;
  padding: 6px var(--space-3);
  font-family: var(--font-ui);
  font-size: var(--fs-caption);
  color: var(--text-muted);
  text-align: center;
  background: var(--surface-card);
  border-top: var(--bw-hair) solid var(--border-default);
}

.qfield--row { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-6); }
.qcheck { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-ui); font-size: var(--fs-body); color: var(--text-strong); cursor: pointer; }
.qcheck--start { gap: 10px; color: var(--text-muted); }
.qcheck select {
  font-family: var(--font-ui);
  font-size: var(--fs-body-sm);
  padding: 6px 10px;
  border: var(--bw-hair) solid var(--border-default);
  border-radius: var(--radius-control);
  background: var(--surface-card);
  color: var(--text-strong);
}

/* Live preview slide */
.qpreview { margin-top: 0; }
.qpreview__frame {
  max-width: 100%;
  margin: 0;
  border-radius: var(--radius-container);
  overflow: hidden;
  box-shadow: var(--shadow-raised);
}
.qpreview__frame .q-slide { width: 100%; }

.qsettings__actions { margin-top: var(--space-6); text-align: left; }
.qstart-btn {
  font-family: var(--font-ui);
  font-size: var(--fs-body);
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-control);
  padding: var(--space-3) var(--space-6);
  cursor: pointer;
  transition: background var(--dur) var(--ease-calm);
}
.qstart-btn:hover { background: var(--accent-press); }
/* Secondary "Resume — slide N", offered only after an accidental exit. */
.qresume-btn {
  display: inline-block;
  margin-top: var(--space-3);
  font-family: var(--font-ui);
  font-size: var(--fs-body-sm);
  font-weight: 600;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius-control);
  padding: var(--space-2) var(--space-5);
  cursor: pointer;
  transition: background var(--dur) var(--ease-calm), color var(--dur) var(--ease-calm);
}
.qresume-btn:hover { background: var(--accent); color: #fff; }
/* Explicit display above overrides the [hidden] UA rule — restore it. */
.qresume-btn[hidden] { display: none; }
.qsettings__note { margin: var(--space-3) 0 0; font-family: var(--font-ui); font-size: var(--fs-body-sm); color: var(--text-faint); }

/* ---- The fullscreen stage (adapted from the package's example.html) ------ */
.stage {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: #000;
  z-index: 100;
}
.stage[hidden] { display: none; }
.frame { position: relative; width: min(96vw, 170.6vh); aspect-ratio: 16 / 9; }
.frame .q-slide { position: absolute; inset: 0; opacity: 0; }
/* No crossfade — slides cut instantly between each other. */
.frame.ready .q-slide { transition: none; }
.frame .q-slide.show { opacity: 1; }

/* Nav controls live OUTSIDE the scaled slide so they stay usable; faint,
   shown only when the mouse moves (auto-hide after stillness). */
.qnav {
  position: fixed; top: 50%; transform: translateY(-50%);
  width: 54px; height: 54px; border-radius: 50%;
  display: grid; place-items: center;
  cursor: pointer; z-index: 110; color: #fff;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(6px);
  opacity: 0; transition: opacity var(--dur) var(--ease-calm);
}
.qnav svg { width: 22px; height: 22px; }
.qnav--prev { left: 18px; }
.qnav--next { right: 18px; }
.stage.show-controls .qnav { opacity: 1; }
.qnav:hover { background: rgba(255,255,255,0.14); }

.qcounter {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 110;
  font-family: var(--font-ui); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  opacity: 0; transition: opacity var(--dur) var(--ease-calm);
}
.stage.show-controls .qcounter { opacity: 1; }

.qhint {
  position: fixed; bottom: 56px; left: 50%; transform: translateX(-50%); z-index: 110;
  font-family: var(--font-ui); font-size: 13px; letter-spacing: 0.08em;
  color: rgba(255,255,255,0.55);
  background: rgba(0,0,0,0.4); padding: 8px 16px; border-radius: 999px;
  opacity: 0; transition: opacity 0.4s var(--ease-calm); pointer-events: none;
}
.qhint.is-visible { opacity: 1; }

.stage.cursor-hidden { cursor: none; }

@media (prefers-reduced-motion: reduce) {
  .frame.ready .q-slide { transition: none; }
}
