/* Hancock Mercantile — storefront design system (Direction B: Shelf)
   Adapted from the Claude Design project "ecomm site" (Hancock Mercantile.html).
   Server-rendered adaptation: document scroll (no 100vh scroll container),
   SPA-only pieces (tweaks panel, marquee, cart drawer) omitted. */

:root {
  --brand-olive: #747452;
  --brand-gold:  #E8B84B;
  --ivory:      #F4EFE6;
  --ivory-2:    #EDE7DA;
  --cream:      #F8F4EB;
  --ink:        #1C1A17;
  --ink-2:      #2A2722;
  --ink-soft:   #5A5348;
  --line:       #D9D1C0;
  --line-soft:  #E6DFCE;
  --olive:       #747452;
  --olive-deep:  #5C5940;
  --olive-light: #9A9770;
  --paper:      var(--ivory);

  --bg: var(--cream);
  --fg: var(--ink);

  --serif: "Instrument Serif", "Cormorant Garamond", Georgia, serif;
  --sans:  "Geist", "Söhne", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, Menlo, monospace;

  --pad-x: clamp(24px, 5vw, 88px);
}

/* Direction B is the shipped storefront direction. */
.dir-b { --bg: var(--cream); --fg: var(--ink); --paper: var(--cream); }

body.dir-b {
  font-family: var(--sans);
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "ss02";
  margin: 0;
}

.dir-b button { font: inherit; cursor: pointer; }
.dir-b button:not(.hm-btn) { color: inherit; background: none; border: 0; padding: 0; }
.dir-b input, .dir-b select { font: inherit; color: inherit; }

/* ---------- Monospace label ---------- */
.hm-mono {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  color: var(--ink-soft);
}
.hm-rule { height: 1px; background: var(--line); width: 100%; }

/* ---------- Placeholder (no-image fallback) ---------- */
.hm-ph {
  position: relative;
  width: 100%;
  overflow: hidden;
  display: block;
}
.hm-ph-stripes { position: absolute; inset: 0; opacity: 0.8; }
.hm-ph-label {
  position: absolute;
  bottom: 10px; left: 10px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  background: rgba(255, 253, 247, 0.82);
  backdrop-filter: blur(3px);
  color: inherit;
  border-radius: 2px;
  max-width: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hm-ph-dot { width: 5px; height: 5px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ---------- Buttons ---------- */
.hm-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: all 180ms ease;
  border: 1px solid transparent;
  line-height: 1;
  white-space: nowrap;
}
.hm-btn-dark { background: var(--ink); color: var(--ivory); }
.hm-btn-dark:hover { background: var(--ink-2); transform: translateY(-1px); }
.hm-btn-primary { background: var(--ink); color: var(--ivory); }
.hm-btn-ghost { background: transparent; border-color: var(--ink); color: var(--ink); }
.hm-btn-ghost:hover { background: var(--ink); color: var(--ivory); }
.hm-btn-block { width: 100%; justify-content: center; }
.hm-btn-lg { padding: 18px 28px; font-size: 15px; flex: 1; justify-content: center; }
.hm-btn.is-added { background: var(--olive); }

.hm-link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  background: none;
  border: 0;
  border-bottom: 1px solid currentColor;
  padding: 0 0 3px 0;
  cursor: pointer;
  transition: gap 160ms ease;
}
.hm-link-arrow:hover { gap: 16px; color: var(--olive); }

