/* Trailmark Workshop (site/workshop.html). Same fonts and colours as site.css, but a work tool: dense, calm, fast.
   Desktop ≥ 1000 px: 260 px left · 3D centre · 360 px right, each column scrolls on its own.
   Phone: 3D on top (45 vh), category chips, parts grid, part card. */
:root {
  --ink: #0c0b0a;
  --soot: #171513;
  --char: #24211e;
  --line: rgba(236, 227, 211, .12);
  --line-2: rgba(236, 227, 211, .22);
  --bone: #ece3d3;
  --muted: #a69d8e;
  --gold: #e0a23a;
  --ember: #e5622a;
  --lime: #b7c43a;
  --glow: #3d8bff;
  --display: "Bahnschrift", "DIN Condensed", "Roboto Condensed", "sans-serif-condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --head: 60px;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--ink); }
body { margin: 0; color: var(--bone); background: var(--ink); font: 400 14px/1.5 var(--body); overflow-x: hidden; overflow-x: clip; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: inherit; }
p { margin: 0 0 .8em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: 10px; background: var(--gold); color: #111; font-weight: 700; text-decoration: none; transition: top .2s; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 18px; border: 0;
  border-radius: 999px; text-decoration: none; font: 700 13px/1 var(--display); letter-spacing: .12em; text-transform: uppercase;
  transition: transform .3s var(--ease), box-shadow .3s; white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.btn--order { background: linear-gradient(180deg, #f0b44c, #d48f24); color: #160f05; box-shadow: 0 4px 18px rgba(224, 162, 58, .3), inset 0 1px 0 rgba(255, 255, 255, .45); }
.btn--order:hover { transform: translateY(-1px); box-shadow: 0 8px 26px rgba(224, 162, 58, .45), inset 0 1px 0 rgba(255, 255, 255, .45); }

/* ---------- Header ---------- */
.ws-head {
  position: sticky; top: 0; z-index: 20; height: var(--head); display: flex; align-items: center; gap: 12px;
  padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  background: rgba(12, 11, 10, .94); border-bottom: 1px solid var(--line);
}
.ws-head__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-height: 44px; flex: none; }
.ws-head__brand img { width: 32px; height: 32px; border-radius: 50%; clip-path: circle(48%); }
.ws-head__brand span { font: 700 14px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
.ws-head__brand sup { font-size: 8px; }
.ws-head__brand em { font: 600 11px/1 var(--display); font-style: normal; letter-spacing: .24em; text-transform: uppercase; color: var(--gold); padding-left: 10px; border-left: 1px solid var(--line-2); }
.ws-mode { margin-left: auto; display: flex; padding: 3px; border-radius: 999px; background: var(--soot); border: 1px solid var(--line); }
.ws-mode button { min-height: 38px; padding: 0 16px; border: 0; border-radius: 999px; background: none; font: 700 12px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.ws-mode button[aria-pressed="true"] { background: var(--bone); color: var(--ink); }
.ws-head .btn--order { padding: 10px 16px; }
@media (max-width: 560px) {
  .ws-head__brand span { display: none; }
  .ws-head__brand em { border: 0; padding: 0; }
  .ws-mode button { padding: 0 12px; }
  .ws-head .btn--order span { display: none; }
  .ws-head .btn--order { width: 44px; padding: 0; }
}
@media (max-width: 440px) { .ws-head__brand em { display: none; } }

/* ---------- Shared bits ---------- */
.ws-label { font: 600 11px/1 var(--display); letter-spacing: .28em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.ws-h { font: 700 22px/1.05 var(--display); letter-spacing: .02em; text-transform: uppercase; margin: 0 0 6px; }
.ws-h3 { font: 700 13px/1 var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin: 22px 0 10px; }
.ws-sub { color: var(--muted); margin-bottom: 12px; }
.ws-small { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.ws-empty { color: var(--muted); padding: 12px 0; }
.ws-chip {
  min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .04);
  font: 600 12px/1 var(--display); letter-spacing: .1em; text-transform: uppercase; white-space: nowrap;
}
.ws-chip:hover { border-color: var(--gold); color: var(--gold); }
.ws-chip[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.ws-chip--quiet { border-color: transparent; color: var(--muted); }
.ws-link { border: 0; background: none; padding: 0; color: var(--gold); text-decoration: underline; text-underline-offset: 3px; min-height: 24px; text-align: left; }
.ws-badge { display: inline-block; padding: 3px 8px; border-radius: 6px; font: 700 11px/1.2 var(--display); letter-spacing: .06em; text-transform: uppercase; }
.ws-badge--est { background: rgba(224, 162, 58, .14); color: var(--gold); border: 1px solid rgba(224, 162, 58, .4); }
.ws-badge--edit { background: rgba(183, 196, 58, .14); color: var(--lime); border: 1px solid rgba(183, 196, 58, .45); }
.ws-badge--rough { background: rgba(229, 98, 42, .14); color: var(--ember); border: 1px solid rgba(229, 98, 42, .45); }
.ws-badge--opt { background: rgba(120, 160, 220, .12); color: #9dbbe8; border: 1px solid rgba(120, 160, 220, .4); }
.ws-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(12, 11, 10, .72); border: 1px solid var(--line); }
.ws-seg button, .ws-seg label { min-height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: none; display: grid; place-items: center; font: 600 12px/1 var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); cursor: pointer; }
.ws-seg button[aria-pressed="true"], .ws-seg label:has(input:checked) { background: var(--bone); color: var(--ink); }
.ws-seg label { position: relative; }
.ws-seg label input { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.ws-seg label:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Layout ---------- */
.ws-main { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "centre" "left" "right"; }
.ws-left { grid-area: left; }
.ws-centre { grid-area: centre; }
.ws-right { grid-area: right; padding: 14px 14px 40px; outline: none; }
@media (min-width: 1000px) {
  .ws-main { grid-template-columns: 260px minmax(0, 1fr) 360px; grid-template-areas: "left centre right"; height: calc(100vh - var(--head) - var(--bar)); height: calc(100dvh - var(--head) - var(--bar)); }
  .ws-left, .ws-right { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .ws-left { border-right: 1px solid var(--line); padding: 16px 14px; }
  .ws-right { border-left: 1px solid var(--line); padding: 16px 16px 40px; }
  .ws-centre { display: flex; flex-direction: column; min-height: 0; }
}

/* ---------- Left: vehicle card + categories ---------- */
.ws-vehicle { display: none; }
@media (min-width: 1000px) {
  .ws-vehicle { display: block; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--soot); margin-bottom: 18px; }
  .ws-vehicle img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: 50% 62%; }
  .ws-vehicle div { padding: 10px 12px 12px; }
  .ws-vehicle p { margin: 0; }
  .ws-vehicle__make { font: 700 17px/1.1 var(--display); letter-spacing: .06em; text-transform: uppercase; }
  .ws-vehicle__model { color: var(--gold); font-weight: 600; }
  .ws-vehicle__spec { color: var(--muted); font-size: 12px; }
}
.ws-cats { padding: 10px 0 4px; border-bottom: 1px solid var(--line); }
.ws-cats .ws-label { display: none; }
.ws-cats ul { display: flex; gap: 8px; overflow-x: auto; padding: 0 14px 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
.ws-cats ul::-webkit-scrollbar { display: none; }
.ws-cats li { flex: none; scroll-snap-align: start; }
.ws-cats button {
  display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--soot); font: 600 13px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
.ws-cats small { font: 600 11px/1 var(--body); color: var(--muted); }
.ws-cats button[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); background: rgba(224, 162, 58, .1); }
@media (min-width: 1000px) {
  .ws-cats { padding: 0; border: 0; }
  .ws-cats .ws-label { display: block; }
  .ws-cats ul { display: grid; gap: 2px; overflow: visible; padding: 0; }
  .ws-cats button { width: 100%; justify-content: space-between; border-radius: 10px; border-color: transparent; background: none; min-height: 42px; }
  .ws-cats button:hover { background: rgba(255, 255, 255, .05); }
  .ws-cats button[aria-pressed="true"] { border-color: transparent; background: rgba(224, 162, 58, .12); box-shadow: inset 3px 0 0 var(--gold); }
}

/* ---------- Centre: 3D stage + groups ---------- */
.ws-stage {
  position: relative; height: 45vh; height: 45svh; min-height: 280px; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 38%, #2a2622 0%, #141210 62%, #0c0b0a 100%);
}
@media (min-width: 1000px) { .ws-stage { flex: 1; height: auto; min-height: 0; } }
.ws-viewer { position: absolute; inset: 0; }
.ws-viewer canvas { opacity: 0; transition: opacity .6s; }
.ws-viewer.is-ready canvas { opacity: 1; }
.ws-viewer__loading { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); font: 600 12px/1 var(--display); letter-spacing: .24em; text-transform: uppercase; animation: ws-pulse 1.6s ease-in-out infinite; }
@keyframes ws-pulse { 50% { opacity: .45; } }
.ws-stage.is-hovering { cursor: pointer; }
.ws-tools { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; pointer-events: none; }
.ws-tools > * { pointer-events: auto; }
.ws-tools .ws-chip { background: rgba(12, 11, 10, .72); min-height: 40px; }
.ws-tools .ws-seg button { min-height: 34px; }
.ws-picked {
  position: absolute; left: 10px; bottom: 10px; max-width: calc(100% - 20px); min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid rgba(61, 139, 255, .6); background: rgba(12, 11, 10, .8); display: flex; align-items: center; gap: 8px;
  font: 600 13px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; overflow: hidden; white-space: nowrap;
}
.ws-picked span { overflow: hidden; text-overflow: ellipsis; }
.ws-picked small { color: var(--muted); font-size: 11px; }
@media (min-width: 1000px) { .ws-picked small { display: none; } .ws-picked { pointer-events: none; } }
.ws-tip { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: rgba(12, 11, 10, .9); border: 1px solid var(--line-2); font-size: 12px; white-space: nowrap; }
.ws-hint { position: absolute; right: 12px; bottom: 14px; margin: 0; font-size: 11px; color: var(--muted); pointer-events: none; text-align: right; max-width: 50%; }
body[data-mode="workshop"] .ws-picked:not([hidden]) ~ .ws-hint { display: none; }
@media (min-width: 1000px) { body[data-mode="workshop"] .ws-picked:not([hidden]) ~ .ws-hint { display: block; } }
.ws-stub { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 20px; text-align: center; }
.ws-stub img { width: min(320px, 70%); border-radius: 12px; }
.ws-stub__name { font: 700 18px/1.1 var(--display); text-transform: uppercase; margin: 0; }
.ws-stub__why { color: var(--muted); font-size: 12px; margin: 0; }

.ws-groups { display: none; }
@media (min-width: 1000px) {
  .ws-groups { display: flex; gap: 8px; padding: 10px 12px; overflow-x: auto; border-top: 1px solid var(--line); background: var(--soot); scrollbar-width: thin; flex: none; }
  .ws-groups button {
    width: 112px; padding: 4px 4px 6px; border-radius: 10px; border: 1px solid var(--line); background: var(--ink);
    display: grid; gap: 4px; font: 600 11px/1.15 var(--display); letter-spacing: .04em; text-transform: uppercase; text-align: center;
  }
  .ws-groups img, .ws-groups__all { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 7px; background: #1b1916; }
  .ws-groups__all { display: block; background: url("../assets/brand/trailmark-logo-96.jpg") center / 40px no-repeat, radial-gradient(circle, #2a2622, #141210); }
  .ws-groups button:hover { border-color: var(--line-2); }
  .ws-groups button[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
}

/* ---------- Right: crumb, parts grid, card ---------- */
.ws-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.ws-crumb__link { border: 0; background: none; padding: 4px 0; min-height: 28px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.ws-crumb__link:hover { color: var(--gold); }
.ws-crumb [aria-current] { color: var(--bone); }
.ws-crumb__sep { opacity: .5; }

.ws-parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
@media (min-width: 1000px) { .ws-parts { grid-template-columns: 1fr 1fr; } }
.ws-tile {
  width: 100%; height: 100%; padding: 6px 6px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--soot);
  display: grid; grid-template-rows: auto auto 1fr; gap: 4px; text-align: left; transition: border-color .2s;
}
.ws-tile img, .ws-tile__none { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: #1b1916; }
.ws-tile__none { display: block; }
.ws-tile__name { font: 700 13px/1.15 var(--display); letter-spacing: .03em; text-transform: uppercase; }
.ws-tile__meta { font-size: 11px; color: var(--muted); line-height: 1.3; }
.ws-tile:hover { border-color: var(--line-2); }
.ws-tile[aria-pressed="true"] { border-color: var(--glow); box-shadow: 0 0 0 1px var(--glow), 0 0 22px rgba(61, 139, 255, .25); }
.ws-parts li.is-child .ws-tile { background: #12100e; }
.ws-parts li.is-child .ws-tile__name::before { content: "↳ "; color: var(--muted); }

.ws-card { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); outline: none; scroll-margin-top: calc(var(--head) + 8px); }
.ws-card__head { display: grid; gap: 6px; justify-items: start; margin-bottom: 12px; }
.ws-facts { margin: 0 0 12px; display: grid; gap: 6px; }
.ws-facts div { display: grid; grid-template-columns: 104px 1fr; gap: 10px; }
.ws-facts dt { color: var(--muted); font-size: 12px; padding-top: 1px; }
.ws-facts dd { margin: 0; }
.ws-card__tools { display: flex; flex-wrap: wrap; gap: 8px; }

.ws-pnls { display: grid; gap: 10px; }
.ws-pnl { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--soot); }
.ws-pnl__fig { display: grid; place-items: center; background: #100f0d; border-radius: 8px; padding: 6px; align-self: start; aspect-ratio: 1; }
.ws-svg { width: 100%; height: 100%; overflow: visible; }
.ws-svg path, .ws-svg line { vector-effect: non-scaling-stroke; fill: none; }
.ws-svg__cut { stroke: var(--bone); stroke-width: 1.4; fill: rgba(236, 227, 211, .05) !important; }
.ws-svg__sew { stroke: var(--gold); stroke-width: 1; stroke-dasharray: 3 2; }
.ws-svg__notch line { stroke: var(--lime); stroke-width: 1.6; }
.ws-svg__grain line { stroke: var(--muted); stroke-width: 1; }
#ws-arrow path { fill: var(--muted); }
.ws-pnl h4 { margin: 0 0 4px; font: 700 14px/1.15 var(--display); letter-spacing: .03em; text-transform: uppercase; }
.ws-pnl h4 small, .ws-table small { display: block; font: 400 11px/1.3 var(--body); text-transform: none; letter-spacing: 0; color: var(--muted); }
.ws-pnl__tags { margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.ws-pnl__fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ws-pnl__fields label { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; font-size: 11px; color: var(--muted); column-gap: 4px; }
.ws-pnl__fields b { grid-column: 1 / -1; font-weight: 400; }
.ws-pnl__fields i { font-style: normal; }
.ws-pnl__fields input {
  width: 100%; min-width: 0; min-height: 36px; padding: 0 6px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--ink); color: var(--bone); font: 600 14px/1 var(--body); font-variant-numeric: tabular-nums;
}
.ws-pnl__fields input:focus { border-color: var(--gold); outline: none; }
.ws-pnl__fields input[aria-invalid="true"] { border-color: var(--ember); }
.ws-pnl__read { margin: 6px 0 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ws-pnl__acts { display: flex; flex-wrap: wrap; gap: 4px 8px; }
@media (max-width: 380px) { .ws-pnl { grid-template-columns: 1fr; } .ws-pnl__fig { width: 120px; } }

.ws-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.ws-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.ws-table caption { text-align: left; padding: 8px 10px; color: var(--muted); font-size: 11px; }
.ws-table th, .ws-table td { padding: 6px 10px; border-top: 1px solid var(--line); text-align: left; white-space: nowrap; vertical-align: top; }
.ws-table thead th { font: 600 11px/1.2 var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.ws-table tbody th { font-weight: 600; white-space: normal; min-width: 110px; }
.ws-table tfoot { color: var(--gold); font-weight: 600; }
.ws-card__acts { margin-top: 16px; }
.ws-card__acts .btn { width: 100%; white-space: normal; text-align: center; line-height: 1.2; }

/* ---------- Design mode ---------- */
body[data-mode="design"] .ws-cats, body[data-mode="design"] .ws-groups { display: none; }
.ws-design { display: grid; gap: 4px; }
.ws-field { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.ws-field legend { padding: 0; margin-bottom: 8px; font: 700 12px/1 var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.ws-field legend span { color: var(--bone); letter-spacing: .06em; }
.ws-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.ws-sw { position: relative; cursor: pointer; }
.ws-sw input { position: absolute; opacity: 0; pointer-events: none; }
.ws-sw span { display: block; width: 44px; height: 44px; border-radius: 50%; background: var(--sw); border: 2px solid rgba(255, 255, 255, .18); box-shadow: inset 0 -6px 12px rgba(0, 0, 0, .35); transition: transform .2s var(--ease); }
.ws-swatches--sm .ws-sw span { width: 34px; height: 34px; margin: 5px; }
.ws-sw input:checked + span { border-color: var(--bone); box-shadow: 0 0 0 3px var(--ink), 0 0 0 5px var(--gold), inset 0 -6px 12px rgba(0, 0, 0, .35); }
.ws-sw input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 6px; }
.ws-seg--wide { display: flex; width: 100%; }
.ws-seg--wide label { flex: 1; }
.ws-switch { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-weight: 600; }
.ws-switch input { width: 20px; height: 20px; accent-color: var(--gold); }
.ws-logo { display: grid; gap: 10px; margin-top: 4px; transition: opacity .2s; }
.ws-logo.is-off { opacity: .45; }
.ws-checks { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.ws-checks label { display: flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; font-size: 13px; }
.ws-checks input { width: 18px; height: 18px; accent-color: var(--gold); flex: none; }
.ws-summary { padding: 12px; border-radius: 12px; background: var(--soot); border: 1px solid var(--line); margin: 4px 0 10px; }
.ws-design__order { width: 100%; white-space: normal; text-align: center; line-height: 1.2; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- showcase banner ---------- */
:root { --bar: 34px; }
@media (max-width: 760px) { :root { --bar: 58px; } }
.showcase-bar { position: relative; z-index: 120; min-height: var(--bar); display: flex; align-items: center; justify-content: center; text-align: center; padding: 6px 14px; background: #171513; color: #ece3d3; border-bottom: 1px solid rgba(224,162,58,.35); font: 500 12px/1.4 var(--body, system-ui, sans-serif); letter-spacing: .04em; }
.showcase-bar a { color: #e0a23a; font-weight: 700; }
