/* Pray view — selector, unit picker, step reader.
   Mobile-first (390px is the design width). Uses only the tokens defined in styles.css.
   v2: compact chrome everywhere, Arabic stays large, art demoted to a small float. */

.pv { padding-bottom: 20px; }

/* recitation-type colour coding — one palette, used by cards, rail and legend */
.pv-reader,
.pv-legend {
  --t-takbir: #d6b25e;
  --t-quran: #5b8ae6;
  --t-tasbih: #37b3a2;
  --t-dua: #a37ade;
  --t-salam: #56bd80;
}
.pv [data-type="takbir"] { --tcol: var(--t-takbir); }
.pv [data-type="quran"]  { --tcol: var(--t-quran); }
.pv [data-type="tasbih"] { --tcol: var(--t-tasbih); }
.pv [data-type="dua"]    { --tcol: var(--t-dua); }
.pv [data-type="salam"]  { --tcol: var(--t-salam); }

/* ---------- shared head ---------- */
.pv-head { margin: 10px 0 14px; }
.pv-head-tight { margin: 6px 0 10px; }
.pv-h1 { font-size: 1.45rem; font-weight: 600; letter-spacing: .01em; }
.pv-h1-ar {
  font-family: var(--font-ar);
  color: var(--gold);
  font-size: 1.1rem;
  margin-left: 8px;
  vertical-align: .06em;
}
.pv-sub { color: var(--text-dim); font-size: .82rem; margin-top: 4px; }
.pv-loading { color: var(--text-dim); font-size: .9rem; padding: 40px 0; text-align: center; }

/* ---------- A. prayer selector ---------- */
.pv-group { margin-bottom: 16px; }
.pv-group-h {
  font-size: .68rem; letter-spacing: .16em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 7px;
}
.pv-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.pv-chip {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 9px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: background .18s, border-color .18s, transform .12s;
}
.pv-chip:hover { background: var(--surface-2); border-color: var(--gold-dim); }
.pv-chip:active { transform: scale(.97); }
.pv-chip-en { font-weight: 600; font-size: .9rem; }
.pv-chip-ar { font-family: var(--font-ar); font-size: .9rem; color: var(--gold); }

.pv-chips-2 .pv-chip { padding: 8px 9px; }
.pv-chips-2 .pv-chip-en { font-size: .82rem; font-weight: 500; }
.pv-chips-2 .pv-chip-ar { font-size: .8rem; color: var(--gold-dim); }

/* wudu card */
.pv-wudu {
  width: 100%;
  display: flex; align-items: center; gap: 11px;
  text-align: left;
  margin-top: 4px;
  padding: 12px 13px;
  border-radius: var(--r-lg);
  border: 1px solid var(--gold-dim);
  background: linear-gradient(140deg, var(--surface-2) 0%, var(--surface) 70%);
  transition: border-color .2s, transform .12s;
}
.pv-wudu:hover { border-color: var(--gold); }
.pv-wudu:active { transform: scale(.99); }
.pv-wudu-glyph {
  flex: 0 0 auto;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--gold-dim);
  background:
    radial-gradient(circle at 50% 62%, var(--gold) 0 22%, transparent 23%),
    radial-gradient(circle at 50% 30%, var(--gold-dim) 0 12%, transparent 13%);
  opacity: .9;
}
.pv-wudu-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pv-wudu-kicker {
  font-size: .64rem; letter-spacing: .18em; text-transform: uppercase; color: var(--gold);
}
.pv-wudu-title { font-weight: 600; font-size: .96rem; line-height: 1.3; }
.pv-wudu-note { color: var(--text-dim); font-size: .78rem; }
.pv-wudu-go { margin-left: auto; color: var(--gold); font-size: 1.4rem; line-height: 1; }