/* ---------- Nav ---------- */
.hm-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
}
.hm-nav-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 18px var(--pad-x);
  gap: 24px;
}
.hm-nav-left { display: flex; gap: 28px; justify-self: start; }
.hm-nav-right { display: flex; gap: 20px; justify-self: end; align-items: center; }
.hm-nav-link {
  font-size: 13.5px;
  letter-spacing: -0.005em;
  color: var(--ink);
  position: relative;
  padding: 4px 0;
}
.hm-nav-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px; background: var(--olive);
  transform: scaleX(0); transform-origin: left;
  transition: transform 200ms ease;
}
.hm-nav-link:hover { color: var(--olive); }
.hm-nav-link:hover::after { transform: scaleX(1); }
.hm-cart-btn { display: inline-flex; align-items: center; gap: 8px; }
.hm-cart-count { margin-left: 4px; color: var(--ink-soft); }
.hm-nav-rule { height: 1px; background: var(--line-soft); margin: 0 var(--pad-x); }
.hm-logo { text-align: center; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Display type (Direction B) ---------- */
.hm-display-b {
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(48px, 7vw, 96px);
  line-height: 0.98;
  letter-spacing: -0.035em;
  margin: 20px 0 28px;
}
.hm-display-sm-b {
  font-family: var(--sans);
  font-weight: 500;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.04;
  letter-spacing: -0.03em;
  margin: 12px 0 0;
}

/* ================== HOME B ================== */
.hm-hero-b {
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 88vh;
  gap: 0;
  align-items: stretch;
}
.hm-hero-b-inner { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; padding: 72px var(--pad-x) 80px; }
.hm-lede-b { font-size: 17px; line-height: 1.55; color: var(--ink-soft); max-width: 40ch; margin: 0 0 36px; }
.hm-hero-b-ctas { display: flex; gap: 12px; flex-wrap: wrap; }
.hm-hero-b-imggrid { position: relative; overflow: hidden; display: block; height: 100%; min-height: 560px; }
.hm-hero-b-imggrid > .hm-ph, .hm-hero-b-imggrid > img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; aspect-ratio: unset;
}

.hm-cats-b { padding: 72px var(--pad-x); border-top: 1px solid var(--line); }
.hm-cats-b-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 32px; gap: 16px; flex-wrap: wrap; }
.hm-cats-b-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.hm-cat-tile { position: relative; display: flex; flex-direction: column; cursor: pointer; text-align: left; transition: transform 260ms cubic-bezier(.2,.6,.2,1); }
.hm-cat-tile:hover { transform: translateY(-4px); }
.hm-cat-tile-meta { padding: 12px 0 0; display: flex; justify-content: space-between; align-items: flex-start; }
.hm-cat-tile-meta h3 { font-size: 17px; margin: 4px 0 0; letter-spacing: -0.02em; font-weight: 500; }
.hm-cat-count { padding-top: 4px; }

.hm-featured-b { padding: 80px var(--pad-x) 96px; background: #EDE4D2; }
.hm-featured-b-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 32px; flex-wrap: wrap; gap: 16px; }
.hm-featured-b-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px 20px; }
.hm-card-b { display: flex; flex-direction: column; gap: 12px; cursor: pointer; text-align: left; }
.hm-card-b-img { position: relative; overflow: hidden; }
.hm-card-b-img .hm-ph, .hm-card-b-img img { transition: transform 600ms cubic-bezier(.2,.6,.2,1); }
.hm-card-b:hover .hm-ph, .hm-card-b:hover img { transform: scale(1.04); }
.hm-card-b-meta h3 { font-size: 16px; font-weight: 500; margin: 0; letter-spacing: -0.015em; }
.hm-card-b-sub { display: flex; justify-content: space-between; align-items: baseline; margin-top: 4px; font-size: 14px; }

.hm-values-b { padding: 80px var(--pad-x); }
.hm-values-grid { margin-top: 48px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 32px; }
.hm-value h3 { font-size: 18px; font-weight: 500; margin: 14px 0 10px; letter-spacing: -0.015em; }
.hm-value p { font-size: 14.5px; line-height: 1.5; color: var(--ink-soft); margin: 0; }

