/* ============================================================================
   Beyond the Line — Decal Lab (decal-lab.html)
   ----------------------------------------------------------------------------
   Loads AFTER site.css and theme.css and only adds the page that is not on the
   main site: the editor shell, the picker grids and the proof pane. Colour
   tokens, buttons, .input, .field-label and .swatch-row all come from those
   two files, so this page cannot drift away from the rest of the site.

   The shell is one screen tall on a laptop — controls on the left, the decal on
   the right — and stacks to proof-then-controls on a phone, so the thing being
   designed is the first thing in view.
   ========================================================================== */

body.dl-body {
  background: var(--ink-bg);
  color: var(--ink-fg);
  min-height: 100svh;
}

/* ---------- the shell ---------- */
.dl-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: calc(100svh - var(--header-h, 44px));
}
/* On a laptop the editor is exactly one screen, so the grid tracks are a
   definite size and the proof canvas can be measured against them. Phones keep
   min-height and scroll, because the stack is taller than a screen. */
@media (min-width: 900px) {
  .dl-shell { height: calc(100svh - var(--header-h, 44px)); }
}

.dl-intro {
  padding: clamp(20px, 3vw, 40px) clamp(16px, 4vw, 44px) clamp(14px, 1.8vw, 22px);
  border-bottom: var(--lw) solid var(--line);
  display: grid; gap: 10px;
}
.dl-intro .kicker { margin-bottom: 4px; }
.dl-intro h1 {
  font-family: "Dela Gothic One", "Noto Sans JP", sans-serif; font-weight: 400;
  font-size: clamp(25px, 3.6vw, 46px); line-height: 1.06;
  word-break: keep-all; overflow-wrap: anywhere;
}
.dl-back {
  justify-self: start; margin-top: 2px;
  font: 700 11px/1 "Plus Jakarta Sans", "Noto Sans JP", sans-serif;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent2); text-decoration: none;
}
.dl-back:hover { color: var(--accent); }

/* Two columns from 900px; below that the proof comes first. */
.dl-main {
  display: grid; min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, auto) minmax(0, 1fr);
}
@media (min-width: 900px) {
  .dl-main {
    grid-template-columns: minmax(320px, 372px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
  }
}

/* ---------- controls column ---------- */
.dl-side {
  order: 2; min-height: 0;
  display: grid; grid-template-rows: minmax(0, 1fr) auto;
  border-top: var(--lw) solid var(--line);
}
@media (min-width: 900px) {
  .dl-side { order: 1; border-top: 0; border-right: var(--lw) solid var(--line); }
}
.dl-controls { overflow-y: auto; min-height: 0; }

.dl-tabs {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: var(--lw) solid var(--line);
  position: sticky; top: 0; z-index: 2; background: var(--ink-bg);
}
.dl-tab {
  padding: 15px 4px 13px; cursor: pointer;
  border: 0; border-bottom: 2px solid transparent; background: transparent;
  font: 700 11px/1 "Plus Jakarta Sans", "Noto Sans JP", sans-serif;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-muted);
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}
.dl-tab:hover { color: var(--ink-fg); }
.dl-tab.is-on { color: var(--ink-fg); background: var(--panel); border-bottom-color: var(--accent); }

.dl-panel { padding: clamp(18px, 2vw, 24px) clamp(16px, 2vw, 22px) 40px; display: grid; gap: 26px; align-content: start; }
.dl-group { display: grid; gap: 12px; }
.dl-group .field-label { margin-bottom: 0; }

.dl-field { display: grid; gap: 7px; }
.dl-field > span {
  font: 700 11px/1 "Plus Jakarta Sans", "Noto Sans JP", sans-serif;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted);
}
.dl-field .input { height: 44px; font-size: 15px; }
.dl-field-row { display: grid; grid-template-columns: minmax(0, 1fr) 92px; gap: 10px; }

/* ---------- pickers ---------- */
.dl-grid { display: grid; gap: 8px; }
.dl-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dl-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dl-grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.dl-pick {
  cursor: pointer; padding: 8px;
  display: grid; place-items: center; gap: 5px;
  background: var(--field); color: var(--ink-muted);
  border: var(--lw) solid var(--panel-line); border-radius: var(--r);
  transition: border-color .18s ease, color .18s ease, transform .18s cubic-bezier(.2, .7, .2, 1);
}
.dl-pick:hover { border-color: var(--accent); color: var(--ink-fg); transform: translateY(-2px); }
.dl-pick.is-on { border-color: var(--accent); color: var(--accent); background: var(--panel); }
.dl-pick--art { aspect-ratio: 1; padding: 9px; }
/* The thumbnails are the same paths the decal is drawn from, so a shape can
   never look like one thing in the picker and another on the badge. */
