/* ---------- Catalog ---------- */
.catalog { list-style: none; margin: var(--s-4) 0 0; padding: 0; display: grid; gap: var(--s-5); }
.product { display: grid; gap: var(--s-3); align-items: center; }
.product__media {
  display: grid; place-items: center; background: var(--cream-200);
  padding: var(--s-4) var(--s-3); min-height: 20rem;
}
.product__media img { width: auto; height: auto; max-width: 62%; max-height: 28rem; filter: drop-shadow(0 1.2rem 1rem rgb(20 19 17 / 0.25)); }
.product__name { font-family: var(--font-display); font-weight: 500; font-size: var(--step-3); line-height: 1.05; margin-block: var(--s-1); }
.product__price { font-size: var(--step-1); font-weight: 600; }
.product__desc { color: var(--ink-700); max-width: 38ch; margin-top: var(--s-2); }

@media (min-width: 48em) {
  .product { grid-template-columns: 1fr 1fr; gap: var(--s-5); }
  .product:nth-child(even) .product__media { order: 2; }
}

/* ---------- Purchase form ---------- */
.buy { display: grid; gap: var(--s-2); margin-top: var(--s-3); max-width: 24rem; border-top: 1px solid var(--line); padding-top: var(--s-3); }
.buy .btn { width: 100%; }
.buy__msg { min-height: 1.5em; font-size: var(--step--1); color: var(--ink-700); }
.buy__msg.is-error { color: var(--logo-red); font-weight: 600; }
.field { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 0.4rem; }
.field__label { padding: 0; font-size: var(--step--1); letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; color: var(--ink-500); }

.qty { display: inline-flex; align-items: stretch; width: fit-content; border: 1px solid var(--ink-900); border-radius: var(--radius); }
.qty__btn { width: 2.75rem; min-height: 2.75rem; background: none; border: 0; font-size: 1.2rem; line-height: 1; }
.qty__btn:hover:not(:disabled) { background: var(--ink-900); color: var(--cream-50); }
.qty__btn:disabled { opacity: 0.35; cursor: not-allowed; }
.qty__input, .qty__val {
  width: 3.5rem; text-align: center; font: inherit; font-weight: 600; background: none; border: 0;
  border-inline: 1px solid var(--line); color: inherit; display: grid; place-items: center;
  -moz-appearance: textfield; appearance: textfield;
}
.qty__input::-webkit-outer-spin-button, .qty__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty__input[aria-invalid="true"] { box-shadow: inset 0 0 0 2px var(--logo-red); }

.choices { display: flex; flex-wrap: wrap; gap: var(--s-1); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 1.1rem; border: 1px solid var(--ink-900); border-radius: var(--radius); font-weight: 600; font-size: var(--step--1); letter-spacing: 0.1em; text-transform: uppercase; }
.choice input:checked + span { background: var(--ink-900); color: var(--cream-50); }
.choice input:focus-visible + span { box-shadow: var(--focus); }

.link-btn { background: none; border: 0; padding: 0.25rem 0; font: inherit; font-size: var(--step--1); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Cart drawer (native <dialog>) ---------- */
.cart {
  border: 0; padding: 0; margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh;
  width: min(28rem, 100%); max-width: 100%; background: var(--cream-100); color: var(--ink-900);
  border-left: 1px solid var(--line);
}
.cart[open] { display: flex; animation: drawer-in 280ms var(--ease); }
.cart::backdrop { background: rgb(15 43 37 / 0.55); }
@keyframes drawer-in { from { transform: translateX(2rem); opacity: 0; } to { transform: none; opacity: 1; } }
body:has(dialog[open]) { overflow: hidden; }

.cart__inner { display: flex; flex-direction: column; width: 100%; height: 100%; }
.cart__head { display: flex; align-items: center; justify-content: space-between; padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--line); }
.cart__head h2 { font-family: var(--font-display); font-weight: 500; font-size: var(--step-1); }
.cart__head h2:focus { outline: none; }
.cart__close { width: 2.75rem; height: 2.75rem; display: grid; place-items: center; background: none; border: 1px solid var(--ink-900); border-radius: var(--radius); }
.cart__body { flex: 1; overflow-y: auto; padding: var(--s-3); display: flex; flex-direction: column; gap: var(--s-3); overscroll-behavior: contain; }

.cart__empty { margin: auto; text-align: center; display: grid; gap: var(--s-3); justify-items: center; }
.cart__empty-title { font-family: var(--font-display); font-size: var(--step-1); }

.cart__lines { list-style: none; margin: 0; padding: 0; display: grid; }
.cline { display: grid; grid-template-columns: 1fr auto; gap: var(--s-1) var(--s-2); align-items: center; padding-block: var(--s-2); border-bottom: 1px solid var(--line); }
.cline__name { font-weight: 600; }
.cline__meta { font-size: var(--step--1); color: var(--ink-500); }
.cline__total { font-weight: 600; text-align: right; }
.cline > .link-btn { justify-self: end; }

.cart__summary { margin-top: auto; display: grid; gap: var(--s-2); padding-top: var(--s-2); border-top: 1px solid var(--ink-900); }
.sum-row { display: flex; justify-content: space-between; font-size: var(--step-1); }
.ship__msg { font-size: var(--step--1); color: var(--ink-700); }
.ship__bar { margin-top: 0.4rem; height: 4px; background: var(--cream-200); }
.ship__bar span { display: block; height: 100%; background: var(--forest-700); transition: width var(--dur) var(--ease); }
.checkout { display: grid; gap: var(--s-1); }
.checkout__hint { font-size: var(--step--1); color: var(--ink-700); }
