/* ============================================================
   JK WOODSHOP AND CRAFTS — storefront stylesheet
   Design language: "spec-sheet meets sawdust"
   Dark theme, mobile-first. Design tokens below; docs/ has the runbooks.
   ============================================================ */

:root {
  --ink:       #191714;
  --surface:   #242019;
  --surface-2: #2E2921;
  --line:      #3D362B;
  --bone:      #F2EDE3;
  --dust:      #A99E8C;
  --ember:     #E8622C;
  --ember-hot: #FF7A3D;
  --oak:       #C68A4E;
  --steel:     #7A8B99;
  --ok:        #7BA05B;

  --font-display: "Big Shoulders Display", "Big Shoulders", Impact, "Arial Narrow", sans-serif;
  --font-body: "Barlow", "Segoe UI", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", Consolas, monospace;

  --chamfer: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
  --chamfer-sm: polygon(0 0, calc(100% - 9px) 0, 100% 9px, 100% 100%, 0 100%);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--ink);
  /* blueprint grid */
  background-image:
    repeating-linear-gradient(0deg,   rgba(61,54,43,0.08) 0 1px, transparent 1px 24px),
    repeating-linear-gradient(90deg,  rgba(61,54,43,0.08) 0 1px, transparent 1px 24px);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ---------- type ---------- */
h1, h2, h3, .display {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.01em;
  line-height: 1.05;
  font-weight: 800;
}
h1 { font-size: 34px; }
h2 { font-size: 24px; }
h3 { font-size: 18px; }

.label-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dust);
}

@media (min-width: 900px) {
  h1 { font-size: 56px; }
  h2 { font-size: 32px; }
  h3 { font-size: 22px; }
  body { font-size: 17px; }
  .label-mono { font-size: 12px; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  text-decoration: none;
  text-align: center;
  border: none;
  cursor: pointer;
  padding: 13px 26px;
  clip-path: var(--chamfer-sm);
  transition: background-color 150ms ease, color 150ms ease;
}
.btn-primary { background: var(--ember); color: var(--ink); }
.btn-primary:hover { background: var(--ember-hot); }
.btn-ghost {
  background: transparent;
  color: var(--bone);
  box-shadow: inset 0 0 0 1px var(--line);
  clip-path: none;
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--dust); color: var(--bone); }
.btn-block { display: block; width: 100%; }
.btn[disabled] { background: var(--surface-2); color: var(--steel); cursor: not-allowed; }

:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }

/* ---------- hazard stripe (used exactly twice sitewide) ---------- */
.hazard {
  height: 6px;
  background: repeating-linear-gradient(
    45deg,
    var(--ember) 0 10px,
    var(--ink) 10px 20px
  );
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.header-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  row-gap: 2px;
  padding: 12px 0 10px;
}
.header-bar .wordmark { grid-column: 1; grid-row: 1; }
.header-bar .cart-btn { grid-column: 2; grid-row: 1; justify-self: end; }
.header-bar .site-nav { grid-column: 1 / -1; grid-row: 2; }
.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--bone);
  text-decoration: none;
  position: relative;
  padding-bottom: 6px;
}
.wordmark::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 42px; height: 4px;
  background: var(--ember);
}
.site-nav { display: flex; gap: 20px; padding: 6px 0 10px; }
.site-nav a {
  text-decoration: none;
  color: var(--dust);
  font-weight: 500;
  font-size: 15px;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--bone); }
.site-nav a[aria-current="page"] { border-bottom: 2px solid var(--ember); padding-bottom: 2px; }

.cart-btn {
  position: relative;
  background: none;
  border: 1px solid var(--line);
  color: var(--bone);
  padding: 8px 12px;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
}
.cart-btn:hover { border-color: var(--dust); }
.cart-count {
  display: inline-block;
  min-width: 20px;
  padding: 1px 5px;
  margin-left: 6px;
  background: var(--ember);
  color: var(--ink);
  font-weight: 700;
  text-align: center;
}
.cart-count.pop { animation: pop 300ms ease; }
@keyframes pop { 50% { transform: scale(1.35); } }