/* ---------- breadcrumb ---------- */
.pv-crumb {
  display: flex; align-items: center; gap: 7px;
  font-size: .78rem; color: var(--text-dim);
  margin: 8px 0 2px;
  min-width: 0;
}
.pv-crumb-back {
  color: var(--gold); font-size: .78rem;
  padding: 5px 0; text-decoration: underline; text-underline-offset: 3px;
  white-space: nowrap;
}
.pv-crumb-back:hover { color: var(--gold-bright); }
.pv-crumb-sep { color: var(--gold-dim); }
.pv-crumb-now { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- B. unit picker ---------- */
.pv-units {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: start;
}
.pv-unit {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color .18s;
}
.pv-unit:hover { border-color: var(--gold-dim); }
.pv-unit-main {
  width: 100%; text-align: left;
  display: flex; flex-direction: column; gap: 3px;
  padding: 11px 11px 12px;
}
.pv-unit-main:active { background: var(--surface-2); }
.pv-unit-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.pv-unit-label { font-size: 1rem; font-weight: 600; }
.pv-unit-rak {
  color: var(--gold); font-size: .74rem; letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
}
.pv-unit-note { color: var(--text-dim); font-size: .75rem; line-height: 1.45; margin-top: 1px; }

.pv-badge {
  font-size: .6rem; letter-spacing: .12em; text-transform: uppercase;
  padding: 2px 6px; border-radius: var(--r-pill);
  border: 1px solid var(--line); color: var(--text-dim);
}
.pv-badge-fard { color: var(--gold-bright); border-color: var(--gold-dim); }
.pv-badge-witr { color: var(--gold); border-color: var(--gold-dim); }

.pv-resume {
  display: block; width: 100%; text-align: left;
  padding: 7px 11px;
  font-size: .72rem; letter-spacing: .03em;
  color: var(--gold-bright);
  border-top: 1px solid var(--line);
  background: rgba(214, 178, 94, .07);
}
.pv-resume:hover { background: rgba(214, 178, 94, .13); }

.pv-madhab {
  color: var(--text-dim);
  font-size: .72rem; line-height: 1.55;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

/* ---------- C. reader ---------- */

/* header row: breadcrumb left, language control right */
.pv-rhead {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.pv-rhead .pv-crumb { flex: 1 1 auto; }

.pv-langwrap {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 5px 3px 7px;
  border: 1px solid var(--gold-dim);
  border-radius: var(--r-pill);
  background: var(--surface);
}
.pv-lang-lbl {
  font-size: .58rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--text-dim);
}
.pv-lang {
  appearance: auto;
  background: transparent;
  border: 0;
  color: var(--gold-bright);
  font-size: .76rem; font-weight: 600; letter-spacing: .06em;
  padding: 2px 0;
  min-height: 24px;
  cursor: pointer;
}
.pv-lang:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }
.pv-lang option { background: var(--surface); color: var(--text); }

/* legend — five dots, deliberately tiny */
.pv-legend {
  display: flex; flex-wrap: wrap; gap: 4px 10px;
  margin: 6px 0 8px;
  font-size: .58rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-dim);
}
.pv-lg { display: inline-flex; align-items: center; gap: 4px; }
.pv-lg i {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--tcol, var(--gold));
}

.pv-stage {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 2px;
}

/* left rail — 60px thumbs, number + type colour carry the meaning */
.pv-rail {
  flex: 0 0 60px;
  width: 60px;
  max-height: calc(100dvh - 250px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  display: flex; flex-direction: column; gap: 4px;
  padding: 4px;
  background: rgba(7, 31, 24, .5);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  position: sticky;
  top: 8px;
}
.pv-rail::-webkit-scrollbar { width: 3px; }
.pv-rail::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: var(--r-pill); }

.pv-rail-item {
  position: relative;
  flex: 0 0 auto;
  width: 100%; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid transparent;
  border-left: 3px solid var(--tcol, var(--gold-dim));
  border-radius: 8px;
  background: var(--surface);
  opacity: .78;
  transition: border-color .16s, background .16s, opacity .16s;
}
.pv-rail-item:hover { background: var(--surface-2); opacity: 1; }
.pv-rail-item.on {
  opacity: 1;
  border-color: var(--gold);
  border-left-color: var(--tcol, var(--gold));
  background: linear-gradient(150deg, var(--surface-2), var(--surface));
  box-shadow: 0 0 0 1px rgba(214, 178, 94, .25), 0 3px 12px rgba(0, 0, 0, .35);
}
.pv-rail-n {
  position: absolute; top: 2px; left: 5px;
  font-size: .62rem; font-weight: 700; line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--tcol, var(--text-dim));
}
.pv-rail-item.on .pv-rail-n { color: var(--gold-bright); }
.pv-rail-img {
  max-width: 30px; max-height: 32px; width: auto; height: auto;
  opacity: .62;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .45));
}
.pv-rail-item.on .pv-rail-img { opacity: 1; }

/* main pane */
.pv-main { flex: 1 1 auto; min-width: 0; }
.pv-step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--tcol, var(--gold-dim));
  border-radius: var(--r-lg);
  padding: 12px 13px 16px;
}
.pv-step::after { content: ''; display: block; clear: both; }

.pv-step-top {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.pv-step-badge {
  flex: 0 0 auto;
  min-width: 26px; height: 26px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: var(--tcol, var(--gold));
  color: #10160f;
  font-size: .86rem; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.pv-step-type {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .62rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--tcol, var(--gold));
  font-weight: 600;
}
.pv-step-type .pv-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tcol, var(--gold));
}
.pv-step-meta {
  margin-left: auto;
  font-size: .62rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* the title is the dominant element on every card */
.pv-step-title {
  font-size: 1.25rem; font-weight: 700; line-height: 1.2;
  margin: 0 0 10px;
}

/* posture art: a small float beside the words, never a hero */
.pv-figure {
  float: right;
  width: 90px;
  margin: 0 0 8px 12px;
  display: flex; justify-content: center;
}
.pv-figure img {
  max-width: 90px; max-height: 110px; width: auto; height: auto;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .45));
}

