/* Raptor showcase — clean white gallery theme.
   Canvas is full-bleed; chrome is minimal, precise, subordinate to the 3D subject. */

:root {
  --ink: #111418;
  --ink-2: #4a5058;
  --ink-3: #8a9099;
  --line: #e6e8ec;
  --paper: #ffffff;
  --accent: #0a57ff;
  --danger: #d33f49;
  --radius: 14px;
  --dock-blur: saturate(1.4) blur(14px);
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; overflow: hidden; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family:
    ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------------------------------------------------ */
/* Canvas + overlay layers                                             */
/* ------------------------------------------------------------------ */

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
body.state-hotfire #scene { cursor: default; }

#labels {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.part-label {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-200px, -200px);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink-2);
  font-size: 11px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  will-change: transform, opacity;
}
.part-label .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 87, 255, 0.13);
}

#tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 6;
  pointer-events: none;
  padding: 5px 11px;
  border-radius: 8px;
  background: rgba(17, 20, 24, 0.88);
  color: #fff;
  font-size: 12.5px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 120ms ease;
  will-change: transform, opacity;
}

/* ------------------------------------------------------------------ */
/* Loading veil + WebGL fallback                                       */
/* ------------------------------------------------------------------ */

#loading {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: var(--paper);
  transition: opacity 500ms ease;
}
#loading.done { opacity: 0; pointer-events: none; }

.loading-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.loading-inner .bar {
  position: relative;
  width: 148px;
  height: 3px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}
.loading-inner .fill {
  position: absolute;
  inset: 0;
  width: 40%;
  border-radius: 999px;
  background: var(--ink);
  animation: slide 1.1s ease-in-out infinite;
}
@keyframes slide {
  from { transform: translateX(-110%); }
  to { transform: translateX(360%); }
}
.loading-inner .msg { color: var(--ink-3); font-size: 13px; letter-spacing: 0.04em; }
.noscript { color: var(--ink-2); text-align: center; padding: 0 20px; }

#fallback {
  position: fixed;
  inset: 0;
  z-index: 41;
  display: grid;
  place-items: center;
  background: var(--paper);
  padding: 24px;
}
.fallback-card {
  max-width: 420px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: 0 18px 50px rgba(17, 20, 24, 0.08);
}
.fallback-card h1 { margin: 0 0 10px; font-size: 22px; }
.fallback-card p { color: var(--ink-2); margin: 0 0 10px; }
.fallback-card .hint { color: var(--ink-3); font-size: 13px; }

.hidden { display: none !important; }

/* ------------------------------------------------------------------ */
/* Masthead                                                            */
/* ------------------------------------------------------------------ */

.masthead {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 20px 0;
  pointer-events: none;
}
.masthead > * { pointer-events: auto; }

.brand { display: flex; gap: 11px; align-items: center; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
}
.brand-text h1 {
  margin: 0;
  font-size: 19px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}
.brand-text p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.03em;
}

/* ------------------------------------------------------------------ */
/* Chips + control dock                                                */
/* ------------------------------------------------------------------ */

.chip-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  padding: 0 14px;
  min-height: 40px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition:
    border-color 140ms ease,
    color 140ms ease,
    background-color 140ms ease,
    transform 80ms ease;
  touch-action: manipulation;
}
.chip-btn:hover { border-color: #c9ced6; color: var(--ink); }
.chip-btn:active { transform: scale(0.97); }
.chip-btn[aria-pressed='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.chip-btn:focus-visible,
.icon-btn:focus-visible,
.icon-action:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.dock {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  max-width: min(94vw, 760px);
}
.dock-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-btn.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.action-btn.primary[aria-pressed='true'] {
  background: var(--danger);
  border-color: var(--danger);
}
.glyph { font-size: 13px; }
.icon-action {
  width: 40px;
  padding: 0;
  justify-content: center;
  font-size: 16px;
}

.info-toggle { box-shadow: 0 8px 24px rgba(17, 20, 24, 0.07); }

/* ------------------------------------------------------------------ */
/* Stats panel (left rail on desktop, bottom sheet on small screens)   */
/* ------------------------------------------------------------------ */

#stats-panel {
  position: fixed;
  z-index: 4;
  top: calc(74px + env(safe-area-inset-top));
  left: 20px;
  width: 264px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  padding: 18px 18px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 320ms cubic-bezier(0.22, 0.9, 0.3, 1), opacity 240ms ease;
}
body:not(.panel-open) #stats-panel {
  transform: translateX(-24px);
  opacity: 0;
  pointer-events: none;
}

