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

:root {
  --paper: #f3eee6;
  --light: #fff9ee;
  --ink: #241915;
  --wine: #71372b;
  --dark: #241915;
  --rule: #bca99b;
  --gutter: clamp(15px, 3.5vw, 56px);
  --nav-height: 68px;
  --bar-height: 52px;
  --columns: 5;
  --sans: Geist, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.45 var(--sans); }
body:has(dialog[open]) { overflow: hidden; }
h1, h2, h3, p, ul, figure, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; cursor: pointer; color: inherit; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; z-index: 6; background: var(--light); padding: 10px; transform: translateY(-130%); }
.skip:focus { transform: translateY(0); }

.masthead {
  display: flex; justify-content: space-between; align-items: center;
  height: var(--nav-height); padding: 0 var(--gutter);
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.wordmark { font: 400 clamp(16px, 2.1vw, 28px)/1 var(--sans); letter-spacing: .025em; text-decoration: none; text-transform: uppercase; white-space: nowrap; }
.wordmark strong { font-weight: 700; }
.masthead nav { display: flex; align-items: center; gap: clamp(15px, 2.7vw, 42px); }
.masthead nav :is(a, button) { border: 0; background: none; display: grid; align-items: center; min-height: 44px; text-decoration: none; padding: 0; font: 500 14px/1 var(--sans); white-space: nowrap; }
.masthead nav :is(a, button):hover { text-decoration: underline; text-underline-offset: 4px; }

.rail {
  --page-overlap: clamp(16px, 3.2vw, 45px);
  --page-width: calc((100% + (var(--columns) - 1) * var(--page-overlap)) / var(--columns));
  display: flex; height: clamp(300px, 34vw, 500px);
  background: var(--dark); overflow-x: auto; overscroll-behavior-inline: contain;
  scrollbar-width: none; scroll-snap-type: x mandatory; scroll-behavior: smooth; isolation: isolate;
}
.rail::-webkit-scrollbar { display: none; }
.rail li { position: relative; flex: 0 0 var(--page-width); min-width: 0; height: 100%; scroll-snap-align: start; }
.rail li + li { margin-inline-start: calc(-1 * var(--page-overlap)); }
.rail li:last-child { scroll-snap-align: end; }
.piece { display: block; position: relative; width: 100%; padding: 0; border: 0; text-align: left; background: transparent; }
.piece img, .product-photo img { display: block; width: 100%; object-fit: cover; object-position: var(--photo-position); }
.product-grid .piece img, .product-photo img { border-radius: 12px; }
.rail .piece { height: 100%; overflow: hidden; background: var(--dark); }
.rail li + li .piece { box-shadow: -1px 0 #fff5e388, -11px 0 18px -6px #170c08ed; }
.rail .piece img { height: 100%; border-radius: 0; }
.page-detail {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none;
  clip-path: inset(0 0 0 100%); transition: clip-path .32s cubic-bezier(.2,.65,.3,1);
}
.page-detail::after {
  content: ""; position: absolute; inset: 0 37% 0 auto; width: 1px;
  background: #fff5e8; box-shadow: -3px 0 8px #1d120e80;
}
.page-detail img, .product-photo--detail img { transform: scale(2.35); transform-origin: var(--detail-position); }
.rail .piece:focus-visible { outline: solid 3px var(--light); outline-offset: -6px; }
.piece-copy { display: grid; gap: 4px; }
.rail .piece-copy {
  position: absolute; inset: auto 0 0; pointer-events: none;
  padding: 13px 33px 15px clamp(10px, 1.3vw, 21px);
  color: var(--ink); background: var(--light); border-top: 1px solid var(--rule);
  opacity: 0; transform: translateY(8px); transition: opacity .2s ease, transform .24s ease;
}
.rail li:has(.piece:is(:focus-visible, [data-touch-preview])) { z-index: 2; }
.rail .piece:is(:focus-visible, [data-touch-preview]) { --reveal: 1; }
.rail .piece .piece-copy {
  opacity: var(--reveal, 0);
  transform: translateY(calc(8px * (1 - var(--reveal, 0))));
}
.rail .piece .page-detail { clip-path: inset(0 0 0 calc(100% - 37% * var(--reveal, 0))); }
@media (any-hover: hover) and (any-pointer: fine) {
  .rail:not([data-touch]) li:hover { z-index: 1; }
  .rail:not([data-touch]) .piece:hover { --reveal: 1; }
}
.piece-name { font-size: clamp(19px, 2.1vw, 32px); font-weight: 560; line-height: 1.1; letter-spacing: -.04em; overflow-wrap: anywhere; }
.piece-meta { font-size: 13px; color: #674f43; }
.piece-price { font-size: 16px; font-weight: 600; color: var(--wine); }
.piece-stock { font-size: 13px; color: #674f43; }
.detail-price { margin: 16px 0 4px; font-size: 24px; font-weight: 600; color: var(--wine); }
.inventory-note { margin-bottom: 18px; font-size: 12px; color: #674f43; }
.piece-action { position: absolute; inset: 13px 13px auto auto; font-size: 18px; color: var(--wine); }

.collection-bar {
  position: relative; display: flex; justify-content: center; align-items: center;
  min-height: var(--bar-height); padding: 0 var(--gutter);
  border-bottom: 1px solid var(--rule); background: var(--paper);
}
.filters { display: flex; justify-content: center; align-items: center; gap: clamp(13px, 3vw, 46px); }
.filters button, .photo-controls button { padding: 0; min-height: 44px; border: 0; background: transparent; font: 500 13px/1 var(--sans); }
.filters button[aria-pressed="true"], .photo-controls button[aria-pressed="true"] { text-decoration: underline; text-underline-offset: 6px; }
.rail-controls { position: absolute; inset-inline-end: var(--gutter); display: flex; }
.rail-controls button { width: 44px; height: 44px; background: none; border: 0; font-size: 21px; }
.rail-controls button:disabled { opacity: .32; }

#shop { padding: clamp(28px, 4.5vw, 70px) var(--gutter); }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; margin-bottom: clamp(16px, 2.2vw, 32px); }
.section-heading h2 { font-size: clamp(33px, 5.3vw, 76px); font-weight: 560; line-height: 1; letter-spacing: -.06em; }
.full-shop-link { color: #71372b; font-size: 14px; font-weight: 600; white-space: nowrap; text-underline-offset: 4px; }
.product-grid { display: grid; grid-template-columns: repeat(var(--columns), minmax(0, 1fr)); gap: clamp(20px, 3vw, 44px) clamp(6px, 1vw, 14px); }
.product-grid .piece img { aspect-ratio: 4/5; background: #e6dbcf; }
.product-grid .piece-copy { padding: 12px 0 2px; }
.product-grid .piece-name { font-size: clamp(16px, 1.8vw, 26px); }
.product-grid .piece:hover .piece-name { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
footer { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 25px; padding: 25px var(--gutter); border-top: 1px solid #614c3c4d; }
footer > a:first-child { font-size: 18px; font-weight: 560; letter-spacing: -.035em; }

dialog { border: 0; color: var(--ink); background: var(--light); padding: 0; width: min(calc(100% - 36px), 1240px); max-height: calc(100dvh - 36px); }
dialog::backdrop { background: #160f0dc7; }
dialog .close { position: absolute; z-index: 1; top: 10px; right: 10px; height: 44px; width: 44px; border: 1px solid #6f5053; color: var(--ink); background: var(--light); font-size: 28px; }
.product-layout { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); }
.product-visual { min-width: 0; background: #e8ddcf; align-self: start; }
.product-photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; }
.product-photo { position: relative; height: clamp(325px, 48vw, 560px); overflow: hidden; background: var(--dark); }
.product-photo img { height: 100%; }
.product-photo--whole img { object-fit: contain; object-position: center; }
.product-photo figcaption {
  position: absolute; inset: auto auto 12px 12px;
  padding: 5px 8px; color: var(--ink); background: var(--light); font-size: 12px;
}
.photo-controls { display: none; }
.product-info { align-self: center; padding: 57px clamp(23px, 3.3vw, 55px) 35px; }
.material { margin-bottom: 12px; color: #6a4d45; }
.product-info h2 { font-size: clamp(33px, 3.9vw, 58px); font-weight: 560; line-height: 1; letter-spacing: -.058em; }
.description { margin: 16px 0; max-width: 38ch; }
.product-info dl { margin: 0 0 17px; font-size: 14px; }
.product-info dl div { display: flex; gap: 10px; }
.product-info dt { font-weight: 650; }
.primary {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  width: 100%; min-height: 50px; padding: 10px 15px; border: 1px solid var(--wine);
  background: var(--wine); color: var(--light); text-decoration: none; text-align: left;
}
.primary:hover { background: #6a3037; }
.primary:focus-visible { outline-color: var(--wine); }
.purchase-note { margin-top: 9px; color: #634d44; font-size: 13px; }

@media (max-width: 1050px) {
  :root { --columns: 4; }
}

@media (max-width: 720px) {
  :root { --nav-height: 61px; --bar-height: 53px; --columns: 3; }
  .wordmark { font-size: clamp(14px, 3.8vw, 22px); }
  .masthead nav { gap: clamp(9px, 3vw, 18px); }
  .masthead nav :is(a, button) { font-size: clamp(12px, 3.2vw, 14px); }
  .rail { height: clamp(175px, 53vw, 340px); }
  .rail .piece-copy { padding: 8px 7px; }
  .rail .piece-name { font-size: clamp(13px, 3.9vw, 25px); }
  .piece-meta { font-size: 11px; line-height: 1.25; }
  .rail .piece-action { display: none; }
  .collection-bar { justify-content: space-between; gap: 4px; padding: 0 10px; }
  .rail-controls { position: static; flex-shrink: 0; }
  .filters { gap: clamp(6px, 2vw, 16px); }
  .filters button { font-size: clamp(11px, 2.9vw, 13px); white-space: nowrap; }
  .rail-controls button { width: 39px; }
  .product-grid .piece-copy { padding: 7px 0 2px; }
  .product-grid .piece-name { font-size: clamp(13px, 3.7vw, 22px); }
  .product-layout { display: block; }
  .product-photos { display: block; }
  .product-photo { height: clamp(210px, 37dvh, 390px); }
  .product-photo figcaption, .product-photos[data-view="detail"] .product-photo--whole,
  .product-photos[data-view="whole"] .product-photo--detail { display: none; }
  .photo-controls { display: flex; justify-content: center; gap: 25px; padding: 4px; }
  .product-info { padding: 20px 18px 25px; }
  .product-info h2 { font-size: clamp(32px, 8vw, 48px); }
  .product-info .material { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
