/* Prayer Times by NESCO — setup manual page.
 * Layers on top of main.css; reuses the same tokens, glass, and TV component.
 * Only the manual-specific structure lives here (hero, prerequisites panel,
 * numbered setup steps, on-screen settings, troubleshooting).
 */

/* ---------- manual hero ---------- */
.manual-hero {
  padding-block: clamp(30px, 4.5vw, 56px) clamp(20px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
}
.manual-hero h1 { font-size: clamp(2rem, 4.4vw, 3.1rem); font-weight: 700; max-width: 18ch; }
.manual-lede {
  color: var(--sand-dim);
  font-size: 1.12rem;
  max-width: 48rem;
  margin-top: 16px;
}
.manual-meta {
  display: flex; flex-wrap: wrap; gap: 10px 22px;
  margin-top: 24px;
  color: var(--sand-faint); font-size: 0.88rem;
}
.manual-meta span { display: inline-flex; align-items: center; gap: 8px; }
.manual-meta .ms { color: var(--green); font-size: 1.2rem; }

/* keep anchored sections clear of the sticky header + subnav */
:where(section, .setup-step)[id] { scroll-margin-top: 118px; }
@media (max-width: 880px) { :where(section, .setup-step)[id] { scroll-margin-top: 96px; } }

/* ---------- sticky in-page nav ---------- */
.manual-subnav {
  position: sticky; top: 68px; z-index: 40;
  background: rgba(12, 23, 18, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.manual-subnav .wrap { display: flex; gap: 4px; overflow-x: auto; padding-block: 10px; }
.manual-subnav a {
  white-space: nowrap;
  text-decoration: none; color: var(--sand-dim);
  font-size: 0.88rem; font-weight: 400;
  padding: 7px 14px; border-radius: 999px;
  transition: color var(--dur-short) var(--ease-standard), background var(--dur-short) var(--ease-standard);
}
.manual-subnav a:hover { color: var(--sand); background: var(--surface); }
.manual-subnav a.active { color: var(--sand); background: var(--green-dim); }

/* ---------- prerequisites (the centerpiece) ----------
 * M3 expressive in this site's own voice: tonal surfaces (no borders, no
 * gradients), and the M3 shape library on oversized filled-icon containers —
 * circle, squircle, and two mirrored leaves. On hover the card and its shape
 * morph together, the same shape-morph language as the site's buttons. */
.prereq { padding-block: clamp(40px, 5vw, 68px); }
.prereq-head { max-width: 640px; margin-bottom: clamp(24px, 3vw, 36px); }
.prereq-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--green-dim);
  color: var(--green);
  font-size: 0.74rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px;
  margin-bottom: 16px;
}
html[lang="ar"] .prereq-badge { letter-spacing: 0.02em; }
.prereq-badge .ms { font-size: 1.1rem; }
.prereq-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
.prereq-head p { color: var(--sand-dim); margin-top: 12px; font-size: 1.02rem; }

.prereq-grid {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.prereq-card p { max-width: 52ch; }
.prereq-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 3vw, 30px) clamp(22px, 2.8vw, 28px) clamp(22px, 2.8vw, 26px);
  transition: background var(--dur-med) var(--ease-standard), border-radius var(--dur-med) var(--ease-emph);
}
.prereq-card:hover { background: var(--surface-2); border-radius: var(--radius); }
.prereq-ico {
  width: 72px; height: 72px;
  display: grid; place-items: center;
  background: var(--green-dim); color: var(--green);
  margin-bottom: 20px;
  transition: border-radius var(--dur-med) var(--ease-emph);
}
.prereq-ico .ms {
  font-size: 2.05rem;
  font-variation-settings: 'opsz' 40, 'wght' 500, 'FILL' 0;
}
/* the M3 shape library: circle, squircle, leaf, mirrored leaf */
.prereq-card:nth-child(1) .prereq-ico { border-radius: 50%; }
.prereq-card:nth-child(2) .prereq-ico { border-radius: 24px; }
.prereq-card:nth-child(3) .prereq-ico { border-radius: 50%; border-end-start-radius: 10px; }
.prereq-card:nth-child(4) .prereq-ico { border-radius: 50%; border-end-end-radius: 10px; }
/* card and shape morph together */
.prereq-card:hover .prereq-ico { border-radius: var(--radius); }
.prereq-card h3 { font-size: 1.08rem; margin-bottom: 8px; }
.prereq-card p { color: var(--sand-dim); font-size: 0.93rem; line-height: 1.65; }