#stats-list { margin: 0; }
.fact-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6.5px 0;
  border-bottom: 1px dashed var(--line);
}
.fact-row:last-child { border-bottom: none; }
.fact-row dt {
  color: var(--ink-3);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.fact-row dd {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.fact-row .note {
  display: block;
  font-weight: 400;
  font-size: 11px;
  color: var(--ink-3);
}

.guide { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.guide h2 {
  margin: 0 0 7px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-3);
}
.guide ul { margin: 0; padding-left: 17px; color: var(--ink-2); font-size: 12.5px; }
.guide li { margin-bottom: 5px; }

/* ------------------------------------------------------------------ */
/* Component info card                                                 */
/* ------------------------------------------------------------------ */

#info-card {
  position: fixed;
  z-index: 6;
  top: calc(74px + env(safe-area-inset-top));
  right: 20px;
  width: min(330px, calc(100vw - 40px));
  padding: 18px 20px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 18px 44px rgba(17, 20, 24, 0.09);
  transform-origin: top right;
  animation: card-in 220ms cubic-bezier(0.22, 0.9, 0.3, 1);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  #info-card { animation: none; }
}

#info-card .eyebrow {
  margin: 0 26px 4px 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--accent);
}
#info-card h2 { margin: 0 0 8px; font-size: 17.5px; letter-spacing: -0.005em; }
#info-chip {
  display: inline-block;
  margin: 0 0 9px;
  padding: 2.5px 9px;
  border-radius: 999px;
  background: rgba(10, 87, 255, 0.08);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
#info-caption { margin: 0; color: var(--ink-2); font-size: 13.5px; }

.icon-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ink-3);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.icon-btn:hover { background: var(--line); color: var(--ink); }

/* ------------------------------------------------------------------ */
/* Responsive — mobile portrait                                        */
/* ------------------------------------------------------------------ */

@media (max-width: 720px) {
  .masthead { padding: calc(12px + env(safe-area-inset-top)) 14px 0; }
  .brand-text p { display: none; }
  .brand-mark { width: 34px; height: 34px; }

  /* Stats panel becomes an expandable sheet above the dock. */
  #stats-panel {
    top: auto;
    left: 14px;
    right: 14px;
    bottom: calc(128px + env(safe-area-inset-bottom));
    width: auto;
    max-height: 46vh;
    transform-origin: bottom center;
  }
  body:not(.panel-open) #stats-panel { transform: translateY(14px); }

  .dock {
    bottom: calc(12px + env(safe-area-inset-bottom));
    width: 100vw;
    padding: 0 10px;
  }
  .chip-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    padding: 2px;
    scrollbar-width: none;
  }
  .chip-row::-webkit-scrollbar { display: none; }
  .preset-btn { flex: 0 0 auto; }

  .chip-btn { min-height: 42px; font-size: 13px; }
  .icon-action { width: 42px; }

  #info-card {
    top: auto;
    bottom: calc(128px + env(safe-area-inset-bottom));
    right: 14px;
    left: 14px;
    width: auto;
    transform-origin: bottom center;
  }

  /* Keep chrome out of the engine's way while inspecting. */
  body.panel-open #stats-panel ~ .dock { opacity: 0.94; }
}

@media (max-width: 380px) {
  .action-btn .glyph { display: none; }
  .brand-text h1 { font-size: 17px; }
}

/* Landscape phones: keep dock compact so it never covers the bell. */
@media (max-height: 480px) {
  #stats-panel { max-height: 56vh; }
  .dock { gap: 6px; }
  .brand-mark { display: none; }
}

/* Reduced motion: shorten global transitions. */
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}
