/* ---------- Brand tokens: change these to restyle the whole quiz ---------- */
:root {
  --bg: #FAF8F4;          /* page */
  --header: #FDFAF6;      /* top bar */
  --card: #FFFFFF;
  --ink: #1A1816;         /* text, buttons, selected borders */
  --muted: #6B655E;
  --line: #E6E0D8;        /* card borders */
  --track: #EFE9E0;       /* empty part of the progress bar */
  --hover: #C9C1B6;
  --selected-bg: #F6F2EC;
  --green: #79A878;       /* from the shop's top bar: ticks and confirmations */
  --photo-bg: #F1EDE7;

  /* the shop's font: change this one line if it needs swapping */
  --font: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --serif: var(--font);
  --sans: var(--font);
  --r-card: 22px;
  --r-img: 14px;
  --gutter: 20px;
  --max: 1080px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
h1:focus { outline: none; }

/* ---------- Header: back arrow, wordmark, step count, progress line ---------- */
.site-header { background: var(--header); position: sticky; top: 0; z-index: 20; }
.bar {
  max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter);
  height: 76px; display: grid; grid-template-columns: 48px 1fr 48px; align-items: center;
}
.hdr-back {
  width: 44px; height: 44px; margin-left: -10px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 50%; color: var(--ink); cursor: pointer;
}
.hdr-back:hover { background: var(--selected-bg); }
.hdr-back svg { width: 24px; height: 24px; }
.hdr-back[hidden] { display: grid; visibility: hidden; }
.brand {
  justify-self: center; text-align: center;
  font-family: var(--font); font-weight: 400; font-size: clamp(0.95rem, 3vw, 1.25rem);
  letter-spacing: 0.3em; text-transform: uppercase; text-decoration: none; color: var(--ink);
  margin-right: -0.3em; /* balances the trailing letter-space */
  white-space: nowrap;
}
.step { justify-self: end; color: var(--muted); font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.progress { height: 5px; background: var(--track); }
.progress span { display: block; height: 100%; width: 0; background: var(--ink); transition: width 0.3s ease; }

@media (min-width: 760px) { .bar { height: 84px; } }

.noscript { max-width: var(--max); margin: 24px auto; padding: 0 var(--gutter); }

/* ---------- Screens ---------- */
.screen { max-width: var(--max); margin: 0 auto; padding: 28px var(--gutter) 48px; }
.screen.results { padding-bottom: 160px; }
@media (min-width: 760px) { .screen { padding-top: 56px; } }

h1 {
  margin: 0 0 12px;
  font-family: var(--font); font-weight: 400;
  font-size: clamp(1.6rem, 4.2vw, 2.6rem);
  line-height: 1.2; letter-spacing: 0.03em;
}

.hint { margin: 0 0 24px; color: var(--muted); font-size: clamp(0.95rem, 2vw, 1.1rem); }
@media (min-width: 760px) { .hint { margin-bottom: 36px; } }

/* ---------- Buttons: square-edged and spaced, like the shop's "SHOP NOW" ---------- */
.btn {
  font: inherit; font-size: 0.85rem; font-weight: 600;
  letter-spacing: 0.18em; text-transform: uppercase;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 16px 32px; border: 1.5px solid var(--ink); border-radius: 3px;
  cursor: pointer; text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #3A3632; border-color: #3A3632; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn:disabled:hover { background: var(--ink); border-color: var(--ink); }

.link {
  font: inherit; color: var(--muted); background: none; border: 0;
  padding: 10px 4px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--hover);
}
.link:hover { color: var(--ink); text-decoration-color: currentColor; }

/* ---------- Intro ---------- */
.intro { display: grid; gap: 40px; align-items: center; }
.intro { text-align: center; justify-items: center; }
.intro h1 { font-size: clamp(2rem, 6vw, 3.2rem); line-height: 1.15; max-width: 18ch; margin: 0 auto 18px; }
.intro .lede { margin-left: auto; margin-right: auto; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 34ch; margin: 0 0 32px; }
.fine { margin: 16px 0 0; color: var(--muted); font-size: 0.9rem; }

.mosaic { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mosaic img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-img); background: var(--photo-bg); display: block; }
.mosaic img:nth-child(3n + 2) { margin-top: 26px; }

@media (min-width: 820px) {
  .screen.intro { padding-top: 72px; }
}