@media (min-width: 720px) {
  .header-bar {
    display: flex;
    align-items: center;
    gap: 36px;
    padding: 14px 0;
  }
  .header-bar .site-nav { margin-left: auto; padding: 0; }
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.hero-inner {
  position: relative;
  z-index: 1;
  padding: 56px 0 48px;
  max-width: 640px;
}
.hero .sub {
  color: var(--dust);
  font-size: 17px;
  margin: 16px 0 28px;
  max-width: 46ch;
}
.hero-art {
  position: absolute;
  right: -60px;
  top: 50%;
  transform: translateY(-50%);
  width: 420px;
  opacity: 0.10;
  pointer-events: none;
}
@media (min-width: 900px) {
  .hero-inner { padding: 96px 0 88px; }
  .hero-art { width: 560px; right: 0; }
}

/* ---------- sections ---------- */
.section { padding: 40px 0; }
.section + .section { border-top: 1px dashed var(--line); }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.section-head .label-mono { white-space: nowrap; }

/* ---------- category tiles ---------- */
.cat-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.cat-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  clip-path: var(--chamfer-sm);
  padding: 18px 16px;
  text-decoration: none;
  transition: border-color 150ms ease;
}
.cat-tile:hover { border-color: var(--dust); }
.cat-tile svg { width: 44px; height: 44px; }
.cat-tile .cat-name { font-weight: 600; font-size: 15px; }
.cat-tile .cat-count { font-family: var(--font-mono); font-size: 11px; color: var(--dust); letter-spacing: 0.1em; }
.cat-tile-wide { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .cat-tiles { grid-template-columns: repeat(6, 1fr); }
  .cat-tile-wide { grid-column: auto; }
}

/* ---------- product grid & cards ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (min-width: 720px)  { .grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, 1fr); } }

/* horizontal scroll-snap strip (featured, related) */
.strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 72%;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 8px;
  scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }
.strip > * { scroll-snap-align: start; }
@media (min-width: 720px) {
  .strip { grid-auto-flow: row; grid-template-columns: repeat(4, 1fr); gap: 16px; overflow: visible; }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: transform 200ms ease, border-color 200ms ease;
}
.card-img {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  clip-path: var(--chamfer-sm);
  overflow: hidden;
}
.card-img svg, .card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 200ms ease;
}
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.card-cat { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dust); }
.card-name {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  color: var(--bone);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
}
.card-price { font-weight: 600; font-size: 16px; color: var(--ember); }
.card-compare { color: var(--dust); text-decoration: line-through; font-weight: 400; font-size: 13px; margin-right: 6px; }
.quick-add {
  background: none;
  border: 1px solid var(--line);
  color: var(--bone);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
}
.quick-add:hover { border-color: var(--ember); color: var(--ember); }
.card-mto {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.1em;
  color: var(--oak); text-transform: uppercase; padding-top: 4px;
}

@media (hover: hover) {
  .card:hover { transform: translateY(-2px); border-color: var(--dust); }
  .card:hover .card-img svg, .card:hover .card-img img { transform: scale(1.03); }
}
@media (min-width: 900px) { .card-name { font-size: 16px; } }

/* sold out */
.card.sold-out .card-img { opacity: 0.55; filter: grayscale(60%); }
.badge-soldout {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--steel);
  background: var(--ink);
  border: 1px solid var(--steel);
  padding: 3px 7px;
}
.card.sold-out .quick-add { display: none; }
.soldout-text { font-family: var(--font-mono); font-size: 11px; color: var(--steel); letter-spacing: 0.1em; }

/* ---------- filter chips ---------- */
.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding: 4px 0 14px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  scroll-snap-align: start;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--dust);
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { border-color: var(--dust); color: var(--bone); }
.chip.active { background: var(--ember); border-color: var(--ember); color: var(--ink); font-weight: 600; }

/* ---------- product detail ---------- */
.pd { display: grid; gap: 24px; padding: 24px 0 40px; }
.pd-img {
  aspect-ratio: 1 / 1;
  background: var(--surface-2);
  clip-path: var(--chamfer);
  overflow: hidden;
}
.pd-img svg, .pd-img img { width: 100%; height: 100%; object-fit: cover; }
.pd-buy { display: flex; flex-direction: column; gap: 14px; }
.pd-price { font-size: 26px; font-weight: 600; color: var(--ember); }
.pd-price .card-compare { font-size: 17px; }
.pd-desc { color: var(--bone); max-width: 60ch; }
.pd select {
  background: var(--surface-2);
  color: var(--bone);
  border: 1px solid var(--line);
  padding: 12px;
  font-family: var(--font-body);
  font-size: 15px;
  width: 100%;
}
.mto-note { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; color: var(--oak); text-transform: uppercase; }
@media (min-width: 900px) {
  .pd { grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; padding-top: 40px; }
}

.spec-table { border-top: 1px dashed var(--line); margin-top: 8px; }
.spec-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.spec-key { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dust); padding-top: 2px; }

/* ---------- cart drawer ---------- */
.scrim {
  position: fixed; inset: 0;
  background: rgba(10, 9, 7, 0.6);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}
.drawer {
  position: fixed;
  z-index: 100;
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  /* mobile: bottom sheet */
  left: 0; right: 0; bottom: 0;
  height: 85vh;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
  transform: translateY(100%);
  transition: transform 250ms ease;
}
body.drawer-open .scrim { opacity: 1; pointer-events: auto; }
body.drawer-open .drawer { transform: translateY(0); }
body.drawer-open { overflow: hidden; }