/* ---------- numbered setup steps ---------- */
.setup-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  padding-block: clamp(30px, 4.5vw, 56px);
}
.setup-step + .setup-step { border-top: 1px solid var(--line); }
/* alternate the visual to the other side on even steps */
.setup-step:nth-of-type(even) .setup-visual { order: -1; }

.setup-num {
  display: inline-flex; align-items: baseline; gap: 12px;
  margin-bottom: 16px;
}
.setup-num b {
  font-family: 'IBM Plex Sans Arabic', var(--font-display);
  font-size: 2.4rem; font-weight: 700; line-height: 1;
  color: var(--green);
}
.setup-num span {
  font-size: 0.8rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--sand-faint);
}
html[lang="ar"] .setup-num span { letter-spacing: 0.02em; }
.setup-text h2 { font-size: clamp(1.4rem, 2.6vw, 1.9rem); margin-bottom: 12px; }
.setup-text p { color: var(--sand-dim); font-size: 0.95rem; line-height: 1.7; }
.setup-text p + p { margin-top: 12px; }

/* small "or" split and inline choice list inside steps */
.setup-choices { display: grid; gap: 12px; margin-top: 20px; }
.setup-choice {
  display: flex; gap: 13px; align-items: flex-start;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 15px 17px;
}
.setup-choice .ms { color: var(--green); font-size: 1.3rem; margin-top: 2px; flex-shrink: 0; }
.setup-choice strong { display: block; font-weight: 500; font-size: 0.96rem; }
.setup-choice small { color: var(--sand-faint); font-size: 0.85rem; line-height: 1.55; display: block; margin-top: 2px; }

/* the TV preview inside a step */
.setup-visual .tv { max-width: 520px; margin-inline: auto; }

/* ---------- callout (important inline notes) ---------- */
.callout {
  display: flex; gap: 13px; align-items: flex-start;
  background: var(--green-dim);
  border: 1px solid rgba(52, 199, 89, 0.25);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-top: 22px;
}
.callout .ms { color: var(--green); font-size: 1.4rem; flex-shrink: 0; margin-top: 1px; }
.callout-text { font-size: 0.94rem; color: var(--sand); line-height: 1.6; }
.callout-text strong { font-weight: 600; }

/* ---------- on-screen settings ---------- */
/* the OK key on the remote, drawn inline in the lead */
.mn-ok {
  display: inline-block;
  font-weight: 600; font-size: 0.78em; line-height: 1;
  letter-spacing: 0.04em;
  color: var(--sand);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 11px;
  vertical-align: 2px;
}
/* the panel's six controls, laid out evenly */
.settings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.settings-item {
  display: flex; gap: 13px; align-items: flex-start;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  transition: background var(--dur-med) var(--ease-standard), border-radius var(--dur-med) var(--ease-emph);
}
.settings-item:hover { background: var(--surface-2); border-radius: 12px; }
.settings-item .ms { color: var(--green); font-size: 1.35rem; margin-top: 1px; flex-shrink: 0; }
.settings-item strong { display: block; font-weight: 500; font-size: 0.96rem; }
.settings-item small { color: var(--sand-faint); font-size: 0.84rem; line-height: 1.5; display: block; margin-top: 3px; }

/* ---------- step visuals: captioned figures ---------- */
.setup-visual .tv-screen { container-type: size; }
.mn-visual { margin: 0; }
.mn-visual figcaption {
  text-align: center;
  color: var(--sand-faint);
  font-size: 0.84rem;
  margin-top: 12px;
}
/* the step's action button, sitting in the reading flow of the text column */
.mn-visual-cta { display: flex; justify-content: flex-start; margin-top: 24px; }
/* the pairing note lives with the scene it describes */
.setup-visual .callout { margin-top: 18px; }

/* step 1: the real Play-store listing, filling the TV panel */
.mn-play-shot { width: 100%; height: 100%; object-fit: cover; display: block; }

/* real dashboard screenshots: framed to sit on the dark ground */
.mn-shot,
.mn-inline-shot img {
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}