/* ---------- Answer options ---------- */
.opts { display: grid; gap: 16px; }
.opts-image { grid-template-columns: repeat(2, 1fr); }
.opts-list { grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) {
  .opts-list { grid-template-columns: repeat(2, 1fr); gap: 14px 16px; }
}
@media (min-width: 900px) {
  .opts-image { grid-template-columns: repeat(3, 1fr); gap: 24px; }
}

.opt {
  font: inherit; color: inherit; text-align: left; cursor: pointer;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--r-card);
  padding: 0; position: relative;
  transition: border-color 0.15s, background 0.15s;
}
.opt:hover { border-color: var(--hover); }
.opt.is-selected { border-color: var(--ink); }

.opt-label { display: block; font-weight: 500; font-size: 1rem; line-height: 1.3; letter-spacing: 0.02em; }
.opt-sub { display: block; color: var(--muted); font-size: 0.88rem; line-height: 1.4; margin-top: 2px; }

/* photo cards (style question) */
.opt-img { overflow: hidden; display: flex; flex-direction: column; }
.opt-photo { display: block; aspect-ratio: 4 / 3; background: var(--photo-bg); }
.opt-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.opt-img .opt-label { padding: 20px 22px 0; }
.opt-img .opt-sub { padding: 0 22px 22px; }
@media (min-width: 760px) {
  .opt-img .opt-label { padding: 26px 30px 0; }
  .opt-img .opt-sub { padding: 0 30px 28px; }
}

.tick {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--ink); color: #fff;
  display: grid; place-items: center;
  transform: scale(0); transition: transform 0.15s ease-out;
}
.opt.is-selected .tick { transform: scale(1); }
.tick svg { width: 16px; height: 16px; }

