/* ==========================================================================
   Bench — design your own watch.

   Deliberately the same palette and type as the Calibre site next door, so
   the two read as one project. The layout differs because the job differs:
   Calibre is a thing you read, this is a thing you operate, and an operating
   surface wants its controls in one place and its result in another.
   ========================================================================== */

:root {
  --page-max: 1720px;
  --page-pad: 26px;
  --accent:    #c8a45c;
  --bg:        #0b0c0e;
  --bg-2:      #121417;
  --panel:     #16181c;
  --panel-2:   #1b1e23;
  --panel-3:   #212530;
  --line:      #262a30;
  --line-soft: #1e2126;
  --ink:       #e8eaee;
  --ink-2:     #a8afb9;
  --ink-3:     #6f7883;
  --good:      #6fb08a;
  --warn:      #d8a34a;
  --bad:       #d2695e;

  --sans: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: "SF Mono", "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(1200px 760px at 50% -12%, #1a1d22 0%, transparent 62%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.01em; }
a { color: var(--ink-2); }
a:hover { color: var(--ink); }

/* ------------------------------------------------------------------ top */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  padding: 16px max(var(--page-pad), calc((100% - var(--page-max)) / 2 + var(--page-pad)));
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(255,255,255,.025), transparent);
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand .mark { color: var(--accent); align-self: center; display: flex; }
.wordmark { font-family: var(--serif); font-size: 25px; letter-spacing: .06em; color: var(--ink); }
.strap {
  font-size: 12.5px; color: var(--ink-3); letter-spacing: .04em;
  border-left: 1px solid var(--line); padding-left: 12px;
}
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  padding: 7px 13px; border-radius: 3px; text-decoration: none;
  font-size: 13.5px; color: var(--ink-3); border: 1px solid transparent;
}
.nav a:hover { color: var(--ink); background: var(--panel); }
.nav a.on { color: var(--ink); border-color: var(--line); background: var(--panel); }

/* ----------------------------------------------------------------- page */

.page {
  max-width: var(--page-max); margin: 0 auto; padding: 22px var(--page-pad) 90px;
}
.designer {
  display: grid; gap: 20px;
  grid-template-columns: 330px minmax(420px, 1fr) 350px;
  align-items: start;
}
@media (max-width: 1300px) {
  .designer { grid-template-columns: 320px 1fr; }
  .designer .col-summary { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .designer { grid-template-columns: 1fr; }
}

.col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.col-stage { position: sticky; top: 84px; }
@media (max-width: 900px) { .col-stage { position: static; } }

/* ---------------------------------------------------------------- panel */

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 5px;
  overflow: hidden;
}
.panel > header {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 11px 14px; border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
}
.panel > header h2 { font-size: 13px; letter-spacing: .10em; text-transform: uppercase; color: var(--ink-2); }
.panel > header .hint { font-size: 11.5px; color: var(--ink-3); }
.panel .body { padding: 13px 14px; }
.panel .body.tight { padding: 8px; }

.note {
  font-size: 12.5px; color: var(--ink-3); line-height: 1.5;
  padding: 10px 14px; border-top: 1px solid var(--line-soft);
  background: rgba(255,255,255,.014);
}

/* ----------------------------------------------------------------- list */

.opts { display: flex; flex-direction: column; gap: 5px; max-height: 430px; overflow: auto; }
.opts.short { max-height: 300px; }

