@font-face {
  font-family: Geist;
  src: url(./fonts/geist.woff2) format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url(./fonts/instrument-serif.woff2) format("woff2");
  font-display: swap;
}

:root {
  --paper: #eee8dc;
  --ink: #211c19;
  --clay: #511820;
  --muted: #61564d;
  --line: #c7bdb0;
  --pad: clamp(18px, 5.2vw, 80px);
  --serif: "Instrument Serif", Georgia, serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.5 Geist, Arial, sans-serif; }
body:has(dialog[open]) { overflow: hidden; }
h1, h2, p { margin: 0; }
button, select, input { font: inherit; color: inherit; }
button, select { cursor: pointer; }
a { color: inherit; text-underline-offset: .22em; }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 4px; }
img { display: block; max-width: 100%; }

.skip, .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip:focus { z-index: 2; top: 8px; left: 8px; width: auto; height: auto; clip-path: none; padding: 8px 12px; background: var(--paper); }

.masthead, .footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 30px;
  padding: 17px var(--pad);
  min-height: 72px;
}
.masthead { border-bottom: 1px solid var(--line); }
.wordmark { font-size: clamp(17px, 2.1vw, 23px); letter-spacing: -.07em; line-height: 1; text-decoration: none; white-space: nowrap; }
.wordmark strong { font-weight: 700; }
.masthead nav, .footer nav { display: flex; gap: clamp(12px, 2.8vw, 40px); }
.masthead nav a, .footer nav a { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; text-decoration: none; }
.masthead nav a:hover, .footer nav a:hover, .masthead a[aria-current] { text-decoration: underline; }

.shop { max-width: 1760px; margin-inline: auto; padding: 0 var(--pad) clamp(56px, 8vw, 126px); }
.shop-heading { padding: clamp(30px, 4.6vw, 76px) 0 clamp(23px, 3.3vw, 52px); }
.shop-heading h1 { color: var(--clay); font: 400 clamp(57px, 9vw, 144px)/.92 var(--serif); letter-spacing: -.035em; }
.shop-heading p { margin-top: 17px; color: var(--muted); font-size: clamp(14px, 1.25vw, 18px); }

.shop-tools { border-block: 1px solid var(--line); }
.categories { display: flex; flex-wrap: wrap; column-gap: clamp(17px, 2.5vw, 38px); }
.categories button {
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 10px 0 8px;
  min-height: 46px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}
.categories button[aria-pressed="true"] { border-color: var(--clay); color: var(--clay); font-weight: 650; }
.categories button:hover { color: var(--clay); }
.catalog-tools { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.search { width: min(100%, 290px); min-width: 0; }
.search input, .sort select {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}
.search input { width: 100%; }
.search input::placeholder { color: var(--muted); opacity: 1; }
.sort select { max-width: 100%; }
.catalog-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 20px;
  margin: 13px 0 19px;
  color: var(--muted);
  font-size: 13px;
}
.catalog-summary p:last-child { text-align: right; }
#result-count { flex: 0 0 auto; white-space: nowrap; }

.product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(28px, 4.8vw, 65px) clamp(14px, 2vw, 32px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.product-card { display: block; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; }
.product-card > img { width: 100%; height: auto; aspect-ratio: 1; border-radius: 12px; background: #ded6c7; object-fit: cover; transition: opacity 150ms ease; }
.product-card:hover > img { opacity: .88; }
.product-meta { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 4px 8px; padding-top: 12px; }
.product-name { font-size: clamp(13px, 1.25vw, 18px); font-weight: 600; line-height: 1.3; }
.product-price { color: var(--clay); font-size: clamp(13px, 1.15vw, 16px); font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.product-category { color: var(--muted); font-size: 13px; }
.empty { padding: 24px 0 60px; }
.empty button { color: var(--clay); border: 0; background: none; padding: 12px 0; text-decoration: underline; text-underline-offset: .22em; }

.footer { border-top: 1px solid var(--line); flex-wrap: wrap; }

dialog { width: min(960px, calc(100% - 32px)); max-height: 92dvh; padding: 0; border: 0; overflow: auto; background: var(--paper); color: var(--ink); }
dialog::backdrop { background: #211c19c4; }
dialog form { position: absolute; z-index: 1; top: 12px; right: 12px; margin: 0; }
.close { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); background: var(--paper); font: 27px/1 Arial, sans-serif; }
.product-detail { display: grid; grid-template-columns: 1.14fr 1fr; }
.product-gallery { padding: 12px; background: #e5ded1; }
#detail-photo { width: 100%; height: auto; aspect-ratio: 1; border-radius: 12px; background: #e5ded1; object-fit: contain; }
.gallery-controls { display: flex; gap: 8px; margin-top: 10px; }
.gallery-controls button { padding: 2px; border: 1px solid transparent; background: transparent; }
.gallery-controls button[aria-pressed="true"] { border-color: var(--clay); }
.gallery-controls img { width: 52px; height: 52px; object-fit: cover; }
.product-info { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: clamp(66px, 7vw, 84px) clamp(24px, 4vw, 48px) 40px; }
.product-info h2 { margin-top: 8px; font: 400 clamp(35px, 5vw, 65px)/.98 var(--serif); letter-spacing: -.025em; }
.detail-price { margin: 14px 0 20px; color: var(--clay); font-size: 23px; font-weight: 600; }
.product-stock { grid-column: 1 / -1; color: var(--clay); font-size: 13px; font-weight: 500; }
.inventory-note { margin: 0 0 18px; font-size: 12px; color: var(--muted); }
.variant-stock { width: 100%; margin: 16px 0; font-size: 13px; }
.variant-stock div { display: flex; justify-content: space-between; gap: 20px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.variant-stock dd { margin: 0; }
.product-info > .product-stock { margin: -10px 0 16px; }
.contact-button { display: flex; justify-content: space-between; gap: 22px; min-height: 44px; margin-top: 25px; padding: 10px 14px; background: var(--clay); color: var(--paper); text-decoration: none; }
.contact-button:hover { background: #3b1218; }
.availability { margin-top: 10px; color: var(--muted); font-size: 13px; }

@media (width <= 1000px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (width <= 620px) {
  .masthead { flex-wrap: wrap; gap: 7px 14px; padding-block: 10px; min-height: 64px; }
  .masthead nav a, .footer nav a { font-size: 13px; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-meta { display: flex; flex-direction: column; gap: 3px; }
  .product-category { font-size: 12px; }
  .product-detail { grid-template-columns: 1fr; }
  .product-info { padding: 24px 24px 30px; }
  #detail-photo { max-height: 47dvh; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