/* text cards (other questions): words sit at the bottom-left, like the mockup */
.opt-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px; border-radius: 16px;
}
@media (min-width: 760px) { .opt-row { min-height: 96px; padding: 20px 26px; } }
.opt-row.is-selected { background: var(--selected-bg); }
.opt-row > span:last-child { flex: 1; }
.mark {
  order: 2; flex: none;
  width: 24px; height: 24px; border: 1.5px solid var(--hover); border-radius: 50%;
  display: grid; place-items: center; color: #fff;
}
.opts-list[data-type="multi"] .mark { border-radius: 7px; }
.opt.is-selected .mark { background: var(--ink); border-color: var(--ink); }
.opt.is-selected .mark::after {
  content: ""; width: 6px; height: 11px; margin-top: -2px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* metal swatches (also used on result cards) */
.swatch {
  flex: none; display: inline-block; width: 30px; height: 30px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14); background: #CFC9C0;
}
.opt-row .swatch { order: 2; width: 26px; height: 26px; }
.swatch[data-metal="gold"]   { background: linear-gradient(135deg, #EBD48F, #B58A33); }
.swatch[data-metal="silver"] { background: linear-gradient(135deg, #F1F2F4, #A3A8B0); }
.swatch[data-metal="both"]   { background: linear-gradient(135deg, #D9B864 50%, #C6CAD0 50%); }
.opt-row.is-selected .swatch { box-shadow: 0 0 0 2px var(--card), 0 0 0 3.5px var(--ink); }

.actions { display: flex; align-items: center; justify-content: flex-end; margin-top: 16px; gap: 16px; }

/* ---------- Results ---------- */
.cards { display: grid; gap: 20px; margin-top: 8px; }
.card {
  display: flex; background: var(--card);
  border: 1.5px solid var(--line); border-radius: var(--r-card);
  overflow: hidden; transition: border-color 0.15s;
}
.card.is-included { border-color: var(--ink); }
.card-photo { flex: none; width: 128px; background: var(--photo-bg); }
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity 0.15s, filter 0.15s; }
.card:not(.is-included) .card-photo img { opacity: 0.45; filter: grayscale(0.6); }
.card-body { padding: 18px; flex: 1; min-width: 0; }
.card h2 { margin: 0; font-family: var(--font); font-size: 1.2rem; line-height: 1.25; font-weight: 500; letter-spacing: 0.02em; }
.meta { margin: 6px 0 0; color: var(--muted); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; }
.price { color: var(--ink); font-weight: 600; }
.why { list-style: none; margin: 14px 0 16px; padding: 0; font-size: 0.95rem; color: var(--muted); }
.why li { padding-left: 22px; position: relative; }
.why li + li { margin-top: 4px; }
.why li::before {
  content: ""; position: absolute; left: 3px; top: 0.42em;
  width: 5px; height: 9px; border: solid var(--green); border-width: 0 2px 2px 0; transform: rotate(45deg);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: 0.9rem; cursor: pointer;
  padding: 5px 14px 5px 6px; border-radius: 999px;
  background: #fff; border: 1.5px solid var(--line); color: var(--ink);
}
.chip:hover { border-color: var(--hover); }
.chip .swatch { width: 22px; height: 22px; }
.chip[aria-pressed="true"] { border-color: var(--ink); font-weight: 600; }

.include { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-weight: 600; cursor: pointer; }
.include input { width: 20px; height: 20px; accent-color: var(--ink); }
.viewlink { display: inline-block; margin-top: 10px; font-size: 0.9rem; color: var(--muted); text-underline-offset: 4px; }
.viewlink:hover { color: var(--ink); }

.results-links { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 28px; }

@media (min-width: 760px) {
  .cards { grid-template-columns: repeat(3, 1fr); gap: 24px; }
  .card { flex-direction: column; }
  .card-photo { width: auto; aspect-ratio: 1; }
  .card-body { padding: 24px 26px 26px; }
}

/* sticky order bar */
.summary {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  background: var(--header); border-top: 1px solid var(--line);
  padding: 14px var(--gutter) calc(14px + env(safe-area-inset-bottom));
}
.summary-in { max-width: var(--max); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.summary-total { font-weight: 600; line-height: 1.25; }
.summary-total small { display: block; font-weight: 400; color: var(--muted); font-size: 0.85rem; }
.summary .btn { padding: 14px 22px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Small phones ---------- */
@media (max-width: 420px) {
  .brand { letter-spacing: 0.13em; margin-right: -0.13em; }
  .opt-img .opt-label { padding: 16px 16px 0; font-size: 1.05rem; }
  .opt-img .opt-sub { padding: 0 16px 18px; font-size: 0.92rem; }
}

/* short phones: tighten so every question fits without scrolling */
@media (max-height: 740px) and (max-width: 759px) {
  .bar { height: 60px; }
  .screen { padding-top: 18px; padding-bottom: 24px; }
  .hint { margin-bottom: 14px; }
  .opts-list { gap: 8px; }
  .opt-row { padding: 11px 16px; }
  .actions { margin-top: 6px; }
}

/* ---------- Centred intro and questions ---------- */
.intro { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0; }
.intro .btn { margin-top: 4px; }
.question { text-align: center; }
.question h1 { max-width: 22ch; margin-left: auto; margin-right: auto; }
.question .opts { max-width: 760px; margin: 0 auto; text-align: left; }
.question .actions { justify-content: center; }

/* questions with lots of answers: two columns on phones too, so nothing scrolls */
@media (max-width: 639px) {
  .opts-list[data-count="6"], .opts-list[data-count="7"], .opts-list[data-count="8"] {
    grid-template-columns: repeat(2, 1fr); gap: 8px;
  }
  .opts-list[data-count="6"] .opt-row, .opts-list[data-count="7"] .opt-row, .opts-list[data-count="8"] .opt-row {
    padding: 12px 12px; gap: 8px; min-height: 64px;
  }
  .opts-list[data-count="6"] .opt-label, .opts-list[data-count="7"] .opt-label, .opts-list[data-count="8"] .opt-label { font-size: 0.92rem; }
  .opts-list[data-count="6"] .opt-sub, .opts-list[data-count="7"] .opt-sub, .opts-list[data-count="8"] .opt-sub { font-size: 0.78rem; }
  .opts-list[data-count="6"] .mark, .opts-list[data-count="7"] .mark, .opts-list[data-count="8"] .mark { width: 20px; height: 20px; }
  .opts-list[data-count="6"] .opt-row .swatch { width: 22px; height: 22px; }
}

/* colour-group swatches */
.swatch[data-metal="warm"]    { background: conic-gradient(#E0533D 0 33%, #F29A3E 0 66%, #F2B6C6 0); }
.swatch[data-metal="cool"]    { background: conic-gradient(#3E6BC4 0 33%, #3F9A6E 0 66%, #8E6BC2 0); }
.swatch[data-metal="neutral"] { background: conic-gradient(#1F1D1B 0 33%, #F4EFE6 0 66%, #9C8B76 0); }
.swatch[data-metal="multi"]   { background: conic-gradient(#E0533D, #F2C94C, #3F9A6E, #3E6BC4, #8E6BC2, #E0533D); }
