/* GumRevive quiz — styles taken from the Figma build template (Quiz v2) */
:root {
  --navy: #102059;
  --ink: #333a6b;
  --muted: #5a6190;
  --primary: #5b65dd;
  --primary-2: #8f95e6;
  --primary-3: #bdc1f0;
  --primary-4: #e1e3f8;
  --tint: #ebebf8;
  --line: #e4e5f0;
  --bg: #f8f8fb;
  --accent: #d9480f;
  --cta-warm: #c94a2c;
  --hero: #3d79c5;
  --radius: 16px;
  --col: 440px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--navy);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
b, strong { font-weight: 700; color: var(--navy); }
u { text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
.tok { color: var(--accent); font-weight: 700; }

/* ---------- Top bar: back + progress ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: #fff; }
.topbar[hidden] { display: none; }
.topbar-inner { position: relative; max-width: var(--col); margin: 0 auto; height: 52px; padding: 0 12px; display: flex; align-items: center; }
.topbar-logo { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 110px; height: auto; }
.back {
  width: 40px; height: 40px; border: 0; border-radius: 50%; background: none;
  display: grid; place-items: center; cursor: pointer; transition: background .15s, opacity .2s;
}
.back:hover { background: var(--tint); }
.back:focus-visible { outline: 3px solid var(--primary-3); outline-offset: 2px; }
.back svg { width: 22px; height: 22px; fill: none; stroke: var(--navy); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.back.off { opacity: 0; pointer-events: none; }
.progress { height: 4px; background: #edf1f7; }
.progress i { display: block; height: 100%; width: 0; background: var(--navy); border-radius: 0 2px 2px 0; transition: width .4s ease; }

/* ---------- Screen shell ---------- */
.screen {
  min-height: 100vh;
  min-height: calc(100dvh - 56px);
  max-width: var(--col);
  margin: 0 auto;
  padding: 20px 24px 120px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: in .28s ease both;
}
.screen.no-cta { padding-bottom: 32px; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.logo { width: 130px; height: auto; margin: 0 auto 4px; }

h1, .h1 { font-size: 24px; line-height: 1.25; font-weight: 700; text-align: center; margin: 0; color: var(--navy); }
.h1.lg { font-size: 26px; }
.h2 { font-size: 28px; font-weight: 700; text-align: center; margin: 0; }
.sub { font-size: 15px; color: var(--muted); text-align: center; margin: -8px 0 0; }
.kicker { font-size: 16px; color: var(--muted); text-align: center; margin: 0; }
.banner { font-size: 16px; font-weight: 700; text-align: center; margin: 0; line-height: 1.4; }
.body { font-size: 16px; line-height: 1.5; color: var(--ink); margin: 0; }
.body.center { text-align: center; }
.body.lg { font-size: 17px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ---------- Options ---------- */
.options { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 50px;
  padding: 14px 16px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  font-size: 16px; font-weight: 500; line-height: 1.3; text-align: left;
  color: var(--navy);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .08s;
}
.opt:hover { border-color: var(--primary-3); }
.opt:active { transform: scale(.99); }
.opt.sel { border-color: var(--primary); background: var(--tint); }
.opt .emo { flex: none; width: 22px; text-align: center; }
.opt .emo + span { flex: 1; min-width: 0; }
.opt:focus-visible, .btn:focus-visible, .tile:focus-visible, .gender:focus-visible { outline: 3px solid var(--primary-3); outline-offset: 2px; }

.box {
  flex: none; width: 20px; height: 20px;
  border: 1.5px solid var(--primary); border-radius: 6px;
  display: grid; place-items: center; background: #fff;
}
.opt.sel .box { background: var(--primary); }
.opt.sel .box::after {
  content: ""; width: 10px; height: 6px;
  border: solid #fff; border-width: 0 0 2px 2px;
  transform: translateY(-1px) rotate(-45deg);
}

/* image tiles (Q3) */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile {
  display: flex; flex-direction: column; gap: 10px;
  padding: 8px 8px 14px;
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius);
  cursor: pointer; text-align: center;
  font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--navy);
  transition: border-color .15s, background .15s;
}
.tile img { width: 100%; aspect-ratio: 145 / 149; object-fit: cover; border-radius: 12px; background: var(--tint); }
.tile.sel { border-color: var(--primary); background: var(--tint); }

/* ---------- CTA ---------- */
.btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 54px; border: 0; border-radius: 999px;
  background: var(--primary); color: #fff;
  font-size: 16px; font-weight: 700; cursor: pointer;
  box-shadow: 0 6px 18px rgba(91, 101, 221, .28);
  transition: transform .08s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.cta {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, rgba(248, 248, 251, 0));
  transition: transform .25s ease, opacity .25s ease;
}
.cta .btn { max-width: calc(var(--col) - 48px); margin: 0 auto; }
.cta.hidden { transform: translateY(110%); opacity: 0; pointer-events: none; }

