/* Facet merch. Monochrome, quiet, no card borders (docs/STYLE_REF.md). */
:root {
  --bg: #000;
  --panel: #0e0e0e;
  --panel-2: #161616;
  --fg: #fff;
  --soft: #f2f2f2;
  --muted: #9a9a9a;
  --dim: #666;
  --line: rgba(255,255,255,0.08);
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --mono: 'DM Mono', ui-monospace, monospace;
  --gutter: clamp(16px, 3vw, 32px);
  --ease: cubic-bezier(.2,.7,.2,1);
}
* { box-sizing: border-box; }
html { background: var(--bg); color-scheme: dark; }
body {
  margin: 0; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg);
  font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
main { flex: 1; outline: none; }

/* ── Header ──────────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding: 0 var(--gutter);
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.wordmark {
  display: block; width: 74px; height: 17px; background: var(--fg);
  -webkit-mask: url(/wordmark.svg) no-repeat left center / contain;
          mask: url(/wordmark.svg) no-repeat left center / contain;
  transform: translateY(2px);
}
.brand-tag { font: italic 400 1.15rem/1 var(--serif); color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.account {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px;
  border-radius: 12px; color: var(--muted); transition: color .2s, background .2s;
}
.account:hover { color: var(--fg); background: var(--panel-2); }
.account img { width: 24px; height: 24px; border-radius: 8px; object-fit: cover; }
.account.has-avatar { padding: 0 7px; }
.bag {
  position: relative; display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 12px; background: var(--panel-2);
  transition: background .2s;
}
.bag:hover { background: #222; }
.bag-count {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 6px;
  background: var(--soft); color: #000; font: 500 10.5px/1 var(--mono);
}
.bag-count[hidden] { display: none; }
.bag.bump { animation: bump .45s var(--ease); }
@keyframes bump { 40% { transform: scale(1.12); } }

/* ── Home: the grid ──────────────────────────────────────────────────────── */
.grid {
  display: grid; gap: 12px; padding: 8px var(--gutter) 48px;
  grid-template-columns: repeat(3, 1fr); grid-auto-rows: minmax(300px, 34vw);
}
.grid.one { grid-template-columns: 1fr; grid-auto-rows: min(78vh, 900px); }
.grid .tile:first-child:not(:only-child) { grid-column: span 2; grid-row: span 2; }
.tile {
  position: relative; overflow: hidden; border-radius: 18px; background: var(--panel);
  opacity: 0; animation: rise .7s var(--ease) forwards;
}
.tile img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  transition: transform .9s var(--ease);
}
.tile:hover img { transform: scale(1.035); }
.label {
  position: absolute; left: 14px; bottom: 14px; right: 14px;
  display: flex; align-items: center; gap: 10px; max-width: max-content;
  padding: 6px 6px 6px 14px; border-radius: 14px;
  background: rgba(0,0,0,0.55); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.label-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.price-chip {
  flex: none; padding: 5px 9px; border-radius: 9px;
  background: var(--soft); color: #000; font: 500 12px/1 var(--mono);
}
.skel { background: linear-gradient(100deg, var(--panel) 40%, #151515 50%, var(--panel) 60%) 0 0 / 300% 100%; animation: shimmer 1.6s linear infinite; opacity: 1; }
@keyframes shimmer { to { background-position: -150% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ── Product ─────────────────────────────────────────────────────────────── */
.product {
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: clamp(20px, 4vw, 56px);
  padding: 8px var(--gutter) 64px; align-items: start;
}
.gallery { display: grid; gap: 10px; }
.stage {
  position: relative; aspect-ratio: 4 / 5; max-height: calc(100dvh - 190px); width: 100%;
  border-radius: 18px; background: var(--panel); overflow: hidden;
}
.stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; } }
.thumbs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.thumbs::-webkit-scrollbar { display: none; }
.thumb {
  flex: none; width: 64px; height: 80px; border-radius: 10px; overflow: hidden;
  background: var(--panel); opacity: .5; transition: opacity .2s;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb:hover, .thumb.on { opacity: 1; }
.buy { position: sticky; top: 88px; display: grid; gap: 22px; }
.buy h1 { margin: 0; font: 400 clamp(2rem, 3.4vw, 2.6rem)/1.05 var(--serif); letter-spacing: -0.01em; }
.buy .price { margin-top: 8px; font: 400 1rem/1 var(--mono); color: var(--soft); }
.opt-label { display: flex; justify-content: space-between; margin-bottom: 10px; font: 400 11px/1 var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.opt-label b { font-weight: 400; color: var(--fg); text-transform: none; letter-spacing: 0; }
.swatches, .sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch {
  width: 32px; height: 32px; border-radius: 10px; padding: 3px;
  box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s;
}
.swatch span { display: block; width: 100%; height: 100%; border-radius: 7px; }
.swatch.on { box-shadow: inset 0 0 0 1.5px var(--soft); }
.size {
  min-width: 46px; height: 38px; padding: 0 12px; border-radius: 11px;
  background: var(--panel-2); color: var(--muted); font-size: 13px;
  transition: background .2s, color .2s;
}
.size:hover { color: var(--fg); }
.size.on { background: var(--soft); color: #000; }
.size:disabled { opacity: .3; text-decoration: line-through; cursor: not-allowed; }
.desc { margin: 0; color: var(--muted); max-width: 46ch; }
details.more { color: var(--muted); }
details.more summary { cursor: pointer; list-style: none; color: var(--fg); font-size: 13px; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::after { content: ' +'; color: var(--dim); }
details.more[open] summary::after { content: ' \2212'; }
details.more ul { margin: 10px 0 0; padding-left: 18px; }

/* ── Buttons (STYLE_REF button-primary) ──────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: .5rem; width: 100%;
  padding: .8rem 20px; border-radius: 16px;
  background: rgb(37,37,37); border: 1px solid #000; outline: 1px solid rgb(89,89,89);
  font: 400 1.15rem/1.2 var(--serif); color: #fff;
  transition: all 350ms ease-in-out;
}
.btn:hover:not(:disabled) { background: rgb(240,240,240); color: #000; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.light { background: var(--soft); color: #000; outline-color: transparent; }
.btn.light:hover:not(:disabled) { background: #fff; }
.btn.inline { width: auto; display: inline-flex; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid currentColor; border-right-color: transparent; animation: turn .7s linear infinite; }
@keyframes turn { to { transform: rotate(360deg); } }

/* ── Cart drawer ─────────────────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.55); opacity: 0; transition: opacity .3s; }
.scrim.on { opacity: 1; }
.drawer {
  position: fixed; z-index: 41; top: 10px; right: 10px; bottom: 10px; width: min(420px, calc(100vw - 20px));
  display: flex; flex-direction: column; border-radius: 22px; background: #0b0b0b;
  box-shadow: 0 30px 80px rgba(0,0,0,.6);
  transform: translateX(calc(100% + 24px)); transition: transform .45s var(--ease);
}
.drawer.on { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 8px 22px; }
.drawer-head h2 { margin: 0; font: 400 1.5rem/1 var(--serif); }
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; color: var(--muted); }
.icon-btn:hover { background: var(--panel-2); color: var(--fg); }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 14px; }
.empty { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; }
.line { display: grid; grid-template-columns: 72px 1fr auto; gap: 14px; align-items: center; padding: 8px; border-radius: 14px; }
.line + .line { margin-top: 2px; }
.line-img { width: 72px; height: 88px; border-radius: 12px; background: var(--panel); overflow: hidden; }
.line-img img { width: 100%; height: 100%; object-fit: cover; }
.line-name { font-size: 13.5px; }
.line-var { color: var(--muted); font-size: 12.5px; }
.line-price { font: 400 12.5px/1 var(--mono); color: var(--soft); text-align: right; }
.qty { display: inline-flex; align-items: center; margin-top: 8px; border-radius: 10px; background: var(--panel-2); }
.qty button { width: 28px; height: 28px; border-radius: 10px; color: var(--muted); }
.qty button:hover { color: var(--fg); }
.qty span { min-width: 18px; text-align: center; font: 400 12px/1 var(--mono); }
.drawer-foot { padding: 16px 22px 22px; display: grid; gap: 14px; }
.drawer-foot:empty { display: none; }
.sum { display: flex; justify-content: space-between; align-items: baseline; }
.sum span:first-child { color: var(--muted); }
.sum span:last-child { font: 400 1rem/1 var(--mono); }
.note { margin: -6px 0 0; color: var(--dim); font-size: 12px; }

/* ── Orders ──────────────────────────────────────────────────────────────── */
.page { max-width: 760px; margin: 0 auto; padding: 24px var(--gutter) 64px; }
.page h1 { margin: 0 0 24px; font: 400 2.4rem/1 var(--serif); }
.center { display: grid; justify-items: center; gap: 18px; padding: 12vh 0; text-align: center; color: var(--muted); }
.center p { margin: 0; }
.order { padding: 18px; border-radius: 18px; background: var(--panel); opacity: 0; animation: rise .6s var(--ease) forwards; }
.order + .order { margin-top: 10px; }
.order-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.order-id { font: 400 12px/1 var(--mono); color: var(--muted); }
.order-total { font: 400 13px/1 var(--mono); }
.order-items { display: flex; gap: 10px; margin: 14px 0; overflow-x: auto; scrollbar-width: none; }
.order-item { display: flex; align-items: center; gap: 10px; flex: none; }
.order-item .line-img { width: 48px; height: 58px; border-radius: 9px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.step { height: 3px; border-radius: 2px; background: #222; }
.step.done { background: var(--soft); }
.order-status { display: flex; justify-content: space-between; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.order-status b { font-weight: 400; color: var(--fg); }
.order.cancelled .step { background: #222; }

/* ── Footer, toast ───────────────────────────────────────────────────────── */
.foot { display: flex; justify-content: space-between; align-items: center; padding: 20px var(--gutter) 28px; color: var(--dim); font: 400 12px/1 var(--mono); }
.currency select {
  appearance: none; -webkit-appearance: none; padding: 7px 10px; border-radius: 9px; border: 0;
  background: var(--panel-2); color: var(--muted); font: inherit; cursor: pointer;
}
.currency select:hover { color: var(--fg); }
.toast {
  position: fixed; z-index: 60; left: 50%; bottom: 24px; transform: translateX(-50%);
  padding: 10px 16px; border-radius: 12px; background: var(--soft); color: #000; font-size: 13px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5); animation: rise .3s var(--ease);
}
.notfound { padding: 20vh var(--gutter); text-align: center; color: var(--muted); }
.notfound h1 { font: 400 2.4rem/1 var(--serif); color: var(--fg); margin: 0 0 12px; }

/* ── Small screens ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr 1fr; grid-auto-rows: minmax(240px, 52vw); }
  .product { grid-template-columns: 1fr; }
  .buy { position: static; }
}
@media (max-width: 560px) {
  .grid, .grid.one { grid-template-columns: 1fr; grid-auto-rows: 120vw; }
  .grid .tile:first-child:not(:only-child) { grid-column: auto; grid-row: auto; }
  .brand-tag { display: none; }
  .page h1 { font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
