/* ENVOY — order-choices.css
   the colourway swatches, the running summary, the terms box

   One part of a stylesheet split across files. The load order in
   index.html is part of the stylesheet — see css/base.css for the map. */

/* ---- colourway swatches ---- */

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(8px, 1vw, 14px);
}

.swatch {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.5em 0.9em 0.5em 0.6em;
  border: 1px solid rgba(239, 32, 21, 0.26);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.45);
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

/* The radio is the control and it keeps every bit of its behaviour — arrow
   keys, the group, the label association. It is moved off-screen rather than
   `display: none`, which would take it out of the tab order and out of the
   accessibility tree along with it. */
.swatch input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.swatch-chip {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: var(--chip, #444);
}

.swatch--ember  { --chip: linear-gradient(140deg, #ff4a34, #a80a0a); }
.swatch--carbon { --chip: linear-gradient(140deg, #3a3a3d, #0b0b0c); }
.swatch--bone   { --chip: linear-gradient(140deg, #f6efe6, #cbbfae); }

.swatch-name {
  font-family: var(--sans);
  font-size: clamp(12px, 0.95vw, 14px);
  letter-spacing: 0.04em;
  color: rgba(243, 228, 226, 0.76);
}

.swatch:hover { border-color: rgba(239, 32, 21, 0.55); }

/* Two selectors for one state. `:has()` is what makes the chips light up
   before a line of script has run — including if order.js never loads — and
   the `.is-on` class js/order.js writes alongside it is the floor for a
   browser too old for `:has()`, where the checked colourway would otherwise
   be invisible. Neither alone covers both cases. */
.swatch:has(input:checked),
.swatch.is-on {
  border-color: var(--red);
  background: rgba(239, 32, 21, 0.13);
}

.swatch:has(input:checked) .swatch-name,
.swatch.is-on .swatch-name { color: var(--ink); }

/* The focus ring belongs on the chip the reader can see, not on the 1px box
   the radio was shrunk to. */
.swatch:has(input:focus-visible) {
  outline: 2px solid var(--red-bright);
  outline-offset: 3px;
}

/* ---- summary ---- */

.order-summary {
  margin: clamp(20px, 3vh, 30px) 0;
  padding: clamp(14px, 2vh, 20px) clamp(14px, 1.6vw, 20px);
  border: 1px solid rgba(239, 32, 21, 0.18);
  background: rgba(0, 0, 0, 0.42);
}

.sum-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.2em;
  padding: 0.42em 0;
}

.sum-key {
  font-family: "Cormorant Garamond", "EB Garamond", Garamond, serif;
  font-size: clamp(15px, 1.2vw, 19px);
  color: rgba(243, 228, 226, 0.76);
}

.sum-key em {
  font-family: "Courier Prime", "Courier New", monospace;
  font-style: normal;
  font-size: 0.62em;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(239, 32, 21, 0.8);
}

.sum-val {
  font-family: var(--sans);
  font-size: clamp(14px, 1.1vw, 17px);
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.sum-row--total {
  margin-top: 0.42em;
  padding-top: 0.8em;
  border-top: 1px solid rgba(239, 32, 21, 0.24);
}

.sum-row--total .sum-key { color: var(--ink); }

.sum-row--total .sum-val {
  font-size: clamp(19px, 1.75vw, 27px);
  color: #fff;
}

/* ---- terms checkbox ---- */

.check {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.75em;
  cursor: pointer;
}

/* Hidden the same way the swatch radios are, and for the same reason. */
.check input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.check-box {
  position: relative;
  width: 1.15em;
  height: 1.15em;
  /* The text next to it is set in Cormorant, which sits small in its box; the
     nudge is what lands the square on the first line's cap height rather than
     above it. */
  margin-top: 0.24em;
  border: 1px solid rgba(239, 32, 21, 0.5);
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.55);
  transition: background-color 0.18s ease, border-color 0.18s ease;
}

.check-box::after {
  content: "";
  position: absolute;
  left: 32%;
  top: 12%;
  width: 28%;
  height: 56%;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(42deg) scale(0.6);
  opacity: 0;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.check:hover .check-box { border-color: var(--red-bright); }

.check input:checked ~ .check-box {
  background: var(--red);
  border-color: var(--red);
}

.check input:checked ~ .check-box::after {
  opacity: 1;
  transform: rotate(42deg) scale(1);
}

.check input:focus-visible ~ .check-box {
  outline: 2px solid var(--red-bright);
  outline-offset: 3px;
}

.check-text {
  font-family: "Cormorant Garamond", "EB Garamond", Garamond, serif;
  font-size: clamp(14px, 1.1vw, 18px);
  line-height: 1.42;
  color: rgba(243, 228, 226, 0.78);
}

.check-text strong { font-weight: 600; color: var(--ink); }
