/* ============================================================
   v7 "CLINICAL IVORY" — component layer
   Loaded last. tokens.css already flips the palette; this file only
   holds what a token swap cannot express: the new photo hero, flat
   clean surfaces in place of the old glow/bloom vocabulary, and the
   photographic condition cards.
   ============================================================ */

html, body { background: var(--obsidian); color: var(--snow); }

/* Retire the dark-era ambient light layers — on ivory they read as stains. */
.ambient, .ambient-glow, .grain, .hero-bloom, .hero3d-bloom,
#bg-canvas, .bg-canvas, .centerpiece-canvas { display: none !important; }

/* ---------- HERO ---------- */
#s0 .s0-body { padding: 12px 20px 24px; gap: 0; }

.hero-photo {
  margin: 0 0 22px;
  border-radius: 20px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #EFE7DA;
  box-shadow: var(--shadow-2);
  animation: v7Rise .9s var(--ease-out) both;
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

#s0 .specimen-tag { margin: 0 0 10px; }
#s0 .hero-headline { margin: 0 0 12px; }
#s0 .hero-headline .line-truth {
  color: var(--snow);
  background: none; -webkit-text-fill-color: currentColor;
  font-weight: 800; line-height: 1.25;
}
#s0 .hero-headline .line-strike { color: var(--mist-dim); }
#s0 .hero-sub { color: var(--mist); margin: 0 0 18px; }
#s0 .hero-trust { color: var(--mist); margin: 0 0 20px; order: 9; justify-content: center; }
#s0 .hero-cta-group { margin: 0 0 16px; }

.btn-start, .btn-primary, .btn-gold {
  background: var(--grad-gold) !important;
  color: #fff !important;
  border: 0 !important;
  box-shadow: 0 8px 20px rgba(184,137,62,0.28) !important;
}
.btn-start * { color: #fff !important; }

/* Floating action buttons sat on top of the headline — keep them low and small. */
.floating-actions, .global-fab-group { top: auto !important; bottom: 88px !important; }

/* ---------- SURFACES ---------- */
.opt, .option-card, .q-option, .card, .panel, .lead-card, .report-card {
  background: #fff;
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow-1);
}
.opt.selected, .option-card.selected, .q-option.selected, .opt[aria-checked="true"] {
  border-color: var(--gold);
  box-shadow: var(--panel-glow-active);
  background: #FFFCF6;
}

/* Photographic condition cards: real photos deserve real room. */
.opt img, .option-card img, .img-card img, .opt-img img {
  border-radius: 12px;
  object-fit: cover;
}

@keyframes v7Rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .hero-photo { animation: none; } }