.pick-art { width: 100%; height: 100%; display: block; }
.dl-pick-off {
  font: 700 10px/1 "Plus Jakarta Sans", sans-serif; letter-spacing: .1em;
}
.dl-pick--font { padding: 10px 4px; }
/* inline-block, or the skew on the Speed sample would not apply. */
.dl-font-sample { display: inline-block; font-size: 18px; line-height: 1; color: var(--ink-fg); }
.dl-pick.is-on .dl-font-sample { color: var(--accent); }
.dl-pick-label {
  font: 700 9.5px/1 "Plus Jakarta Sans", "Noto Sans JP", sans-serif;
  letter-spacing: .06em; text-align: center;
}

/* Quick sets: base across the top, border and accent split beneath. */
.dl-set {
  cursor: pointer; height: 38px; padding: 0; overflow: hidden;
  display: grid; grid-template-rows: 1fr 1fr;
  border: var(--lw) solid var(--panel-line); border-radius: var(--r);
  transition: border-color .18s ease, transform .18s cubic-bezier(.2, .7, .2, 1);
}
.dl-set:hover { border-color: var(--accent); transform: translateY(-2px); }
.dl-set.is-on { border-color: var(--accent); }
.dl-set > span { display: block; }
.dl-set-split { display: grid; grid-template-columns: 1fr 1fr; }
.dl-set-split > span { display: block; }

.dl-row-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font: 700 11px/1 "Plus Jakarta Sans", "Noto Sans JP", sans-serif;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-muted);
}
.dl-row-value { display: inline-flex; align-items: center; gap: 7px; letter-spacing: .06em; }
.dl-chip {
  width: 15px; height: 15px; border-radius: 4px; flex: 0 0 auto;
  border: 1px solid var(--panel-line);
}

.dl-swatches { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
.dl-swatch {
  cursor: pointer; aspect-ratio: 1; padding: 0; border-radius: 50%;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .35);
  transition: transform .16s cubic-bezier(.2, .7, .2, 1), border-color .16s ease;
}
.dl-swatch:hover { transform: scale(1.1); border-color: var(--ink-fg); }
.dl-swatch.is-on { border-color: var(--accent); transform: scale(1.06); }

/* ---------- the action rail under the controls ---------- */
.dl-actions {
  display: grid; gap: 9px;
  padding: clamp(13px, 1.6vw, 18px) clamp(16px, 2vw, 22px);
  border-top: var(--lw) solid var(--line); background: var(--panel);
}
.dl-dice {
  display: flex; align-items: center; gap: 12px; text-align: left;
  cursor: pointer; padding: 11px 14px;
  border: var(--lw) solid var(--accent2); border-radius: var(--r);
  background: color-mix(in srgb, var(--accent2) 12%, transparent);
  color: var(--accent2);
  transition: background .18s ease, transform .18s cubic-bezier(.2, .7, .2, 1);
}
.dl-dice:hover { background: color-mix(in srgb, var(--accent2) 24%, transparent); transform: translateY(-2px); }
.dl-dice svg { flex: 0 0 auto; }
.dl-dice-text { display: grid; gap: 3px; }
.dl-dice-title {
  font: 900 12.5px/1 "Plus Jakarta Sans", "Noto Sans JP", sans-serif;
  letter-spacing: .1em; text-transform: uppercase;
}
.dl-dice-hint { font-size: 11px; line-height: 1.4; color: var(--ink-muted); }
.dl-action-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.dl-action-row .btn { padding: 0; height: 46px; font-size: 13px; }

/* ---------- proof column ---------- */
.dl-preview {
  order: 1; min-height: 0; overflow: hidden;
  display: grid; grid-template-rows: auto minmax(0, 1fr);
}
@media (min-width: 900px) { .dl-preview { order: 2; } }

.dl-preview-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: clamp(14px, 1.8vw, 20px) clamp(16px, 3vw, 32px);
  border-bottom: var(--lw) solid var(--line);
}
.dl-preview-name {
  font-family: "Dela Gothic One", "Noto Sans JP", sans-serif; font-weight: 400;
  font-size: clamp(16px, 1.8vw, 24px); line-height: 1.15;
  word-break: keep-all; overflow-wrap: anywhere;
}

/* A cutting mat behind the decal, so a pale badge still reads as an object. */
/* overflow:hidden is load-bearing. decal-lab.js measures this pane and then
   sets the canvas to fit; without it a tall badge would stretch the pane, the
   resize observer would measure the taller pane, and the two would run away
   from each other. */
.dl-pane {
  min-height: 0; overflow: hidden; display: grid; place-items: center;
  padding: clamp(16px, 2.6vw, 34px);
  background:
    repeating-conic-gradient(rgba(255, 255, 255, .045) 0% 25%, transparent 0% 50%) 0 0 / 24px 24px,
    var(--ink-bg);
}
@media (max-width: 899px) { .dl-pane { min-height: 52svh; } }
.dl-canvas {
  display: block; max-width: 100%; max-height: 100%;
  filter: drop-shadow(0 20px 34px rgba(0, 0, 0, .55));
}