/* ---------- Images ---------- */
/* Skeleton shimmer on an image until it has loaded (class set and cleared in quiz.js). */
img.sk {
  background: linear-gradient(100deg, var(--tint) 30%, #f6f6fd 50%, var(--tint) 70%) 0 0 / 300% 100%;
  animation: sk 1.3s ease-in-out infinite;
}
@keyframes sk { from { background-position: 100% 0; } to { background-position: 0 0; } }
.media { width: 100%; border-radius: 14px; overflow: hidden; background: var(--tint); }
.media img { width: 100%; height: 100%; object-fit: cover; }
.media.r220 { aspect-ratio: 340 / 220; }
.media.r200 { aspect-ratio: 340 / 200; }
.emblem { background: #fff; border-radius: 14px; padding: 12px; }
.emblem img { width: 100%; height: auto; border-radius: 6px; }

/* slider (S5) and before/after carousel (S17) */
.slider { position: relative; overflow: hidden; border-radius: 14px; touch-action: pan-y; }
.track { display: flex; transition: transform .45s ease; }
.track > * { flex: 0 0 100%; }
.slider.r220 .track > * { aspect-ratio: 340 / 220; }
.slider.r220 img { width: 100%; height: 100%; object-fit: cover; }
.dots { display: flex; justify-content: center; align-items: center; gap: 8px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: #d3d5f0; transition: all .2s; }
.dots i.on { width: 10px; height: 10px; background: var(--primary); }

.ba-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.ba { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ba figure { position: relative; margin: 0; aspect-ratio: 155 / 200; border-radius: 12px; overflow: hidden; background: var(--tint); }
.ba img { width: 100%; height: 100%; object-fit: cover; }
.ba figcaption {
  position: absolute; top: 10px; left: 10px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; color: #fff; background: var(--navy);
}
.ba figure + figure figcaption { background: var(--primary); }
.ba-cap { margin: 10px 0 2px; font-size: 14px; font-weight: 600; text-align: center; }

/* ---------- Loaders ---------- */
.ring { position: relative; margin: 0 auto; }
.ring svg { display: block; transform: rotate(-90deg); }
.ring .track-c { stroke: var(--tint); }
.ring .prog-c { stroke: var(--primary); stroke-linecap: round; }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 22px; color: var(--navy); }
.ring.sm .pct { font-size: 16px; }
.loading-note { text-align: center; font-size: 14px; font-weight: 600; color: var(--primary); margin: 0; }

.spinner {
  width: 64px; height: 64px; margin: 60px auto 12px;
  border: 5px solid var(--tint); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.bar { width: 280px; max-width: 100%; height: 10px; margin: 0 auto 8px; background: var(--tint); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--primary); border-radius: 999px; }
.checklist { list-style: none; padding: 0; margin: 4px auto 0; display: flex; flex-direction: column; gap: 12px; font-size: 15px; color: var(--ink); }
.checklist li { display: flex; gap: 10px; align-items: center; opacity: .45; transition: opacity .3s; }
.checklist li::before {
  content: ""; flex: none; width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--primary-3); background: #fff center / 10px no-repeat;
  transition: background-color .2s, border-color .2s;
}
.checklist li.done { opacity: 1; }
.checklist li.done::before {
  border-color: var(--primary); background-color: var(--primary);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1.2 5.2l3.5 3.5 6.5-7.5' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.fallback-link { text-align: center; font-size: 15px; font-weight: 600; color: var(--primary); text-underline-offset: 3px; opacity: 0; transition: opacity .4s; }
.fallback-link.show { opacity: 1; }

/* ---------- S12 note block ---------- */
.note { background: var(--tint); border-radius: 12px; padding: 14px; font-size: 15px; line-height: 1.5; color: var(--ink); margin: 0; }
.goodnews { font-size: 16px; line-height: 1.5; margin: 0; color: var(--navy); font-weight: 600; }

/* ---------- S21 profile ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; }
.level-row { display: flex; justify-content: space-between; align-items: center; font-size: 15px; font-weight: 600; color: var(--ink); }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 14px; font-weight: 700; }
.gauge { display: flex; flex-direction: column; gap: 6px; }
.gauge .marker { align-self: flex-start; padding: 3px 8px; border-radius: 999px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 700; }
.segs, .seg-labels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.segs i { height: 10px; border-radius: 999px; }
.segs i:nth-child(1) { background: var(--primary); }
.segs i:nth-child(2) { background: var(--primary-2); }
.segs i:nth-child(3) { background: var(--primary-3); }
.segs i:nth-child(4) { background: var(--primary-4); }
.seg-labels span { font-size: 12px; color: var(--muted); text-align: center; }
.seg-labels span:first-child { font-weight: 700; color: var(--navy); }
.alert { background: var(--tint); border-radius: 12px; padding: 14px; }
.alert h3 { margin: 0 0 6px; font-size: 17px; line-height: 1.3; }
.alert p { margin: 0; font-size: 15px; line-height: 1.5; color: var(--ink); }
.stat { display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stat .ico { flex: none; width: 48px; height: 48px; border-radius: 50%; background: var(--tint); display: grid; place-items: center; }
.stat .ico svg { width: 26px; height: 26px; stroke: var(--primary); stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.stat .lbl { font-size: 13px; color: var(--muted); }
.stat .val { font-size: 18px; font-weight: 700; color: var(--accent); line-height: 1.3; }
.stat .val.good { color: #15803d; } /* positive result ("Room to rebuild: High") */

/* ---------- S24 ---------- */
.ticks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 16px; color: var(--ink); }
.orbit { display: block; width: 100%; max-width: 360px; height: auto; margin: 0 auto; border-radius: 12px; animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px); } }

