/* ==========================================================================
   ALT scent quiz — styles
   Layout: one rounded card with two tilted cards stacked behind it, on a flat
   linen background. Inside: progress dashes + close, small
   label, question, "select only one", radio rows, Back / Next bottom right.
   ALT palette and type: Futura PT, #231f20 card, #b9a78a ink, #e5dfd4 linen.
   ========================================================================== */

/* Full-screen overlay on index.html (#quiz). Variables are qz- prefixed and every rule is
   scoped to the dialog so nothing leaks into the homepage (style.css has its own --track etc).
   Fonts come from style.css ("ALT Futura" local Futura PT, Jost fallback). */
.qz-dialog {
  --qz-linen: #e5dfd4;        /* page, from the best-sellers panel */
  --qz-card: #231f20;         /* front card, from fold1.ai */
  --qz-back-1: #f1ece4;       /* tilted cards behind: a shade lighter than the page, as in the reference */
  --qz-back-2: #ebe5db;
  --qz-ink: #b9a78a;          /* card text, from fold1.ai */
  --qz-ink-hi: #cbbb9e;       /* button border / hover */
  --qz-muted: rgba(185, 167, 138, .55);
  --qz-track: #4a4445;        /* empty progress dash, bar track */
  --qz-rule: rgba(185, 167, 138, .18);
  --qz-fl: clamp(380px, min(54vw, 86svh), 935px);   /* flower diameter; 935px = the painting at 100% */
  --qz-cw: 480px;                                     /* question card width (the flower is placed against it) */
  --qz-ch: min(640px, calc(100svh - 112px));          /* card base height */
  --qz-ease: cubic-bezier(.25, .46, .45, .94);
  --qz-ease-expo: cubic-bezier(.19, 1, .22, 1);

  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  overflow: hidden auto; overscroll-behavior: contain;
  scrollbar-gutter: stable;   /* a scrollbar appearing on long screens must not nudge the card or flower */
  background: var(--qz-linen); color: var(--qz-ink); font-family: var(--font-brand); font-synthesis: none;
}
.qz-dialog::backdrop { background: #e5dfd4; }
.qz-dialog[open] { animation: qz-fade .45s var(--qz-ease); }
@keyframes qz-fade { from { opacity: 0; } }
/* Element resets: :where() keeps them at plain element specificity, so the .qz-* rules below win */
:where(.qz-dialog) *, :where(.qz-dialog) *::before, :where(.qz-dialog) *::after { box-sizing: border-box; }
:where(.qz-dialog) :where(h1, h2, h3, p, ul, ol, dl, dd, fieldset) { margin: 0; padding: 0; }
:where(.qz-dialog) :where(ul, ol) { list-style: none; }
:where(.qz-dialog) fieldset { border: 0; min-width: 0; }
:where(.qz-dialog) legend { padding: 0; }
:where(.qz-dialog) a { color: inherit; }
:where(.qz-dialog) button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:where(.qz-dialog) svg { display: block; }
:where(.qz-dialog) b { font-weight: 500; }

/* ---------- Card stack ---------- */
.qz { min-height: 100svh; display: flex; overflow-x: clip; padding: 56px 24px; }
.qz-card {
  position: relative; display: flex; flex-direction: column;
  width: min(var(--qz-cw), 100%); min-height: var(--qz-ch); margin: auto;  /* auto margins centre it, and never clip a tall result */
  left: calc(var(--qz-fl) * -.2);   /* shifted left so card + bouquet sit centred together. Not a transform: that would put the flower above the card */
  padding: 44px 44px 40px; border-radius: 30px; background: var(--qz-card);
}
.qz-card[data-mode="result"] { width: min(560px, 100%); }
.qz-card::before, .qz-card::after {
  content: ""; position: absolute; inset: 0; z-index: -2; border-radius: inherit;
  transition: transform .7s var(--qz-ease-expo);
}
.qz-card::before { background: var(--qz-back-2); transform: translate(-22px, 16px) rotate(-4deg); }
.qz-card::after  { background: var(--qz-back-1); transform: translate(18px, 12px) rotate(3.5deg); }
/* Bouquet ornament, pinned to the screen: it never moves with scrolling or with
   the card's height, it only turns about its own centre. Placed so its centre
   sits on the question card's right edge, at mid-screen; the front card always
   hides about half. Layered over the tilted cards (z -1 vs -2) and under the
   front card, so a long result card scrolls over it. Turns 45° counter-clockwise
   per answer, as it's picked.
   (Fixed is relative to the screen here because no ancestor has a transform.) */
.qz-flower {
  position: fixed; z-index: -1; pointer-events: none; user-select: none;
  width: var(--qz-fl); height: auto;
  top: calc(50% - var(--qz-fl) / 2);
  left: calc(50% + var(--qz-cw) / 2 - var(--qz-fl) * .7);   /* card's right edge (card is shifted left by .2 fl), minus half the flower */
  /* --turn is set by quiz.js: -45deg per answered question (on picking it), one full turn by the result */
  transform: rotate(var(--turn, 0deg));
  opacity: 0;   /* fades in once loaded instead of popping in */
  transition: transform 1.6s var(--qz-ease-expo), opacity 1.2s var(--qz-ease);
}
.qz-flower.is-in { opacity: 1; }
/* The result card is tall, so the tilt is kept small */
.qz-card[data-mode="result"]::before { transform: translate(-10px, 10px) rotate(-1deg); }
.qz-card[data-mode="result"]::after  { transform: translate(8px, 8px) rotate(.8deg); }

.qz-stage, .qz-screen, .qz-form { display: flex; flex-direction: column; flex: 1; }
.qz-screen { animation: qz-in .5s var(--qz-ease-expo) both; }
@keyframes qz-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Top row ---------- */
.qz-top { display: flex; align-items: center; justify-content: space-between; min-height: 24px; margin-bottom: 52px; }
.qz-mark { width: 34px; height: auto; color: var(--qz-ink); }
.qz-progress { display: flex; gap: 9px; }
.qz-seg { position: relative; width: 30px; height: 3px; border-radius: 2px; background: var(--qz-track); overflow: hidden; }
.qz-seg i { position: absolute; inset: 0; background: var(--qz-ink); transform: scaleX(var(--f)); transform-origin: left; transition: transform .5s var(--qz-ease); }
.qz-close {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--qz-muted); color: var(--qz-card); transition: background .2s;
}
.qz-close svg { width: 9px; height: 9px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.qz-close:hover, .qz-close:focus-visible { background: var(--qz-ink); }

/* ---------- Type ---------- */
.qz-label { font-weight: 500; font-size: 12.5px; line-height: 1; letter-spacing: .2em; text-transform: uppercase; }
.qz-q { margin-top: 18px; font-weight: 400; font-size: clamp(25px, 1rem + 1vw, 29px); line-height: 1.2; }
.qz-body { margin-top: 16px; font-size: 18px; line-height: 1.4; }
.qz-help { display: block; color: var(--qz-muted); font-weight: 500; font-size: 12.5px; line-height: 1; letter-spacing: .2em; text-transform: uppercase; }
.qz-body + .qz-help { margin-top: 28px; }

/* ---------- Answers: radio / checkbox rows ---------- */
.qz-opts { margin-top: 38px; }
.qz-opts .qz-help { margin-bottom: 14px; }
.qz-opt { position: relative; display: flex; gap: 14px; align-items: flex-start; padding: 9px 0; cursor: pointer; }
.qz-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.qz-tick {
  flex: none; position: relative; width: 18px; height: 18px; margin-top: 2px;
  border: 1.5px solid var(--qz-ink); border-radius: 50%; transition: background .2s, box-shadow .2s;
}
.qz-opt input:checked + .qz-tick { background: var(--qz-ink); box-shadow: inset 0 0 0 3.5px var(--qz-card); }
.qz-opt input[type="checkbox"] + .qz-tick { border-radius: 4px; }
.qz-opt input[type="checkbox"]:checked + .qz-tick { box-shadow: none; }
.qz-opt input[type="checkbox"]:checked + .qz-tick::after {
  content: ""; position: absolute; left: 4.5px; top: 1px; width: 5px; height: 9px;
  border: solid var(--qz-card); border-width: 0 1.8px 1.8px 0; transform: rotate(45deg);
}
.qz-opt input:focus-visible + .qz-tick { outline: 2px solid var(--qz-ink); outline-offset: 3px; }
.qz-opt__t { display: block; font-size: 18px; line-height: 1.3; }
.qz-opt__s { display: block; margin-top: 2px; font-size: 15px; line-height: 1.3; color: var(--qz-muted); }
.qz-opt:hover .qz-opt__t { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }

/* ---------- Back / Next ---------- */
.qz-nav { display: flex; justify-content: flex-end; align-items: center; gap: 34px; margin-top: auto; padding-top: 44px; }
.qz-back { padding: 10px 0; font-weight: 500; font-size: 14px; letter-spacing: .16em; text-transform: uppercase; text-decoration: none; }
.qz-back:hover { text-decoration: underline; text-underline-offset: 5px; }
/* Primary actions use the site-wide .button .button--light (style.css); .qz-btn only adds the disabled state */
.qz-back:focus-visible, .qz-link:focus-visible, .qz-close:focus-visible { outline: 2px solid var(--qz-ink); outline-offset: 3px; }
.qz-btn:disabled { opacity: .35; cursor: default; background: transparent; color: var(--qz-ink); }

/* ---------- Result ---------- */
.qz-section { margin-top: 34px; padding-top: 26px; border-top: 1px solid var(--qz-rule); }
.qz-section > .qz-help { margin-bottom: 18px; }

.qz-traits { display: grid; gap: 22px 28px; }
@media (min-width: 600px) { .qz-traits { grid-template-columns: 1fr 1fr; } }
.qz-traits dd { margin-top: 9px; }
.qz-trait__v { display: block; font-size: 19px; line-height: 1.25; }
.qz-trait__l { display: block; margin-top: 4px; font-size: 15px; line-height: 1.35; color: var(--qz-muted); }
.qz-meter { position: relative; display: block; height: 3px; margin-top: 12px; border-radius: 2px; background: var(--qz-track); overflow: hidden; }
.qz-meter i { position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--qz-ink); transform-origin: left; animation: qz-grow 1.2s var(--qz-ease-expo) .3s both; }
.qz-meter__ends { display: flex; justify-content: space-between; margin-top: 7px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--qz-muted); }
@keyframes qz-grow { from { transform: scaleX(0); } }

