/*
 * The storefront's one stylesheet.
 *
 * Written against the design tokens in `vdp_shop/storefront/theme.py`, which a
 * shop's ThemeSettings fill in as `--shop-*` custom properties on the root
 * element. Everything else here is VDP's own commerce design: a merchant
 * chooses colours, type and shape, not layout, and there is no merchant CSS
 * anywhere in this file's path.
 *
 * Structure: tokens, reset, layout, typography, then one section per
 * component in `templates/storefront/components/`.
 */

/* --- Derived tokens ---------------------------------------------------- */

:root {
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  --line: color-mix(in srgb, var(--shop-text) 14%, transparent);
  --line-strong: color-mix(in srgb, var(--shop-text) 26%, transparent);
  --muted: color-mix(in srgb, var(--shop-text) 62%, transparent);
  --surface: color-mix(in srgb, var(--shop-text) 4%, var(--shop-background));
  --surface-sunken: color-mix(in srgb, var(--shop-text) 7%, var(--shop-background));
  --on-primary: #ffffff;

  --positive: #1a6f3c;
  --caution: #8a5a00;
  --negative: #a01b20;

  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 8px 24px rgb(0 0 0 / 5%);
}

/* --- Reset -------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body,
h1, h2, h3, h4,
p, figure, ul, ol, dl, dd {
  margin: 0;
}

ul, ol {
  padding: 0;
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--shop-background);
  color: var(--shop-text);
  font-family: var(--shop-body-font);
  font-size: 1rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--shop-heading-font);
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 650;
  text-wrap: balance;
}

h1 { font-size: clamp(1.75rem, 1.2rem + 2vw, 2.5rem); }
h2 { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.65rem); }
h3 { font-size: 1.1rem; }

p { text-wrap: pretty; }

a {
  color: inherit;
  text-underline-offset: 0.18em;
}

a:hover { text-decoration-thickness: 2px; }

/*
 * A visible focus ring everywhere, on the keyboard path as well as the mouse
 * path. Removing it is the single most common way a storefront becomes
 * unusable without a pointer.
 */
:focus-visible {
  outline: 3px solid var(--shop-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* --- Layout ------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--shop-container);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

@media (min-width: 40rem) {
  .container { padding-inline: var(--space-6); }
}

.page {
  flex: 1;
  padding-block: var(--space-6) var(--space-8);
}

.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -4rem;
  z-index: 10;
  background: var(--shop-background);
  color: var(--shop-text);
  padding: var(--space-2) var(--space-4);
  border: 2px solid var(--shop-accent);
  border-radius: var(--shop-radius);
  transition: top 120ms ease-out;
}

.skip-link:focus { top: var(--space-4); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* A wrapper that carries structured data and nothing a person can see.
 *
 * It still generates a box, and a product page whose container is a two-column
 * grid gave that empty box the first cell: the picture went to the right of it
 * and the whole description dropped to the next row, leaving a hole the size of
 * the gallery in the top left. `display: contents` takes the box away and
 * leaves the element -- and therefore its microdata -- exactly where it was. */
.structured-only { display: contents; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.nowrap { white-space: nowrap; }
.text-positive { color: var(--positive); }

/*
 * The one utility set: vertical space between blocks that are not components.
 *
 * These exist because the content policy allows no inline `style` attribute,
 * and a one-off margin is not worth a component. Anything more than a top
 * margin belongs in a named class.
 */
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }
.mt-7 { margin-top: var(--space-7); }
.mt-8 { margin-top: var(--space-8); }

/* --- Header ------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--shop-background);
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-4);
}

.site-header__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--shop-heading-font);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--shop-primary);
}

.site-header__logo {
  max-height: 2.5rem;
  width: auto;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.site-nav {
  border-top: 1px solid var(--line);
  overflow-x: auto;
}

.site-nav__list {
  display: flex;
  gap: var(--space-5);
  padding-block: var(--space-3);
}

.site-nav a {
  text-decoration: none;
  font-size: 0.95rem;
  color: var(--muted);
  white-space: nowrap;
  padding-block: var(--space-1);
  border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--shop-text);
  border-bottom-color: var(--shop-accent);
}

.cart-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  font-weight: 600;
}

.search-form {
  display: flex;
  gap: var(--space-2);
}

/* --- Footer ------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding-block: var(--space-6);
  font-size: 0.9rem;
}

.site-footer__grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
}

.site-footer h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: var(--space-2);
}

.site-footer li + li { margin-top: var(--space-1); }

.site-footer__legal {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

/* --- Buttons ------------------------------------------------------------ */

/*
 * A closed set: primary, secondary and quiet. Buttons and link-buttons share
 * the class so an action reads the same whether it posts or navigates.
 */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.7rem 1.35rem;
  border-radius: var(--shop-button-radius);
  border: 2px solid var(--shop-primary);
  background: var(--shop-primary);
  color: var(--on-primary);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  min-height: 2.75rem;
  transition: background-color 120ms ease-out, border-color 120ms ease-out;
}