/* ---------- S25 chart ---------- */
.chart { padding-top: 12px; }
.bars { position: relative; height: 200px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; align-items: end; padding: 0 8px; }
.bars i { display: block; border-radius: 8px 8px 4px 4px; height: 0; transition: height .7s cubic-bezier(.2, .8, .2, 1); position: relative; }
.bars i:nth-child(1) { background: #e1e3f8; }
.bars i:nth-child(2) { background: #c9ccf2; }
.bars i:nth-child(3) { background: #aeb3ee; }
.bars i:nth-child(4) { background: #8f95e6; }
.bars i:nth-child(5) { background: #757ce1; }
.bars i:nth-child(6) { background: #5b65dd; }
.goal { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; opacity: 0; transition: opacity .4s .8s; }
.goal b { padding: 3px 8px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 11px; }
.goal span { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--navy); display: grid; place-items: center; }
.goal span::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--navy); }
.chart.go .goal { opacity: 1; }
.axis { display: flex; justify-content: space-between; padding: 8px 8px 0; font-size: 13px; font-weight: 700; }

/* ---------- Q0 welcome ---------- */
.welcome { min-height: 100vh; min-height: 100dvh; background: var(--hero); color: #fff; display: flex; flex-direction: column; }
.welcome b { color: #fff; }
.welcome-inner, .welcome-col { flex: 1; display: flex; flex-direction: column; }
.hero {
  flex: 1; position: relative;
  padding: 18px 24px 260px;
  /* At least as tall as the photo (179% wide, 1600×1744), so scrolling down shows the whole product. */
  min-height: calc(179vw * 1744 / 1600);
  background: var(--hero) url("assets/img/hero-bg.webp") no-repeat right top / 179% auto;
}
.hero .logo { width: 130px; margin: 0 auto 14px; }
.hero h1 { font-family: var(--serif); font-size: 26px; line-height: 1.2; color: #fff; margin: 0 0 14px; }
.hero .lede { font-size: 15px; line-height: 1.4; color: rgba(255, 255, 255, .9); margin: 0 0 14px; }
.benefits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 15px; font-weight: 500; }
.benefits .t { font-weight: 700; margin-bottom: 0; }
.benefits li:not(.t) { display: flex; align-items: center; gap: 10px; }
.benefits li:not(.t)::before {
  content: ""; flex: none; width: 20px; height: 20px; border-radius: 5px;
  background: var(--cta-warm) center / 12px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12.4 9.9'%3E%3Cpath d='M1.2 5.2l3.5 3.5 6.5-7.5' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.gender-box {
  position: sticky; bottom: 0;
  background: #fff; color: var(--navy);
  padding: 18px 24px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px rgba(16, 32, 89, .12);
}
.gender-box .q { font-size: 17px; font-weight: 600; margin: 0 0 12px; }
.genders { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gender {
  height: 58px; border: 0; border-radius: 12px;
  background: var(--cta-warm); color: #fff;
  font-size: 18px; font-weight: 700; cursor: pointer;
  transition: filter .15s, transform .08s;
}
.gender:hover { filter: brightness(1.06); }
.gender:active { transform: scale(.98); }
.micro { font-size: 12px; color: #737794; text-align: center; margin: 12px 0 0; }

/* Tablet portrait: the phone layout scaled up in a centred column. The photo is sized to the
   column (not the screen), and the right-edge strip continues its blue out to the screen edge. */
@media (min-width: 600px) and (max-width: 899px) {
  .welcome {
    --wcol: 560px;
    --imgw: calc(var(--wcol) * 1.79);
    --imgh: calc(var(--imgw) * 1744 / 1600);
    background-color: var(--hero);
    background-image: url("assets/img/hero-bg.webp"), url("assets/img/hero-strip-right.webp");
    background-size: var(--imgw) auto, calc(50vw - var(--wcol) / 2 + 2px) var(--imgh);
    background-position: calc(50vw + var(--wcol) / 2 - var(--imgw)) 0, calc(50vw + var(--wcol) / 2 - 1px) 0;
    background-repeat: no-repeat;
  }
  .welcome-inner { width: var(--wcol); margin: 0 auto; }
  .hero { background: none; min-height: var(--imgh); padding: 28px 0 260px; }
  .hero .logo { width: 150px; }
  .hero h1 { font-size: 34px; }
  .hero .lede, .benefits { font-size: 17px; }
  /* Gender bar stays full width even though it sits inside the centred column. */
  .gender-box { padding-left: 0; padding-right: 0; box-shadow: 0 0 0 100vmax #fff; clip-path: inset(0 -100vmax); }
  .gender-box .q { font-size: 18px; }
}

@media (min-width: 900px) {
  /* Same sizing as the live Clarflow page: the photo scales with screen height (never
     stretched past its 1600px source), and 1px edge strips continue its blue to the sides. */
  .welcome {
    /* Extra push of the product to the right, for a wider gap to the text. Grows with
       screen width (0 at 1360px, 140px from 1560px) so the device is never cropped. */
    --shift: clamp(0px, calc((100vw - 1360px) / 2), 140px);
    display: block;
    background-color: #2c66b0;
    background-image: url("assets/img/hero-bg.webp"), url("assets/img/hero-strip-right.webp"), url("assets/img/hero-strip-left.webp");
    background-size: auto 171vh, 100vw 171vh, 100vw 171vh;
    background-position:
      calc(50vw + 89px - 86.8vh + var(--shift)) bottom,
      calc(50vw + 86px + 70.08vh + var(--shift)) bottom,
      calc(-50vw + 92px - 86.8vh + var(--shift)) bottom;
    background-repeat: no-repeat;
  }
  .welcome-inner { max-width: 1288px; margin: 0 auto; min-height: 100vh; flex-direction: row; align-items: center; padding: 60px 24px; }
  .welcome-col { flex: none; width: 520px; }
  .hero { background: none; padding: 0; flex: none; min-height: 0; }
  .hero .logo { width: 156px; margin: 0 0 24px; }
  .hero h1 { font-size: 48px; margin-bottom: 24px; text-align: left; }
  .hero .lede { font-size: 18px; margin-bottom: 24px; }
  .benefits { font-size: 17px; gap: 12px; }
  .gender-box { position: static; background: none; color: #fff; box-shadow: none; padding: 24px 0 0; }
  .gender-box .q { font-size: 18px; color: #fff; }
  .genders { max-width: 416px; gap: 16px; }
  .micro { text-align: left; font-size: 13px; color: rgba(255, 255, 255, .8); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
