:root {
  color-scheme: dark;

  /* Brand palette, sampled from the logo (assets/brand/logo-source.jpg). */
  --bg: #2B1D27;              /* the logo's aubergine background */
  --text: #FDFBE5;            /* the wordmark's cream */
  --text-muted: rgba(253, 251, 229, 0.72);
  --accent: #C18F54;          /* the gold of the ring and trim */
  --accent-text: #2B1D27;     /* text and marks on gold */
  --accent-hover: #D2A56C;
  --accent-active: #A97A43;
  --accent-wash: rgba(193, 143, 84, 0.1);
  --selected: #5A1C2C;        /* the garments' crimson (#D32748), deepened to sit behind cream text */
  --progress-track: rgba(253, 251, 229, 0.14);
  --radius: 6px;
  --max-width: 672px;

  --surface: #3A2A35;
  --surface-low: #32232E;     /* resting package cards: one quiet step above the page */
  --border-subtle: rgba(253, 251, 229, 0.18);
  --border-input: rgba(253, 251, 229, 0.45);
  --placeholder: rgba(253, 251, 229, 0.58);
  --hover-wash: rgba(253, 251, 229, 0.08);
  --error: #FF9AA8;           /* the crimson, lightened to stay readable on the dark page */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23FDFBE5' stroke-opacity='.72' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable; /* pages differ in height; keep the column from shifting */
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Roboto', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 18px;
  line-height: 28px;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  accent-color: var(--accent);
  caret-color: var(--accent);
}

::selection { background: var(--accent); color: var(--accent-text); }

button, label, select, input { -webkit-tap-highlight-color: transparent; }

/* Chrome */

.progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--progress-track);
  z-index: 20;
}
.progress-fill {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease-out);
}

.header, .nav, .main {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 16px;
}
.header { padding-top: 12px; }
.logo { display: block; height: 72px; width: auto; }
@media (max-width: 600px) {
  .logo { height: 56px; }
}

.nav { height: 52px; display: flex; align-items: center; justify-content: space-between; padding-top: 8px; }
.back {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  margin-left: -10px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.back:active { background: var(--hover-wash); }
.back:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Matchmaking step, "1 of 6": sits in the nav row beside the progress bar. */
.step {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.main { padding-bottom: 64px; }

/* Pages */

.page { width: 100%; }
.page--single {
  min-height: calc(100dvh - 200px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 40px;
}
.page--form { padding-top: 8px; }

h1 {
  margin: 0 0 16px;
  font-size: 36px;
  line-height: 49.5px;
  font-weight: 600;
  text-wrap: balance;
}
h1:focus { outline: none; }
.subtitle { margin: 0 0 24px; color: var(--text-muted); text-wrap: pretty; }

@media (max-width: 600px) {
  h1 { font-size: 30px; line-height: 41px; }
}

.form { display: flex; flex-direction: column; gap: 32px; }
.page--form .form { margin-top: 24px; }

.label { display: block; margin: 0 0 8px; font-size: 20px; line-height: 28px; font-weight: 600; text-wrap: balance; }
.required { color: var(--error); }
.helper { margin: 0 0 12px; color: var(--text-muted); font-size: 16px; line-height: 24px; text-wrap: pretty; }
.notice { margin: 16px 0 0; color: var(--text-muted); text-wrap: pretty; }
.error { margin: 8px 0 0; color: var(--error); font-size: 16px; line-height: 24px; font-weight: 500; }
.error:empty { display: none; }
.counter {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 20px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Buttons */

.btn {
  min-height: 44px;
  min-width: 160px;
  padding: 8px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s var(--ease-out), opacity 0.15s ease;
}
.btn:active:not(:disabled, [aria-disabled="true"]) { background: var(--accent-active); transform: scale(0.98); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.actions { margin-top: 40px; }
.actions .error { margin: 0 0 12px; }

/* Welcome screen: app.js sets this block's width to its widest line of text, so the
   button row centres under the text rather than under the full column. */
.welcome-block { max-width: 100%; }
.btn-row { display: flex; align-items: center; justify-content: center; gap: 32px; }
.enter-hint { display: none; align-items: center; gap: 6px; color: var(--text-muted); font-size: 16px; line-height: 24px; }
/* Laptops and desktops only: a wide screen with a mouse or trackpad. */
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  .enter-hint { display: inline-flex; }
}

/* Text, select, textarea */

.control {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius);
  background-color: var(--surface);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.control::placeholder { color: var(--placeholder); opacity: 1; }
textarea.control { min-height: 120px; max-height: 320px; resize: vertical; field-sizing: content; }
input[type="tel"].control { font-variant-numeric: tabular-nums; }

/* Native select, with our own arrow so it matches on every platform. */
select.control {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 42px;
  background-image: var(--chevron);
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}
select.control:has(option[value=""]:checked) { color: var(--placeholder); }

/* Focus thickens the field's own border (1px border + 1px ring of the same colour).
   The transparent outline keeps a focus indicator in forced-colors mode. */
.control:focus { outline: 2px solid transparent; box-shadow: 0 0 0 1px var(--border-input); }
.control[aria-invalid="true"] { border-color: var(--error); }
.control[aria-invalid="true"]:focus { box-shadow: 0 0 0 1px var(--error); }

.other { margin-top: 8px; }

.select-row { display: flex; align-items: center; gap: 12px; }
.select-row .control { flex: 1; min-width: 0; }
.fixed-label { flex: none; color: var(--text-muted); font-weight: 500; }

.phone-row { display: flex; border-radius: var(--radius); transition: box-shadow 0.15s ease; }
.phone-row:focus-within { box-shadow: 0 0 0 1px var(--border-input); }
.phone-row:has(.control[aria-invalid="true"]):focus-within { box-shadow: 0 0 0 1px var(--error); }
.phone-row .control:focus { box-shadow: none; }
.phone-prefix {
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--border-input);
  border-right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--surface);
  font-variant-numeric: tabular-nums;
}
.phone-row .control { border-radius: 0 var(--radius) var(--radius) 0; }
.phone-row:has(.control[aria-invalid="true"]) .phone-prefix { border-color: var(--error); }

.check-row { display: flex; align-items: flex-start; gap: 12px; margin-top: 20px; min-height: 44px; cursor: pointer; }
.check-row input { flex: none; width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--accent); cursor: pointer; }
.date-row { margin-top: 24px; max-width: 280px; }
.date-row .label { font-size: 18px; font-weight: 500; }

/* Choice options (real radio / checkbox inputs inside labels) */

.options { display: flex; flex-direction: column; gap: 8px; }
/* Two short options sit side by side at every width. */
.options--pair { display: grid; grid-template-columns: 1fr 1fr; }
/* Short option sets use columns once there is room; phones keep one column. */
@media (min-width: 600px) {
  .options--cols { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
}

.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background-color: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
/* Selected: the logo's deep crimson with a second pixel of gold border. */
.option:has(input:checked) {
  background-color: var(--selected);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.option:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--surface);
  transition: background-color 0.15s ease;
}
.option--multi .mark { border-radius: 4px; }
.option:has(input:checked) .mark { background: var(--accent); }
.option:has(input:checked) .mark::after {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-text);
}
.option--multi:has(input:checked) .mark::after {
  width: 5px; height: 10px;
  border: solid var(--accent-text);
  border-width: 0 2px 2px 0;
  border-radius: 0;
  background: none;
  transform: translateY(-1px) rotate(45deg);
}

