/* Font Lab prototype. Same tokens and type as the rest of Animal Shapes (see /css/site.css and
   /overspray/css/styles.css). Single dark theme by choice. */
:root {
  --wall: #141619;
  --bench: #1b1e22;
  --bench-2: #22262b;
  --line: #2d3238;
  --text: #e6e3db;
  --muted: #8b9097;
  --cap: #e8c547;
  --cap-ink: #1a1606;
  --warn: #ff7a59;
  --f-display: "Allerta Stencil", "Stencil Std", Impact, sans-serif;
  --f-body: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--wall); color: var(--text); font: 14px/1.45 var(--f-body);
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px));
}
.bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.home { font: 600 12px var(--f-body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); text-decoration: none; margin-right: -6px; }
.home::after { content: " /"; }
.home:hover { color: var(--text); }
/* "Feedback": the site's feedback form, with this tool already chosen. */
.feedback-link { font: 500 13px var(--f-body); color: var(--muted); text-decoration: none; padding: 7px 4px; }
.feedback-link:hover { color: var(--text); text-decoration: underline; }
.feedback-link:focus-visible { outline: 2px solid var(--cap); outline-offset: 2px; border-radius: 2px; }
.mark { font: 28px/1 var(--f-display); letter-spacing: .04em; text-transform: uppercase; margin: 0; }
.mark span { color: var(--cap); }
.tag { color: var(--muted); font-size: 13px; }
.spacer { flex: 1; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.stage { min-width: 0; }
.wall { position: relative; border: 1px solid var(--line); border-radius: 6px; background: #0d0e10; overflow: hidden; min-height: 320px; }
.wall.loaded { min-height: 0; }   /* app.js sets its aspect ratio to the zoomed view */
.wall.drag { outline: 2px dashed var(--cap); outline-offset: -8px; }
/* Both canvases are the full page; app.js sizes and offsets them so the wall shows just the writing. */
.wall canvas { position: absolute; left: 0; top: 0; display: block; width: 100%; height: auto; }
#marks { cursor: pointer; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); margin: 0; padding: 24px; }
.status { font: 12px var(--f-mono); color: var(--muted); margin: 8px 0 0; min-height: 1.4em; }

.sheet { margin-top: 18px; }
.sheet h2, .group h2 { margin: 0 0 10px; font: 600 11px/1 var(--f-body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.cells { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.cells li button { width: 100%; padding: 4px 4px 2px; display: grid; gap: 2px; justify-items: center; background: var(--bench); }
.cells canvas { width: 54px; height: 54px; background: #f4f1ea; border-radius: 3px; }
.cells .ch { font: 500 13px var(--f-mono); min-height: 1.3em; }
.cells .ch.set { color: var(--cap); }
.cells .wide .ch, .cells .extra .ch { color: var(--warn); }
.cells button[aria-pressed=true] { border-color: var(--cap); }

/* Character spaces: one per character, grouped. Empty ones are dashed with a faint stand-in. */
.slots { display: grid; gap: 16px; }
.slot-group h3 { margin: 0 0 8px; font: 600 12px/1.3 var(--f-body); color: var(--text); display: flex; flex-wrap: wrap; gap: 2px 10px; align-items: baseline; }
.slot-group h3 .of { font: 12px var(--f-mono); color: var(--muted); }
.slot-group h3 .hint { font-weight: 400; color: var(--muted); }
.cells li button.vacant { background: transparent; border-style: dashed; }
.cells .ghost { width: 54px; height: 54px; display: grid; place-items: center; font: 500 26px/1 var(--f-body); color: #5f656e; }
.cells .vacant .ch { color: var(--muted); }
.cells button { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.cells button[data-k] { cursor: grab; }
.slot-group.tray { border: 1px dashed var(--line); border-radius: 6px; padding: 10px; }
.slot-group.tray.idle { display: none; }
/* While dragging: where it came from, where it would land, and the letter under the pointer. */
body.dragging .slot-group.tray.idle { display: block; }
body.dragging, body.dragging * { cursor: grabbing !important; }
.cells li.from > button { opacity: .35; }
.cells li.over > button, .slot-group.tray.over { outline: 2px solid var(--cap); outline-offset: 2px; }
.drag-ghost { position: fixed; z-index: 40; pointer-events: none; width: 58px; height: 58px; border-radius: 4px; background: #f4f1ea; box-shadow: 0 8px 20px rgba(0, 0, 0, .55); transform: translate(-50%, -60%); }

.fontbox { margin-top: 22px; display: grid; gap: 8px; }
.fontbox h2 { margin: 0 0 2px; font: 600 11px/1 var(--f-body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.font-bar { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: end; margin-bottom: 6px; }
.font-bar .ctl { width: 170px; }
.fld { display: grid; gap: 4px; font-size: 13px; }
.fld input { font: 13px var(--f-body); color: var(--text); background: var(--bench-2); border: 1px solid var(--line); border-radius: 5px; padding: 6px 10px; min-height: 32px; width: 210px; }
/* The preview is paper and ink, in the font being built (app.js sets the family and size). */
.sample { display: block; width: 100%; background: #f4f1ea; color: #141414; border-color: var(--line); padding: 12px 18px; line-height: 1.3; min-height: 2.6em; }
button.primary { background: var(--cap); color: var(--cap-ink); border-color: var(--cap); font-weight: 600; }
button.primary:hover { border-color: #f3d76b; background: #f0cf55; }

.bench { background: var(--bench); border: 1px solid var(--line); border-radius: 6px; position: sticky; top: 14px; }
.group { padding: 14px 16px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.group:last-child { border-bottom: 0; }
.group h2 { margin: 0; }
textarea, #char {
  font: 13px/1.5 var(--f-mono); color: var(--text); background: var(--bench-2);
  border: 1px solid var(--line); border-radius: 5px; padding: 8px 10px; width: 100%; resize: vertical;
}
#char { width: 4.5em; text-align: center; }
.ctl { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.ctl label, .lbl { font-size: 13px; }
.ctl output { font: 12px var(--f-mono); color: var(--muted); }
.ctl input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--cap); margin: 0; height: 24px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.note { font-size: 12px; color: var(--muted); margin: 0; }
.note strong { color: var(--text); font-weight: 600; }
.note button { display: block; margin-top: 8px; }

button, .file {
  font: 500 13px var(--f-body); color: var(--text); background: var(--bench-2);
  border: 1px solid var(--line); border-radius: 5px; padding: 7px 11px; cursor: pointer; min-height: 32px;
}
button:hover, .file:hover { border-color: #444a52; }
button:focus-visible, input:focus-visible, textarea:focus-visible, .file:focus-within, .home:focus-visible { outline: 2px solid var(--cap); outline-offset: 2px; }
button[aria-disabled=true] { opacity: .45; cursor: default; }
.file { position: relative; display: inline-flex; align-items: center; }
.file input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; background: var(--bench-2); border: 1px solid var(--line); padding: 9px 14px; border-radius: 6px; font-size: 13px; z-index: 30; }
.toast.off { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .bench { position: static; }
}

/* The Characters toolbar: set, print, start over. */
.sheet-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 12px; }
.sheet-bar h2 { margin: 0; }
.fld.inline { display: flex; align-items: center; gap: 6px; }
select { font: 13px var(--f-body); color: var(--text); background: var(--bench-2); border: 1px solid var(--line); border-radius: 5px; padding: 6px 8px; min-height: 32px; }
select:focus-visible, canvas:focus-visible { outline: 2px solid var(--cap); outline-offset: 2px; }

/* The character editor. */
#editor { background: var(--bench); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 0; width: min(940px, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
#editor::backdrop { background: rgba(0, 0, 0, .65); }
.ed { display: grid; gap: 12px; padding: 14px 16px; }
.ed-head { display: flex; align-items: center; justify-content: space-between; }
.ed-head h2 { margin: 0; font: 600 15px var(--f-body); }
#ed-char { font: 600 20px var(--f-mono); color: var(--cap); }
.ed-x { font-size: 18px; line-height: 1; padding: 4px 10px; }
.ed-main { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 16px; align-items: start; }
/* Keep the drawing a sensible size on short screens; pointer maths reads its real on-screen box. */
.ed-paper { max-width: min(100%, calc((100vh - 300px) * 1.1)); display: grid; gap: 8px; }
.ed-paper .note { margin: 0; }
#ed-canvas { display: block; width: 100%; height: auto; border-radius: 6px; touch-action: none; cursor: crosshair; background: #f4f1ea; }
#ed-canvas[data-tool=move] { cursor: grab; }
.ed-try { margin: 0; padding: 6px 12px; background: #f4f1ea; color: #141414; border-radius: 6px; font-size: 48px; line-height: 1.25; min-height: 1.35em; }
.ed-tools { display: grid; gap: 12px; align-content: start; }
.ed-tools .fld select { width: 100%; }
.ed-tools input#ed-copy { font: 13px/1.5 var(--f-mono); color: var(--text); background: var(--bench-2); border: 1px solid var(--line); border-radius: 5px; padding: 6px 8px; width: 4.5em; text-align: center; }
.seg button[aria-pressed=true] { border-color: var(--cap); color: var(--cap); }
.ed-foot { display: flex; justify-content: flex-end; gap: 8px; }
@media (max-width: 720px) { .ed-main { grid-template-columns: minmax(0, 1fr); } }

/* Printing: only the sheet pages, at their real size. */
#print-pages { display: none; }
@media print {
  @page { size: letter; margin: 0; }
  html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body > :not(#print-pages) { display: none !important; }
  #print-pages { display: block !important; }
  #print-pages svg { display: block; width: 8.5in; height: 11in; break-after: page; }
  #print-pages svg:last-child { break-after: auto; }
}
