:root {
  --bg: #f3efe3;
  --ink: #241f16;
  --muted: #7a7160;
  --accent: #3f6b53;
  --card-bg: #ece4cf;
  --border: #d9cfb8;
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --font-label: 'Archivo Narrow', 'Arial Narrow', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-label);
  line-height: 1.5;
}

.hero h1, .item-card h2 {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
}

.cart-badge, .price-line, .cart-total, .qty-input, .cart-qty-value,
.payment-details dt, .payment-details dd {
  font-family: var(--font-mono);
}

a { color: var(--accent); }

.breadcrumb-bar {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.9rem 1.8rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}
.breadcrumb-bar a { color: var(--ink); transition: color 0.15s ease; }
.breadcrumb-bar a:hover, .breadcrumb-bar a:focus-visible { color: var(--accent); }
.breadcrumb-bar .crumb-sep { color: var(--muted); font-weight: 400; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
}

.site-header .brand {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--ink);
}

.site-header nav { display: flex; gap: 1.25rem; align-items: center; }
.site-header nav a { text-decoration: none; color: var(--ink); }
.site-header nav a:hover { color: var(--accent); }

.cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  height: 1.4rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.75rem;
}

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }

.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
  font-size: 0.85rem;
}

/* Home */
.hero { text-align: center; padding: 2rem 1rem 3rem; }
.hero h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.hero p { color: var(--muted); max-width: 40rem; margin: 0 auto; }

.item-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}

.item-card {
  display: block;
  padding: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.item-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.06); }
.item-card h2 { margin: 0 0 0.5rem; }
.item-card p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.item-card--soon { opacity: 0.7; }

.placeholder-page { text-align: center; padding: 3rem 1rem; color: var(--muted); }

/* Shop layout: catalogue grid + preview/controls panel */
.shop-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1fr);
  gap: 2rem;
  align-items: start;
}
@media (max-width: 800px) {
  .shop-layout { grid-template-columns: 1fr; }
}

.catalogue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.5rem;
  max-height: 560px;
  overflow-y: auto;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--card-bg);
}

.catalogue-thumb {
  padding: 0;
  border: 2px solid transparent;
  border-radius: 0.4rem;
  overflow: hidden;
  cursor: pointer;
  background: none;
  line-height: 0;
}
.catalogue-thumb img { width: 100%; height: 90px; object-fit: cover; display: block; }
.catalogue-thumb.selected { border-color: var(--accent); }

/* Catalogue category sidebar + jump links (issue #74) */
.sidebar-layout {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 0.75rem;
  align-items: start;
}
@media (max-width: 560px) {
  .sidebar-layout { grid-template-columns: 1fr; }
}

.cat-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  max-height: 560px;
  overflow-y: auto;
  padding-right: 0.25rem;
}
.cat-sidebar button {
  display: flex;
  justify-content: space-between;
  gap: 0.4rem;
  text-align: left;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 0.4rem 0.5rem;
  border-radius: 0.4rem;
  cursor: pointer;
}
.cat-sidebar button:hover { background: var(--bg); color: var(--ink); }
.cat-sidebar button.is-active { background: var(--bg); color: var(--accent); font-weight: 700; }
.cat-sidebar .n { font-variant-numeric: tabular-nums; }

.grid-section-heading {
  grid-column: 1 / -1;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin: 0.5rem 0 0.1rem;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--border);
  scroll-margin-top: 0.4rem;
}
.grid-section-heading:first-child { border-top: none; padding-top: 0; margin-top: 0; }

/* Mobile picker (issue #98): below 800px — where .shop-layout already stacks the picker above
   the mockup (see below) — the sidebar's category list and the tall vertical grid put several
   screens of scrolling between landing on the page and seeing the mockup. Swapped for a
   dropdown + horizontal strip there instead, reusing the same catalogue-thumb elements the
   desktop grid renders (filtered by `hidden`, not a second copy) so there's one source of
   truth for the catalogue at every width. Desktop keeps the sidebar+grid #74 settled on. */
.mobile-category-select { display: none; }

@media (max-width: 800px) {
  /* min-width: 0 overrides the automatic minimum size grid items get by default (their
     content's min-content size) — without it, .catalogue-grid's nowrap strip below still
     forces .sidebar-layout, and with it the whole .shop-layout column, out to fit every
     un-scrolled thumbnail instead of the viewport. */
  .sidebar-layout { display: block; min-width: 0; }
  .cat-sidebar { display: none; }
  .mobile-category-select {
    display: block;
    width: 100%;
    font: inherit;
    font-size: 0.9rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--card-bg);
    color: var(--ink);
    margin-bottom: 0.6rem;
  }
  .grid-section-heading { display: none; }
  .catalogue-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    max-height: none;
    scroll-snap-type: x proximity;
    /* Grid/flex items default to min-width: auto, which resolves to their content's
       min-content size — for a nowrap flex strip that's the sum of every unwrapped
       thumbnail (248 * 84px here), and with nothing capping it that blows out
       .sidebar-layout's and .shop-layout's grid tracks to match, taking the whole page
       to that width instead of the viewport's. min-width: 0 lets overflow-x: auto
       actually contain it. */
    min-width: 0;
  }
  .catalogue-grid .catalogue-thumb {
    flex: 0 0 auto;
    width: 84px;
    scroll-snap-align: start;
  }
  .catalogue-grid .catalogue-thumb img { width: 84px; height: 84px; }
}