/* ---------- HEADER: ivory bar, hairline below ---------- */
.app-header, html[data-quality="low"] .app-header {
  background: rgba(250,247,242,.94) !important;
  border-bottom: 1px solid var(--hairline);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
}
.lang-toggle, .lang-toggle svg { color: #fff !important; }

/* ---------- SCREENS: clean ivory, no photographic wallpaper ---------- */
.screen:not(#s0) { background: var(--obsidian) !important; }
.q-body::before { display: none !important; }

/* ---------- HERO TYPE: calmer scale so the CTA lands above the fold ---------- */
#s0 .hero-headline { font-size: clamp(28px, 8vw, 40px); line-height: 1.2; letter-spacing: 0; }
#s0 .hero-headline .line-strike { font-size: .62em; margin-bottom: 6px; }
.hero-photo { aspect-ratio: 16 / 11; }

/* ---------- PHOTO ANSWER CARDS ----------
   When a question's answers carry photos, lay them out as a 2-column
   gallery with the photo on top — the photo IS the answer, so it gets
   the room. Text-only answers in the same list span the full width. */
#adaptive-opts:has(.has-condition-img), .opts:has(.has-condition-img) {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
#adaptive-opts:has(.has-condition-img) .opt:not(:has(.has-condition-img)),
.opts:has(.has-condition-img) .opt:not(:has(.has-condition-img)) { grid-column: 1 / -1; }
.opt:has(.has-condition-img) { padding: 8px !important; }
.opt-content.has-condition-img { flex-direction: column; align-items: stretch; gap: 10px; text-align: start; }
.condition-card-img-wrap {
  width: 100%; height: auto; aspect-ratio: 1; border-radius: 12px;
  background: #EFE7DA;
}
.opt-content.has-condition-img .opt-text { padding: 0 4px 4px; }
.opt-content.has-condition-img .opt-label { font-size: 14px; line-height: 1.35; }
.opt-content.has-condition-img .opt-sub { font-size: 12px; }
.opt.selected .condition-card-img-wrap { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- CTA ---------- */
.btn-start { min-height: 58px !important; height: auto !important; padding: 14px 20px !important; border-radius: 16px !important; align-items: center !important; }
.btn-start::before, .btn-start::after { display: none !important; }
.btn-start .btn-start-arrow { background: rgba(255,255,255,.22) !important; color: #fff !important; }
.opt:has(.has-condition-img) { position: relative; display: block !important; border-radius: 16px !important; margin: 0 !important; }
.opt:has(.has-condition-img)::before {
  position: absolute; top: 14px; inset-inline-start: 14px; z-index: 2;
  background: rgba(255,255,255,.9); border-radius: 999px; padding: 2px 7px; margin: 0 !important;
}
.opt:has(.has-condition-img) .opt-content { width: 100%; }
.q-progress { background: var(--obsidian) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
.q-progress::before, .q-progress::after { display: none !important; }
#adaptive-opts:has(.has-condition-img){margin-inline:0 !important;width:100%;}

/* ============================================================
   v7.1 TYPE — one Arabic family, no tracking on Arabic.
   Letter-spacing breaks Arabic joining (the spaced "ا ل ت ش خ ي ص"
   labels), and the mono Latin face had no Arabic glyphs at all, so
   labels fell back to a system font. Everything now reads in
   IBM Plex Sans Arabic; Latin falls back to Manrope.
   ============================================================ */
:root {
  --ff-body: 'IBM Plex Sans Arabic', 'Manrope', system-ui, sans-serif;
  --ff-display: 'IBM Plex Sans Arabic', 'Manrope', system-ui, sans-serif;
  --ff-latin-display: 'Manrope', 'IBM Plex Sans Arabic', sans-serif;
  --ff-latin-body: 'Manrope', 'IBM Plex Sans Arabic', sans-serif;
  --ff-mono: 'IBM Plex Sans Arabic', 'Manrope', sans-serif;
}
html[dir="rtl"] *, html[lang="ar"] * { letter-spacing: 0 !important; }
html[dir="rtl"] *:not(.btn-start-arrow) { text-transform: none !important; }
body { font-family: var(--ff-body); -webkit-font-smoothing: antialiased; }

/* ============================================================
   v7.1 HERO — alive, ordered, calm
   ============================================================ */
#s0 .s0-body { display: flex; flex-direction: column; }
.hero-photo { position: relative; aspect-ratio: 4 / 3; margin-bottom: 20px; }
.hero-photo img { animation: v7KenBurns 18s ease-in-out infinite alternate; transform-origin: 60% 55%; }
@keyframes v7KenBurns { from { transform: scale(1); } to { transform: scale(1.08); } }

.hero-float {
  position: absolute; z-index: 2;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px;
  background: rgba(255,255,255,.92);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px rgba(74,56,28,.12);
  font-size: 12.5px; font-weight: 500; color: var(--snow);
  animation: v7Float 5s ease-in-out infinite, v7Pop .7s var(--ease-out) both;
}
.hero-float b { color: var(--gold-bright); font-weight: 700; font-size: 14px; }
.hero-float-a { top: 14px; inset-inline-start: 14px; animation-delay: 0s, .5s; }
.hero-float-b { bottom: 14px; inset-inline-end: 14px; animation-delay: -2.5s, .8s; }
.hf-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 4px rgba(79,122,94,.15); }
@keyframes v7Float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes v7Pop { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }

/* Staggered entrance */
#s0 .specimen-tag, #s0 .hero-headline, #s0 .hero-sub, #s0 .hero-cta-group, #s0 .hero-trust, #s0 .hero-conditions {
  animation: v7Rise .8s var(--ease-out) both;
}
#s0 .specimen-tag   { animation-delay: .15s; }
#s0 .hero-headline  { animation-delay: .25s; }
#s0 .hero-sub       { animation-delay: .35s; }
#s0 .hero-cta-group { animation-delay: .45s; }
#s0 .hero-trust     { animation-delay: .55s; order: 0; justify-content: flex-start; flex-wrap: wrap; }
#s0 .hero-conditions{ animation-delay: .65s; }

#s0 .specimen-tag {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px; background: var(--gold-soft);
}
#s0 .specimen-text { font-size: 12.5px; font-weight: 600; color: var(--gold-deep); }
#s0 .hero-headline { font-size: clamp(27px, 7.6vw, 38px); font-weight: 700; line-height: 1.3; }
#s0 .hero-headline .line-truth { font-weight: 700; }
#s0 .hero-headline .line-strike { font-size: .55em; font-weight: 500; }
#s0 .hero-sub { font-size: 16px; line-height: 1.75; }
#s0 .hero-trust span { font-size: 13px; }

/* CTA: soft breathing glow so the eye lands on it */
.btn-start { animation: v7Rise .8s var(--ease-out) .45s both, v7Breathe 3.2s ease-in-out 1.6s infinite !important; }
@keyframes v7Breathe { 0%,100% { box-shadow: 0 8px 20px rgba(184,137,62,.28); } 50% { box-shadow: 0 10px 30px rgba(184,137,62,.45); } }

/* Conditions marquee */
.hero-conditions { margin-top: 26px; }
.hc-title { font-size: 14px; font-weight: 600; color: var(--snow); margin-bottom: 12px; }
.hc-track {
  overflow: hidden; cursor: pointer; margin-inline: -20px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.hc-row { display: flex; gap: 10px; width: max-content; padding: 4px 20px; animation: v7Marquee 28s linear infinite; }
.hc-track:hover .hc-row { animation-play-state: paused; }
.hc-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 14px 5px 5px; border-radius: 999px;
  background: #fff; border: 1px solid var(--panel-border); box-shadow: var(--shadow-1);
  font-size: 13.5px; font-weight: 500; color: var(--snow); white-space: nowrap;
}
html[dir="rtl"] .hc-chip { padding: 5px 5px 5px 14px; }
.hc-chip img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
@keyframes v7Marquee { from { transform: translateX(0); } to { transform: translateX(50%); } }
html[dir="ltr"] .hc-row { animation-name: v7MarqueeL; }
@keyframes v7MarqueeL { from { transform: translateX(0); } to { transform: translateX(-50%); } }

@media (prefers-reduced-motion: reduce) {
  .hero-photo img, .hero-float, .btn-start, .hc-row,
  #s0 .specimen-tag, #s0 .hero-headline, #s0 .hero-sub, #s0 .hero-cta-group, #s0 .hero-trust, #s0 .hero-conditions { animation: none !important; }
}

/* ============================================================
   v7.1 REPORT STORIES
   ============================================================ */
.rs-chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 4px 2px 12px; margin: 0 0 6px; position: sticky; top: 56px; z-index: 5;
  background: linear-gradient(var(--obsidian) 80%, transparent);
}
.rs-chips::-webkit-scrollbar { display: none; }
.rs-chip {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px 7px 8px; border-radius: 999px; border: 1px solid var(--panel-border);
  background: #fff; color: var(--mist); font: 500 13px/1 var(--ff-body); cursor: pointer;
  transition: background .25s, color .25s, border-color .25s;
}
.rs-chip b { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold-soft); color: var(--gold-deep); font-size: 11px; }
.rs-chip.on { background: var(--snow); color: #fff; border-color: var(--snow); }
.rs-chip.on b { background: var(--gold); color: #fff; }

.rs-deck {
  display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory;
  scrollbar-width: none; gap: 14px; transition: height .35s var(--ease-out); align-items: flex-start;
  -webkit-overflow-scrolling: touch;
}
.rs-deck::-webkit-scrollbar { display: none; }
.rs-slide { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; padding-bottom: 8px; }
.rs-slide > .r-section { margin: 0 !important; }
.rs-next {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  margin-top: 12px; padding: 13px; border-radius: 14px; cursor: pointer;
  background: transparent; border: 1px solid var(--gold); color: var(--gold-deep);
  font: 600 15px var(--ff-body);
}
.rs-cta {
  position: sticky; bottom: 0; z-index: 6; padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(transparent, var(--obsidian) 30%);
}
.rs-cta button {
  width: 100%; padding: 16px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--grad-gold); color: #fff; font: 700 16px var(--ff-body);
  box-shadow: 0 10px 24px rgba(184,137,62,.3);
}
/* Report blocks: lighter, roomier, fewer borders */
.r-block { background: #fff !important; border: 1px solid var(--panel-border) !important; border-radius: 18px !important; box-shadow: var(--shadow-1); }
.r-block p, .r-block-body { line-height: 1.8; }

/* Floating site/Facebook buttons: only on the landing, smaller, never over content */
body:has(#s0:not(.active)) .global-fab-dock { display: none !important; }
.global-fab-dock { bottom: 96px !important; top: auto !important; }
.global-fab { width: 42px !important; height: 42px !important; }

/* ============================================================
   v7.2 TYPE — Alexandria for display, Almarai for reading
   ============================================================ */
:root {
  --ff-body: 'Almarai', 'Manrope', system-ui, sans-serif;
  --ff-display: 'Alexandria', 'Almarai', sans-serif;
  --ff-head: 'Alexandria', 'Almarai', sans-serif;
  --ff-mono: 'Almarai', 'Manrope', sans-serif;
  --ff-latin-display: 'Manrope', 'Alexandria', sans-serif;
  --ff-latin-body: 'Manrope', 'Almarai', sans-serif;
}
h1, h2, h3, .hero-headline, .q-title, .r-block-title, .app-logo-name, .opt-label, .btn-start, .rs-cta button { font-family: var(--ff-display) !important; }
#s0 .hero-headline { font-weight: 600; font-size: clamp(26px, 7.2vw, 36px); line-height: 1.4; }
#s0 .hero-sub { font-size: 15.5px; line-height: 1.85; }
#s0 .specimen-text { font-family: var(--ff-display); font-weight: 500; font-size: 12px; }
.hc-chip, .hc-title, .hero-float { font-family: var(--ff-display); }
.hc-chip { font-weight: 400; }
.hc-title { font-weight: 500; }

/* Floating buttons covered the headline — social links now live in the footer */
.global-fab-dock { display: none !important; }
.s0-footer { flex-wrap: wrap; justify-content: center; gap: 10px; }
.s0-social {
  display: inline-flex; align-items: center; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--panel-border); background: #fff; color: var(--snow);
  font: 500 12.5px var(--ff-latin-body); text-decoration: none;
}
.s0-footer-text { flex-basis: 100%; text-align: center; }

/* Hero jar: a slow light sweep across the photo so the still reads as "live" */
.hero-photo::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255,240,205,.38) 48%, transparent 61%);
  transform: translateX(-120%); animation: v7Sweep 6.5s ease-in-out 1.2s infinite;
  mix-blend-mode: soft-light;
}
@keyframes v7Sweep { 0% { transform: translateX(-120%); } 45%, 100% { transform: translateX(120%); } }
@media (prefers-reduced-motion: reduce) { .hero-photo::after { animation: none; display: none; } }

