:root {
  --navy: #26323e;
  --navy-deep: #151d27;
  --copper: #d79762;
  --copper-deep: #a8683a;
  --copper-pale: #f0c9a4;
  --paper: #f4e7cf;
  --paper-edge: #e3cfa9;
  --ink: #2b2118;
  --ink-soft: #5d4a3a;
  --wood: #4a2f1c;
  --danger: #9b2c1f;
  --display: 'Rye', 'Old Standard TT', Georgia, serif;
  --serif: 'Old Standard TT', Georgia, 'Times New Roman', serif;
  --map-url: url('/assets/map.webp');
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--navy-deep);
  color: var(--paper);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
}

body.no-scroll { overflow: hidden; }

/* The map: fixed behind everything, never scrolls. A fixed element (not
   background-attachment) so it also holds still on iOS Safari. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--navy-deep);
  background-image:
    radial-gradient(ellipse at 50% 35%, rgba(21, 29, 39, 0) 0%, rgba(21, 29, 39, .35) 55%, rgba(10, 14, 20, .85) 100%),
    var(--map-url);
  background-size: cover, cover;
  background-position: center, center;
}

.backdrop::after {
  /* faint paper grain so the map reads as printed, not on-screen */
  content: '';
  position: absolute;
  inset: 0;
  opacity: .18;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--copper); }
a:hover { color: var(--copper-pale); }

img { max-width: 100%; display: block; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

:focus-visible { outline: 3px solid var(--copper); outline-offset: 3px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ---------------------------------------------------------------- header */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 0;
  max-width: 1120px;
  margin: 0 auto;
}

.topbar .home-link img { width: 64px; height: 64px; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .55)); }

.cart-tag, .back-tag {
  margin-left: auto;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 9px 22px;
  font: 700 15px/1 var(--serif);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink);
  background: linear-gradient(180deg, #f7ebd5, #e8d3ad);
  border: 1px solid #c9ad80;
  border-radius: 4px 14px 14px 4px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .45);
  cursor: pointer;
}

.cart-tag::before, .back-tag::before {
  /* the tag's punched hole */
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border-radius: 50%;
  background: var(--navy-deep);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6);
}

/* Back: the cart tag mirrored, rounded end outward (left), hole on the inner side. */
.back-tag {
  margin-left: 0;
  padding: 9px 22px 9px 16px;
  border-radius: 14px 4px 4px 14px;
  text-decoration: none;
}
.back-tag:hover { color: var(--ink); }
.back-tag::before { left: auto; right: 8px; }

.cart-tag .count {
  min-width: 22px;
  padding: 3px 6px;
  border-radius: 11px;
  background: var(--navy);
  color: var(--copper-pale);
  font-size: 13px;
  text-align: center;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 8px 16px 0;
}

.hero .logo {
  width: min(300px, 62vw);
  height: auto;
  aspect-ratio: 1;
  filter: drop-shadow(0 14px 28px rgba(0, 0, 0, .6));
}

.tagline {
  margin: 14px 0 0;
  font-style: italic;
  font-size: 20px;
  color: var(--copper-pale);
  text-shadow: 0 2px 8px rgba(0, 0, 0, .8);
}

/* ---------------------------------------------------------------- barrels */

.barrels {
  list-style: none;
  margin: 28px auto 0;
  padding: 0 16px 48px;
  max-width: 1120px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px 24px;
}

/* flex, not grid, so a short last row of barrels sits centered */
.barrels > li { flex: 0 1 calc((100% - 48px) / 3); min-width: 0; }

@media (max-width: 820px) {
  .barrels { gap: 22px 14px; }
  .barrels > li { flex-basis: calc((100% - 14px) / 2); }
}
@media (max-width: 420px) {
  .barrels { max-width: 340px; }
  .barrels > li { flex-basis: 100%; }
}

.barrel {
  position: relative;
  display: block;
  aspect-ratio: 391 / 403;
  text-decoration: none;
  transition: transform .25s ease;
}

.barrel .tub {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, .7));
}

.barrel .sign {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 104%;
  transform: translate(-50%, -48%) rotate(-2deg);
  aspect-ratio: 1234 / 626;
  transform-origin: 50% 0;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, .65));
  transition: transform .35s ease;
}

.barrel:hover, .barrel:focus-visible { transform: translateY(-6px); }
.barrel:hover .sign, .barrel:focus-visible .sign { transform: translate(-50%, -48%) rotate(1.5deg); }

/* Sign contents: a lettered SVG board (js/sign.js) or an uploaded image. */
.sign-svg, .sign-img { display: block; width: 100%; height: auto; }
.sign-svg { aspect-ratio: 1234 / 626; overflow: visible; }

.empty-shelf {
  margin: 40px auto;
  max-width: 460px;
  text-align: center;
}

/* ---------------------------------------------------------------- paper */

.paper {
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, .45), transparent 70%),
    radial-gradient(ellipse at 50% 100%, rgba(150, 110, 60, .14), transparent 70%);
  border: 1px solid var(--paper-edge);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
}

.paper a { color: var(--copper-deep); }
.muted { color: var(--ink-soft); }

/* ---------------------------------------------------------------- category */

.cat-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 16px 0;
  text-align: center;
}

.cat-head .sign-big { width: min(560px, 92vw); aspect-ratio: 1234 / 626; filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .7)); }
.cat-head .blurb { max-width: 640px; margin: 18px auto 0; padding: 14px 20px; font-size: 18px; }

.grid {
  list-style: none;
  margin: 28px auto 0;
  padding: 0 16px 56px;
  max-width: 1120px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 22px;
}

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.card .pic {
  display: block;
  aspect-ratio: 1;
  background: #efe0c3;
  border-bottom: 1px solid var(--paper-edge);
  position: relative;
}

