:root {
  --ink: #0b1a4a;
  --ink-soft: #55607f;
  --royal: #0a3aa8;
  --gold: #c9962d;
  --gold-bright: #f0c25a;
  --paper: #eceef2;
  --paper-2: #dfe3ea;
  --line: rgba(11, 26, 74, .13);
  --glass: rgba(255, 255, 255, .72);
  --radius: 14px;
  --sans: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Instrument Serif', 'Times New Roman', serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 500 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 2px solid var(--royal); outline-offset: 2px; }
h1, h2, p { margin: 0; }

/* ---- viewer ---- */
.viewer {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 620px;
  overflow: hidden;
  background:
    radial-gradient(120% 70% at 50% 64%, #f8f9fb 0%, #eef0f4 46%, #dcdfe7 100%);
}
.viewer:fullscreen { min-height: 0; }
.stage { position: absolute; inset: 0; }
.stage canvas {
  display: block; width: 100%; height: 100%;
  cursor: grab; touch-action: none; outline: none;
  opacity: 0; transition: opacity .9s ease;
}
.stage canvas:active { cursor: grabbing; }
.is-ready .stage canvas { opacity: 1; }

.masthead {
  position: absolute; top: clamp(18px, 3.2vh, 34px); left: clamp(18px, 3vw, 44px);
  display: grid; gap: clamp(14px, 2.4vh, 26px);
  max-width: min(560px, 80vw);
  pointer-events: none;
}
.masthead__copy { transition: opacity .4s; }
.is-end .masthead__copy { opacity: 0; }
.logo {
  width: 148px; aspect-ratio: 590 / 215;
  background: var(--ink);
  -webkit-mask: url(../assets/brand/logo.png) left center / contain no-repeat;
  mask: url(../assets/brand/logo.png) left center / contain no-repeat;
}
.eyebrow {
  font-size: 11.5px; font-weight: 700; letter-spacing: .15em; text-transform: uppercase;
  color: var(--gold);
}
h1 {
  font: 400 clamp(34px, 3.7vw, 54px)/1.02 var(--serif);
  letter-spacing: -.012em;
  margin-top: 6px;
}
h1 em { color: var(--royal); }
.design-line { margin-top: 8px; color: var(--ink-soft); font-size: 14px; }

.tools {
  position: absolute; top: clamp(18px, 3.2vh, 34px); right: clamp(18px, 3vw, 44px);
  display: flex; gap: 8px;
}
.icon {
  width: 42px; height: 42px; display: grid; place-items: center;
  border-radius: 50%; background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: background .2s, color .2s, transform .15s;
}
.icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon:hover { background: #fff; }
.icon:active { transform: scale(.94); }
.icon.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }

.hint {
  position: absolute; left: 50%; bottom: 112px; transform: translateX(-50%);
  font-size: 12.5px; color: var(--ink-soft); letter-spacing: .02em;
  padding: 5px 12px; border-radius: 99px; background: rgba(255,255,255,.55);
  pointer-events: none; transition: opacity .5s; white-space: nowrap;
}
.hint.is-gone { opacity: 0; }

.dock {
  position: absolute; left: 50%; bottom: clamp(14px, 2.4vh, 26px); transform: translateX(-50%);
  width: min(1400px, calc(100% - 24px));
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 10px 12px;
  border-radius: 18px;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 10px 34px rgba(11, 26, 74, .10);
}
.dock__group { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dock__label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft);
  padding-left: 6px;
}
.tabs, .chips { display: flex; gap: 4px; }
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 11px 7px 7px; border-radius: 11px;
  font-weight: 600; font-size: 13px; white-space: nowrap;
  transition: background .2s, color .2s;
}
.tab i {
  width: 22px; height: 22px; display: grid; place-items: center; border-radius: 7px;
  font: 700 12px var(--sans); background: rgba(11, 26, 74, .08);
  transition: background .2s, color .2s;
}
.tab:hover { background: rgba(11, 26, 74, .06); }
.tab.is-on { background: var(--ink); color: #fff; }
.tab.is-on i { background: var(--gold-bright); color: var(--ink); }
.chip {
  padding: 7px 10px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--ink-soft);
  white-space: nowrap; transition: background .2s, color .2s;
}
.chip:hover { background: rgba(11, 26, 74, .06); color: var(--ink); }
.chip.is-on { color: var(--royal); background: rgba(10, 58, 168, .10); }
.chip--alt { border: 1px solid var(--line); color: var(--ink); }
.chip--alt.is-on { background: var(--ink); color: #fff; border-color: var(--ink); }

.loader {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 22px;
  background: var(--paper); transition: opacity .7s ease;
}
.is-ready .loader { opacity: 0; pointer-events: none; }
.loader[hidden] { display: none; }
.loader__mark {
  width: 190px; aspect-ratio: 590 / 215; background: var(--ink);
  -webkit-mask: url(../assets/brand/logo.png) center / contain no-repeat;
  mask: url(../assets/brand/logo.png) center / contain no-repeat;
}
.loader__track { width: 190px; height: 2px; background: var(--line); overflow: hidden; }
#loader-bar { height: 100%; background: var(--gold); transform: scaleX(.06); transform-origin: left; transition: transform .3s ease; }

.fallback { display: none; position: absolute; left: 50%; top: 52%; transform: translate(-50%,-50%); text-align: center; color: var(--ink-soft); padding: 0 20px; }
.no-webgl .fallback { display: block; }
.no-webgl .dock, .no-webgl .tools, .no-webgl .hint { display: none; }
.no-webgl .viewer { height: 60vh; min-height: 420px; }

/* ---- artwork ---- */
.artwork { padding: clamp(48px, 8vh, 96px) clamp(18px, 4vw, 64px) clamp(40px, 6vh, 72px); background: #fff; }
.artwork__head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap;
  max-width: 1320px; margin: 0 auto 32px;
}
h2 { font: 400 clamp(32px, 3.6vw, 48px)/1.05 var(--serif); margin-top: 6px; }
.artwork__line { color: var(--ink-soft); margin-top: 8px; }
.tabs--light .tab { border: 1px solid var(--line); }
.grid {
  max-width: 1320px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px;
}
.flat { margin: 0; min-width: 0; }
.flat--pass, .flat--drv { grid-column: span 5; }
.flat--rear { grid-column: span 2; }
.flat button {
  display: flex; width: 100%; height: clamp(150px, 19vw, 280px); padding: 10px; align-items: center; justify-content: center;
  background: #f4f5f8; border-radius: var(--radius); overflow: hidden;
  transition: background .2s;
}
.flat button:hover { background: var(--paper-2); }
.flat img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.flat figcaption { display: grid; gap: 1px; margin-top: 10px; font-size: 13px; }
.flat figcaption span { color: var(--ink-soft); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.flat figcaption b { font-weight: 600; }

.foot {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 18px clamp(18px, 4vw, 64px); background: #fff; border-top: 1px solid var(--line);
  color: var(--ink-soft); font-size: 12.5px;
}

/* ---- responsive ---- */
@media (max-width: 1400px) {
  .dock { flex-direction: column; align-items: stretch; gap: 6px; }
  .dock__group { justify-content: space-between; }
  .chips, .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .chips::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
  .hint { bottom: 136px; }
}
@media (max-width: 1080px) {
  .flat--pass, .flat--drv { grid-column: span 12; }
  .flat--rear { grid-column: span 12; }
  .flat button { height: auto; aspect-ratio: 2.1; }
  .flat--rear button { aspect-ratio: 1.6; }
}
@media (max-width: 720px) {
  .viewer { height: auto; min-height: 0; overflow: visible; display: flex; flex-direction: column; }
  .stage { position: relative; inset: auto; height: 56svh; min-height: 300px; order: 2; }
  .masthead { position: relative; top: auto; left: auto; order: 1; padding: 16px 16px 0; gap: 12px; max-width: none; }
  .logo { width: 116px; }
  h1 { font-size: 34px; }
  .design-line { font-size: 14px; }
  .tools { top: 14px; right: 16px; }
  .icon { width: 38px; height: 38px; }
  #btn-in, #btn-out { display: none; }
  .hint { position: relative; left: auto; bottom: auto; transform: none; order: 3; align-self: center; margin-top: -30px; }
  .dock { position: relative; left: auto; bottom: auto; transform: none; width: auto; margin: 8px 16px 16px; order: 4; }
  .dock__group { flex-direction: column; align-items: stretch; gap: 4px; }
  .dock__label { padding-top: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: .01ms !important; }
}
