/* The first screen: pitch, live preview, and the control strip. */
.bench { display: grid; grid-template-rows: 1fr auto; min-height: calc(100svh - var(--header)); }

.hero {
  display: grid; grid-template-columns: minmax(280px, 36fr) 64fr; align-items: center;
  padding: 12px var(--gutter) 28px; min-height: 0;
}
.hero h1 .short { display: none; }
@media (max-width: 640px) {
  .hero h1 .long { display: none; }
  .hero h1 .short { display: inline; }
}
.hero h1 { font-stretch: 118%; font-weight: 800; font-size: clamp(34px, 4.3vw, 62px); line-height: 0.98; margin: 0 0 20px; letter-spacing: -0.02em; }
/* The heading drifts between orange and light sky blue. The gradient is two
   headings wide and ends where it starts, so one full shift loops unseen. */
.hero h1 {
  background: linear-gradient(100deg, #ff8a3d, #ffb53d, #87cefa, #c6e9ff, #87cefa, #ffb53d, #ff8a3d) 0 0 / 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-bottom: 0.12em; margin-bottom: calc(20px - 0.12em);
  animation: drift 16s linear infinite;
}
@keyframes drift { to { background-position: 200% 0; } }
/* The sentence under the heading keeps the look it had as an h4. */
.hero p { margin: 1.33em 0; font-weight: bold; }

.stage { height: min(62vh, 640px); min-height: 300px; }
.stage svg { width: 100%; height: 100%; overflow: visible; display: block; }
.stage .face { stroke: #2a1a0c; stroke-width: 1.4; stroke-linejoin: round; }
.stage .top { fill: var(--birch-light); }
.stage .left { fill: var(--birch); }
.stage .right { fill: var(--birch-dark); }
.stage .tilted { fill: color-mix(in oklab, var(--birch-light) 55%, var(--birch)); }
.stage .inside { stroke: #2a1a0c; stroke-width: 1; }
.stage .floor { fill: #6b5231; }
.stage .far { fill: #a98a57; }
.stage .back { fill: #8f7345; }
.stage .finger { fill: var(--char); opacity: 0.9; }
.stage .hot-thickness .finger { fill: var(--amber); opacity: 1; }
.stage .shadow { fill: #000; opacity: 0.42; filter: blur(14px); }
.stage .dim line { stroke: #5f6c78; stroke-width: 1.4; }
.stage .dim text { fill: var(--mute); font-stretch: 110%; text-anchor: middle; dominant-baseline: middle; paint-order: stroke; stroke: var(--bed); stroke-width: 8px; }
.stage .dim.hot line { stroke: var(--amber); stroke-width: 3; }
.stage .dim.hot text { fill: var(--amber); font-weight: 600; }

.panel {
  position: relative; margin: 0;
  background: var(--panel); border-top: 3px solid var(--amber); border-bottom: 1px solid var(--rule);
  /* The choices, the three sides, thickness, notch, Generate. */
  display: grid; grid-template-columns: minmax(max-content, 1.3fr) repeat(3, minmax(0, 1fr)) minmax(0, 1.35fr) minmax(0, 1.2fr) minmax(140px, 1.1fr);
}
/* Why the box cannot be made: a bright red pill above the strip. */
.hint {
  position: absolute; left: var(--gutter); bottom: calc(100% + 10px); margin: 0; max-width: calc(100% - 2 * var(--gutter));
  padding: 6px 16px; border-radius: 99px; background: var(--error); color: #fff; font-size: 14px; font-weight: 700; line-height: 1.35;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.35);
}
.hint:empty { display: none; }

.field { position: relative; padding: 16px clamp(12px, 1.5vw, 22px) 14px; border-right: 1px solid var(--rule); display: grid; gap: 10px; align-content: start; }
.field > label { font-size: 13px; color: var(--mute); font-stretch: 110%; cursor: move; user-select: none; touch-action: none; display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; overflow: hidden; }
.field > label i { font-style: normal; opacity: 0; transition: opacity 0.15s; white-space: nowrap; }
.field:hover > label i, .field:focus-within > label i { opacity: 0.7; }
.num { display: flex; align-items: baseline; gap: 6px; }
.num input {
  width: 100%; min-width: 0; background: none; border: 0; padding: 0; outline: 0;
  font-size: clamp(28px, 3.1vw, 44px); font-weight: 300; font-stretch: 110%; line-height: 1.1;
  font-variant-numeric: tabular-nums; caret-color: var(--amber);
}
.num span { font-size: 14px; color: var(--mute); }
.num input::placeholder { color: var(--mute); opacity: 0.7; }
.range { font-size: 13px; color: var(--mute); font-variant-numeric: tabular-nums; }
.field::after { content: ""; position: absolute; inset: auto 0 0 0; height: 3px; background: var(--amber); transform: scaleX(0); transform-origin: left; transition: transform 0.18s ease-out; }
.field:focus-within::after { transform: scaleX(1); }
.field:focus-within .num input { color: var(--amber); }
.field.bad .num input { color: var(--alarm); }
.field.bad::after { background: var(--alarm); transform: scaleX(1); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button, .more, .pick select {
  background: none; border: 1px solid #3a4651; border-radius: 99px; padding: 2px 10px;
  font-size: 13px; color: var(--soft); cursor: pointer;
}
.chips button:hover, .more:hover, .pick select:hover { border-color: var(--soft); }
/* Wraps to "Reset to / defaults" when the Width cell is too narrow for one line. */
.field .restart { text-align: left; border-radius: 14px; }
.reset { position: relative; justify-self: start; }
/* Reset, and the Yes that carries it out, warn in red. */
.field .restart:hover, .field .restart[aria-expanded="true"], .reset .yes:hover { color: var(--error); border-color: var(--error); }
/* The popup sits to the right of Reset, over the next cell, with a point towards the button. */
.reset .confirm {
  position: absolute; z-index: 5; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 6px 8px 6px 12px; border: 1px solid var(--edge); border-radius: 12px;
  background: var(--sheet); box-shadow: 0 4px 16px rgb(0 0 0 / 0.45); font-size: 13px; color: var(--soft);
}
.reset .confirm[hidden] { display: none; }
.reset .confirm::before {
  content: ""; position: absolute; left: -6px; top: 50%; width: 10px; height: 10px;
  background: var(--sheet); border-left: 1px solid var(--edge); border-bottom: 1px solid var(--edge);
  transform: translateY(-50%) rotate(45deg);
}
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }

.side { padding: 14px clamp(12px, 1.5vw, 22px); border-right: 1px solid var(--rule); display: grid; gap: 8px; align-content: center; justify-items: start; }
.seg { display: inline-flex; border: 1px solid #3a4651; border-radius: 99px; padding: 2px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 3px 14px; font-size: 14px; border-radius: 99px; color: var(--soft); cursor: pointer; }
.seg input:checked + span { background: var(--ink); color: var(--panel); }
.seg input:focus-visible + span { outline: 2px solid var(--amber); outline-offset: 2px; }
.pick select { padding: 4px 10px; max-width: 100%; }
/* The column is as wide as its longest option; both dropdowns fill it, so they line up. */
.side .pick { justify-self: stretch; }
.side .pick select { width: 100%; }
.pick select option { background: var(--panel); color: var(--ink); }

/* The slope and front height of a sloped box: a row of its own under the strip, after Generate. */
.sloped { grid-column: 1 / -1; order: 1; display: grid; grid-template-columns: subgrid; border-top: 1px solid var(--rule); }
.sloped[hidden] { display: none; }
/* A text input is twenty characters wide unless told otherwise; without this the Slope input would widen the choices column. */
.sloped > .field { contain: inline-size; }
.sloped .note { grid-column: 3 / -1; margin: 0; padding: 16px clamp(12px, 1.5vw, 22px); align-self: center; max-width: 72ch; font-size: 13px; line-height: 1.4; color: var(--mute); }

.go {
  background: var(--beam); color: #160a04; border: 0; cursor: pointer;
  font-stretch: 120%; font-weight: 800; font-size: clamp(20px, 2vw, 28px);
  display: grid; place-content: center; gap: 2px; text-align: center; padding: 14px;
}
.go small { font-weight: 500; font-stretch: 100%; font-size: 12.5px; opacity: 0.75; }
.go:hover { background: #ff6f45; }
.go:disabled { background: #4a3a34; color: #9b8c86; cursor: not-allowed; }

@media (max-width: 900px) {
  .bench { min-height: 0; }
  .hero { grid-template-columns: 1fr; padding-top: 8px; padding-bottom: 12px; }
  /* As tall as the drawing needs and no taller, so no empty band above and below it. */
  .stage { height: auto; min-height: 0; margin-top: 8px; }
  .stage svg { height: auto; max-height: 50vh; }
  /* Twelve columns: three sides in fourths, then thickness and notch, with slope and front height between them. */
  .panel { grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .panel > .field { grid-column: span 4; }
  .field.thickness { grid-column: span 8; }
  .side, .go, .sloped .note { grid-column: 1 / -1; }
  .sloped { display: contents; }
  .sloped[hidden] { display: none; }
  .sloped:not([hidden]) > .field,
  .panel:has(.sloped:not([hidden])) .field.thickness,
  .panel:has(.sloped:not([hidden])) .field.notch { grid-column: span 3; }
  /* Every control comes before Generate. */
  .field.notch { order: 1; }
  .sloped .note { order: 2; }
  .go { order: 3; }
  /* The choices come first, so every row under them gets a rule. */
  .panel > .field, .sloped > .field, .go { border-top: 1px solid var(--rule); }
  /* Above the measurements, the choices sit in one line beside the units pill, wrapping only when there is no room. */
  .side { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
  .side .pick select { width: auto; }
  .go { padding: 18px; }
  .hint { position: static; grid-column: 1 / -1; justify-self: start; margin: 10px var(--gutter) 0; max-width: none; border-radius: 18px; }
  .sloped .note { grid-column: 1 / -1; padding-top: 0; }
}

/* A phone-width Width cell only has room for "Reset". */
@media (max-width: 520px) {
  .field .restart .wide { display: none; }
}

/* On a phone, Generate is a slim bar under the controls. */
@media (max-width: 640px) {
  .go { padding: 9px 14px; font-size: 18px; }
  .go small { display: none; }
}
