@font-face {
  font-family: 'Bebas Neue';
  src: url('fonts/bebas-neue-latin.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
:root {
  --bg: #0b0b0b; --fg: #f4f4f2; --muted: #9a9a96; --accent: #13582c; --accent-hi: #1d7a3f;
  --display: 'Bebas Neue', 'Oswald', 'Impact', 'Arial Narrow', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg);
  font: 15px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
body { display: flex; flex-direction: column; min-height: 100dvh; }

/* Header: Riley's artwork (phone @3x 1170x250, tablet 2048x300) on a charcoal bar below the iOS safe area.
   Artwork content sits in the middle ~40% of the image height, so it's cropped (object-fit: cover)
   to a capped bar height instead of showing its full padded height. */
.bt-header { background: #151515; padding-top: env(safe-area-inset-top); flex: none; line-height: 0; }
.bt-header picture { display: block; }
.bt-header-img { display: block; width: 100%; object-fit: cover; object-position: center;
  height: clamp(56px, calc(100vw / 4.68 * 0.75), 72px); }
@media (min-width: 700px) {
  .bt-header-img { height: clamp(72px, calc(100vw / 6.83 * 0.6), 96px); }
}
@media (max-height: 500px) and (orientation: landscape) {
  .bt-header-img { height: 52px; object-fit: contain; }
}
.poster { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: #1a0f0b; }
.poster img { width: min(60%, 360px); height: auto; opacity: .85; }

.stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
model-viewer { flex: 1 1 auto; width: 100%; min-height: 44vh; background: #1a0f0b; --poster-color: #1a0f0b; }
.ar-btn { position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
  min-width: 240px; padding: 16px 28px; border: 0; border-radius: 999px;
  background: var(--accent); color: #fff; font-family: var(--display); font-size: 26px; letter-spacing: .06em;
  box-shadow: 0 6px 20px rgba(0,0,0,.45); cursor: pointer; }
.ar-btn:active { background: var(--accent-hi); transform: translateX(-50%) scale(.98); }
.ar-btn::before { content: ''; display: inline-block; width: 22px; height: 22px; margin-right: 10px; vertical-align: -3px;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M12 2 3 7v10l9 5 9-5V7z'/%3E%3Cpath d='M3 7l9 5 9-5M12 12v10'/%3E%3C/svg%3E"); }
.progress { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: transparent; }
.progress-fill { height: 100%; width: 0; background: var(--accent-hi); transition: width .2s; }
.progress.done { display: none; }

.ar-hint { position: absolute; left: 12px; right: 12px; bottom: 14px; margin: 0 auto; max-width: 520px;
  padding: 10px 14px; border-radius: 12px; background: rgba(0,0,0,.72); color: #ddd; font-size: 13px; text-align: center;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

/* Current product name over the 3D view */
.now { position: absolute; left: 0; right: 0; top: 0; padding: 10px 56px 18px; text-align: center; pointer-events: none;
  background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,0)); }
.now-name { margin: 0; font-family: var(--display); font-weight: 400; font-size: 24px; letter-spacing: .05em; line-height: 1.1; }
.now-dims { margin: 2px 0 0; font-size: 12px; color: #c9c9c4; }
.step { position: absolute; top: 45%; width: 44px; height: 64px; border: 0; border-radius: 12px; background: rgba(0,0,0,.45);
  color: #fff; font-size: 38px; line-height: 1; cursor: pointer; padding: 0 0 6px; }
.step:active { background: rgba(29,122,63,.8); }
.step-prev { left: 8px; } .step-next { right: 8px; }
.counter { position: absolute; right: 12px; bottom: 84px; font-size: 11px; color: #bbb; background: rgba(0,0,0,.45);
  padding: 2px 8px; border-radius: 999px; pointer-events: none; }

/* Picker: Material -> Product -> Size/colour */
.picker { background: #000; padding: 10px 0 4px; flex: none; }
.materials, .products, .variants { display: flex; gap: 8px; overflow-x: auto; padding: 0 12px; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity; }
.materials::-webkit-scrollbar, .products::-webkit-scrollbar, .variants::-webkit-scrollbar { display: none; }
.mat-tab { flex: 1 0 auto; padding: 8px 6px; border: 0; border-bottom: 3px solid #222; background: none; color: var(--muted);
  font-family: var(--display); font-size: 20px; letter-spacing: .06em; cursor: pointer; }
.mat-tab[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent-hi); }
.products { margin-top: 10px; }
.prod-chip { flex: none; display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 999px; scroll-snap-align: start;
  border: 1px solid #333; background: #141414; color: var(--fg); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; }
.prod-chip .count { font-size: 11px; color: var(--muted); background: #262626; border-radius: 999px; padding: 0 6px; }
.prod-chip[aria-checked="true"] { border-color: var(--accent-hi); background: #0f2618; }
.variants { margin-top: 10px; padding-bottom: 6px; }
.var-card { position: relative; flex: none; width: 104px; padding: 0 0 6px; border-radius: 12px; overflow: hidden; scroll-snap-align: start;
  border: 2px solid #262626; background: #141414; color: var(--fg); font: inherit; cursor: pointer; text-align: center; }
.var-card img { display: block; width: 100%; height: auto; aspect-ratio: 1; background: #222; }
.var-label { display: block; padding: 5px 4px 0; font-size: 12px; line-height: 1.25; }
.var-card[aria-checked="true"] { border-color: var(--accent-hi); background: #0f2618; }
.var-off { position: absolute; top: 5px; right: 5px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent-hi);
  color: #fff; font-size: 11px; line-height: 18px; }

/* Offline */
.offline { background: #000; padding: 8px 12px 4px; flex: none; border-top: 1px solid #161616; }
.offline-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.offline-status { font-size: 13px; color: #b5b5b0; }
.offline-status.ready { color: #cfe9d7; }
.offline-status .ok { color: #4fc47a; }
.offline-status.warn { color: #f0c36b; }
.dl-btn { padding: 10px 16px; border: 1px solid var(--accent-hi); border-radius: 999px; background: #0f2618; color: #fff;
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.dl-btn:active { background: var(--accent); }
.dl-bar { margin-top: 8px; height: 6px; border-radius: 3px; background: #1d1d1d; overflow: hidden; }
.dl-fill { height: 100%; width: 0; background: var(--accent-hi); transition: width .2s; }
.meta { padding: 4px 12px calc(8px + env(safe-area-inset-bottom)); background: #000; color: #6d6d69; font-size: 12px; }
.meta b { color: #9a9a96; font-weight: 600; }

/* Tablet and up: bigger header and controls */
@media (min-width: 700px) {
  .ar-btn { bottom: 32px; font-size: 30px; padding: 18px 40px; min-width: 300px; }
  .materials, .products, .variants { padding: 0 28px; }
  .offline, .meta { padding-left: 28px; padding-right: 28px; }
  .var-card { width: 128px; }
  .now-name { font-size: 30px; }
  .ar-hint { font-size: 14px; bottom: 24px; }
}
/* Landscape phones: keep the viewer usable */
@media (max-height: 500px) and (orientation: landscape) {
  model-viewer { min-height: 70vh; }
  .counter { bottom: 56px; }
  .ar-btn { bottom: 10px; padding: 10px 22px; font-size: 22px; }
}
