/* ------------------------------------------------------------------
   The Line — homepage
   One idea: the line. A thread in the selected brand's colour runs
   from the masthead through the two steps. Everything else stays quiet.

   Layouts
   - Phone            < 640px   single column, compact intro
   - iPad portrait    640–1023  centred column, roomier, 2-col store list
   - iPad landscape / desktop ≥ 1024  intro left, form right
------------------------------------------------------------------- */
:root {
  --ink: #15171B;
  --graphite: #5C6068;
  --quiet: #8B9097;
  --mist: #E3E5E8;
  --haze: #F4F5F6;
  --paper: #FFFFFF;

  /* Set from BRANDS[selected] at runtime */
  --brand: #A71931;
  --brand-tint: #FBE7EA;
  --brand-text: #7A1424;

  --font: "Readex Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 12px;
  --gutter: max(20px, env(safe-area-inset-left));
  --thread: 3px;
  --tile-gap: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }

/* ---------- Masthead ---------- */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1160px;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) var(--gutter) 14px;
}
.wordmark { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
.wordmark .sub { font-weight: 300; color: var(--graphite); margin-inline-start: 4px; }

.lang-toggle { display: inline-flex; border: 1px solid var(--mist); border-radius: 999px; padding: 3px; }
.lang-btn {
  min-width: 44px;
  border: 0;
  background: transparent;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--graphite);
  cursor: pointer;
}
.lang-btn.active { background: var(--ink); color: var(--paper); }

.rule { height: var(--thread); background: var(--brand); transition: background-color .35s ease; }

/* ---------- Layout (phone first) ---------- */
.layout {
  max-width: 1160px;
  margin: 0 auto;
  padding: 28px var(--gutter) 40px;
  display: grid;
  gap: 32px;
}
.layout > *, .step, .field { min-width: 0; } /* stops the scrolling country row from widening the column */
.intro h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -0.025em;
  max-width: 15ch;
  text-wrap: balance;
}
.intro p { margin: 10px 0 0; font-size: 15px; font-weight: 300; color: var(--graphite); max-width: 36ch; }
[dir="rtl"] .intro h1 { letter-spacing: 0; line-height: 1.3; }

/* ---------- Steps on the thread ---------- */
.steps { position: relative; margin: 0; padding: 0; list-style: none; }
.steps::before {
  content: "";
  position: absolute;
  inset-inline-start: 13px;
  top: 14px;
  bottom: 14px;
  width: var(--thread);
  background: var(--brand);
  border-radius: 2px;
  transition: background-color .35s ease;
}
.step { position: relative; padding-inline-start: 46px; padding-bottom: 36px; }
.step:last-child { padding-bottom: 0; }
.node {
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  background: var(--paper);
  border: var(--thread) solid var(--brand);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-text);
  transition: border-color .35s ease, color .35s ease;
}
.step h2 { margin: 0 0 16px; font-size: 19px; line-height: 29px; font-weight: 500; letter-spacing: -0.01em; }

.field + .field { margin-top: 22px; }
.field-label { display: block; margin-bottom: 10px; font-size: 14px; font-weight: 500; color: var(--graphite); }

/* ---------- Brand picker ----------
   Type-set cards instead of logo images: one consistent system for all
   four brands. Each card carries its own colour as a small swatch; the
   selected card fills with that colour — the same colour as the thread. */