.card .pic img { width: 100%; height: 100%; object-fit: cover; }

.ribbon {
  position: absolute;
  top: 12px;
  left: -4px;
  padding: 4px 12px;
  background: var(--danger);
  color: #fff;
  font: 700 12px/1.2 var(--serif);
  letter-spacing: .1em;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}

.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card h3 { margin: 0; font-size: 19px; line-height: 1.25; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.card .desc {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .row { margin-top: auto; padding-top: 8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.price { font-weight: 700; font-size: 20px; color: var(--copper-deep); }

.no-photo {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  font-family: var(--display);
  font-size: 22px;
  color: rgba(74, 47, 28, .45);
}

/* ---------------------------------------------------------------- product */

.product {
  max-width: 1080px;
  margin: 22px auto 56px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 26px;
  align-items: start;
}

@media (max-width: 780px) { .product { grid-template-columns: minmax(0, 1fr); } }

.gallery { padding: 12px; }
.gallery .main { aspect-ratio: 1; background: #efe0c3; border-radius: 4px; overflow: hidden; }
.gallery .main img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumbs button {
  width: 68px; height: 68px; padding: 0; border: 2px solid transparent; border-radius: 4px;
  background: #efe0c3; cursor: pointer; overflow: hidden;
}
.thumbs button[aria-current='true'] { border-color: var(--copper-deep); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }

.info { padding: 22px 24px 26px; }
.info .crumb { font-size: 14px; text-transform: uppercase; letter-spacing: .1em; }
.info h1 { margin: 6px 0 6px; font-size: clamp(26px, 4vw, 36px); line-height: 1.15; }
.info .price { font-size: 26px; }
.info .description { margin: 16px 0 20px; white-space: pre-line; }
.buy { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.qty { display: inline-flex; align-items: center; border: 1px solid #c9ad80; border-radius: 4px; background: #fbf4e6; }
.qty button { width: 40px; height: 44px; border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--ink); }
.qty output { min-width: 34px; text-align: center; font-weight: 700; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border-radius: 4px;
  border: 1px solid transparent;
  font: 700 15px/1.1 var(--serif);
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(180deg, #2f3d4b, var(--navy));
  color: var(--copper-pale);
  border-color: #1a232d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 3px 8px rgba(0, 0, 0, .25);
}
.btn-primary:hover { background: var(--navy); color: #fff; }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.btn-small { min-height: 38px; padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; }

.btn-ghost { background: transparent; border-color: currentColor; color: var(--copper-pale); }

.back {
  display: inline-block;
  margin: 18px 0 0;
  color: var(--copper-pale);
  text-decoration: none;
  font-size: 15px;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .8);
}

/* ---------------------------------------------------------------- cart drawer */

.cart-shade {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(8, 11, 16, .6);
  display: flex;
  justify-content: flex-end;
}

.cart {
  width: min(420px, 100%);
  height: 100%;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  animation: slide .22s ease-out;
}

@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cart { animation: none; } .barrel, .barrel .sign { transition: none; } }

.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--paper-edge); }
.cart-head h2 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 26px; color: var(--wood); }
.icon-btn { width: 44px; height: 44px; border: 0; background: none; font-size: 30px; line-height: 1; cursor: pointer; color: var(--ink); }

.cart-body { flex: 1; overflow-y: auto; padding: 8px 18px; }
.cart-empty { text-align: center; color: var(--ink-soft); margin: 40px 0; }
.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-line { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; padding: 14px 0; border-bottom: 1px dashed var(--paper-edge); align-items: start; }
.cart-line .thumb { width: 64px; height: 64px; border-radius: 4px; background: #efe0c3; overflow: hidden; }
.cart-line .thumb img { width: 100%; height: 100%; object-fit: cover; }
.cart-info { display: flex; flex-direction: column; gap: 2px; font-size: 15px; }
.cart-info a { color: var(--ink); font-weight: 700; text-decoration: none; }
.stepper { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.stepper button:not(.link) { width: 30px; height: 30px; border: 1px solid #c9ad80; border-radius: 4px; background: #fbf4e6; cursor: pointer; font-size: 16px; }
.link { border: 0; background: none; padding: 0 4px; color: var(--copper-deep); text-decoration: underline; cursor: pointer; font: inherit; font-size: 14px; }
.line-total { font-size: 15px; }

.cart-foot { padding: 16px 18px 22px; border-top: 1px solid var(--paper-edge); }
.cart-foot:empty { display: none; }
.sum { display: flex; justify-content: space-between; margin-bottom: 6px; }
.cart-error { color: var(--danger); font-size: 15px; margin: 8px 0; }
.cart-foot .btn { margin-top: 10px; }
.fine { margin: 10px 0 0; font-size: 13px; color: var(--ink-soft); text-align: center; }

/* ---------------------------------------------------------------- misc */

.notice { max-width: 560px; margin: 40px auto; padding: 28px 26px; text-align: center; }
.notice h1 { font-family: var(--display); font-weight: 400; color: var(--wood); margin: 0 0 10px; font-size: 32px; }

.site-foot {
  padding: 26px 16px 34px;
  text-align: center;
  font-size: 14px;
  color: rgba(244, 231, 207, .8);
  text-shadow: 0 1px 4px rgba(0, 0, 0, .9);
}
.site-foot p { margin: 4px 0; }
.site-foot .credit { font-size: 12px; opacity: .8; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 60;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 20px;
  border-radius: 4px;
  background: var(--navy);
  color: var(--copper-pale);
  border: 1px solid var(--copper-deep);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .5);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.skeleton { min-height: 40vh; }