.hm-story-b {
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(40px, 6vw, 96px);
  padding: 80px var(--pad-x); background: var(--ink); color: var(--ivory); align-items: center;
}
.hm-story-b .hm-mono { color: #C9BE9D; }
.hm-story-b-text h2 { color: var(--ivory); }
.hm-story-b-text p { font-size: 18px; line-height: 1.6; color: #D9CEB3; max-width: 44ch; margin: 24px 0 28px; }
.hm-story-b-img .hm-ph, .hm-story-b-img img { width: 100%; object-fit: cover; }

/* ---------- Tags / badges ---------- */
.hm-card-tag, .hm-card-tag-b {
  position: absolute; top: 12px; left: 12px;
  background: var(--ivory); color: var(--ink);
  padding: 5px 10px; font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.09em; text-transform: uppercase; border-radius: 999px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12);
}
.hm-card-tag.is-limited, .hm-card-tag-b.is-limited { background: var(--olive); color: var(--ivory); }
.hm-card-tag.is-new, .hm-card-tag-b.is-new { background: var(--olive-light); color: var(--ivory); }
.hm-card-tag.is-sold-out { background: #5A5348; color: var(--ivory); }

.hm-card-quick, .hm-prod-quick {
  position: absolute; bottom: 12px; left: 12px; right: 12px;
  background: rgba(28, 26, 23, 0.92); backdrop-filter: blur(4px); color: var(--ivory);
  padding: 12px 14px; font-size: 12.5px; font-weight: 500; letter-spacing: 0.02em;
  border-radius: 999px; display: inline-flex; justify-content: center; align-items: center; gap: 8px;
  opacity: 0; transform: translateY(6px); transition: all 240ms cubic-bezier(.2,.6,.2,1); border: 0;
}
.hm-card-quick input[type=submit], .hm-prod-quick input[type=submit] {
  background: none; border: 0; color: inherit; font: inherit; cursor: pointer;
}
.hm-card-b:hover .hm-card-quick,
.hm-prod-card:hover .hm-prod-quick { opacity: 1; transform: translateY(0); }

/* ================== CATEGORY HERO ================== */
.hm-cat-hero { position: relative; height: clamp(320px, 42vh, 520px); overflow: hidden; display: flex; align-items: flex-end; }
.hm-cat-hero-img { position: absolute; inset: 0; }
.hm-cat-hero-img img, .hm-cat-hero-img .hm-ph { width: 100%; height: 100%; object-fit: cover; }
.hm-cat-hero-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(28,26,23,0.72) 0%, rgba(28,26,23,0.18) 55%, transparent 100%); }
.hm-cat-hero-text { position: relative; z-index: 2; padding: 40px var(--pad-x); color: var(--ivory); max-width: 800px; }
.hm-cat-hero-text .hm-mono { color: rgba(244,239,230,0.7); margin-bottom: 10px; display: block; }
.hm-cat-hero-title { color: var(--ivory) !important; margin: 8px 0 16px; font-size: clamp(48px, 7vw, 88px); }
.hm-cat-hero-desc { font-size: 15px; line-height: 1.55; color: rgba(244,239,230,0.85); max-width: 52ch; margin: 0; }