.brand-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--tile-gap); }
.brand-btn {
  --c: var(--ink);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  min-height: 104px;
  padding: 14px 16px 15px;
  text-align: start;
  background: var(--paper);
  border: 1.5px solid var(--mist);
  border-radius: 14px;
  cursor: pointer;
  transition: background-color .3s ease, border-color .3s ease, color .3s ease;
}
.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--c);
  transition: background-color .3s ease;
}
.brand-name {
  display: block;
  font-size: 19px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.brand-meta {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  font-weight: 300;
  color: var(--graphite);
  transition: color .3s ease;
}
.brand-check {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--c);
  opacity: 0;
  transform: scale(.6);
  transition: opacity .25s ease, transform .25s ease;
}
.brand-btn[aria-checked="true"] { background: var(--c); border-color: var(--c); color: #fff; }
.brand-btn[aria-checked="true"] .swatch { background: rgba(255,255,255,.35); }
.brand-btn[aria-checked="true"] .brand-meta { color: rgba(255,255,255,.78); }
.brand-btn[aria-checked="true"] .brand-check { opacity: 1; transform: none; }

/* ---------- Store picker ---------- */
.countries {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.country {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1.5px solid var(--mist);
  background: var(--paper);
  font-size: 14px;
  font-weight: 500;
  color: var(--graphite);
  cursor: pointer;
}
.country .count { font-weight: 400; color: var(--quiet); font-variant-numeric: tabular-nums; }
.country[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.country[aria-selected="true"] .count { color: rgba(255,255,255,.6); }

.stores { display: grid; gap: 8px; }
.store {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  text-align: start;
  background: var(--paper);
  border: 1.5px solid var(--mist);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease;
}
.store-text { flex: 1; min-width: 0; }
.store-name { display: block; font-size: 15px; font-weight: 500; line-height: 1.3; }
.store-city { display: block; font-size: 13px; font-weight: 300; color: var(--graphite); }
.tick {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid #C9CCD1;
  display: grid;
  place-items: center;
  color: transparent;
}
.store[aria-checked="true"] { border-color: var(--brand); background: var(--brand-tint); }
.store[aria-checked="true"] .tick { background: var(--brand); border-color: var(--brand); color: #fff; }
.store.single { cursor: default; }

/* Kept for app compatibility; the visible picker drives it */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- Name ---------- */
.field-input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  background: var(--paper);
  border: 1.5px solid var(--mist);
  border-radius: var(--radius);
  font-size: 16px; /* 16px stops iOS zooming in on focus */
}
.field-input::placeholder { color: var(--quiet); }
.field-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint); }

/* ---------- Paths ---------- */
.paths { display: grid; gap: 10px; }
.path {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 72px;
  padding: 16px;
  text-align: start;
  background: var(--paper);
  border: 1.5px solid var(--mist);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease;
}
.path:active { background: var(--brand-tint); border-color: var(--brand); }
.path-text { flex: 1; min-width: 0; }
.path-title { display: block; font-size: 16px; font-weight: 500; line-height: 1.3; }
.path-sub { display: block; margin-top: 3px; font-size: 13.5px; font-weight: 300; color: var(--graphite); }
.path-go {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand);
  color: #fff;
  transition: background-color .35s ease;
}
[dir="rtl"] .path-go svg { transform: scaleX(-1); }

/* ---------- Footer ---------- */
.note {
  max-width: 1160px;
  margin: 0 auto;
  padding: 20px var(--gutter) calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--mist);
  font-size: 12.5px;
  color: var(--quiet);
}
.note p { margin: 0; max-width: 64ch; }

