/* Amalor catalogue tokens; the standalone viewer needs no app bundle. */
:root {
  --background: #f4f2eb;
  --foreground: #252823;
  --surface: #fffdf6;
  --surface-strong: #ebe3d2;
  --line: #d8c7a3;
  --muted: #706d62;
  --accent: #b9472f;
  --accent-dark: #803020;
  --font-body: "Inter", "Segoe UI", Arial, Helvetica, sans-serif;
  --font-display: "Arial Narrow", "Roboto Condensed", "Segoe UI Condensed", Arial, sans-serif;
  --font-utility: "Roboto Mono", "Cascadia Mono", Consolas, monospace;
  font: 14px/1.5 var(--font-body);
  color: var(--foreground);
  background: var(--background);
  color-scheme: light;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, select, input { font: inherit; }
button, select, a { color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .5; cursor: wait; }
button, select, input { border-radius: 0; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, #canvas-host:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 3px; }
svg { display: block; flex-shrink: 0; }
button svg { width: 19px; height: 19px; }
[hidden] { display: none !important; }

.topbar { height: 76px; padding: 0 28px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; flex-shrink: 0; }
.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; background: var(--foreground); color: var(--surface); font: 900 20px var(--font-display); }
.brand-name { display: block; font: 900 24px/1 var(--font-display); text-transform: uppercase; }
.brand-tagline { display: block; margin-top: 3px; font: 10px/1.4 var(--font-utility); text-transform: uppercase; color: var(--muted); }
.modes { display: flex; border: 1px solid var(--line); }
.modes button { min-height: 42px; padding: 9px 23px; border: 0; background: transparent; font-weight: 600; }
.modes button + button { border-left: 1px solid var(--line); }
.modes button[aria-pressed="true"] { background: var(--foreground); color: var(--surface); }
.modes button[aria-pressed="false"]:hover { background: var(--surface-strong); }
.save-button { min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 10px 16px; border: 1px solid var(--accent); background: var(--accent); color: var(--surface); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.save-button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.viewer-nav { height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 28px; border-bottom: 1px solid var(--line); font-size: 12px; background: var(--background); }
.viewer-trail { display: flex; align-items: center; gap: 12px; }
.viewer-trail > span { color: var(--muted); }
.viewer-nav a { text-decoration: none; }
.viewer-nav a:hover { color: var(--accent-dark); text-decoration: underline; text-underline-offset: 3px; }
.back-to-product { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.back-to-product svg { width: 17px; height: 17px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 320px; height: calc(100dvh - 120px); min-height: 600px; }
.viewport { position: relative; min-width: 0; overflow: hidden; background: var(--background); }
.model-caption { position: absolute; z-index: 1; top: 28px; left: 32px; pointer-events: none; }
.model-caption h1 { margin: 0 0 7px; font: 900 36px/1.15 var(--font-display); }
.model-caption h1 > span { color: var(--accent-dark); }
.model-caption p { margin: 0; font-size: 14px; color: var(--muted); }
.caption-specs { display: flex; flex-wrap: wrap; margin-top: 18px; gap: 8px 18px; font: 11px/1.5 var(--font-utility); color: var(--muted); }
.caption-specs > span:first-child { color: var(--foreground); }
.caption-specs > span + span { border-left: 1px solid var(--line); padding-left: 18px; }
#canvas-host { width: 100%; height: 100%; touch-action: none; }
#canvas-host:focus-visible { outline-offset: -4px; }
canvas { display: block; width: 100%; height: 100%; }
#loading { position: absolute; left: 50%; top: 48%; transform: translate(-50%, -50%); width: min(360px, 85%); padding: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); text-align: center; }
.view-buttons { position: absolute; bottom: 58px; left: 50%; transform: translateX(-50%); display: flex; white-space: nowrap; border: 1px solid var(--line); background: var(--surface); }
.view-buttons button { min-height: 42px; padding: 10px 17px; border: 0; background: transparent; font-size: 12px; }
.view-buttons button + button { border-left: 1px solid var(--line); }
.view-buttons button[aria-pressed="true"] { background: var(--foreground); color: var(--surface); }
.view-buttons button[aria-pressed="false"]:hover { background: var(--surface-strong); }
.gesture-hint { position: absolute; bottom: 17px; left: 0; right: 0; margin: 0; text-align: center; font-size: 11px; color: var(--muted); pointer-events: none; }
.gesture-hint span[aria-hidden] { padding: 0 10px; color: var(--line); }
.gesture-touch { display: none; }
.reset-button { position: absolute; right: 24px; bottom: 16px; display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); background: var(--surface); }
.reset-button:hover { background: var(--surface-strong); }

.settings { padding: 28px 24px 24px; overflow-y: auto; border-left: 1px solid var(--line); background: var(--surface); scrollbar-width: thin; scrollbar-color: var(--line) var(--surface); }
.settings-section + .settings-section { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 24px; }
.settings h2 { margin: 0 0 20px; font: 800 18px/1.25 var(--font-display); }
.field-label { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 17px 0 7px; color: var(--muted); font-size: 12px; }
.field-label output { font: 12px var(--font-utility); color: var(--accent-dark); }
select { width: 100%; min-height: 44px; padding: 10px 30px 10px 11px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; cursor: pointer; }
select:hover { border-color: var(--muted); }
.specs { margin: 20px 0 0; padding: 13px 12px; background: var(--background); font-size: 11px; }
.specs > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.specs > div + div { margin-top: 9px; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; font-family: var(--font-utility); font-variant-numeric: tabular-nums; }
input[type="range"] { appearance: none; display: block; width: 100%; height: 24px; margin: 0; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 3px; background: var(--line); }
input[type="range"]::-moz-range-track { height: 3px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb { appearance: none; width: 16px; height: 16px; margin-top: -6.5px; border: 2px solid var(--accent); background: var(--surface); }
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border: 2px solid var(--accent); border-radius: 0; background: var(--surface); }
.range-scale { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 15px; font-size: 10px; color: var(--muted); }
.check-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 40px; font-size: 12px; cursor: pointer; }
.check-row > span { display: flex; align-items: center; gap: 9px; }
input[type="checkbox"] { appearance: none; position: relative; flex-shrink: 0; width: 18px; height: 18px; margin: 0; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
input[type="checkbox"]:checked { border-color: var(--accent); background: var(--accent); }
input[type="checkbox"]:checked::after { content: ""; position: absolute; left: 3px; top: 4px; width: 9px; height: 5px; border-left: 2px solid var(--surface); border-bottom: 2px solid var(--surface); transform: rotate(-45deg); }
input:disabled { opacity: .4; cursor: default; }
.field-label:has(+ input:disabled) { opacity: .5; }
.swatch { display: inline-block; width: 8px; height: 8px; }
.steel { background: #62686c; }
.anchor { background: #747a7b; }
.cage { background: #56504a; }
.rib { background: #a3998d; }
.reinforcement-note { margin: 14px 0 0; font-size: 11px; line-height: 1.65; color: var(--muted); }
.model-note { margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 11px; line-height: 1.65; color: var(--muted); }
noscript { display: block; padding: 20px; }

@media (min-width: 1700px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 350px; }
  .settings { padding: 32px; }
  .model-caption { top: 36px; left: 40px; }
  .model-caption h1 { font-size: 42px; }
}
@media (max-width: 1000px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 280px; }
  .settings { padding: 24px 18px; }
  .topbar, .viewer-nav { padding-inline: 20px; }
  .model-caption { left: 24px; }
  .model-caption h1 { font-size: 30px; }
  .view-buttons button { padding-inline: 12px; }
  .gesture-hint { bottom: 25px; font-size: 10px; }
  .reset-button { right: 16px; }
}
@media (max-width: 760px) {
  .topbar { height: 116px; padding: 12px 18px; display: grid; grid-template-columns: 1fr auto; gap: 12px; }
  .brand-mark { width: 36px; height: 36px; font-size: 18px; }
  .brand-name { font-size: 22px; }
  .brand-tagline { font-size: 9px; }
  .save-button { grid-column: 2; grid-row: 1; min-height: 40px; padding: 9px 12px; }
  .save-button span { display: none; }
  .modes { grid-column: 1 / -1; grid-row: 2; }
  .modes button { flex: 1; min-height: 36px; padding: 7px 12px; font-size: 12px; }
  .viewer-nav { height: 44px; padding-inline: 18px; font-size: 11px; }
  .workspace { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .viewport { height: 66dvh; min-height: 450px; max-height: 660px; }
  .model-caption { top: 24px; left: 22px; }
  .model-caption p { font-size: 12px; }
  .caption-specs { margin-top: 12px; font-size: 10px; }
  .settings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 28px; padding: 26px 22px; overflow: visible; border-left: 0; border-top: 1px solid var(--line); }
  .settings-section + .settings-section { margin: 0; border: 0; padding: 0; }
  .model-note { grid-column: 1 / -1; }
  .view-buttons { bottom: 66px; }
  .view-buttons button { min-height: 40px; padding: 9px 12px; font-size: 11px; }
  .gesture-hint { bottom: 17px; left: 14px; right: 54px; font-size: 10px; }
  .gesture-hint span[aria-hidden] { padding-inline: 5px; }
  .reset-button { width: 36px; height: 36px; right: 14px; bottom: 10px; }
}
@media (max-width: 520px) {
  .viewer-context, .viewer-trail > span[aria-hidden] { display: none; }
  .settings { display: block; }
  .settings-section + .settings-section { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
  .check-row { min-height: 44px; font-size: 13px; }
}
@media (pointer: coarse) {
  .gesture-desktop { display: none; }
  .gesture-touch { display: inline; }
}