.controls-panel {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem;
}

.option-group { margin-bottom: 1.25rem; }
.option-group legend { font-weight: 600; margin-bottom: 0.5rem; }
.option-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.option-row label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  cursor: pointer;
  font-size: 0.9rem;
}

/* Mobile size picker (issue #98) — same "select drives the real radios" pattern as the
   category dropdown above; scoped to .size-option-row specifically, not every .option-row,
   since Apparel's own option rows (shirt size, colour) aren't part of this change. */
.mobile-size-select { display: none; }
@media (max-width: 800px) {
  .mobile-size-select {
    display: block;
    width: 100%;
    font: inherit;
    font-size: 0.9rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background: var(--card-bg);
    color: var(--ink);
    margin-bottom: 0.5rem;
  }
  .size-option-row { display: none; }
}

.shirt-swatch {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer;
  padding: 0;
}
.shirt-swatch.selected { outline: 2px solid var(--accent); outline-offset: 2px; }

.price-line { font-size: 1.4rem; font-weight: 700; margin: 1rem 0; }

.qty-stepper { display: inline-flex; align-items: center; gap: 0.5rem; }
.qty-btn {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  background: none;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.qty-btn:hover { filter: brightness(1.05); }
.qty-input {
  width: 3rem;
  text-align: center;
  padding: 0.4rem 0.2rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  font-size: 1rem;
}
/* Hide native spinner arrows — the qty-btn pair replaces them. */
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 0.5rem;
  padding: 0.7rem 1.2rem;
  font-size: 1rem;
  cursor: pointer;
}
button.primary:disabled { opacity: 0.5; cursor: not-allowed; }
button.primary:hover:not(:disabled) { filter: brightness(1.05); }

.add-status { margin-top: 0.6rem; color: var(--muted); font-size: 0.9rem; }

/* Living-room wall mockup: a real room photo (room.jpg) with the chosen print positioned
   directly on the wall — see issue #17's spike and #20 for how the geometry was derived. */
.room-scene {
  position: relative;
  width: 100%;
  aspect-ratio: 1100 / 712;
  border-radius: 0.5rem;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  margin-bottom: 1rem;
}

/* Frameless: the print sits straight on the wall — a thin edge line and a soft, tight
   contact shadow stand in for the aluminium panel's own edge, no frame/mat. */
.wall-print {
  position: absolute;
  display: block;
  object-fit: cover;
  border: 1px solid rgba(0, 0, 0, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Apparel shirt mockup */
.shirt-scene {
  background: #e4e4e4;
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 1rem;
}
.shirt-scene svg { width: 100%; height: auto; display: block; }

/* Cart page */
.cart-items { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.cart-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}
.cart-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 0.35rem; }
.cart-item-info { flex: 1; }
.cart-item-qty { display: inline-flex; align-items: center; gap: 0.5rem; }
.cart-qty-value { min-width: 1.5rem; text-align: center; font-weight: 600; }
.cart-item-price { font-weight: 600; }
.cart-remove {
  background: none;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  color: var(--muted);
}

.cart-total { font-size: 1.3rem; font-weight: 700; margin: 1rem 0; }
.cart-empty { color: var(--muted); padding: 2rem 0; }
.lead-time-note { color: var(--muted); font-size: 0.9rem; }

/* Checkout modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }

.modal-box {
  background: var(--card-bg);
  border-radius: 0.75rem;
  padding: 1.75rem;
  max-width: 32rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-box h2 { margin-top: 0; }
.modal-close {
  float: right;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--muted);
}

.payment-details {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1rem;
  margin: 1rem 0;
  font-size: 0.95rem;
}
.payment-details dt { font-weight: 600; }
.payment-details dd { margin: 0 0 0.6rem; }

.form-field { margin-bottom: 1rem; }
.form-field label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.form-field input, .form-field textarea {
  width: 100%;
  padding: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  font-size: 0.95rem;
  font-family: inherit;
}

.checkout-error {
  background: #fdecea;
  color: #7a2320;
  border-radius: 0.4rem;
  padding: 0.6rem 0.8rem;
  margin-bottom: 1rem;
}

.checkout-success { text-align: center; padding: 1rem 0; }