.qz-picks { display: grid; gap: 30px; }
.qz-pick { display: grid; grid-template-columns: 76px 1fr; column-gap: 16px; align-items: center; }
.qz-pick__img { width: 76px; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #2e2a2b; }
.qz-pick__name { margin-top: 8px; font-weight: 400; font-size: 21px; line-height: 1.15; }
.qz-pick__meta { margin-top: 3px; font-size: 14px; color: var(--qz-muted); }
.qz-pick__body { grid-column: 1 / -1; margin-top: 14px; }
.qz-pick__why { font-size: 16.5px; line-height: 1.45; }
.qz-pick__sib { margin-top: 8px; font-size: 15px; line-height: 1.4; color: var(--qz-muted); }
.qz-pick__sib a { color: var(--qz-ink); text-underline-offset: 3px; }
.qz-notes { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin-top: 12px; font-size: 14px; line-height: 1.35; }
.qz-notes dt { padding-top: 2px; color: var(--qz-muted); font-weight: 500; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.qz-link { display: inline-block; margin-top: 12px; font-weight: 500; font-size: 13px; letter-spacing: .16em; text-transform: uppercase; text-underline-offset: 5px; }
.qz-link:hover { text-decoration-thickness: 2px; }

.qz-bars { display: grid; gap: 12px; }
.qz-bar { display: grid; grid-template-columns: 112px 1fr 34px; gap: 12px; align-items: center; font-size: 15px; }
.qz-bar__t { position: relative; height: 3px; border-radius: 2px; background: var(--qz-track); overflow: hidden; }
.qz-bar__t i { position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--qz-ink); transform-origin: left; animation: qz-grow 1.2s var(--qz-ease-expo) both; animation-delay: calc(var(--i) * .06s + .2s); }
.qz-bar__n { text-align: right; font-size: 12px; color: var(--qz-muted); }

.qz-all summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.qz-all summary::-webkit-details-marker { display: none; }
.qz-all summary::after { content: "+"; font-size: 22px; font-weight: 300; letter-spacing: 0; transition: transform .3s var(--qz-ease); }
.qz-all[open] summary::after { transform: rotate(45deg); }
.qz-all ol { margin-top: 16px; display: grid; counter-reset: r; }
.qz-all li { display: grid; grid-template-columns: 22px 1fr 72px 38px; gap: 10px; align-items: center; padding: 8px 0; font-size: 15px; border-bottom: 1px solid var(--qz-rule); counter-increment: r; }
.qz-all li::before { content: counter(r); font-size: 12px; color: var(--qz-muted); }
.qz-all li a { text-decoration: none; }
.qz-all li a:hover { text-decoration: underline; text-underline-offset: 3px; }
.qz-all li small { margin-left: 6px; font-size: 12px; color: var(--qz-muted); }
.qz-all .qz-bar__t i { animation: none; }

.qz-foot { margin-top: 22px; font-size: 13px; line-height: 1.45; color: var(--qz-muted); }

/* ---------- Portrait tablets ----------
   Little room beside the card but plenty above it: the card stays centred and
   the bouquet rises, larger, from behind its top-right corner. */
@media (min-width: 560px) and (orientation: portrait) {
  .qz-dialog { --qz-fl: min(70vw, 560px); }
  .qz { padding: calc(var(--qz-fl) * .42 + 16px) 24px 56px; }   /* the card starts .42 fl down the bouquet */
  .qz-card { left: 0; margin-top: 0; }
  .qz-flower { top: 16px; left: calc(50% + var(--qz-cw) / 2 - var(--qz-fl) * .82); }   /* runs .18 fl past the card's right edge */
}

/* ---------- Phones ---------- */
@media (max-width: 559px) {
  /* No room beside the card: the bouquet rises above its top-right corner instead, inside the screen */
  .qz-dialog { --qz-fl: 240px; }
  .qz { padding: calc(var(--qz-fl) * .46 + 12px) 16px 40px; }
  .qz-flower { top: 12px; left: auto; right: calc(16px - var(--qz-fl) * .06); }   /* runs .06 fl past the card's right edge */
  .qz-card { left: 0; margin-top: 0; min-height: min(600px, calc(100svh - 68px)); padding: 30px 24px 26px; border-radius: 24px; }
  .qz-card::before { transform: translate(-8px, 12px) rotate(-3deg); }
  .qz-card::after  { transform: translate(7px, 9px) rotate(2.5deg); }
  .qz-top { margin-bottom: 38px; }
  .qz-progress { gap: 6px; }
  .qz-seg { width: 22px; }
  .qz-opts { margin-top: 30px; }
  .qz-opt__t { font-size: 17px; }
  .qz-nav { gap: 26px; padding-top: 34px; }
  .qz-bar { grid-template-columns: 96px 1fr 30px; }
}

@media (prefers-reduced-motion: reduce) {
  .qz-screen, .qz-meter i, .qz-bar__t i { animation: none; }
  .qz-flower { transition: opacity 1.2s var(--qz-ease); }   /* turns without the motion */
  .qz-card::before, .qz-card::after, .qz-seg i { transition: none; }
}