/* ---------- Hover only where there is a mouse ---------- */
@media (hover: hover) {
  .brand-btn[aria-checked="false"]:hover { border-color: var(--c); }
  .country:hover { border-color: #C9CCD1; }
  .store:hover { border-color: var(--brand); }
  .path:hover { border-color: var(--brand); background: var(--brand-tint); }
  .field-input:hover:not(:focus) { border-color: #C9CCD1; }
}

/* ---------- iPad portrait & small tablets ---------- */
@media (min-width: 640px) {
  :root { --gutter: max(40px, env(safe-area-inset-left)); --tile-gap: 14px; }
  .masthead { padding-top: calc(20px + env(safe-area-inset-top)); padding-bottom: 18px; }
  .layout { max-width: 720px; padding-top: 52px; padding-bottom: 56px; gap: 44px; }
  .intro h1 { font-size: 46px; line-height: 1.06; letter-spacing: -0.03em; }
  .intro p { font-size: 18px; margin-top: 14px; }
  .step { padding-inline-start: 56px; padding-bottom: 44px; }
  .step h2 { font-size: 21px; margin-bottom: 20px; }
  .brand-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .brand-btn { min-height: 128px; }
  .stores { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stores.one { grid-template-columns: minmax(0, 1fr); }
  .paths { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .path { flex-direction: column; align-items: flex-start; min-height: 150px; padding: 20px; }
  .path-go { margin-top: auto; }
  .path-title { font-size: 17px; }
  .note { max-width: 720px; }
}

/* ---------- iPad landscape & desktop ---------- */
@media (min-width: 1024px) {
  .layout {
    max-width: 1160px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 520px);
    gap: 72px;
    padding-top: 72px;
    align-items: start;
  }
  .intro { position: sticky; top: 64px; }
  .intro h1 { font-size: 60px; line-height: 1.03; }
  .brand-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .brand-btn { min-height: 112px; }
  .note { max-width: 1160px; }
}

/* ---------- Quality floor ---------- */
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.field-input:focus-visible { outline: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
@media (max-width: 360px) {
  :root { --gutter: 16px; --tile-gap: 8px; }
  .step { padding-inline-start: 42px; }
  .brand-name { font-size: 17px; }
}

/* ==================================================================
   Inner pages — team picker and feedback form
   ================================================================== */

/* Single centred column; the thread carries on from the homepage */
.flow {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px var(--gutter) 48px;
}
@media (min-width: 640px) { .flow { padding-top: 44px; padding-bottom: 64px; } }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin: 0 0 20px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--graphite);
  cursor: pointer;
}
[dir="rtl"] .back-link svg { transform: scaleX(-1); }

/* Finished steps */
.step.done { padding-bottom: 22px; }
.step.done .node {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  transition: background-color .35s ease;
}
.trail {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 29px;
  color: inherit;
  text-decoration: none;
}
.trail-text { flex: 1; min-width: 0; }
.trail-label { display: block; font-size: 13px; line-height: 1.3; color: var(--quiet); padding-top: 1px; }
.trail-value { display: block; font-size: 15px; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; }
.trail-change {
  flex: none;
  padding-top: 1px;
  font-size: 13px;
  font-weight: 500;
  color: var(--brand-text);
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color .2s ease;
}
.trail:focus-visible { outline-offset: 4px; border-radius: 6px; }

.step h1.step-title {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.step-sub { margin: 8px 0 22px; font-size: 15px; font-weight: 300; color: var(--graphite); }
[dir="rtl"] .step h1.step-title { letter-spacing: 0; line-height: 1.35; }
@media (min-width: 640px) {
  .step h1.step-title { font-size: 34px; }
  .step-sub { font-size: 16px; margin-bottom: 28px; }
}

/* Team list */
.teams { display: grid; gap: 10px; }
@media (min-width: 640px) { .teams { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.team {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 76px;
  padding: 14px 16px;
  text-align: start;
  background: var(--paper);
  border: 1.5px solid var(--mist);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease;
}
.team:active { border-color: var(--brand); background: var(--brand-tint); }
.team-text { flex: 1; min-width: 0; }
.team-name { display: block; font-size: 16px; font-weight: 500; line-height: 1.3; }
.team-sub { display: block; margin-top: 2px; font-size: 13.5px; font-weight: 300; line-height: 1.4; color: var(--graphite); }
.team-go {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--haze);
  color: var(--ink);
  transition: background-color .2s ease, color .2s ease;
}
[dir="rtl"] .team-go svg { transform: scaleX(-1); }
.team.unsure { border-style: dashed; background: var(--haze); }
@media (min-width: 640px) { .team.unsure { grid-column: 1 / -1; } }

/* Feedback form */
textarea.field-input {
  display: block;
  height: auto;
  min-height: 180px;
  padding: 14px 16px;
  line-height: 1.55;
  resize: vertical;
}
@media (min-width: 640px) { textarea.field-input { min-height: 220px; } }
.field-label .optional { font-weight: 300; color: var(--quiet); }

.attach {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 14px 16px;
  border: 1.5px dashed #C9CCD1;
  border-radius: 14px;
  background: var(--paper);
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease;
}
.attach input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.attach.dragging { border-color: var(--brand); background: var(--brand-tint); }
.attach-ico {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--haze);
  color: var(--ink);
}
.attach-text { flex: 1; min-width: 0; }
.attach-title { display: block; font-size: 15px; font-weight: 500; }
.attach-sub { display: block; font-size: 13px; font-weight: 300; color: var(--graphite); }

.file-chip {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px 10px 14px;
  border-radius: var(--radius);
  background: var(--brand-tint);
  font-size: 14px;
}
.file-chip.show { display: flex; }
.file-chip .file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip button {
  flex: none;
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: rgba(255,255,255,.7);
  font-size: 13px;
  font-weight: 500;
  color: var(--brand-text);
  cursor: pointer;
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 56px;
  margin-top: 28px;
  border: 0;
  border-radius: 14px;
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color .35s ease, opacity .2s ease;
}
.btn-primary:disabled { opacity: .6; cursor: progress; }
[dir="rtl"] .btn-primary svg { transform: scaleX(-1); }

.status { min-height: 22px; margin-top: 12px; font-size: 14px; }
.status.err { color: #B42318; }

/* Sent */
.sent {
  display: none;
  padding: 8px 0 4px;
}
.sent.show { display: block; }
.sent-mark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  background: var(--brand);
  color: #fff;
}
.sent-mark svg { width: 26px; height: 26px; }
.sent h2 { margin: 0; font-size: 26px; font-weight: 500; letter-spacing: -0.02em; }
.sent p { margin: 6px 0 0; font-size: 15px; font-weight: 300; color: var(--graphite); }
.form-body.hide { display: none; }

@media (hover: hover) {
  .back-link:hover { color: var(--ink); }
  .trail:hover .trail-change { text-decoration-color: currentColor; }
  .team:hover { border-color: var(--brand); }
  .team:hover .team-go { background: var(--brand); color: #fff; }
  .attach:hover { border-color: var(--brand); }
  .btn-primary:not(:disabled):hover { opacity: .92; }
}

/* No colour fades while a page is first painting — only after the visitor acts */
html:not(.ready) *, html:not(.ready) *::before, html:not(.ready) *::after { transition: none !important; }

/* Frozen feedback path */
.path[disabled] { cursor: not-allowed; opacity: .45; background: var(--paper); border-color: var(--mist); }
.path[disabled] .path-go { display: none; }
