/* ==========================================================================
   PAGE LAYOUT (css/engine/layout.css)
   The 3D stage and the configurator dock share the viewport, so no panel
   covers rendered pixels. Landscape: the dock is a right column. Portrait: it
   is a bottom sheet. The stage box is the canvas box; resizeCanvas() follows
   it. UI surfaces are opaque: no backdrop or image filters.
   ========================================================================== */
:root {
  --stage-gap: 16px;
  --dock-w: clamp(320px, 30vw, 420px);
  --dock-h: 46dvh;
  --stage-right: var(--dock-w);
  --stage-bottom: 0px;
  --stage-safe-bottom: env(safe-area-inset-bottom, 0px);
  --stage-top-offset: calc(var(--stage-gap) + env(safe-area-inset-top, 0px));
}

@media (orientation: portrait) {
  :root {
    --stage-gap: 12px;
    --stage-right: 0px;
    --stage-bottom: var(--dock-h);
    --stage-safe-bottom: 0px;
  }
}

/* --------------------------------------------------------------------------
   Stage. Layout containment makes it the containing block of the overlays
   inside it (toolbar, FPS, split view, hints); as a size container it lets
   them follow the width of the 3D view (header.css, below).
   -------------------------------------------------------------------------- */
.canvas-wrapper {
  position: fixed;
  inset: 0 var(--stage-right) var(--stage-bottom) 0;
  contain: layout;
  container: stage / inline-size;
}

.canvas-wrapper #glCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.runtime-fps {
  top: calc(var(--stage-top-offset) + 56px);
  left: 50%;
  z-index: 80;
  transform: translateX(-50%);
  background: var(--background-secondary);
}

.less-engine-home {
  left: var(--stage-gap);
  bottom: calc(var(--stage-gap) + var(--stage-safe-bottom));
  width: 76px;
  z-index: 100;
}

.engine-first-touch-hint {
  bottom: calc(var(--stage-gap) + var(--stage-safe-bottom) + 60px);
}

.split-label {
  top: calc(var(--stage-top-offset) + 64px);
}

.split-label-a {
  left: calc(50% - 100px);
}

.split-label-b {
  left: calc(50% + 16px);
}

.edit-mode-pill {
  top: calc(var(--stage-top-offset) + 112px);
  right: calc(var(--stage-right) + var(--stage-gap));
}

/* Phones: the environment pills take the second top row (header.css), so
   the FPS readout moves beside them and the Less mark to the first row. */
@container stage (max-width: 599px) {
  .runtime-fps {
    top: calc(var(--stage-top-offset) + 60px);
    left: var(--stage-gap);
    transform: none;
  }

  .less-engine-home {
    inset: calc(var(--stage-top-offset) + 6px) var(--stage-gap) auto auto;
    width: 60px;
    height: 32px;
  }

  .engine-first-touch-hint {
    bottom: calc(var(--stage-gap) + 100px);
  }
}

/* Stages just wide enough for one bottom row of camera pills (header.css):
   the Less mark stands above that 52px bar instead of under its plate. */
@container stage (min-width: 600px) and (max-width: 707px) {
  .less-engine-home {
    bottom: calc(var(--stage-gap) + var(--stage-safe-bottom) + 58px);
  }
}

/* --------------------------------------------------------------------------
   Dock (mockup): head with client, model and key specs, the tab switch, one
   pane, and the footer with the total, the quote request and text actions.
   -------------------------------------------------------------------------- */
.config-dock {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: var(--z-sidebar);
  width: var(--dock-w);
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px);
  border-left: 1px solid var(--ui-line);
  background: var(--ui-bg);
  color: var(--ui-ink);
  font-family: var(--font-sans);
}

.dock-head {
  flex: none;
  padding: 24px 26px 0;
}

