:root {
  --paper: #f4efe4;
  --paper-2: #ebe4d4;
  --card: #fffdf8;
  --ink: #141414;
  --muted: #5e5a52;
  --red: #d9402a;
  --yellow: #f6c544;
  --green: #2f7d4f;
  --radius: 6px;
  --shadow: 4px 4px 0 var(--ink);
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, monospace;
  --pad: clamp(16px, 4vw, 48px);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--display); font-size: 17px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, select, input { font: inherit; }
button { cursor: pointer; }
code { font-family: var(--mono); font-size: .9em; background: rgba(0,0,0,.08); padding: 1px 5px; border-radius: 3px; }

.setup-banner { padding: 10px var(--pad); background: var(--yellow); border-bottom: 2px solid var(--ink); font-size: 15px; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px var(--pad); background: var(--paper); border-bottom: 2px solid var(--ink); }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; text-decoration: none; letter-spacing: -.3px; min-width: 0; }
.logo > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo-mark { flex: none; display: grid; place-items: center; width: 36px; height: 36px; background: var(--red); color: #fff; border: 2px solid var(--ink); font-family: var(--mono); font-size: 13px; transform: rotate(-4deg); }
.topnav { display: flex; align-items: center; gap: 22px; flex: none; }
.topnav a { text-decoration: none; font-weight: 600; }
.topnav a:hover { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 2px; }
.cart-btn { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--ink); color: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius); font-weight: 600; }
.cart-count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--yellow); color: var(--ink); font-family: var(--mono); font-size: 13px; display: grid; place-items: center; }
.cart-count.bump { animation: bump .35s ease; }
@keyframes bump { 50% { transform: scale(1.35); } }

.btn { display: inline-block; padding: 12px 20px; border: 2px solid var(--ink); border-radius: var(--radius); font-weight: 700; text-decoration: none; transition: transform .12s ease, box-shadow .12s ease; }
.btn-primary { background: var(--red); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover:not(:disabled) { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--ink); }
.btn-primary:disabled { background: #aaa; cursor: not-allowed; }
.btn-ghost { background: var(--card); }
.btn-ghost:hover { background: var(--yellow); }
.btn-block { width: 100%; }

.hero { padding: clamp(36px, 6vw, 80px) var(--pad) clamp(30px, 5vw, 60px); border-bottom: 2px solid var(--ink); background: radial-gradient(circle, rgba(20,20,20,.08) 1.3px, transparent 1.6px) 0 0 / 14px 14px, var(--paper); }
.kicker { display: inline-block; margin: 0 0 16px; padding: 4px 10px; font-family: var(--mono); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; background: var(--yellow); border: 2px solid var(--ink); }
.hero h1 { margin: 0 0 16px; max-width: 14em; font-size: clamp(38px, 5.6vw, 72px); line-height: .98; letter-spacing: -2px; font-weight: 800; }
.hl { background: linear-gradient(transparent 58%, var(--yellow) 58%, var(--yellow) 92%, transparent 92%); padding: 0 4px; }
.lede { max-width: 36em; margin: 0 0 30px; color: var(--muted); font-size: 19px; }
.trust { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; max-width: 1000px; }
.trust li { display: flex; flex-direction: column; padding: 14px 16px; background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); }
.trust strong { font-size: 17px; }
.trust span { color: var(--muted); font-size: 15px; }