/* step 2 visual: the two dialogs, staggered like cards on a desk —
 * profile behind, the screen that follows it in front */
.mn-shots {
  display: grid;
  max-width: 520px;
  margin-inline: auto;
}
.mn-shots .mn-shot { grid-area: 1 / 1; }
.mn-shot--back { width: 76%; justify-self: start; }
.mn-shot--front { width: 66%; justify-self: end; margin-top: 30%; }
/* wide, short panels (settings cards) stagger tighter than tall dialogs */
.mn-shots--wide .mn-shot--back { width: 84%; }
.mn-shots--wide .mn-shot--front { width: 76%; margin-top: 21%; }

/* step 3: the Link Device dialog inside the reading flow */
.mn-inline-shot { margin: 20px 0 0; max-width: 360px; }
.mn-inline-shot figcaption {
  color: var(--sand-faint);
  font-size: 0.84rem;
  line-height: 1.55;
  margin-top: 10px;
}

/* step 2 visual: a hand raises the phone in front of the TV's QR code.
 * One looped timeline (--mn-t): the phone rises dark from below the frame
 * (cropped at the scene's bottom edge) up to the middle; while it is still
 * rising, the camera view slides up from the phone's bottom edge with the
 * code, the scanner frame appears and breathes, then the phone lowers away. */
.mn-scene { position: relative; overflow: hidden; --mn-t: 10s; }
.mn-scene .tv-screen { position: relative; }

/* the app's own loading screen (LoadingOverlay.kt): green field, splash
 * logo, three pulsing dots, shown once the scan has done its job */
.mn-tv-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--green);
  opacity: 0;
}
/* dp values at Android TV's 2x density: 147dp logo, 10dp dots, 12dp gaps */
.mn-load-logo { width: 27cqh; height: auto; }
.mn-load-dots { display: flex; gap: 2.2cqh; margin-top: 2.6cqh; }
.mn-load-dots span {
  width: 1.9cqh; height: 1.9cqh;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  transform: scale(0.5);
}
.mn-phone {
  position: absolute;
  width: 27%;
  aspect-ratio: 9 / 18;
  inset-inline: 0;
  margin-inline: auto;
  bottom: -12%;
  background: #060606;
  border: 2px solid #2E2E2E;
  border-radius: 18px;
  padding: 5px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.6);
}
.mn-phone-screen {
  position: relative;
  height: 100%;
  border-radius: 13px;
  background: #0B0F0D;   /* dark until the camera catches the code */
  overflow: hidden;
}
.mn-phone-view {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: #0A0F0C;
}
.mn-phone-view img { width: 60%; }
/* what the camera sees once the TV turns green: a soft close-up portion
 * of the loading screen */
.mn-cam-load {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: var(--green);
  opacity: 0;
}
/* same size ratio as QR-on-phone vs QR-on-TV (~0.58x) */
.mn-cam-load svg { width: 35%; filter: blur(1.5px); }
/* scanner corner brackets, breathing gently once the code is in view */
.mn-scan-frame {
  --b: var(--green);
  position: absolute;
  inset: 0;
  margin: auto;
  width: 72%; aspect-ratio: 1;
  background:
    linear-gradient(var(--b), var(--b)) top left / 18% 3px,
    linear-gradient(var(--b), var(--b)) top left / 3px 18%,
    linear-gradient(var(--b), var(--b)) top right / 18% 3px,
    linear-gradient(var(--b), var(--b)) top right / 3px 18%,
    linear-gradient(var(--b), var(--b)) bottom left / 18% 3px,
    linear-gradient(var(--b), var(--b)) bottom left / 3px 18%,
    linear-gradient(var(--b), var(--b)) bottom right / 18% 3px,
    linear-gradient(var(--b), var(--b)) bottom right / 3px 18%;
  background-repeat: no-repeat;
  border-radius: 8px;
}
/* the animation runs only while the scene is on screen: an observer in the
 * page stamps .is-live, so the loop always starts from its beginning */