.dock-kicker {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  color: var(--ui-accent-text);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* Marine kicker: a short accent rule before the label (admin ".kicker"). */
.dock-kicker::before {
  content: "";
  flex: none;
  width: 18px;
  height: 2px;
  margin-top: 8px;
  border-radius: 2px;
  background: currentColor;
}

.dock-title {
  margin: 4px 0 2px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.dock-sub {
  margin: 0;
  color: var(--ui-mute);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.dock-kicker:empty,
.dock-sub:empty {
  display: none;
}

/* Tabs: the admin's segmented control (track, raised white segment). */
.dock-tabs {
  display: flex;
  gap: 4px;
  margin-top: 18px;
  padding: 4px;
  border-radius: 12px;
  background: var(--ui-track);
  box-shadow: inset 0 0 0 1px rgba(229, 226, 218, 0.6);
}

.dock-tabs [role="tab"] {
  flex: 1 1 0;
  padding: 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ui-mute);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.dock-tabs [role="tab"]:hover:not([aria-selected="true"]) {
  background: rgba(255, 254, 251, 0.55);
  color: var(--ui-ink);
}

.dock-tabs [role="tab"][aria-selected="true"] {
  background: var(--ui-raised);
  color: var(--ui-accent-text);
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(15, 29, 48, 0.14), inset 0 0 0 1px rgba(29, 29, 27, 0.07);
}

.dock-tabs [role="tab"]:focus-visible {
  outline: 2px solid var(--ui-ring);
  outline-offset: 1px;
}

.dock-tabs [role="tab"][hidden],
.config-dock > .dock-pane[hidden] {
  display: none;
}

.config-dock > .dock-pane {
  flex: 1 1 auto;
  min-height: 0;
}

.dock-info,
.dock-controls {
  padding: 18px 26px 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dock-controls {
  display: grid;
  align-content: start;
  gap: 12px;
}

/* Footer: a white summary band (total, quote request, text actions). */
.dock-foot {
  position: relative;
  flex: none;
  padding: 14px 26px calc(20px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--ui-line);
  background: var(--ui-card);
}

.dock-foot .config-info-footer {
  margin-bottom: 12px;
}

/* Request a quote: the one primary action (admin ".btn.primary"). */
.dock-quote {
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  background: var(--ui-accent);
  color: var(--ui-on-accent);
  box-shadow: var(--ui-shadow-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.005em;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.dock-quote:hover {
  background: var(--ui-accent-hover);
}

.dock-quote:active {
  background: var(--ui-accent-hover);
  box-shadow: none;
}

.dock-quote:focus-visible {
  outline: 2px solid var(--ui-ring);
  outline-offset: 2px;
}

/* Quote request failed (css/quote-request.css draws the "!" disc): the
   admin's ".btn.danger" card instead of a red ring on the marine fill. */
.dock-foot .dock-quote[data-quote-state="error"] {
  background: var(--ui-card);
  color: var(--ui-danger);
  box-shadow: inset 0 0 0 1px #d8a89d, var(--ui-shadow-xs); /* danger 35% on line */
}

/* Quote form fields: the azure ring with halo of every other input. */
.dock-foot .quote-field input:focus-visible {
  outline: 0;
  border-color: var(--ui-ring);
  box-shadow: 0 0 0 3px var(--ui-focus);
}

.dock-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
}

/* Portrait: a bottom sheet. The model and its switcher sit on the stage and
   the specs live in Info, so the head keeps only the tabs; the footer puts
   the total, the text actions and the quote request in one row. */
@media (orientation: portrait) {
  .config-dock {
    inset: auto 0 0 0;
    width: auto;
    height: var(--dock-h);
    padding-top: 0;
    border-left: 0;
    border-top: 1px solid var(--ui-line);
  }

  .dock-head {
    padding: 12px 26px 0;
  }

  .dock-kicker,
  .dock-title,
  .dock-sub {
    display: none;
  }

  .dock-tabs {
    margin-top: 0;
  }

  .dock-foot {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(180px, 240px);
    align-items: center;
    column-gap: 24px;
    padding: 10px 26px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .dock-foot .config-info-footer {
    grid-area: 1 / 1;
    margin: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  .dock-foot .config-total-price {
    align-items: flex-start;
  }

  .dock-actions {
    grid-area: 1 / 2;
    justify-content: center;
    gap: 20px;
    margin: 0;
  }

  .dock-quote {
    grid-area: 1 / 3;
    padding: 12px;
  }
}

/* Tablet portrait: a taller sheet, and Info reads in two columns (Controls:
   canvas.css, Configure: sidebar.css). */
@media (orientation: portrait) and (min-width: 600px) {
  :root {
    --dock-h: 50dvh;
  }

  .dock-info {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    column-gap: 26px;
  }
}

/* Phones: the total shares a row with the quote request; the actions follow. */
@media (orientation: portrait) and (max-width: 599px) {
  .dock-head {
    padding: 10px 16px 0;
  }

  .dock-info,
  .dock-controls {
    padding: 14px 16px 10px;
  }

  .dock-foot {
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 16px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .dock-quote {
    grid-area: 1 / 2;
  }

  .dock-actions {
    grid-area: 2 / 1 / 3 / -1;
    justify-content: space-between;
    margin-top: 6px;
  }
}

/* Hotspot labels (overlays.css): the marine dot only on wide stages, so the
   labels over the boat stay compact on tablets and phones. */
@container stage (min-width: 900px) {
  .variant-hotspot.text-hotspot::before {
    content: "";
    flex: none;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ui-accent);
  }
}

/* Lead form states (loading.css is at its line ceiling): the admin's tinted
   danger box for the form error and the dashboard's invalid field border. */
#loading-screen .crm-error:not(:empty) {
  padding: 9px 12px;
  border: 1px solid #d7a69b; /* danger 36% on line */
  border-radius: 11px;
  background: #fcf4f1; /* danger 5% on card */
}

#loading-screen .crm-form input:user-invalid {
  border-color: #c47a6c; /* danger 55% on line-strong */
}

#loading-screen .crm-form input:user-invalid:focus {
  box-shadow: 0 0 0 3px rgba(191, 59, 43, 0.14);
}