.shop { padding: clamp(36px, 5vw, 64px) var(--pad); }
.shop-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 20px; margin-bottom: 18px; }
.shop-head h2 { margin: 0; font-size: clamp(30px, 4vw, 44px); letter-spacing: -1px; line-height: 1; }
.ship-line { margin: 0; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.sections { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; background: var(--card); border: 2px solid var(--ink); border-radius: 999px; font-weight: 600; font-size: 15px; }
.chip:hover { background: var(--yellow); }
.chip.on { background: var(--ink); color: var(--paper); }
.chip .n, .group-head .n { font-family: var(--mono); font-size: 12px; opacity: .7; font-weight: 400; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1.5px var(--ink); }
.chip.on .dot { box-shadow: 0 0 0 1.5px var(--paper); }
.groups { display: grid; gap: 48px; }
.group-head { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); font-size: 26px; letter-spacing: -.5px; }
.group-head .dot { width: 16px; height: 16px; }
.see-all { margin-left: auto; background: none; border: 0; font-weight: 700; font-size: 15px; text-decoration: underline; text-underline-offset: 3px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.controls input[type=search], .controls select { padding: 9px 12px; border: 2px solid var(--ink); border-radius: var(--radius); background: var(--card); font-size: 15px; }
.controls input[type=search] { flex: 1 1 260px; }
.check { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 600; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.results { margin: 0 0 18px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 26px; }
.card { display: flex; flex-direction: column; }
.card-photo { position: relative; display: block; width: 100%; padding: 0; aspect-ratio: 2 / 3; border: 2px solid var(--ink); background: var(--card); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
.card-photo:hover { transform: translate(-2px,-2px); box-shadow: 6px 6px 0 var(--ink); }
.card-photo img, .detail-photo img, .line-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card.sold .card-photo { filter: grayscale(1); opacity: .6; }
.badge { position: absolute; top: 8px; right: 8px; padding: 2px 8px; font-family: var(--mono); font-size: 12px; font-weight: 500; background: var(--card); border: 2px solid var(--ink); border-radius: 3px; }
.badge.out { background: var(--ink); color: var(--paper); }
.nophoto { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; padding: 14px; text-align: center; background: repeating-linear-gradient(-45deg, var(--paper-2) 0 10px, var(--paper) 10px 20px); }
.np-title { font-weight: 800; font-size: 18px; line-height: 1.1; }
.np-issue { font-family: var(--mono); font-size: 15px; }
.np-note { margin-top: 10px; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.card-meta { padding: 12px 2px 0; display: flex; flex-direction: column; flex: 1; }
.card-meta h3 { margin: 0; font-size: 17px; line-height: 1.2; }
.sub { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin: 3px 0 10px; }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; gap: 8px; }
.price { font-family: var(--mono); font-weight: 500; font-size: 17px; }
.add { padding: 6px 14px; background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); font-weight: 700; font-size: 15px; }
.add:hover:not(:disabled) { background: var(--yellow); }
.add:disabled { opacity: .45; cursor: not-allowed; }
.more-wrap { text-align: center; margin-top: 34px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px; padding: 28px var(--pad); background: var(--ink); color: #d8d1c1; font-size: 15px; }
.footer strong { color: var(--paper); }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-start; }

.detail { width: min(860px, 94vw); padding: 0; border: 2px solid var(--ink); border-radius: var(--radius); background: var(--paper); color: var(--ink); box-shadow: 8px 8px 0 var(--ink); }
.detail::backdrop { background: rgba(20,20,20,.55); }
.detail-body { display: grid; grid-template-columns: 320px 1fr; gap: 30px; padding: 30px; }
.detail-photo { border: 2px solid var(--ink); aspect-ratio: 2 / 3; overflow: hidden; background: var(--card); }
.detail h2 { margin: 0 40px 0 0; font-size: 34px; line-height: 1.05; letter-spacing: -1px; }
.detail .sub { font-size: 14px; margin: 8px 0 16px; }
.cond { margin: 0 0 14px; font-size: 15px; }
.cond-tag { display: inline-block; margin-right: 6px; padding: 1px 8px; border: 2px solid var(--ink); font-family: var(--mono); font-size: 13px; background: var(--yellow); }
.notes { padding: 12px 14px; background: var(--card); border-left: 4px solid var(--ink); }
.buy { display: flex; align-items: center; gap: 18px; margin-top: 20px; }
.detail .price { font-size: 26px; }
.stock { font-family: var(--mono); font-size: 13px; color: var(--green); margin: 12px 0 4px; }
.fine { font-size: 14px; color: var(--muted); }
.close { position: absolute; top: 10px; right: 12px; width: 38px; height: 38px; background: transparent; border: 2px solid var(--ink); border-radius: 50%; font-size: 22px; line-height: 1; }
.close:hover { background: var(--yellow); }

.scrim { position: fixed; inset: 0; background: rgba(20,20,20,.45); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(420px, 100vw); display: flex; flex-direction: column; background: var(--paper); border-left: 2px solid var(--ink); transform: translateX(105%); transition: transform .3s cubic-bezier(.2,.8,.2,1); }
.drawer.open { transform: none; }
.drawer-head { position: relative; padding: 20px 24px; border-bottom: 2px solid var(--ink); }
.drawer-head h3 { margin: 0; font-size: 24px; }
.drawer-head .close { top: 14px; right: 18px; }
.drawer-items { flex: 1; overflow-y: auto; padding: 6px 24px; }
.drawer-empty { color: var(--muted); text-align: center; padding: 60px 0; }
.line { display: grid; grid-template-columns: 54px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px dashed #b9b2a2; }
.line-photo { width: 54px; aspect-ratio: 2 / 3; border: 2px solid var(--ink); overflow: hidden; }
.line-photo .nophoto { padding: 2px; }
.line-photo .np-title { font-size: 8px; }
.line-photo .np-issue, .line-photo .np-note { display: none; }
.line h4 { margin: 0; font-size: 15px; line-height: 1.2; }
.line .sub { margin: 2px 0 0; }
.qty { display: inline-flex; align-items: center; margin-top: 6px; border: 2px solid var(--ink); border-radius: var(--radius); }
.qty button { width: 28px; height: 26px; border: 0; background: transparent; font-weight: 700; }
.qty span { min-width: 22px; text-align: center; font-family: var(--mono); font-size: 14px; }
.line-price { font-family: var(--mono); text-align: right; font-size: 15px; }
.remove { display: block; margin-top: 6px; border: 0; background: none; color: var(--muted); font-size: 12px; text-decoration: underline; padding: 0; margin-left: auto; }
.drawer-foot { padding: 18px 24px 24px; border-top: 2px solid var(--ink); }
.drawer-foot .row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.drawer-foot .row strong { font-family: var(--mono); font-size: 20px; }
.drawer-foot .muted { color: var(--muted); font-size: 15px; margin-bottom: 16px; }
.note { min-height: 1em; margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.note.err { color: var(--red); font-weight: 600; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translate(-50%, 160%); padding: 12px 18px; background: var(--ink); color: var(--paper); border-radius: var(--radius); font-weight: 600; transition: transform .25s ease; }
.toast.show { transform: translate(-50%, 0); }

/* Policies page */
.doc { max-width: 760px; margin: 0 auto; padding: clamp(30px, 5vw, 60px) var(--pad); }
.doc h1 { font-size: clamp(34px, 5vw, 52px); letter-spacing: -1.5px; line-height: 1; margin: 0 0 24px; }
.doc h2 { margin: 44px 0 10px; font-size: 26px; letter-spacing: -.5px; scroll-margin-top: 90px; }
.doc table { width: 100%; border-collapse: collapse; font-size: 15px; }
.doc td { padding: 8px 10px; border-bottom: 1px solid #cfc8b8; vertical-align: top; }
.doc td:first-child { font-family: var(--mono); font-weight: 500; white-space: nowrap; }

@media (max-width: 820px) {
  .trust { grid-template-columns: 1fr; }
  .detail-body { grid-template-columns: 1fr; padding: 22px; }
  .detail-photo { max-width: 260px; }
  .topnav a { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.card-photo, .detail-photo, .line-photo { position: relative; }
.stock-tag { position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; background: rgba(20,20,20,.82); color: #fff; font-family: var(--mono); font-size: 11px; border-radius: 3px; }
.line-photo .stock-tag { display: none; }
[hidden] { display: none !important; }
.card-photo img, .detail-photo img, .line-photo img { object-fit: contain; background: var(--paper-2); }

.thumbs { display: flex; gap: 8px; margin-top: 10px; }
.thumb { width: 56px; aspect-ratio: 2 / 3; padding: 0; border: 2px solid #b9b2a2; background: var(--paper-2); overflow: hidden; }
.thumb.on { border-color: var(--ink); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* photo frames: 2:3, filled edge to edge, backdrop matches the photo canvas */
.card-photo, .detail-photo, .line-photo, .thumb { aspect-ratio: 2 / 3; background: #f6f6f4; }
.card-photo img, .detail-photo img, .line-photo img, .thumb img { width: 100%; height: 100%; object-fit: cover; background: #f6f6f4; }
.card-photo img[src*="photos/"], .detail-photo img[src*="photos/"] { object-position: center; }
.detail-photo { width: 100%; }