.button:hover { background: var(--shop-accent); border-color: var(--shop-accent); }

.button[disabled],
.button[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

.button--outline {
  background: transparent;
  color: var(--shop-primary);
}

.button--outline:hover {
  background: var(--surface-sunken);
  border-color: var(--shop-primary);
  color: var(--shop-primary);
}

.button--quiet {
  background: transparent;
  border-color: transparent;
  color: var(--shop-secondary);
  padding-inline: var(--space-2);
  text-decoration: underline;
  font-weight: 500;
}

.button--quiet:hover { background: transparent; color: var(--shop-text); }

.button--block { width: 100%; }
.button--large { padding: 0.9rem 1.75rem; font-size: 1.05rem; }

/*
 * The outline theme swaps which button style is filled. It is a token, so it
 * changes appearance only: the primary action is still the primary action.
 */
.theme-outline .button--primary {
  background: transparent;
  color: var(--shop-primary);
}

.theme-outline .button--primary:hover {
  background: var(--shop-primary);
  color: var(--on-primary);
}

.inline-form { display: inline; }

/* --- Badges ------------------------------------------------------------- */

.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  background: var(--surface-sunken);
  color: var(--shop-text);
  border: 1px solid var(--line);
}

.badge--positive { color: var(--positive); border-color: color-mix(in srgb, var(--positive) 35%, transparent); }
.badge--caution { color: var(--caution); border-color: color-mix(in srgb, var(--caution) 35%, transparent); }
.badge--negative { color: var(--negative); border-color: color-mix(in srgb, var(--negative) 35%, transparent); }

.badge--count {
  background: var(--shop-accent);
  color: var(--on-primary);
  border-color: transparent;
}

/* --- Alerts and messages ------------------------------------------------ */

/*
 * Every alert carries a word as well as a colour. Colour alone is not a
 * message: it is invisible to a screen reader and ambiguous to a good part of
 * the people who can see it.
 */
.alert {
  border: 1px solid var(--line-strong);
  border-left-width: 4px;
  border-radius: var(--shop-radius);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
}

.alert + .alert { margin-top: var(--space-2); }
.alert__label { font-weight: 700; }

.alert--success { border-left-color: var(--positive); }
.alert--error { border-left-color: var(--negative); }
.alert--warning { border-left-color: var(--caution); }
.alert--info { border-left-color: var(--shop-accent); }

.messages { margin-bottom: var(--space-5); }

/* --- Forms -------------------------------------------------------------- */

.field + .field { margin-top: var(--space-4); }

.field__label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.field__help {
  display: block;
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: var(--space-1);
}

.field__errors {
  color: var(--negative);
  font-size: 0.875rem;
  margin-top: var(--space-1);
  font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="search"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font: inherit;
  color: inherit;
  background: var(--shop-background);
  border: 1px solid var(--line-strong);
  border-radius: var(--shop-radius);
  min-height: 2.75rem;
}