@media (min-width: 720px) {
  .drawer {
    left: auto; top: 0; bottom: 0; right: 0;
    width: 420px; height: auto;
    border-left: 1px solid var(--line);
    clip-path: none;
    transform: translateX(100%);
  }
  body.drawer-open .drawer { transform: translateX(0); }
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.drawer-close { background: none; border: none; color: var(--dust); font-size: 22px; cursor: pointer; line-height: 1; padding: 4px; }
.drawer-close:hover { color: var(--bone); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.drawer-foot { padding: 16px 20px 20px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }

.cart-line {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}
.cart-line-img { width: 56px; height: 56px; background: var(--surface-2); overflow: hidden; }
.cart-line-img svg { width: 100%; height: 100%; }
.cart-line-name { font-weight: 600; font-size: 14px; }
.cart-line-var { font-size: 12px; color: var(--dust); }
.cart-line-price { font-weight: 600; font-size: 14px; text-align: right; }
.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  margin-top: 6px;
}
.qty-stepper button {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--bone);
  width: 24px; height: 24px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.qty-stepper button:hover { border-color: var(--dust); }
.cart-remove { background: none; border: none; color: var(--dust); cursor: pointer; font-size: 16px; padding: 4px; justify-self: end; }
.cart-remove:hover { color: var(--ember); }

.subtotal-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 4px;
}
.subtotal-row .amount { color: var(--ember); font-weight: 600; font-size: 20px; }

.notice-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 0 0 14px;
  font-size: 14px;
  color: var(--dust);
}
.notice-card .hazard { margin-bottom: 12px; }
.notice-card .inner { padding: 0 14px; }
.notice-card strong { color: var(--bone); }

.cart-empty { text-align: center; padding: 40px 0; color: var(--dust); }
.cart-empty svg { width: 90px; margin: 0 auto 16px; opacity: 0.6; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translate(-50%, 200%);
  z-index: 120;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--bone);
  font-size: 14px;
  font-weight: 500;
  padding: 12px 18px;
  display: flex;
  gap: 14px;
  align-items: center;
  transition: transform 250ms ease;
  white-space: nowrap;
}
.toast.show { transform: translate(-50%, 0); }
.toast .ok { color: var(--ok); }
.toast a, .toast button {
  color: var(--ember); background: none; border: none;
  font-weight: 600; cursor: pointer; text-decoration: none; font-size: 14px;
}

/* ---------- about / contact ---------- */
.prose { max-width: 62ch; color: var(--bone); display: flex; flex-direction: column; gap: 14px; }
.prose .oak { color: var(--oak); }

.blurb-grid { display: grid; gap: 14px; margin-top: 20px; }
@media (min-width: 720px) { .blurb-grid { grid-template-columns: repeat(3, 1fr); } }
.blurb {
  background: var(--surface);
  border: 1px solid var(--line);
  clip-path: var(--chamfer-sm);
  padding: 18px 16px;
}
.blurb .label-mono { color: var(--oak); display: block; margin-bottom: 8px; }
.blurb p { font-size: 14px; color: var(--dust); }

.contact-btns { display: grid; gap: 12px; margin: 24px 0 8px; max-width: 480px; }
@media (min-width: 720px) {
  .about-grid { grid-template-columns: 1fr auto; align-items: center; }
}
.faq { max-width: 720px; margin-top: 12px; }
.faq details { border-bottom: 1px dashed var(--line); }
.faq summary {
  cursor: pointer;
  padding: 16px 0;
  font-weight: 600;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--font-mono); color: var(--ember); font-size: 18px; flex: none; }
.faq details[open] summary::after { content: "–"; }
.faq .faq-a { padding: 0 0 16px; color: var(--dust); max-width: 60ch; }

/* ---------- empty / 404 states ---------- */
.empty-state { text-align: center; padding: 48px 16px; color: var(--dust); }
.empty-state svg { width: 110px; margin: 0 auto 18px; opacity: 0.6; }
.empty-state h3 { color: var(--bone); margin-bottom: 8px; }

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  margin-top: 48px;
  padding: 32px 0 40px;
}
.footer-grid { display: flex; flex-direction: column; gap: 18px; }
.site-footer .wordmark { font-size: 18px; }
.site-footer .tag { color: var(--dust); font-size: 14px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-links a { color: var(--dust); text-decoration: none; font-size: 14px; }
.footer-links a:hover { color: var(--bone); }
.footer-note { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; color: var(--dust); text-transform: uppercase; }
@media (min-width: 720px) {
  .footer-grid { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ---------- utility ---------- */
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}

/* ---------- contact form embed ---------- */
.form-embed { background: var(--bone); border: 1px solid var(--line); }
.form-embed iframe { width: 100%; height: 920px; border: 0; display: block; }