/* v7.3 problem picker: grouped, with a photo per problem */
.q1-group { font: 600 13px var(--ff-display); color: var(--gold-deep); margin: 18px 4px 8px; }
.q1-group:first-child { margin-top: 0; }
.q1-opt { padding: 10px !important; }
.q1-opt::before { display: none !important; }
.has-q1-img { display: flex; align-items: center; gap: 12px; }
.q1-img { width: 62px; height: 62px; border-radius: 14px; object-fit: cover; flex-shrink: 0; }
.has-q1-img .opt-text { flex: 1; min-width: 0; }
.has-q1-img .opt-sub { line-height: 1.6; }

/* ============================================================
   v7.3 REPORT GUIDE — problem → solution, routine, tips
   ============================================================ */
.rg-card { background: #fff; border: 1px solid var(--panel-border); border-radius: 20px; padding: 20px 18px; margin: 0 0 16px; box-shadow: var(--shadow-1); }
.rg-card h2 { font: 600 18px var(--ff-display); color: var(--snow); margin: 0 0 14px; }
.rg-card h3 { font: 600 15px var(--ff-display); color: var(--snow); margin: 0 0 4px; }
.rg-card p { font-size: 14.5px; line-height: 1.85; color: var(--mist); margin: 0; }
.rg-summary { background: linear-gradient(160deg, #FFFCF6, #fff); border-color: rgba(184,137,62,.3); }
.rg-step { display: flex; gap: 12px; align-items: flex-start; }
.rg-step + .rg-step { margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--hairline-strong); }
.rg-ico { flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: #F1EADF; color: var(--snow); font: 700 13px var(--ff-display); }
.rg-ico-gold { background: var(--gold); color: #fff; }
.rg-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 380px) { .rg-cols { grid-template-columns: 1fr; } }
.rg-col { background: var(--obsidian); border-radius: 14px; padding: 12px; }
.rg-when { font: 600 13.5px var(--ff-display); color: var(--gold-deep); margin-bottom: 8px; }
.rg-col ol { list-style: none; margin: 0; padding: 0; }
.rg-col li { display: flex; gap: 8px; font-size: 13.5px; line-height: 1.6; color: var(--snow); padding: 5px 0; }
.rg-col li b { flex: 0 0 18px; height: 18px; border-radius: 50%; background: #fff; color: var(--gold-deep); font-size: 11px; display: grid; place-items: center; margin-top: 2px; }
.rg-tips-h { margin-top: 20px !important; }
.rg-tips { margin: 0; padding: 0; list-style: none; }
.rg-tips li { position: relative; padding: 9px 0; padding-inline-start: 22px; font-size: 14px; line-height: 1.75; color: var(--snow); border-bottom: 1px solid var(--hairline); }
.rg-tips li:last-child { border-bottom: 0; }
.rg-tips li::before { content: ''; position: absolute; inset-inline-start: 4px; top: 17px; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }

/* v7.3 hero video (motion is baked in — no CSS zoom/sweep on top) */
.hero-photo .hero-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero-photo::after { display: none !important; }