/* Subcategory / child pills */
.hm-subcat-bar { display: flex; flex-wrap: wrap; gap: 8px; padding: 20px var(--pad-x); border-bottom: 1px solid var(--line); background: #EDE5D3; }
.hm-subcat-pill { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; background: var(--bg); cursor: pointer; transition: all 160ms ease; text-decoration: none; color: var(--ink); }
.hm-subcat-pill:hover { border-color: var(--olive); color: var(--olive); }
.hm-subcat-pill.is-active { background: var(--olive); color: var(--ivory); border-color: var(--olive); }

/* ================== SHOP ================== */
.hm-shop-header { padding: 56px var(--pad-x) 24px; }
.hm-shop-header-inner { max-width: 1080px; }
.hm-shop-lede { font-size: 16px; color: var(--ink-soft); margin: 16px 0 0; max-width: 50ch; }

.hm-shop-toolbar {
  position: sticky; top: 60px; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 16px var(--pad-x); background: var(--bg);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.hm-cat-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.hm-cat-tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; font-size: 13.5px;
  border-radius: 999px; border: 1px solid transparent; transition: all 180ms ease;
  text-decoration: none; color: var(--ink);
}
.hm-cat-tab:hover { border-color: var(--line); }
.hm-cat-tab.is-active { background: var(--olive); color: var(--ivory); }
.hm-cat-tab.is-active .hm-mono { color: #D8CFA8; }

.hm-results-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 56px 36px; padding: 48px var(--pad-x) 96px; }

.hm-prod-card { display: flex; flex-direction: column; gap: 0; cursor: pointer; text-align: left; text-decoration: none; color: inherit; position: relative; }
.hm-prod-card-img { position: relative; overflow: hidden; }
.hm-prod-card-img .hm-ph, .hm-prod-card-img img { transition: transform 600ms cubic-bezier(.2,.6,.2,1); width: 100%; display: block; }
.hm-prod-card:not(.is-sold-out):hover .hm-prod-card-img .hm-ph,
.hm-prod-card:not(.is-sold-out):hover .hm-prod-card-img img { transform: scale(1.04); }
.hm-prod-card-img.is-sold-out .hm-ph, .hm-prod-card-img.is-sold-out img { opacity: 0.5; filter: grayscale(30%); }
.hm-prod-card-meta { padding: 16px 0 0; }
.hm-prod-card-top { display: flex; justify-content: space-between; margin-bottom: 6px; }
.hm-prod-card h3 { font-family: var(--sans); font-weight: 500; font-size: 15px; letter-spacing: -0.015em; line-height: 1.25; margin: 0 0 6px; }
.hm-prod-card-bottom { display: flex; justify-content: space-between; align-items: baseline; }
.hm-prod-origin { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.hm-prod-price { font-size: 14px; font-weight: 500; letter-spacing: -0.01em; }
.hm-prod-sold-out { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); text-decoration: line-through; }

.hm-empty { padding: 80px var(--pad-x); text-align: center; }
.hm-empty p { margin-top: 8px; font-size: 16px; color: var(--ink-soft); }

/* ================== PDP ================== */
.hm-crumbs { padding: 20px var(--pad-x) 0; }
.hm-crumbs a, .hm-crumbs button { text-decoration: none; background: none; border: 0; cursor: pointer; color: inherit; }
.hm-crumbs a:hover { text-decoration: underline; }
.hm-crumb-sep { margin: 0 6px; opacity: 0.5; }

.hm-pdp-top { padding: 32px var(--pad-x) 72px; display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(40px, 6vw, 96px); align-items: start; }
.hm-pdp-gallery { position: sticky; top: 96px; }
.hm-pdp-main { position: relative; }
.hm-pdp-main img, .hm-pdp-main .hm-ph { width: 100%; display: block; }
.hm-pdp-tag { position: absolute; top: 16px; left: 16px; background: var(--ink); color: var(--ivory); padding: 6px 10px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; }
.hm-pdp-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.hm-pdp-thumb { overflow: hidden; }
.hm-pdp-thumb img, .hm-pdp-thumb .hm-ph { width: 100%; display: block; }

.hm-pdp-info { padding-top: 8px; }
.hm-pdp-batch { display: block; margin-bottom: 18px; }
.hm-pdp-name-b { font-family: var(--sans); font-weight: 500; font-size: clamp(34px, 4.2vw, 56px); line-height: 1.04; letter-spacing: -0.03em; margin: 0 0 20px; max-width: 14ch; }
.hm-pdp-price { font-size: 22px; font-weight: 500; display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.hm-pdp-stock { margin-bottom: 20px; }
.hm-badge { display: inline-block; padding: 6px 14px; border-radius: 999px; font-size: 13px; }
.hm-badge-in { background: #E4EADD; color: #43503A; }
.hm-badge-out { background: var(--ivory-2); color: var(--ink-soft); }
.hm-pdp-desc { font-family: var(--sans); font-size: 16px; line-height: 1.6; color: var(--ink-soft); max-width: 44ch; margin: 0 0 28px; }

.hm-pdp-specs { margin: 0 0 32px; border-top: 1px solid var(--line); }
.hm-pdp-specs > div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); margin: 0; }
.hm-pdp-specs dt { margin: 0; }
.hm-pdp-specs dd { margin: 0; font-size: 14.5px; }

.hm-pdp-actions { display: flex; gap: 12px; margin-bottom: 24px; align-items: stretch; }
.hm-qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.hm-qty input { width: 48px; text-align: center; border: 0; background: none; font-weight: 500; }
.hm-qty-lg { padding: 4px; }

.hm-pdp-meta-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-top: 20px; border-top: 1px solid var(--line); }
.hm-pdp-meta-row > div { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }

.hm-pdp-related { padding: 72px var(--pad-x); }
.hm-pdp-related-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 32px; flex-wrap: wrap; gap: 16px; }
.hm-pdp-related-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

/* ================== FOOTER ================== */
.hm-footer { background: var(--ink); color: var(--ivory); padding: 72px var(--pad-x) 24px; margin-top: 40px; }
.hm-footer .hm-mono { color: #C9BE9D; }
.hm-footer-top { display: grid; grid-template-columns: 1.2fr 2fr; gap: 64px; padding-bottom: 64px; }
.hm-footer-brand { display: flex; flex-direction: column; gap: 20px; }
.hm-footer-tag { font-size: 15px; line-height: 1.55; color: #D9CEB3; max-width: 42ch; margin: 0; }
.hm-footer-cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px; }
.hm-footer-cols ul { list-style: none; padding: 0; margin: 18px 0 0; display: flex; flex-direction: column; gap: 10px; }
.hm-footer-cols li a { font-size: 14px; color: #D9CEB3; text-decoration: none; }
.hm-footer-cols li a:hover { color: var(--ivory); }
.hm-footer-bottom { display: flex; justify-content: space-between; padding-top: 24px; border-top: 1px solid #3A3731; flex-wrap: wrap; gap: 12px; }

/* ================== Responsive ================== */
@media (max-width: 960px) {
  .hm-nav-left { display: none; }
  .hm-nav-inner { grid-template-columns: auto 1fr auto; }
  .hm-hero-b, .hm-story-b, .hm-pdp-top { grid-template-columns: 1fr; }
  .hm-hero-b { min-height: auto; }
  .hm-hero-b-inner { padding: 48px var(--pad-x); }
  .hm-hero-b-imggrid { min-height: 300px; }
  .hm-cats-b-grid, .hm-featured-b-grid, .hm-results-grid, .hm-pdp-related-grid, .hm-values-grid { grid-template-columns: repeat(2, 1fr); }
  .hm-footer-top { grid-template-columns: 1fr; gap: 40px; }
  .hm-pdp-gallery { position: static; }
}

/* Content pages (Pages#show) — plain-CSS design system, no Tailwind/@layer dependency */
.hm-page { max-width: 760px; margin: 0 auto; padding: 64px var(--pad-x) 88px; }
.hm-page-title {
  font-family: var(--serif); font-weight: 400; letter-spacing: -0.01em;
  font-size: clamp(34px, 5vw, 52px); line-height: 1.05; color: var(--ink); margin: 0 0 28px;
}
.hm-page-body { font-family: var(--sans); font-size: 17px; line-height: 1.7; color: var(--ink-2); }
.hm-page-body > :first-child { margin-top: 0; }
.hm-page-body h2, .hm-page-body h3 {
  font-family: var(--serif); font-weight: 400; color: var(--ink); line-height: 1.15; margin: 1.8em 0 0.5em;
}
.hm-page-body h2 { font-size: 28px; }
.hm-page-body h3 { font-size: 22px; }
.hm-page-body p { margin: 0 0 1.1em; }
.hm-page-body a { color: var(--olive-deep); text-decoration: underline; text-underline-offset: 2px; }
.hm-page-body a:hover { color: var(--ink); }
.hm-page-body ul, .hm-page-body ol { margin: 0 0 1.1em; padding-left: 1.5em; }
.hm-page-body ul { list-style: disc; }
.hm-page-body ol { list-style: decimal; }
.hm-page-body li { margin: 0.3em 0; }
.hm-page-body blockquote {
  margin: 1.4em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--line);
  color: var(--ink-soft); font-style: italic;
}
.hm-page-body img { max-width: 100%; height: auto; border-radius: 8px; margin: 1.4em 0; }
.hm-page-body strong { font-weight: 600; }
.hm-page-body hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