/* Arabic stays generous — this is the one thing that must not shrink */
.pv-ar {
  font-family: var(--font-ar);
  font-size: 1.55rem;
  line-height: 1.95;
  direction: rtl;
  text-align: right;
  color: var(--gold-bright);
  margin-bottom: 10px;
}
.pv-translit {
  font-style: italic;
  color: var(--gold);
  font-size: .88rem;
  line-height: 1.6;
  margin-bottom: 8px;
}
.pv-en { font-size: .92rem; line-height: 1.6; margin-bottom: 10px; }
.pv-how {
  color: var(--text-dim);
  font-size: .8rem; line-height: 1.6;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  clear: both;
}

/* ---------- slim sticky control bar (replaces the two giant pills) ---------- */
.pv-ctrl {
  position: sticky;
  bottom: calc(var(--tabbar-h) + 10px);
  z-index: 5;
  height: 48px;
  margin-top: 10px;
  display: flex; align-items: center; gap: 8px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, .45);
}
.pv-ctrl-arrow {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--gold-dim);
  color: var(--gold-bright);
  font-size: 1.3rem; line-height: 1;
  background: transparent;
  transition: background .16s, opacity .2s, transform .12s;
}
.pv-ctrl-arrow:hover { background: var(--surface-2); }
.pv-ctrl-arrow:active { transform: scale(.94); }
.pv-ctrl-arrow.pv-btn-quiet { opacity: .5; }

.pv-ctrl-mid { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pv-ctrl-track {
  height: 3px; border-radius: var(--r-pill);
  background: var(--line);
  overflow: hidden;
}
.pv-ctrl-track i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold-bright));
  transition: width .25s cubic-bezier(.16, 1, .3, 1);
}
.pv-ctrl-txt {
  font-size: .68rem; letter-spacing: .08em;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------- generic buttons (completion + error cards) ---------- */
.pv-btn {
  flex: 1 1 0;
  min-height: 46px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-size: .92rem; font-weight: 600;
  border-radius: var(--r-pill);
  transition: transform .12s, box-shadow .2s, opacity .2s;
}
.pv-btn:active { transform: scale(.97); }
.pv-btn-gold {
  background: var(--gold); color: #21190a;
  box-shadow: 0 4px 18px rgba(214, 178, 94, .25);
}
.pv-btn-ghost { color: var(--gold); border: 1px solid var(--gold-dim); }
.pv-arrow { font-size: 1.2rem; line-height: 1; }

/* ---------- completion ---------- */
.pv-done { text-align: center; padding: 40px 12px 16px; }
.pv-done-mark {
  width: 56px; height: 56px; margin: 0 auto 16px;
  border-radius: 50%;
  border: 1px solid var(--gold-dim);
  background: radial-gradient(circle at 50% 50%, rgba(214, 178, 94, .22) 0 40%, transparent 41%);
}
.pv-done-title { font-size: 1.2rem; font-weight: 600; }
.pv-done-sub { color: var(--text-dim); font-size: .86rem; margin-top: 5px; }
.pv-done-nav { display: flex; flex-direction: column; gap: 9px; margin-top: 20px; }

/* ---------- error ---------- */
.pv-error {
  text-align: center;
  margin-top: 30px;
  padding: 22px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.pv-error-title { font-size: 1.05rem; font-weight: 600; }
.pv-error-msg { color: var(--text-dim); font-size: .84rem; margin: 8px 0 16px; }
.pv-error .pv-btn { width: 100%; }

/* ---------- wider screens ---------- */
@media (min-width: 480px) {
  .pv-units { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pv-chips { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .pv-rail { flex-basis: 66px; width: 66px; }
  .pv-rail-item { height: 50px; }
  .pv-rail-img { max-width: 34px; max-height: 36px; }
  .pv-step { padding: 16px 18px 20px; }
  .pv-figure { width: 100px; margin-left: 16px; }
  .pv-figure img { max-width: 100px; max-height: 128px; }
  .pv-ar { font-size: 1.7rem; }
  .pv-done-nav { flex-direction: row; }
}

/* ---------- theme-proof type coding ----------
   themes.css repaints .pv-step and .pv-rail-item borders with a higher-specificity
   selector. These rules win the left stripe back so the recitation-type colour
   survives in every theme; everything else stays under theme control. */
.pv-reader .pv-main .pv-step[data-type] { border-left: 4px solid var(--tcol); }
.pv-reader .pv-rail .pv-rail-item[data-type] { border-left: 3px solid var(--tcol); }
.pv-reader .pv-rail .pv-rail-item[data-type].on { border-left-color: var(--tcol); }

@media (prefers-reduced-motion: reduce) {
  .pv-ctrl-track i { transition: none; }
  .pv-btn:active, .pv-chip:active, .pv-wudu:active, .pv-ctrl-arrow:active { transform: none; }
}