textarea { min-height: 6rem; }

input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--negative);
  border-width: 2px;
}

fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}

legend {
  padding: 0;
  font-weight: 650;
  margin-bottom: var(--space-2);
}

.field-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
}

.field-grid .field + .field { margin-top: 0; }
.field--wide { grid-column: 1 / -1; }

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.checkbox input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.25rem;
  flex: none;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  margin-top: var(--space-5);
}

/* --- Asking to hear from the shop ---------------------------------------- */

.follow-form {
  display: grid;
  gap: var(--space-3);
  justify-items: start;
  max-width: 28rem;
}

.follow-form__promise { margin: 0; }
.follow-form__row { width: 100%; }
.follow-form__terms { margin: 0; color: var(--muted); font-size: 0.875rem; }

/* --- Product grid and cards --------------------------------------------- */

.product-grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}

.product-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--shop-radius);
  overflow: hidden;
  background: var(--shop-background);
  transition: box-shadow 140ms ease-out;
}

.product-card:hover { box-shadow: var(--shadow); }

.product-card__body {
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

.product-card__title {
  font-size: 1rem;
  font-weight: 650;
}

.product-card__title a { text-decoration: none; }

/* The whole card is clickable, and the link is still the link. */
.product-card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.product-card { position: relative; }

.product-card__meta {
  margin-top: auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

/* --- Media -------------------------------------------------------------- */

.media {
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--surface-sunken);
  overflow: hidden;
}

.media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media--square { aspect-ratio: 1 / 1; }
.media--tall { aspect-ratio: 3 / 4; }

.media--empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.85rem;
}

/* --- Price and stock ---------------------------------------------------- */

.price {
  font-family: var(--shop-heading-font);
  font-weight: 700;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

.price--large { font-size: 1.6rem; }
.price__tax-note { display: block; font-size: 0.8rem; font-weight: 400; color: var(--muted); }

.stock {
  font-size: 0.875rem;
  font-weight: 600;
}

.stock--in { color: var(--positive); }
.stock--low { color: var(--caution); }
.stock--out { color: var(--negative); }

/* --- Not quite perfect --------------------------------------------------- */

.flaw {
  padding: var(--space-3);
  border: 1px solid currentColor;
}

.seconds ul { margin: 0; padding: 0; list-style: none; }
.seconds a { display: inline-block; padding-block: var(--space-1); }

/* --- Product detail ----------------------------------------------------- */

.product-detail {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 52rem) {
  .product-detail { grid-template-columns: 1.15fr 1fr; gap: var(--space-8); align-items: start; }
}

.product-gallery { display: grid; gap: var(--space-3); }

.product-gallery__thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
  gap: var(--space-3);
}

.variant-list { display: grid; gap: var(--space-2); }

.variant-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--shop-radius);
  padding: var(--space-3);
}

.variant-option:has(input:checked) {
  border-color: var(--shop-accent);
  border-width: 2px;
  padding: calc(var(--space-3) - 1px);
}

.variant-option__name { font-weight: 600; }
.variant-option__detail { margin-left: auto; text-align: right; }

.quantity {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.quantity input {
  width: 5rem;
  text-align: center;
}

.attribute-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-2) var(--space-5);
  font-size: 0.95rem;
}

.attribute-list dt { color: var(--muted); }

.prose { max-width: 62ch; }
.prose p + p { margin-top: var(--space-4); }

/* The EU notice on the legal guarantee. It is shown as published: the law allows
 * no other colour, shape or layout, so a theme leaves this rule alone. The image
 * has no ground of its own and was drawn for white paper, and as wide as that
 * paper its smallest text reads easily. */
.guarantee-notice {
  width: 100%;
  max-width: 210mm;
  background: #fff;
}

