/* Store styles. Colors are tokens; the dark theme follows the system. */
:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --text: #1f1c18;
  --muted: #6b645b;
  --line: #ddd5c8;
  --accent: #8a4b1f;
  --accent-text: #ffffff;
  --badge: #fbf0df;
  --ok: #2f6b3a;
  --danger: #a3261b;
  --radius: 10px;
  --wrap: 1120px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171512;
    --surface: #221f1b;
    --text: #f1ece4;
    --muted: #b3aa9d;
    --line: #3a352e;
    --accent: #e0a065;
    --accent-text: #1a1209;
    --badge: #3a2c1d;
    --ok: #7fc48a;
    --danger: #ff8b7e;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
a { color: var(--accent); }
img { max-width: 100%; height: auto; display: block; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .88em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
main { max-width: var(--wrap); margin: 0 auto; padding: 16px; }
h1, h2, h3 { line-height: 1.2; }

.site-header {
  display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between;
  max-width: var(--wrap); margin: 0 auto; padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.brand { font-size: 1.25rem; font-weight: bold; text-decoration: none; color: var(--text); letter-spacing: .02em; }
.site-header nav { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.site-header nav a { text-decoration: none; }
.site-footer { max-width: var(--wrap); margin: 40px auto 0; padding: 20px 16px 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; }

button, .button {
  font: inherit; font-size: .95rem; cursor: pointer; border-radius: 999px; padding: 9px 18px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; display: inline-block;
}
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.wide { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; border-radius: 0; font-size: .9rem; }
.icon-button { border-radius: 50%; width: 40px; height: 40px; padding: 0; font-size: 1.4rem; line-height: 1; }
.cart-count { display: inline-block; min-width: 1.6em; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-text); font-size: .8rem; text-align: center; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); max-width: 100%; }
label { display: block; }
.stack { display: grid; gap: 14px; max-width: 520px; }
.stack input:not([type="checkbox"]), .stack textarea { width: 100%; margin-top: 4px; }
.stack button { justify-self: start; }
.inline { display: flex; gap: 8px; align-items: center; }
.hp { position: absolute; left: -9999px; }
.muted, .series { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; }

.hero { padding: 20px 0 8px; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 6px; }
.hero p { color: var(--muted); margin: 0; max-width: 60ch; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin: 20px 0; }
.filters select { display: block; margin-top: 4px; }
.grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; padding-bottom: 14px; }
.card-link { text-decoration: none; color: var(--text); }
.card img, .card-ph { aspect-ratio: 1; width: 100%; object-fit: cover; background: var(--badge); }
.card h2 { font-size: 1.15rem; margin: 12px 14px 4px; }
.card p { margin: 2px 14px; font-size: .92rem; }
.card .price { margin-top: 8px; font-weight: bold; }
.formats { font-weight: normal; color: var(--muted); }
.empty { color: var(--muted); }

.product { display: grid; gap: 28px; grid-template-columns: 1fr; padding-top: 12px; }
@media (min-width: 860px) { .product { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.gallery { display: grid; gap: 12px; align-content: start; }
.gallery img { border-radius: var(--radius); border: 1px solid var(--line); }
.product h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); margin: 4px 0; }
.tagline { font-size: 1.1rem; color: var(--muted); margin-top: 0; }
.spec-bar { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 12px 0; margin: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.spec-bar dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.spec-bar dd { margin: 0; font-weight: bold; }
.buy fieldset { border: 0; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.buy legend { font-weight: bold; margin-bottom: 6px; }
.format { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.format:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.format-name { flex: 1; }
.format-price { font-weight: bold; }
.qty { display: inline-flex; gap: 8px; align-items: center; margin-right: 12px; }
.qty input { width: 72px; }
.added { min-height: 1.4em; color: var(--ok); }
.lead-badge { background: var(--badge); border-radius: var(--radius); padding: 12px 14px; font-size: .95rem; }
.bom { padding-left: 1.2em; }
.links { display: flex; flex-wrap: wrap; gap: 8px 20px; }

.drawer-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / .35); z-index: 20; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 21; background: var(--surface);
  display: flex; flex-direction: column; box-shadow: -6px 0 24px rgb(0 0 0 / .2);
  transform: translateX(100%); transition: transform .2s ease;
  padding-bottom: env(safe-area-inset-bottom);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 1.2rem; }
.drawer-body { flex: 1; overflow: auto; padding: 8px 16px; }
.drawer-foot { padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.line { display: grid; grid-template-columns: 56px 1fr auto; gap: 4px 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line img, .line-ph { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; background: var(--badge); grid-row: span 2; }
.line-main { display: grid; }
.line-main small { color: var(--muted); }
.line-qty { display: flex; gap: 8px; align-items: center; }
.line-qty button { width: 32px; height: 32px; padding: 0; border-radius: 50%; }
.line .link { grid-column: 3; justify-self: end; }
.row { display: flex; justify-content: space-between; gap: 12px; margin: 6px 0; }
.free-bar { margin: 10px 0; }
.free-track { height: 8px; background: var(--badge); border-radius: 999px; overflow: hidden; }
.free-fill { height: 100%; background: var(--accent); }
.lead-note { font-size: .85rem; color: var(--muted); }
.cart-page { display: grid; gap: 24px; }
@media (min-width: 860px) { .cart-page:has(.summary) { grid-template-columns: 2fr 1fr; align-items: start; } }
.summary { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.notice { max-width: 640px; }

.steps { list-style: none; padding: 0; display: grid; gap: 10px; }
.steps li { padding: 10px 14px; border-left: 4px solid var(--line); background: var(--surface); border-radius: 0 8px 8px 0; display: grid; }
.steps li span { color: var(--muted); font-size: .9rem; }
.steps li.done { border-color: var(--ok); }
.steps li.current { border-color: var(--accent); background: var(--badge); }

/* Workshop admin */
.admin main { max-width: 1280px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 20px 0; overflow-x: auto; }
.panel h2 { margin-top: 0; }
.badge { display: inline-block; padding: 0 8px; border-radius: 999px; background: var(--badge); font-size: .8rem; }
table { border-collapse: collapse; width: 100%; font-size: .92rem; }
caption { text-align: left; font-weight: bold; padding: 6px 0; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.two-col { display: grid; gap: 20px; }
@media (min-width: 860px) { .two-col { grid-template-columns: 1fr 1fr; } }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tabs a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; }
.tabs a[aria-current="page"] { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.tabs a[aria-current="page"] .badge { background: var(--accent-text); color: var(--accent); }
.note { color: var(--danger); font-size: .85rem; }
.parts { list-style: none; padding: 0; }
.parts li { border-bottom: 1px solid var(--line); padding: 10px 0; }
.toast { position: sticky; bottom: 12px; background: var(--badge); padding: 0 12px; border-radius: 8px; }
.toast:empty { display: none; }
.order-ids code { display: inline-block; margin: 2px 6px 2px 0; }
.slip { page-break-after: always; break-after: page; padding: 16px 0; border-bottom: 2px dashed var(--line); }
.slip header { display: flex; justify-content: space-between; gap: 12px; }
.slip address { font-style: normal; margin: 12px 0; }
.slip h3 { font-size: 1rem; margin: 12px 0 4px; }
.checklist { list-style: none; padding-left: 8px; columns: 2; }

@media print {
  .site-header, .site-footer, .no-print, .drawer, .drawer-backdrop { display: none !important; }
  body { background: #fff; color: #000; font-size: 12pt; }
  .panel { border: 0; padding: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
.attention { border-color: var(--danger); }
