/* ============================================================
   Drawer Divider — the same design system as zanbaghi.com:
   cool near-black ground, warm bone ink, one amber accent,
   serif for voice, sans for furniture, mono for figures.
   ============================================================ */

:root {
  --ground: #08080a;
  --raised: #121218;
  --raised-2: #17171e;
  --ink: #f2f0ed;
  --ink-2: #cfcac3;
  --ink-3: #a29c93;
  --ink-4: #8b8880;
  --accent: #e9a44c;
  --danger: #e2593f;
  --rule: rgba(242, 240, 237, 0.1);
  --rule-2: rgba(242, 240, 237, 0.16);
  --edge: rgba(242, 240, 237, 0.4);

  --serif: "Newsreader", Georgia, serif;
  --sans: "Inter Tight", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --r: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  background: var(--ground);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-x: clip;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding-inline: clamp(20px, 4vw, 40px);
}

.spacer {
  flex: 1;
}

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 50;
  padding: 8px 16px;
  color: var(--ground);
  background: var(--accent);
  border-radius: 6px;
  transition: top 200ms var(--ease);
}

.skip:focus {
  top: 16px;
}

/* --- header ------------------------------------------------ */

.top {
  border-bottom: 1px solid var(--rule);
}

.top-in {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.tag {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
}

/* --- layout -------------------------------------------------
   Controls beside the model, readout spanning underneath. The
   viewer gets the larger half: it is the thing being judged. */

.layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  grid-template-areas: "controls stage" "readout readout";
  gap: 26px;
  padding-block: 30px 60px;
  align-items: start;
}

#controls {
  grid-area: controls;
}
.stage {
  grid-area: stage;
}
.readout {
  grid-area: readout;
}

@media (max-width: 940px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "stage" "controls" "readout";
  }
}

/* --- controls ---------------------------------------------- */

.panel {
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 22px;
}

.ph {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.012em;
}

.ph--sep {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}

.pnote {
  margin-top: 3px;
  font-size: 13px;
  color: var(--ink-4);
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.f {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.f--wide {
  margin-top: 14px;
}

.f-l {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-4);
}

.f-l em {
  font-style: normal;
  color: var(--ink-faint, #6b6860);
}

.f-l b {
  float: right;
  font-weight: 400;
  color: var(--accent);
}

.f input[type="number"] {
  width: 100%;
  padding: 9px 11px;
  font: inherit;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  background: var(--raised-2);
  border: 1px solid var(--rule-2);
  border-radius: 9px;
  transition: border-color 140ms var(--ease);
}

.f input[type="number"]:focus {
  outline: none;
  border-color: var(--accent);
}

.f input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.hint {
  font-size: 12px;
  color: var(--ink-4);
}

/* A control that no longer applies is dimmed and inert rather than
   removed, so the panel does not reflow when the mode changes. */
.off {
  opacity: 0.4;
  pointer-events: none;
}

.seg {
  display: flex;
  margin-top: 12px;
  padding: 3px;
  gap: 2px;
  background: var(--raised-2);
  border: 1px solid var(--rule-2);
  border-radius: 10px;
}

.seg button {
  flex: 1;
  padding: 8px 6px;
  font: inherit;
  font-size: 13px;
  color: var(--ink-4);
  background: none;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  transition:
    color 140ms var(--ease),
    background 140ms var(--ease);
}

.seg button:hover {
  color: var(--ink);
}

.seg button[aria-pressed="true"] {
  color: var(--ground);
  background: var(--ink);
}

.acts {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.btn {
  flex: 1;
  padding: 11px 18px;
  font: inherit;
  font-weight: 500;
  color: var(--ground);
  background: var(--ink);
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  transition:
    background 140ms var(--ease),
    transform 120ms var(--ease);
}

.btn:hover:not(:disabled) {
  background: #fff;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ghost {
  padding: 11px 16px;
  font: inherit;
  font-size: 14px;
  color: var(--ink-3);
  background: none;
  border: 1px solid var(--rule-2);
  border-radius: 9px;
  cursor: pointer;
  transition:
    color 140ms var(--ease),
    border-color 140ms var(--ease);
}

.ghost:hover {
  color: var(--ink);
  border-color: var(--accent);
}

.ghost.sm {
  padding: 6px 12px;
  font-size: 12px;
}

.err {
  margin-top: 14px;
  padding-left: 12px;
  border-left: 2px solid var(--danger);
  font-size: 13px;
  color: var(--ink-3);
}

/* --- viewer ------------------------------------------------- */

.stage {
  position: relative;
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  overflow: hidden;
  /* A fixed aspect keeps the canvas from collapsing before the first
     render and stops the page jumping when the model loads.
     No min-height alongside it: with aspect-ratio set, a minimum height
     drives the WIDTH instead (320px tall x 4/3 = 427px wide), which
     pushed the viewer past a 390px viewport. */
  width: 100%;
  aspect-ratio: 4 / 3;
}

#view {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.stage-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  font-size: 12px;
  color: var(--ink-4);
  background: linear-gradient(to top, rgba(8, 8, 10, 0.9), transparent);
}

.stage-hint {
  position: absolute;
  top: 14px;
  left: 16px;
  font-size: 12px;
  color: var(--ink-4);
  pointer-events: none;
}

/* --- readout ------------------------------------------------ */

.readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border: 1px solid var(--rule);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--raised);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 16px 18px;
  border-right: 1px solid var(--rule);
}

.stat:last-child {
  border-right: 0;
}

.s-l {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-4);
}

.s-v {
  font-size: 16px;
  color: var(--ink);
}

.s-v.bad {
  color: var(--danger);
}

/* --- footer ------------------------------------------------- */

.foot {
  border-top: 1px solid var(--rule);
}

.foot-in {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 0;
  font-size: 13px;
  color: var(--ink-4);
}

.foot a:hover {
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}

/* The wordmark is a flourish, not information: at phone widths it pushes
   the header past the viewport, so it goes rather than wraps. */
@media (max-width: 520px) {
  .tag {
    display: none;
  }
  .fields {
    grid-template-columns: 1fr 1fr;
  }
  /* Squarer on a phone: 4:3 of a 350px column is only 262px of model. */
  .stage {
    aspect-ratio: 1 / 1;
  }
}