.mn-scene:not(.is-live) .mn-phone { transform: translateY(105%); }
.mn-scene.is-live .mn-phone { animation: mn-phone-in var(--mn-t) var(--ease-emph) infinite; }
.mn-scene.is-live .mn-phone-view { animation: mn-cam-in var(--mn-t) var(--ease-emph) infinite; }
.mn-scene.is-live .mn-cam-load { animation: mn-cam-load-in var(--mn-t) var(--ease-standard) infinite; }
.mn-scene.is-live .mn-scan-frame { animation: mn-scan 2.2s var(--ease-standard) infinite; }
.mn-scene.is-live .tv { animation: mn-tv-blur var(--mn-t) var(--ease-standard) infinite; }
.mn-scene.is-live .mn-tv-loading { animation: mn-loading-in var(--mn-t) var(--ease-standard) infinite; }
.mn-scene.is-live .mn-load-dots span { animation: mn-dot 1.2s ease-in-out infinite; }
.mn-scene.is-live .mn-load-dots span:nth-child(2) { animation-delay: 0.2s; }
.mn-scene.is-live .mn-load-dots span:nth-child(3) { animation-delay: 0.4s; }

/* rise from below the frame, hold at the middle while scanning, then lower
 * away (loop resets while the phone is fully hidden below the crop) */
@keyframes mn-phone-in {
  0% { transform: translateY(95%); }
  18%, 56% { transform: translateY(0); }
  68%, 100% { transform: translateY(105%); }
}
/* the camera catches the code as the phone rises past it: the QR enters
 * the screen from the top, with the phone's own upward motion */
@keyframes mn-cam-in {
  0% { transform: translateY(-103%); }
  18%, 100% { transform: translateY(0); }
}
/* ... and once the TV turns green, the camera sees green too */
@keyframes mn-cam-load-in {
  0%, 34% { opacity: 0; }
  40%, 100% { opacity: 1; }
}
/* depth of field: the TV behind falls out of focus while the phone is up */
@keyframes mn-tv-blur {
  0% { filter: blur(0); }
  18%, 56% { filter: blur(5px); }
  70%, 100% { filter: blur(0); }
}
/* the scan lands mid-scene: the TV switches to the app's loading screen,
 * still out of focus behind the raised phone */
@keyframes mn-loading-in {
  0%, 32% { opacity: 0; }
  38%, 94% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes mn-scan {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
/* PulsingDots: 600ms tween, reverse repeat, 200ms stagger */
@keyframes mn-dot {
  0%, 100% { transform: scale(0.5); }
  50% { transform: scale(1); }
}
/* no motion: the scene rests at its scanning moment, TV kept sharp */
@media (prefers-reduced-motion: reduce) {
  .mn-scene.is-live :is(.mn-phone, .mn-phone-view, .mn-cam-load, .mn-scan-frame, .tv, .mn-tv-loading, .mn-load-dots span) { animation: none; }
}
.perf-lite .mn-scene.is-live :is(.mn-phone, .mn-phone-view, .mn-cam-load, .mn-scan-frame, .tv, .mn-tv-loading, .mn-load-dots span) { animation: none; }

/* ---------- everyday use: all four states at once ---------- */
.mn-daily {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(24px, 3.5vw, 40px);
}
.mn-state-cap { display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; }
.mn-state-cap .ms { color: var(--green); font-size: 1.35rem; flex-shrink: 0; margin-top: 2px; }
.mn-state-cap strong { display: block; font-weight: 500; font-size: 0.98rem; }
.mn-state-cap small { color: var(--sand-faint); font-size: 0.84rem; line-height: 1.5; display: block; margin-top: 2px; }

/* ---------- responsive ---------- */
@media (max-width: 880px) {
  .manual-subnav { top: 0; }
  /* stacked: hold the step to the TV's own width so text and preview align */
  .setup-step { grid-template-columns: 1fr; gap: 24px; max-width: 560px; margin-inline: auto; }
  .setup-step:nth-of-type(even) .setup-visual { order: 0; }
  .settings-grid { grid-template-columns: repeat(2, 1fr); }
  .mn-scene .mn-phone { width: 32%; }
  .mn-daily { grid-template-columns: 1fr; max-width: 560px; margin-inline: auto; }
}
@media (max-width: 640px) {
  .settings-grid { grid-template-columns: 1fr; }
  .prereq-grid { grid-template-columns: 1fr; }
  .prereq-ico { width: 60px; height: 60px; margin-bottom: 16px; }
  .prereq-ico .ms { font-size: 1.7rem; }
}