.opt {
  display: grid; grid-template-columns: 1fr auto; gap: 3px 10px;
  width: 100%; text-align: left; cursor: pointer;
  padding: 9px 11px; border-radius: 4px;
  background: var(--panel-2); border: 1px solid var(--line-soft); color: var(--ink-2);
  font-family: inherit; font-size: 13.5px;
  transition: border-color .16s, background .16s, color .16s;
}
.opt:hover { border-color: #3a4048; color: var(--ink); }
.opt.on { border-color: var(--accent); background: #1e2128; color: var(--ink); }
.opt .t { font-weight: 500; }
.opt .n { font-size: 11.5px; color: var(--ink-3); grid-column: 1 / -1; }
.opt .p { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.opt.warn { border-left: 2px solid var(--warn); }
.opt.bad { opacity: .48; }
.opt.bad .t { text-decoration: line-through; text-decoration-color: var(--ink-3); }

/* --------------------------------------------------------------- stage */

.stage {
  background:
    radial-gradient(720px 520px at 50% 12%, #1c2027 0%, transparent 70%),
    var(--bg-2);
  border: 1px solid var(--line); border-radius: 5px;
  padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.stage.lume {
  background: radial-gradient(700px 520px at 50% 20%, #070a0f 0%, #030406 70%);
}
.wd-svg { display: block; width: 100%; height: auto; max-height: 66vh; }
.stage-wrap { width: 100%; max-width: 560px; }

/* The 3D view. A square box, because the renderer draws a square frame and
   letting the element go oblong just stretches it. */
.stage-gl {
  display: block; width: 100%; aspect-ratio: 1 / 1;
  max-height: 66vh; margin: 0 auto;
  transition: opacity 160ms linear;
}
/* Geometry is up but the dial, hands and bezel sheets are still rasterising. */
.stage-gl.is-drawing { opacity: 0.4; }
/* No aspect-ratio (older Safari): fall back to a fixed height rather than
   collapsing the canvas to nothing, which is what a bare block canvas with
   width:100% and no height does. */
@supports not (aspect-ratio: 1 / 1) {
  .stage-gl { height: 460px; aspect-ratio: auto; }
}
.stage.gl { background: radial-gradient(760px 560px at 50% 14%, #191d24 0%, #0c0e12 72%); }
.stage-note {
  color: var(--ink-3); font-size: 13px; line-height: 1.5;
  max-width: 34em; text-align: center; margin: 48px auto;
}

.stagebar { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.seg {
  display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden;
}
.seg button {
  padding: 6px 12px; background: var(--panel); color: var(--ink-3); border: 0;
  border-right: 1px solid var(--line-soft); font-family: inherit; font-size: 12.5px;
  cursor: pointer;
}
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--panel-3); color: var(--ink); }
.seg button:hover { color: var(--ink); }

.readout {
  display: flex; gap: 16px; flex-wrap: wrap; justify-content: center;
  font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.readout b { color: var(--ink-2); font-weight: 500; }

/* ---------------------------------------------------------------- specs */

.spec { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.spec dt { color: var(--ink-3); }
.spec dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }

.flags { display: flex; flex-direction: column; gap: 7px; }
.flag {
  display: grid; grid-template-columns: 14px 1fr; gap: 9px;
  font-size: 12.5px; line-height: 1.45; color: var(--ink-2);
  padding: 9px 11px; border-radius: 4px; background: var(--panel-2);
  border: 1px solid var(--line-soft);
}
.flag .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; }
.flag.yes .dot { background: var(--good); }
.flag.caution .dot { background: var(--warn); }
.flag.no .dot { background: var(--bad); }
.flag.no { border-color: #3a2724; }
.flag.note .dot { background: var(--ink-3); }
.flag.note { color: var(--ink-3); }
.flag .where { color: var(--ink-3); display: block; font-size: 11px;
               text-transform: uppercase; letter-spacing: .07em; margin-bottom: 2px; }

.verdict {
  display: flex; align-items: center; gap: 9px; font-size: 13px;
  padding: 10px 14px; border-bottom: 1px solid var(--line-soft);
}
.verdict .dot { width: 9px; height: 9px; border-radius: 50%; }
.verdict.yes { color: var(--good); } .verdict.yes .dot { background: var(--good); }
.verdict.caution { color: var(--warn); } .verdict.caution .dot { background: var(--warn); }
.verdict.no { color: var(--bad); } .verdict.no .dot { background: var(--bad); }

.money { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.money .row { display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.money .row span:last-child { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.money .row .sub { display: block; color: var(--ink-3); font-size: 11.5px; }
.money .total {
  border-top: 1px solid var(--line); margin-top: 7px; padding-top: 8px;
  font-size: 14px; color: var(--ink);
}

/* --------------------------------------------------------------- inputs */

.field { display: grid; gap: 5px; margin-bottom: 12px; }
.field > label {
  font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3);
  display: flex; justify-content: space-between; gap: 8px;
}
.field > label .val { color: var(--ink-2); text-transform: none; letter-spacing: 0;
                      font-variant-numeric: tabular-nums; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }

select, input[type="text"], input[type="number"], textarea {
  width: 100%; padding: 7px 9px; border-radius: 4px;
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line);
  font-family: inherit; font-size: 13px;
}
select:focus, input:focus, textarea:focus { outline: 1px solid var(--accent); border-color: var(--accent); }

input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="color"] {
  width: 100%; height: 30px; padding: 2px; border-radius: 4px;
  background: var(--panel-2); border: 1px solid var(--line); cursor: pointer;
}
input[type="checkbox"] { accent-color: var(--accent); }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }

.btn {
  padding: 8px 14px; border-radius: 4px; cursor: pointer;
  background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line);
  font-family: inherit; font-size: 13px;
}
.btn:hover { color: var(--ink); border-color: #3a4048; }
.btn.primary { background: #2a2416; border-color: var(--accent); color: #f0dcb0; }
.btn.primary:hover { background: #332c1a; }
.btn.danger { border-color: var(--bad); color: var(--bad); }
.btn.danger:hover { background: #2a1715; color: #eaa79e; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* The shelf, grouped by collection. */
.shelf-group { margin-bottom: 10px; }
.shelf-group > summary {
  display: flex; align-items: baseline; gap: 8px; cursor: pointer;
  padding: 6px 2px 8px; color: var(--ink); list-style-position: inside;
}
.shelf-group > summary b { font-weight: 500; font-size: 13.5px; }
.shelf-group > summary .hint { margin-left: auto; }

/* Renaming happens in the row, not in a dialog box. */
.renamer { display: flex; gap: 6px; margin-top: 6px; }
.renamer input {
  flex: 1; padding: 5px 8px; border-radius: 4px; background: var(--bg-2);
  color: var(--ink); border: 1px solid var(--line); font-family: inherit;
  font-size: 13px;
}

.swatches { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.sw {
  width: 22px; height: 22px; border-radius: 3px; cursor: pointer;
  border: 1px solid var(--line); padding: 0;
}
.sw:hover { border-color: var(--ink-2); }
.sw.on { outline: 2px solid var(--accent); outline-offset: 1px; }

/* --------------------------------------------------------------- studio */

.studio { display: grid; gap: 18px; grid-template-columns: 360px minmax(360px, 1fr) 360px; align-items: start; }
@media (max-width: 1280px) { .studio { grid-template-columns: 340px 1fr; } .studio .col-c { grid-column: 1 / -1; } }
@media (max-width: 860px) { .studio { grid-template-columns: 1fr; } }

.tabs { display: flex; gap: 3px; padding: 8px 8px 0; flex-wrap: wrap; border-bottom: 1px solid var(--line-soft); }
.tabs button {
  padding: 7px 11px; border: 1px solid transparent; border-bottom: 0;
  background: transparent; color: var(--ink-3); cursor: pointer;
  font-family: inherit; font-size: 12.5px; border-radius: 4px 4px 0 0;
}
.tabs button.on { color: var(--ink); background: var(--panel-2); border-color: var(--line-soft); }
.tabs button:hover { color: var(--ink); }
.tabpane { display: none; padding: 13px 14px; }
.tabpane.on { display: block; }

.textrow {
  border: 1px solid var(--line-soft); border-radius: 4px; padding: 10px;
  margin-bottom: 9px; background: var(--panel-2);
}
.textrow .head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.textrow .head b { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.mini { padding: 3px 8px; font-size: 11.5px; }

/* --------------------------------------------------------------- tables */

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 5px; background: var(--panel); }
table.cat { border-collapse: collapse; width: 100%; font-size: 13px; }
table.cat th, table.cat td { padding: 8px 11px; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
table.cat th {
  position: sticky; top: 0; background: var(--panel-3); z-index: 2; cursor: pointer;
  font-weight: 500; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3);
}
table.cat th:hover { color: var(--ink); }
table.cat th.sorted { color: var(--accent); }
table.cat td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.cat tbody tr:hover { background: rgba(255,255,255,.026); }
table.cat td.wide { white-space: normal; min-width: 260px; color: var(--ink-2); }
table.cat .tag {
  display: inline-block; font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 2px; border: 1px solid var(--line); color: var(--ink-3);
}
table.cat .tag.buy { border-color: #3d5a48; color: var(--good); }
table.cat .tag.ref { border-color: #4a4030; color: var(--warn); }
table.cat .tag.gone { border-color: #5a3d3d; color: #d99a8f; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input[type="text"] { max-width: 280px; }
.filters select { width: auto; min-width: 130px; }
.count { font-size: 12.5px; color: var(--ink-3); margin-left: auto; }

/* --------------------------------------------------------------- prose */

.lede {
  max-width: 74ch; color: var(--ink-2); font-size: 15.5px; line-height: 1.62;
  margin: 4px 0 20px;
}
.lede strong { color: var(--ink); font-weight: 500; }
h1.page-title { font-family: var(--serif); font-size: 30px; letter-spacing: .01em; margin-bottom: 6px; }

.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 5px;
  padding: 12px; cursor: pointer; text-align: left; font-family: inherit; color: var(--ink-2);
}
.card:hover { border-color: #3a4048; }
.card .thumb { background: var(--bg-2); border-radius: 4px; margin-bottom: 9px; padding: 8px; }
.card .thumb svg { max-height: 150px; }
.card b { display: block; color: var(--ink); font-weight: 500; font-size: 13.5px; margin-bottom: 3px; }
.card small { color: var(--ink-3); font-size: 11.5px; line-height: 1.45; display: block; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

footer.site {
  max-width: var(--page-max); margin: 0 auto; padding: 26px var(--page-pad) 60px;
  color: var(--ink-3); font-size: 12.5px; border-top: 1px solid var(--line-soft);
}
footer.site a { color: var(--ink-2); }

/* --------------------------------------------------------------- logo studio

   The mark grid is a picker of pictures, not of names: you find a shape in a
   grid of twenty faster than you read twenty labels, and much faster than you
   click through twenty dropdown items. */

.markgrid {
  display: grid; gap: 5px;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  max-height: 340px; overflow: auto;
}
.markchip {
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 4px;
  padding: 5px 3px 3px; cursor: pointer; font-family: inherit; color: var(--ink-3);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.markchip:hover { border-color: #3a4048; color: var(--ink); }
.markchip.on { border-color: var(--accent); background: #1e2128; color: var(--ink); }
.markchip svg { width: 100%; aspect-ratio: 1; height: auto; display: block; }
.markchip small { font-size: 9px; line-height: 1.2; text-align: center; }

.drop {
  border: 1px dashed var(--line); border-radius: 5px; padding: 18px 14px;
  text-align: center; color: var(--ink-2); font-size: 13px;
}
.drop.over { border-color: var(--accent); background: rgba(200,164,92,.06); }
.drop p { margin: 0 0 8px; }
.drop small { color: var(--ink-3); font-size: 11.5px; line-height: 1.5; display: block; }

/* Actual size means actual size: the box is millimetres on the screen, and it
   is the only honest way to judge a three-millimetre mark. */
.actualbox {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 5px;
  background: var(--panel);
}
.actualbox > div { display: flex; align-items: center; justify-content: center; }
.actualbox span {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
}

.threeup { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.threeup > div { text-align: center; }
.threeup svg { max-height: 130px; }
.threeup small { font-size: 10.5px; color: var(--ink-3); display: block; margin-top: 3px; }

textarea { resize: vertical; font-family: var(--mono); font-size: 12px; }

.logothumb {
  background: var(--bg-2); border: 1px solid var(--line-soft); border-radius: 4px;
  padding: 8px; margin-bottom: 10px; display: flex; justify-content: center;
}
.logothumb svg { width: 110px; height: 110px; }

/* ------------------------------------------------------------- gallery

   The parts, as pictures. Each card is a render made in Blender from the
   part's own record (tools/render-parts.py), so what you see is the size the
   numbers say. Renders have a transparent ground; the card supplies it. */

.viewtoggle { display: inline-flex; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.viewtoggle button {
  background: transparent; border: 0; color: var(--ink-3); padding: 6px 12px;
  font: inherit; font-size: 12.5px; cursor: pointer;
}
.viewtoggle button + button { border-left: 1px solid var(--line); }
.viewtoggle button.on { background: var(--panel-3); color: var(--ink); }

.gallery {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.card {
  display: flex; flex-direction: column; text-align: left;
  background: radial-gradient(120% 90% at 50% 20%, #23272e 0%, var(--panel) 70%);
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  color: var(--ink); font: inherit; padding: 0; cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.card:hover, .card:focus-visible { border-color: #3a4048; transform: translateY(-1px); }
.card .pic { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; }
.card .pic img { width: 100%; height: 100%; object-fit: contain; }
.card .pic .none { font-size: 12px; color: var(--ink-3); padding: 20px; text-align: center; }
.card .cap { padding: 10px 12px 12px; border-top: 1px solid var(--line-soft); }
.card .cap b { display: block; font-weight: 500; font-size: 14px; }
.card .cap span { display: block; font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

/* The detail view: every angle of one part, and what the record says. */
.detail {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
  background: rgba(6, 7, 9, .82); backdrop-filter: blur(6px); padding: 3vh 3vw;
}
.detail .sheet {
  width: min(1180px, 100%); max-height: 94vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
}
.detail .stage {
  position: relative; background: radial-gradient(90% 80% at 50% 35%, #2a2f37 0%, #15171b 75%);
  display: flex; flex-direction: column;
}
.detail .stage img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; display: block; }
.detail .thumbs { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line-soft); }
.detail .thumbs button {
  flex: 0 1 120px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 4px;
  padding: 0; cursor: pointer; color: var(--ink-3); font: inherit; font-size: 11px;
}
.detail .thumbs button.on { border-color: var(--accent); color: var(--ink); }
.detail .thumbs img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; display: block; }
.detail .thumbs span { display: block; padding: 3px 0 5px; }
.detail .info { padding: 20px 22px; }
.detail .info h3 { font-size: 21px; margin-bottom: 4px; }
.detail .info .sub { color: var(--ink-3); font-size: 13px; margin-bottom: 14px; }
.detail .info dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: 13px; }
.detail .info dt { color: var(--ink-3); }
.detail .info dd { margin: 0; font-variant-numeric: tabular-nums; }
.detail .info p { font-size: 13.5px; color: var(--ink-2); }
.detail .info .shown { font-size: 11.5px; color: var(--ink-3); border-top: 1px solid var(--line-soft); padding-top: 10px; margin-top: 14px; }
.detail .close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  background: rgba(0,0,0,.4); border: 1px solid var(--line); color: var(--ink);
  border-radius: 4px; padding: 4px 10px; cursor: pointer; font: inherit;
}
@media (max-width: 820px) {
  .detail .sheet { grid-template-columns: 1fr; }
}

/* A small picture in the designer's pickers, so a case is recognisable
   before its name is read. */
.opt.withpic { grid-template-columns: 44px 1fr auto; }
.opt.withpic .pic { grid-row: 1 / span 2; width: 44px; height: 44px; }
.opt.withpic .pic img { width: 44px; height: 44px; object-fit: contain; }
.opt.withpic .n { grid-column: 2 / -1; }

/* Search tools remain outside redrawable lists so typing keeps focus. */
.picker-search { width: 100%; margin-bottom: 8px; }
.shelf-tools { display: grid; gap: 8px; }
.shelf-tools input, .shelf-tools select { width: 100%; min-width: 0; }
:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 12px;
  background: var(--panel); color: var(--ink); transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Layout display rules must not reveal controls marked hidden. */
[hidden] { display: none !important; }

/* Visual refinement: warm metal accents, calm work surfaces, legible controls. */
:root {
  --bg: #0e1115; --bg-2: #12171c; --panel: #181e24;
  --panel-2: #1e262e; --panel-3: #29323b;
  --line: #34404b; --line-soft: #29323b;
  --ink: #f1eee7; --ink-2: #bdc5cc; --ink-3: #929faa;
  --accent: #d6b778; --page-pad: 28px;
  color-scheme: dark;
}
body { background: radial-gradient(ellipse at 65% 0%, #232c35 0%, transparent 55%), var(--bg); }
::selection { background: #d6b778; color: #11161c; }
.topbar { background: rgba(14,18,23,.94); border-bottom-color: #39424b; gap: 14px;
  box-shadow: 0 8px 30px #00000020; padding-top: 13px; padding-bottom: 13px; }
.wordmark { font-size: 29px; letter-spacing: .025em; }
.nav a { border-radius: 7px; padding: 8px 11px; color: var(--ink-2); }
.nav a.on { background: #d6b77814; border-color: #d6b77855; color: #ecd29e; }
.page { padding-top: 34px; }
h1.page-title { font-size: clamp(30px, 2.7vw, 44px); line-height: 1.15; letter-spacing: -.025em; }
.lede { max-width: 80ch; font-size: 14px; margin-top: 12px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 9px; color: var(--accent); font-size: 10px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .22em; }
.designer, .studio { gap: 22px; }
.col { gap: 20px; }
.panel { border-radius: 12px; box-shadow: 0 8px 26px #00000018; }
.panel > header { padding: 15px 17px; background: #ffffff02; }
.panel > header h2 { color: #d7dce0; font-size: 11px; letter-spacing: .13em; font-weight: 600; }
.panel .body, .tabpane { padding: 16px; }
.panel > .note { margin: 0; padding: 13px 17px; }
.note { line-height: 1.65; }
.opts { gap: 7px; scrollbar-width: thin; scrollbar-color: #58616a transparent; padding-right: 3px; }
.opt { border-radius: 8px; padding: 12px; gap: 5px 8px; background: #1b2229; }
.opt:hover { background: #252f38; border-color: #63717d; }
.opt.on { background: #d6b7780c; border-color: #d6b778a0; box-shadow: inset 3px 0 var(--accent); }
.opt .t { line-height: 1.4; font-size: 13px; }
.opt .n { line-height: 1.5; }
.opt .p { color: #c4b18e; }
.opt.bad { opacity: .65; }
.opt.withpic { grid-template-columns: 68px 1fr; }
.opt.withpic .pic { grid-row: 1 / span 3; width: 68px; height: 78px;
  background: #10151b; border: 1px solid #35404b; border-radius: 7px; display: grid; place-items: center; }
.opt.withpic .pic img { width: 66px; height: 76px; }
.opt.withpic .t, .opt.withpic .n, .opt.withpic .p { grid-column: 2; }
.opt.withpic .t { grid-row: 1; }
.opt.withpic .n { grid-row: 2; }
.opt.withpic .p { grid-row: 3; }
#stage { border-radius: 16px; border-color: #45515d; padding: 24px 18px 18px;
  background: radial-gradient(ellipse at 50% 35%, #303a44 0%, #192129 65%, #141a20 100%);
  box-shadow: 0 18px 65px #00000035; }
#stage.lume { background: #030609; }
#stage.gl { background: radial-gradient(ellipse at 50% 30%, #252e38, #10151c 75%); }
.stagebar { width: 100%; padding-top: 14px; border-top: 1px solid #ffffff12; gap: 9px; }
.seg { border-radius: 8px; padding: 3px; gap: 2px; background: #11171d; }
.seg button { border: 0; border-radius: 5px; background: transparent; padding: 8px 10px; color: #aeb9c3; }
.seg button.on { background: #38414a; color: #f6e5c2; box-shadow: 0 1px 4px #0004; }
.readout { gap: 6px; }
.readout > span { padding: 5px 9px; border: 1px solid #ffffff10; border-radius: 5px; background: #00000015; }
.readout b { color: #e6d1a6; }
select, input[type="text"], input[type="number"], input[type="search"], textarea {
  width: 100%; min-height: 38px; padding: 9px 11px; border-radius: 7px;
  background: #11181f; color: var(--ink); border: 1px solid #3a4652;
  font-family: inherit; font-size: 13px;
}
input::placeholder, textarea::placeholder { color: #8d99a4; opacity: 1; }
input[type="color"] { height: 39px; border-radius: 7px; padding: 4px; background: #11181f; }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 4px; }
input[type="range"] { min-height: 24px; cursor: pointer; }
.field { margin-bottom: 17px; gap: 7px; }
.field > label { font-size: 10.5px; letter-spacing: .065em; }
.field > label .val { color: #e0c796; }
.btn { border-radius: 7px; min-height: 36px; padding: 8px 12px; font-weight: 500; }
.btn.primary { background: #d6b778; color: #191b1d; border-color: #e1c792; box-shadow: 0 3px 10px #0002; }
.btn.primary:hover { background: #e8cb92; color: #111; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.mini { min-height: 30px; font-size: 11px; padding: 5px 8px; }
.tabs { gap: 5px; padding: 10px; background: #12191f; }
.tabs button { border: 1px solid transparent; border-radius: 6px; padding: 8px 10px; }
.tabs button.on { background: #d6b77818; border-color: #d6b77860; color: #e6cea0; }
.sw { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #ffffff26; }
.flag { padding: 12px; border-radius: 8px; line-height: 1.6; }
.verdict { padding: 14px 16px; font-weight: 500; }
.verdict.yes { background: #6fb08a0c; }
.verdict.caution { background: #d8a34a0c; }
.money { gap: 8px; }
.money .total { font-size: 17px; padding-top: 14px; margin-top: 12px; }
.spec { gap: 8px 14px; }
.textrow { padding: 13px; border-radius: 9px; }
.textrow .head { flex-wrap: wrap; }
.textrow .head b { font-size: 13px; color: var(--ink); overflow-wrap: anywhere; }
.card { border-radius: 11px; }
.card .cap { padding: 14px; }
.card .cap b { font-size: 15px; }
.card .cap span { line-height: 1.6; }
#presets .card, #chips .card { padding: 12px; gap: 5px; }
.gallery { gap: 18px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.markgrid { gap: 8px; }
.markchip { border-radius: 8px; padding: 8px 5px; background: #121a21; }
.markchip small { font-size: 10px; line-height: 1.35; }
.markchip.on { border-color: var(--accent); background: #d6b77812; }
.threeup > div { background: #11181f; padding: 10px; border: 1px solid var(--line-soft); border-radius: 8px; }
.drop { padding: 24px 16px; border-radius: 10px; border-color: #60707d; background: #11181f; }
.tablewrap, .detail .sheet { border-radius: 12px; }
table.cat th, table.cat td { padding: 12px 14px; }
.detail .thumbs { overflow-x: auto; }
.detail .thumbs button { min-width: 65px; }
footer.site { margin-top: 20px; line-height: 1.7; }
@media (min-width: 1301px) { .designer { grid-template-columns: 320px minmax(380px, 1fr) 320px; } }
@media (min-width: 901px) and (max-width: 1300px) {
  .designer .col-summary { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); align-items: start; }
}
@media (max-width: 1100px) { .topbar { position: relative; } .col-stage { top: 20px; } }
/* Here the summary drops below the stage and spans the full width, and a
   sticky item is held for the whole of its grid container, not just its own
   row -- so the stage stayed pinned over the summary and the saved shelf all
   the way down. With nothing beside it to keep pace with, it scrolls. */
@media (min-width: 901px) and (max-width: 1300px) { .col-stage { position: static; } }
@media (max-width: 900px) {
  :root { --page-pad: 16px; }
  .designer { grid-template-columns: minmax(0,1fr); }
  .designer .col-stage { order: -1; }
  .col-stage { position: static; }
  .page { padding-top: 24px; }
  .nav { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 3px; }
  .nav a { white-space: nowrap; flex-shrink: 0; }
  .brand .strap { font-size: 11px; }
  #stage { padding: 18px 12px; }
}
@media (max-width: 600px) {
  .studio { grid-template-columns: minmax(0,1fr); }
  .studio .col-c { grid-column: auto; }
  .row3 { grid-template-columns: minmax(0,1fr); }
  .stagebar .seg { flex-wrap: wrap; justify-content: center; }
  .filters > input, .filters > select { width: 100%; max-width: none; }
  .gallery { grid-template-columns: minmax(0,1fr); }
  .renamer { flex-wrap: wrap; }
}

/* The studio's col-c is the centre preview, not the trailing tools. */
@media (min-width: 861px) and (max-width: 1280px) {
  .studio { grid-template-columns: 340px minmax(0, 1fr); }
  .studio .col-c { grid-column: 2; grid-row: 1; }
  .studio > .col:last-child { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .studio .col-c { grid-column: 1; grid-row: 1; }
}

/* Keep the dial alongside long control panels. The preview column scrolls
   independently only when its legibility notes exceed the available height. */
@media (min-width: 861px) {
  .dial-studio .studio > .col-c {
    position: sticky;
    top: 90px;
    max-height: calc(100dvh - 106px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #58616a transparent;
    align-self: start;
  }
  .dial-studio #stage .wd-svg, .dial-studio #stage .stage-gl {
    max-height: min(60vh, calc(100dvh - 245px));
  }
}
@media (min-width: 861px) and (max-width: 1100px) {
  .dial-studio .studio > .col-c { top: 16px; max-height: calc(100dvh - 32px); }
}

/* Folding groups of controls, for a tab with too many to show at once. */
.ctl-group { border-top: 1px solid #ffffff14; }
.ctl-group:last-of-type { border-bottom: 1px solid #ffffff14; margin-bottom: 14px; }
.ctl-group > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px;
  padding: 11px 2px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-2);
}
.ctl-group > summary::-webkit-details-marker { display: none; }
.ctl-group > summary::before {
  content: ''; width: 0; height: 0; border-style: solid; border-width: 4px 0 4px 6px;
  border-color: transparent transparent transparent currentColor; transition: transform .15s;
}
.ctl-group[open] > summary::before { transform: rotate(90deg); }
.ctl-group > summary:hover, .ctl-group > summary:focus-visible { color: #e0c796; }
.ctl-group > summary .count {
  margin-left: auto; font-size: 10px; letter-spacing: 0; opacity: .55;
  font-variant-numeric: tabular-nums;
}
.ctl-group[open] > summary { margin-bottom: 4px; }
.ctl-group > .field:last-child { margin-bottom: 14px; }

/* Your own finish: the builder in the Base tab and the cards that choose one. */
.finish-builder {
  border: 1px solid var(--line-soft); border-radius: 9px; padding: 13px;
  margin: 4px 0 16px; background: var(--bg-2);
}
.finish-builder h3 {
  margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-2);
}
.finish-builder .textrow .head .btns { flex-wrap: nowrap; gap: 4px; }
.finish-builder .textrow .head .btn.mini { min-width: 28px; padding: 4px 6px; }
.minihead {
  margin: 16px 0 9px; font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3);
}
.cards.own-finishes { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.finish-card { text-align: left; width: 100%; }
.finish-card .thumb { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; padding: 6px; }
.finish-card .thumb svg { width: 100%; height: 100%; max-height: none; }
.finish-card small.from { opacity: .7; font-size: 10.5px; margin-top: 2px; }
.finish-card.make .thumb span { font-size: 30px; color: var(--ink-3); line-height: 1; }
.finish-card-wrap { position: relative; }
.finish-card-wrap .drop {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--line-soft); background: var(--bg-2); color: var(--ink-3);
  font-size: 10px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.finish-card-wrap:hover .drop, .finish-card-wrap .drop:focus-visible { opacity: 1; }
@media (hover: none) { .finish-card-wrap .drop { opacity: 1; } }

/* Hour by hour: a small clock of the twelve positions. */
.hours-panel {
  border: 1px solid var(--line-soft); border-radius: 9px; padding: 13px;
  margin: 14px 0 6px; background: var(--bg-2);
}
.hours-panel h3 {
  margin: 0 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-2);
}
.hour-clock {
  position: relative; width: 180px; max-width: 100%; aspect-ratio: 1 / 1;
  margin: 0 auto 12px; border-radius: 50%; border: 1px solid var(--line-soft);
}
.hour-pick {
  position: absolute; transform: translate(-50%, -50%); width: 30px; height: 30px;
  border-radius: 50%; border: 1px solid var(--line-soft); background: var(--bg);
  color: var(--ink-2); font-size: 12px; font-variant-numeric: tabular-nums; cursor: pointer;
}
.hour-pick:hover:not(:disabled) { border-color: var(--ink-3); }
.hour-pick.own { border-color: var(--accent); color: var(--accent); }
.hour-pick.on { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.hour-pick:disabled { opacity: .3; cursor: not-allowed; }
.hour-mid {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  font-size: 22px; color: var(--ink-3); pointer-events: none;
}
.hours-panel > small { display: block; margin-top: 8px; color: var(--ink-3); font-size: 11.5px; }

.finish-builder .tex-name { margin: 0 0 10px; font-size: 14px; color: var(--ink); }
.finish-builder a.btn { display: inline-block; text-decoration: none; }

/* Sync between computers (cloud.js), under the shelf's "where they live". */
.cloud-panel { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 12.5px; }
.cloud-panel .cloud-head { margin-bottom: 4px; }
.cloud-panel p { margin: 0 0 8px; color: var(--ink-2, var(--ink)); line-height: 1.45; }
.cloud-panel .cloud-error { color: var(--bad); }
.cloud-panel .cloud-row { display: flex; gap: 6px; flex-wrap: wrap; }
.cloud-panel .cloud-key { flex: 1 1 140px; min-width: 0; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: inherit; }