.scale { display: flex; gap: 8px; }
.option--scale { flex: 1; justify-content: center; padding: 10px 0; font-weight: 500; font-variant-numeric: tabular-nums; }
.option--scale .mark { display: none; }
.scale-labels { display: flex; justify-content: space-between; margin-top: 8px; color: var(--text-muted); font-size: 16px; line-height: 24px; }

/* Packages: borderless cards on a quiet surface, separated by space. The chosen plan
   steps up to the brighter surface and gains a hairline gold ring. */

.plans { display: flex; flex-direction: column; gap: 16px; margin-top: 40px; }
.plan {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  grid-template-areas:
    "mark name price"
    ".    billing billing"
    ".    text text";
  column-gap: 16px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--surface-low);
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.plan input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.plan .mark { grid-area: mark; margin-top: 4px; background: transparent; }
.plan-name { grid-area: name; font-size: 20px; line-height: 28px; font-weight: 600; }
.plan-price { grid-area: price; font-size: 24px; line-height: 28px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.plan-per { color: var(--text-muted); font-size: 16px; font-weight: 400; }
.plan-was { margin-right: 8px; color: var(--text-muted); font-size: 16px; font-weight: 400; }
.plan-billing { grid-area: billing; margin-top: 2px; color: var(--text-muted); font-size: 16px; line-height: 24px; }
.plan-text {
  grid-area: text;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 52ch;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 24px;
  text-wrap: pretty;
  transition: color 0.2s ease;
}

.plan:has(input:checked) { background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent); }
.plan:has(input:checked) .plan-text { color: var(--text); }
.plan:has(input:checked) .mark { background: var(--accent); }
.plan:has(input:checked) .mark::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-text); }
.plan:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 600px) {
  .plan { padding: 20px 16px; column-gap: 12px; }
  .plan-price { font-size: 22px; }
}

.policy { margin: 32px 0 0; color: var(--text-muted); font-size: 14px; line-height: 22px; text-wrap: pretty; }

/* Terms */

.terms-box {
  max-height: 50dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border-input) transparent;
  padding: 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 16px;
  line-height: 24px;
}
.terms-box:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.terms-box h2 { margin: 0 0 8px; font-size: 20px; line-height: 28px; font-weight: 600; }
.terms-box h3 { margin: 24px 0 4px; font-size: 16px; line-height: 24px; font-weight: 600; }
.terms-box p { margin: 0 0 12px; text-wrap: pretty; }
.terms-box ul { margin: 0 0 12px; padding-left: 22px; }
.terms-box li + li { margin-top: 4px; }
.terms-box > :last-child { margin-bottom: 0; }

/* Waiting */

.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  margin-right: 10px;
  border: 2px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Pointer hover, only where a real pointer exists (no sticky hover on touch). */

@media (hover: hover) {
  .btn:hover:not(:disabled, [aria-disabled="true"]) { background: var(--accent-hover); }
  .back:hover { background: var(--hover-wash); }
  .control:hover:not(:focus) { border-color: var(--text-muted); }
  .option:hover:not(:has(input:checked)) { background-image: linear-gradient(var(--accent-wash), var(--accent-wash)); }
  .plan:hover:not(:has(input:checked)) { background: var(--surface); }
}

/* Phones: primary actions span the column for an easy thumb target. */

@media (max-width: 600px) {
  .actions .btn { width: 100%; min-height: 48px; }
}

/* Page transitions: up on Continue, down on Back */

@keyframes enter-up { from { transform: translateY(32px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes enter-down { from { transform: translateY(-32px); opacity: 0; } to { transform: none; opacity: 1; } }
.enter-up { animation: enter-up 0.3s var(--ease-out) both; }
.enter-down { animation: enter-down 0.3s var(--ease-out) both; }

@media (prefers-reduced-motion: reduce) {
  .enter-up, .enter-down { animation: none; }
  .progress-fill, .btn, .option, .plan, .plan-text, .control, .mark, .back, .phone-row { transition: none; }
  .spinner { animation-duration: 2s; }
}
