/* Glint Founding Beta — reservation form.
   Builds on css/beta.css tokens. Calm and roomy, like a good checkout:
   one column, boxed fields, choice chips, nothing competing with the next step. */

.reserve {
  --field-border: #c9c9cf;
  --field-border-hover: #8e8e93;
  --error: #b42318;
  padding-bottom: 0;
}

.form-page {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(1rem, 3vh, 2rem) var(--gutter) clamp(3rem, 8vh, 5rem);
}

/* ---------- Step header ---------- */
.progress { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 1rem; }
.progress__bar { height: 3px; border-radius: 999px; background: var(--rule); }
.progress__bar.is-on { background: var(--fg); }
.step__count { font-size: 0.8125rem; font-weight: 600; color: var(--fg-2); }
.step__title {
  margin-top: 0.375rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.125rem, 5vw, 2.75rem);
  line-height: 1;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.step__title:focus { outline: none; }
.step__intro { margin-top: 0.5rem; font-size: 1rem; color: var(--fg-2); text-wrap: pretty; }

/* ---------- Groups and fields ---------- */
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }
.group { display: grid; gap: 1rem; margin-top: clamp(1.5rem, 4vw, 2rem); }
.group__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.375rem;
  line-height: 1.1;
  margin-bottom: -0.25rem;
}
.field { display: grid; gap: 0.25rem; min-width: 0; align-content: start; }
.field__label { font-weight: 600; font-size: 0.875rem; }
.field__optional { font-weight: 400; color: var(--fg-2); }
.field__hint { font-size: 0.8125rem; color: var(--fg-2); margin-top: -0.125rem; }
.field-row { display: grid; gap: 1rem; }
@media (min-width: 640px) {
  .field-row--2 { grid-template-columns: 1fr 1fr; }
  .field-row--3 { grid-template-columns: 1fr 8rem 1fr; }
  /* Side by side, fields share rows (label, hint, box, error), so every box
     lines up whether or not its neighbour has a hint. */
  .field-row { grid-template-rows: auto auto auto auto; row-gap: 0.25rem; }
  .field-row > .field { grid-row: span 4; grid-template-rows: subgrid; gap: 0; }
  .field-row > .field > .field__label { grid-row: 1; }
  .field-row > .field > .field__hint { grid-row: 2; margin-top: 0; }
  .field-row > .field > .input,
  .field-row > .field > .phone { grid-row: 3; margin-top: 0.25rem; }
  .field-row > .field > .field__error { grid-row: 4; margin-top: 0.25rem; }
}

.input {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 0.875rem;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 1rem;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
  -webkit-appearance: none;
  appearance: none;
}
.input:hover { border-color: var(--field-border-hover); }
.input:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12); }
.input[readonly] { background: var(--band); border-color: transparent; color: var(--fg-2); }
.input[aria-invalid="true"] { border-color: var(--error); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.16); }
.select {
  padding-right: 2.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}
.phone { display: grid; grid-template-columns: 4rem 1fr; gap: 0.5rem; }
.phone__cc { text-align: center; padding: 0 0.5rem; }

.field__error {
  display: flex;
  align-items: flex-start;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--error);
}
/* The icon means errors never rely on colour alone. */
.field__error::before {
  content: "!";
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  margin-top: 0.1em;
  border-radius: 50%;
  background: var(--error);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
}
.field__error[hidden] { display: none; }

/* ---------- Choice chips (radios) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { position: relative; }
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 1rem;
  border: 1px solid var(--field-border);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}
.chip:hover span { border-color: var(--field-border-hover); }
.chip input:checked + span { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.chip input:focus-visible + span { outline: 2px solid var(--fg); outline-offset: 3px; }
.is-invalid .chip span { border-color: var(--error); }

/* ---------- Health questions ---------- */
/* Each question is one compact row: the question, then its answers. The grey
   box is a plain wrapper, never the fieldset: browsers (Safari especially)
   draw a fieldset's box from the middle of its legend. */
.question {
  padding: 0.875rem 1rem;
  border-radius: 14px;
  background: var(--band);
}
.question__set { display: grid; gap: 0.625rem; }
.question legend { margin-bottom: 0.625rem; font-size: 0.9375rem; font-weight: 500; line-height: 1.4; text-wrap: pretty; }
.question .chip span { min-height: 34px; padding: 0 0.875rem; }
@media (min-width: 640px) {
  .question__set { grid-template-columns: 1fr auto; align-items: center; column-gap: 1.5rem; }
  .question legend { margin-bottom: 0; display: contents; }
  .question .chips { flex-wrap: nowrap; }
  .question .field__error { grid-column: 1 / -1; }
}
.group > .question + .question { margin-top: -0.5rem; }
.question .chip span { background: var(--bg); }
.question .chip input:checked + span { background: var(--fg); }
.question--age { margin-top: clamp(1.5rem, 4vw, 2rem); }

.minor {
  margin-top: 1rem;
  padding: 1.25rem 1.5rem;
  border-left: 3px solid var(--fg);
  border-radius: 0 14px 14px 0;
  background: var(--band);
  color: var(--fg-2);
}
.minor__title { color: var(--fg); font-weight: 600; margin-bottom: 0.25rem; }