.guarantee-list { padding-left: var(--space-5); }
ul.guarantee-list { list-style: disc; }
ol.guarantee-list { list-style: decimal; }

/* --- Cart --------------------------------------------------------------- */

.cart-layout {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 52rem) {
  .cart-layout { grid-template-columns: 1.6fr 1fr; align-items: start; }
}

.cart-line {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: var(--space-4);
  padding-block: var(--space-4);
  border-bottom: 1px solid var(--line);
}

.cart-line__body {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  align-items: flex-start;
  justify-content: space-between;
}

.cart-line__title { font-weight: 650; }
.cart-line__title a { text-decoration: none; }
.cart-line__controls { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.cart-line__amount { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Totals ------------------------------------------------------------- */

.panel {
  border: 1px solid var(--line);
  border-radius: var(--shop-radius);
  padding: var(--space-5);
  background: var(--surface);
}

.panel + .panel { margin-top: var(--space-4); }
.panel__title { font-size: 1rem; margin-bottom: var(--space-3); }

.totals { width: 100%; font-variant-numeric: tabular-nums; }

.totals__row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-1);
}

.totals__row--discount { color: var(--positive); }

.totals__row--grand {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--line-strong);
  font-size: 1.15rem;
  font-weight: 700;
}

/* --- Checkout ----------------------------------------------------------- */

.checkout-layout {
  display: grid;
  gap: var(--space-6);
}

@media (min-width: 52rem) {
  .checkout-layout { grid-template-columns: 1.5fr 1fr; align-items: start; }
}

.progress { margin-bottom: var(--space-6); }

.progress__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  font-size: 0.9rem;
  counter-reset: step;
}

.progress__step {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--muted);
}

.progress__step::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 0.8rem;
  font-weight: 700;
  flex: none;
}

.progress__step--done { color: var(--shop-text); }
.progress__step--done::before { border-color: var(--positive); color: var(--positive); }

.progress__step--current { color: var(--shop-text); font-weight: 650; }

.progress__step--current::before {
  background: var(--shop-primary);
  border-color: var(--shop-primary);
  color: var(--on-primary);
}

.choice-list { display: grid; gap: var(--space-3); }

.choice {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  border: 1px solid var(--line-strong);
  border-radius: var(--shop-radius);
  padding: var(--space-4);
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--shop-accent);
  border-width: 2px;
  padding: calc(var(--space-4) - 1px);
}

.choice input { margin-top: 0.3rem; flex: none; }
.choice__label { font-weight: 650; }

.review-section + .review-section { margin-top: var(--space-5); }

.review-section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.summary-line {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-2);
  border-bottom: 1px solid var(--line);
}

.summary-line__amount { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- Order status ------------------------------------------------------- */

.status-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
}

.status-grid dt {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.status-grid dd { font-weight: 650; margin-top: var(--space-1); }

/* --- Empty state -------------------------------------------------------- */

.empty {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  border: 1px dashed var(--line-strong);
  border-radius: var(--shop-radius);
  color: var(--muted);
}

.empty h2 { color: var(--shop-text); margin-bottom: var(--space-2); }
.empty .button { margin-top: var(--space-4); }

/* --- Pagination --------------------------------------------------------- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-7);
}

.pagination__status { color: var(--muted); font-size: 0.9rem; }

/* --- Hero and section headers ------------------------------------------- */

.hero {
  padding-block: var(--space-7);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--space-7);
}

.hero__lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 48ch;
  margin-top: var(--space-3);
}

