:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  color: #192b24;
  background: #f6f7f1;
  --ink: #192b24;
  --muted: #4f6158;
  --accent: #20543f;
  --accent-hover: #163d2d;
  --border: #d9e1d8;
  --surface: #fff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }

.shell {
  width: min(100% - 2.5rem, 64rem);
  margin-inline: auto;
}

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

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 4.5rem;
}

.shop-name {
  font-weight: 750;
  letter-spacing: -.025em;
}

#cart-count {
  background: #eaf2e8;
  border-radius: 999px;
  color: var(--accent);
  font-size: .875rem;
  font-weight: 650;
  padding: .4rem .75rem;
}

main { padding-block: clamp(2.25rem, 6vw, 4.75rem); }

h1 {
  margin: 0 0 1.75rem;
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.05;
  letter-spacing: -.065em;
}

h1:focus { outline: none; }

.back-link {
  display: inline-block;
  margin-bottom: 1.25rem;
  color: var(--accent);
  font-size: .94rem;
  font-weight: 650;
  text-underline-offset: .2em;
}

.product-grid,
.order-layout {
  display: grid;
  gap: 1rem;
}

.product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.order-layout { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.order-layout:has(> #checkout-products[hidden]) { grid-template-columns: minmax(0, 24rem); }
.product-list { display: grid; gap: .75rem; }

.product,
.summary,
.shop-summary,
.empty-cart,
.confirmation {
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface);
}

.product { padding: clamp(1rem, 3vw, 1.65rem); }
.product-details h2 { margin: 0 0 .3rem; font-size: 1.35rem; letter-spacing: -.025em; }
.unit-price { margin: 0; color: var(--muted); }

.product-amount,
.shop-summary,
.total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.product-amount {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.quantity {
  display: grid;
  grid-template-columns: 2.75rem minmax(2.15rem, auto) 2.75rem;
  align-items: center;
  text-align: center;
}

button, input { font: inherit; }
button, .button { touch-action: manipulation; }

.quantity button {
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid #cbd7cc;
  border-radius: .55rem;
  background: var(--surface);
  color: var(--accent);
  font-size: 1.25rem;
  cursor: pointer;
}

.quantity button:hover:enabled { background: #eaf2e8; }
.quantity button:disabled { color: #52665a; background: #f1f3ee; cursor: default; }

.quantity-value, output { font-weight: 700; font-variant-numeric: tabular-nums; }

.line-total { text-align: right; }
.line-total span { display: block; color: var(--muted); font-size: .78rem; }

.shop-summary {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
}

.shop-summary .total { justify-content: flex-start; flex-wrap: wrap; }
.total { color: var(--muted); font-weight: 600; }
.total output { color: var(--ink); font-size: 1.4rem; }

.summary {
  align-self: start;
  display: grid;
  gap: .8rem;
  padding: 1.25rem;
}

.summary label { font-weight: 700; }
#order-form .total { margin-top: .5rem; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .65rem 1rem;
  min-height: 2.75rem;
  border: 1px solid transparent;
  border-radius: .55rem;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.shop-summary .button { flex-shrink: 0; }
.button:hover:not(:disabled) { background: var(--accent-hover); }
.button:disabled { background: #e8eee7; color: #495e51; cursor: default; }

:where(a, button, input):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

input {
  width: 100%;
  min-height: 2.75rem;
  padding: .65rem .75rem;
  border: 1px solid #a9baac;
  border-radius: .55rem;
  color: var(--ink);
}

input[aria-invalid="true"] { border-color: #a62b33; }
.field-error { margin: 0; color: #a62b33; font-size: .9rem; }
.empty-note { margin: 0; color: var(--muted); font-size: .9rem; }
.empty-cart { margin: 0; padding: 1.65rem; color: var(--muted); }

.confirmation {
  max-width: 37rem;
  margin-inline: auto;
  padding: clamp(1.5rem, 6vw, 3.5rem);
  text-align: center;
}

.confirmation-tick {
  display: grid;
  place-items: center;
  width: 4.5rem;
  height: 4.5rem;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  background: #e0f2e5;
  color: #24633d;
  font-size: 2.3rem;
}

.confirmation h1 { margin-bottom: .8rem; font-size: clamp(1.85rem, 5vw, 2.8rem); }
.order-id { margin: 0; overflow-wrap: anywhere; color: var(--muted); }
.order-id strong { color: var(--ink); }
.confirmation .button { margin-top: 1.5rem; }

@media (max-width: 44rem) {
  .product-grid, .order-layout { grid-template-columns: 1fr; }
}

@media (max-width: 24rem) {
  .shop-summary { align-items: stretch; flex-direction: column; }
}