/* ---------- Acknowledgments ---------- */
.check { display: grid; grid-template-columns: 22px 1fr; gap: 0.25rem 0.75rem; align-items: start; font-size: 0.9375rem; }
.check input {
  width: 22px;
  height: 22px;
  margin: 0.05em 0 0;
  border: 1.5px solid var(--field-border-hover);
  border-radius: 7px;
  background: var(--bg);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out);
}
.check input:checked {
  background: var(--fg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center / 16px no-repeat;
  border-color: var(--fg);
}
.check input:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.check label { cursor: pointer; line-height: 1.45; text-wrap: pretty; }
.check .field__error { grid-column: 2; }
.check.is-invalid input { border-color: var(--error); }

/* ---------- Review notice, summary, terms ---------- */
.flag-notice {
  margin-top: clamp(1.5rem, 4vw, 2rem);
  font-size: 0.9375rem;
  padding: 1.125rem 1.25rem;
  border-left: 3px solid var(--fg);
  border-radius: 0 14px 14px 0;
  background: #fff7e6;
  line-height: 1.5;
}
.flag-notice + .summary { margin-top: 1rem; }
.summary {
  margin-top: clamp(1.5rem, 4vw, 2rem);
  padding: clamp(1rem, 3vw, 1.5rem);
  border-radius: 20px;
  border: 1px solid var(--rule);
}
.summary__total { font-family: var(--font-display); font-size: clamp(1.5rem, 4vw, 1.875rem); line-height: 1.1; }
.summary__rows { margin-top: 0.75rem; border-top: 1px solid var(--rule); }
.summary__rows li { padding: 0.5rem 0; font-size: 0.9375rem; border-bottom: 1px solid var(--rule); color: var(--fg-2); }
.summary__rows .summary__now { color: var(--fg); font-weight: 600; font-size: 1rem; }
.summary__policy { margin-top: 0.75rem; font-size: 0.875rem; color: var(--fg-2); }
.summary__fine { margin-top: 0.5rem; font-size: 0.875rem; color: var(--fg-2); }
.check--terms { margin-top: 1.25rem; }

/* ---------- Actions ---------- */
.aside { margin-top: 1.5rem; font-size: 0.875rem; color: var(--fg-2); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-top: 1.75rem; }
.actions__primary { min-height: 48px; padding: 0 1.75rem; font-size: 1rem; font-weight: 600; }
/* Off until every Before you reserve box is ticked; while checkout opens it shows progress. */
.actions__primary[disabled] { opacity: 0.35; cursor: not-allowed; }
.actions__primary[aria-busy="true"] { opacity: 0.6; cursor: progress; }
.pay-hint { flex-basis: 100%; margin: -0.25rem 0 0; font-size: 0.875rem; color: var(--fg-2); }
.pay-hint[hidden] { display: none; }
.btn--quiet {
  min-height: 44px;
  padding: 0 0.25rem;
  border: 0;
  background: none;
  color: var(--fg);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: rgba(0, 0, 0, 0.3);
  text-underline-offset: 0.2em;
}
.btn--quiet:hover { text-decoration-color: currentColor; }
@media (max-width: 559px) {
  .actions { flex-direction: column; align-items: stretch; }
  .actions__primary { width: 100%; }
  /* Stacked: the hint sits right under Pay, above Back to details. */
  .pay-hint { order: 1; margin: -0.25rem 0 0; text-align: center; }
  .actions .btn--quiet { order: 2; }
}
.checkout-status { margin-top: 1rem; font-size: 0.9375rem; color: var(--fg-2); }
.checkout-status:empty { display: none; }
.checkout-status.is-notice { padding: 1rem 1.25rem; border-radius: 14px; background: var(--band); color: var(--fg); }

/* A fieldset's legend sits outside its grid, so it needs its own space below. */
legend.group__title { margin-bottom: 1rem; }

/* A choice group's legend sits outside the grid: give it the same label-to-hint
   spacing as an ordinary label. */
.choice > legend { margin-bottom: 0.25rem; }
.choice > legend + .field__hint { margin-top: -0.125rem; }

/* ---------- A term with a picture: "cymba conchae" in the jewellery box ---------- */
.check { position: relative; }
.term {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline dotted;
  text-decoration-color: rgba(0, 0, 0, 0.55);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 0.22em;
  cursor: help;
}
.term:hover, .term[aria-expanded="true"] { text-decoration-color: currentColor; }
.term:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; border-radius: 3px; }
.term-tip {
  position: absolute;
  top: calc(100% + 0.375rem);
  left: 34px;
  z-index: 10;
  display: grid;
  gap: 0.5rem;
  width: min(13.5rem, calc(100% - 34px));
  padding: 0.75rem 0.875rem 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  background: var(--bg);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.06);
}
.term-tip[hidden] { display: none; }
.term-tip__ear { display: block; justify-self: center; width: auto; height: 9.5rem; }
.term-tip__text { font-size: 0.8125rem; line-height: 1.4; color: var(--fg-2); }
.term-tip__text strong { color: var(--fg); font-weight: 600; }

/* The note under a group heading sits with the heading. */
.group > .group__hint { margin-top: -0.75rem; }