.hero__actions { margin-top: var(--space-5); display: flex; gap: var(--space-3); flex-wrap: wrap; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.cue-list {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  margin-top: var(--space-6);
}

.cue {
  border: 1px solid var(--line);
  border-radius: var(--shop-radius);
  padding: var(--space-4);
  background: var(--surface);
}

.cue h3 { font-size: 0.95rem; margin-bottom: var(--space-1); }
.cue p { color: var(--muted); font-size: 0.9rem; }

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.category-chip {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.95rem;
}

.category-chip:hover { border-color: var(--shop-accent); }
.category-chip[aria-current="page"] { background: var(--shop-primary); color: var(--on-primary); border-color: var(--shop-primary); }

/* --- Motion ------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Print -------------------------------------------------------------- */

@media print {
  .site-header,
  .site-footer,
  .form-actions,
  .progress { display: none; }
}

/* The composition of a personalised line: what the product costs, what each
 * answer added, and what one of them therefore costs. Two columns, because a
 * label beside its amount is the only arrangement in which the arithmetic is
 * checkable at a glance. */
.line-options {
  margin: 0.4rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.line-options--priced {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.15rem 1rem;
}

.line-options--priced dt,
.line-options--priced dd { margin: 0; }
.line-options__amount { text-align: right; font-variant-numeric: tabular-nums; }
.line-options__sum { border-top: 1px solid var(--line); padding-top: 0.25rem; font-weight: 600; }

/* ---------------------------------------------------------------------------
 * The customer's own invoice
 * ------------------------------------------------------------------------- */

.document__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.document__number { font-size: 1.25rem; font-weight: 600; margin: 0.25rem 0 0; }
.document__meta { display: flex; gap: 2rem; margin: 0; flex-wrap: wrap; }
.document__meta dt { color: var(--muted); font-size: 0.8rem; }
.document__meta dd { margin: 0; font-variant-numeric: tabular-nums; }

.document__parties {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
}

.document__vat { width: 100%; border-collapse: collapse; }
.document__vat th,
.document__vat td { padding: 0.35rem 0; border-bottom: 1px solid var(--line); text-align: left; }
.document__vat .numeric { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Purchase confidence ------------------------------------------------
 *
 * Under the buy button, supporting it rather than competing with it. Quiet
 * type, one accent, no badges: a row of loud trust seals reads as a shop that
 * needs to insist, which is the opposite of the effect.
 */

.confidence {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--shop-radius, 6px);
  background: var(--surface);
}

.confidence--compact { padding: var(--space-3); gap: var(--space-2); }

.confidence__point {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  gap: var(--space-3);
  align-items: start;
  font-size: 0.9rem;
  line-height: 1.45;
}

.confidence__icon {
  width: 1rem;
  height: 1rem;
  margin-top: 0.15rem;
  border-radius: 50%;
  border: 2px solid var(--shop-primary, currentColor);
}

.confidence__point--stock .confidence__icon { background: var(--positive); border-color: var(--positive); }
.confidence__point--payment .confidence__icon,
.confidence__point--age .confidence__icon { border-style: double; border-width: 3px; }

.confidence__text { display: grid; gap: 0.1rem; }
.confidence__text strong { font-weight: 600; }
.confidence__detail { color: var(--muted); font-size: 0.85rem; }

/* --- An assortment in a basket ------------------------------------------ */

.cart-bundle {
  border: 1px solid var(--line);
  border-radius: var(--shop-radius, 6px);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  background: var(--surface);
}

.cart-bundle--unfinished { border-color: var(--caution); }

.bundle-head { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: baseline; }
.bundle-head__title { font-size: 1.05rem; margin: 0; }
.bundle-head__meta { color: var(--muted); font-size: 0.85rem; }
.bundle-head__saving { color: var(--positive); font-weight: 600; }

.cart-bundle__warn { color: var(--caution); font-size: 0.9rem; margin-top: var(--space-2); }
.cart-bundle__lines { margin-top: var(--space-3); }

/* --- The builder --------------------------------------------------------
 *
 * Two columns on a wide screen: what may be chosen, and what has been. On a
 * narrow one the crate goes to the bottom and sticks there, because the answer
 * to "how many more" has to stay visible while scrolling a long pool.
 */

.builder-intro {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: 1fr;
}

.builder-terms {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.builder-terms li { display: grid; gap: 0.1rem; }
.builder-terms strong { font-size: 1.4rem; line-height: 1; }
.builder-terms span { color: var(--muted); font-size: 0.85rem; }

.builder { display: grid; gap: var(--space-6); grid-template-columns: 1fr; }
/* The box first on a phone: a summary somebody has to scroll past the whole
 * pool to reach is a summary nobody reads. */
.builder > .crate { order: -1; }

.builder__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
  align-items: end;
  margin-bottom: var(--space-4);
}

.builder__search { display: flex; gap: var(--space-2); }
.builder__search input { min-width: 0; }

.builder__filters { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-5); }

.chip {
  display: inline-block;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.85rem;
  text-decoration: none;
  color: inherit;
}

.chip--on { background: var(--shop-text); color: var(--shop-background); border-color: var(--shop-text); }

.builder__grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 10rem), 1fr));
}

.pick {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--shop-radius, 6px);
  align-content: start;
}

.pick--out { opacity: 0.55; }
.pick__name { font-size: 0.95rem; margin: 0; }
.pick__name a { text-decoration: none; color: inherit; }
.pick__style { color: var(--muted); font-size: 0.8rem; }
.pick__price { font-size: 0.95rem; }
.pick__price s { margin-left: var(--space-2); font-size: 0.8rem; }
.pick__add { display: flex; gap: var(--space-2); }
.pick__count { width: 3.5rem; }

.crate {
  border: 1px solid var(--line-strong);
  border-radius: var(--shop-radius, 6px);
  padding: var(--space-4);
  background: var(--surface);
  align-self: start;
  display: grid;
  gap: var(--space-4);
}

.crate__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }
.crate__title { font-size: 1rem; margin: 0; }
.crate__count { font-variant-numeric: tabular-nums; }
.crate__count strong { font-size: 1.3rem; }

.crate__progress {
  height: 0.5rem;
  border-radius: 999px;
  background: var(--surface-sunken);
  overflow: hidden;
}

.crate__bar { display: block; fill: var(--shop-primary, var(--shop-text)); }

.crate__list { display: grid; gap: var(--space-3); max-height: 22rem; overflow-y: auto; }

.crate__item {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  gap: var(--space-3);
  align-items: center;
}

.crate__item-name { font-size: 0.9rem; }
.crate__item-price s { margin-left: var(--space-2); }
.crate__item-form { display: flex; gap: var(--space-2); }
.crate__item-count { width: 3rem; }

.crate__totals { display: grid; gap: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--line); }
.crate__totals > div { display: flex; justify-content: space-between; }
.crate__saved { color: var(--positive); font-weight: 600; }
.crate__remaining { color: var(--muted); font-size: 0.9rem; }
.crate__actions { display: grid; gap: var(--space-3); }
.crate__empty { font-size: 0.9rem; }

.box-links { display: grid; gap: var(--space-3); }

.box-link {
  display: grid;
  gap: 0.15rem;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--shop-radius, 6px);
  text-decoration: none;
  color: inherit;
}

.box-link span { color: var(--muted); font-size: 0.9rem; }

@media (min-width: 52rem) {
  .builder-intro { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; }
  .builder { grid-template-columns: minmax(0, 1fr) minmax(0, 21rem); align-items: start; }
  .builder > .crate { order: 0; position: sticky; top: var(--space-5); }
}

/* An invoice is a thing people print. No PDF is generated for it -- every
 * browser prints to one, and a PDF library is a dependency, a font problem and
 * a difference between what somebody saw and what they filed. */
@media print {
  .site-header,
  .site-footer,
  nav { display: none !important; }

  body { background: #fff; }
  .page { padding: 0; }
}

/* A quick add from a grid. Outline rather than solid: the primary action on a
 * listing is still opening the product, and a page of solid buttons is a page
 * with no hierarchy left. */
.product-card__add { margin-top: var(--space-3); }
