/* Hallmark · shape: Workbench (app screen) · genre: playful · theme: Sticker (deal 1/3, seed tukda-free-open-source-collage-6f88·6cc0ff94·2026-11-29·r0) · job: try · draw: app-scope
 * hero: none (app screen) · nav: tool bar, wordmark and three actions · footer: none · imagery: the archive itself · signature: every cut piece becomes a die-cut sticker on the table · sticker: sheet
 * axes: light/display-heavy/chromatic-magenta · posture: full-palette · contrast: pass · fold: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P3 H3 E3 S4 R3 V3 · weakest: R, three panels on one screen; the table stays the largest surface and panels collapse to a dock below 60rem */
@import url("./tokens.css");
@import url("./base.css");

body.studio { height: 100dvh; display: grid; grid-template-rows: auto 1fr; overflow: hidden; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs); height: 48px; padding: 0 var(--space-lg); border: 0; border-radius: var(--radius-pill); background: var(--color-paper-3); color: var(--color-ink); font-weight: 700; font-size: var(--text-md); text-decoration: none; cursor: pointer; box-shadow: inset 0 0 0 2px var(--color-ink); transition: translate var(--dur-micro) var(--ease-out), box-shadow var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out); white-space: nowrap; }
.btn--sm { height: 40px; padding: 0 var(--space-md); font-size: var(--text-sm); }
.btn:hover { background: var(--color-paper-2); }
.btn:active { translate: 1px 1px; }
.btn:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; transition: none; }
.btn--primary { background: var(--color-accent); color: var(--color-accent-ink); box-shadow: 0 0 0 4px var(--color-white), 4px 5px 0 var(--color-ink); }
.btn--primary:hover { background: var(--color-accent-deep); }
.btn--primary:active { translate: 3px 4px; box-shadow: 0 0 0 4px var(--color-white), var(--shadow-press); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; translate: none; }
.btn[aria-busy="true"] { cursor: progress; opacity: 0.7; }

.tool { height: 36px; padding: 0 var(--space-sm); border: 0; border-radius: var(--radius-pill); background: var(--color-paper-3); color: var(--color-ink); font-weight: 700; font-size: var(--text-sm); cursor: pointer; box-shadow: inset 0 0 0 2px var(--color-ink); transition: background-color var(--dur-micro) var(--ease-out); }
.tool:hover { background: var(--color-paper-2); }
.tool:active { translate: 1px 1px; }
.tool:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; transition: none; }
.tool.is-on, .tool[aria-checked="true"] { background: var(--color-ink); color: var(--color-paper); }
.tool:disabled { opacity: 0.45; cursor: not-allowed; }

.icon-btn { width: 40px; height: 40px; border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--color-ink); font-size: var(--text-lg); cursor: pointer; }
.icon-btn:hover { background: var(--color-paper-2); }
.icon-btn:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }

.toggle { display: inline-flex; align-items: center; gap: var(--space-xs); font-weight: 600; font-size: var(--text-sm); cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--color-ink); }
.toggle input:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }

/* ---------- top bar ---------- */
.bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); padding: var(--space-sm) var(--space-lg); background: var(--color-ink); color: var(--color-paper); }
.wordmark { font-family: var(--font-display); font-size: var(--text-xl); color: var(--color-paper); text-decoration: none; letter-spacing: var(--tracking-display); }
.wordmark:hover { color: var(--color-accent-2); }
.wordmark:focus-visible { outline: 3px solid var(--color-accent-2); outline-offset: 4px; }
.bar__actions { display: flex; align-items: center; gap: var(--space-sm); flex-wrap: wrap; justify-content: flex-end; }
.bar .btn--ghost { background: transparent; color: var(--color-paper); box-shadow: inset 0 0 0 2px var(--color-paper); }
.bar .btn--ghost:hover { background: var(--color-ink-2); }
.bar label.btn:focus-within { outline: 3px solid var(--color-accent-2); outline-offset: 3px; }
.noscript { padding: var(--space-lg); }

/* ---------- desk ---------- */
.desk { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr) minmax(0, 220px); min-height: 0; }
.drawer > *, .tray > * { flex-shrink: 0; }
.drawer, .tray { display: flex; flex-direction: column; gap: var(--space-sm); min-height: 0; padding: var(--space-md); background: var(--color-paper-2); overflow-y: auto; }
.tray { background: var(--color-paper-2); }
.drawer__head { display: flex; align-items: center; justify-content: space-between; }
.panel-title { font-size: var(--text-lg); max-width: none; }
.search { height: 44px; padding: 0 var(--space-md); border: 0; border-radius: var(--radius-card); background: var(--color-paper-3); color: var(--color-ink); box-shadow: inset 0 0 0 2px var(--color-ink); }
.search:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.search::placeholder { color: var(--color-muted); }

.chips { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.chip { height: 32px; padding: 0 var(--space-sm); border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--color-ink); font-weight: 600; font-size: var(--text-xs); cursor: pointer; box-shadow: inset 0 0 0 2px var(--color-ink); }
.chip:hover { background: var(--color-paper-3); }
.chip:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.chip[aria-pressed="true"] { background: var(--color-ink); color: var(--color-paper); }

.sheets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); margin: 0; padding: 0; list-style: none; }
.sheet { display: block; width: 100%; padding: 0; border: 4px solid var(--color-white); border-radius: 12px; background: var(--color-slot); cursor: pointer; aspect-ratio: 4 / 5; overflow: hidden; box-shadow: 3px 4px 0 var(--color-ink); transition: translate var(--dur-micro) var(--ease-out), rotate var(--dur-micro) var(--ease-out); }
.sheet img { width: 100%; height: 100%; object-fit: cover; }
.sheet:hover { translate: 0 -2px; rotate: -1deg; }
.sheet:active { translate: 2px 3px; box-shadow: var(--shadow-press); }
.sheet:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; transition: none; }
.sheets__empty { grid-column: 1 / -1; color: var(--color-muted); font-size: var(--text-sm); }

.pieces { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); margin: 0; padding: 0; list-style: none; }
.piece { display: grid; place-items: center; width: 100%; aspect-ratio: 1; padding: var(--space-xs); border: 0; border-radius: 12px; background: var(--color-paper-3); cursor: grab; box-shadow: inset 0 0 0 2px var(--color-rule); }
.piece img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(2px 3px 0 var(--color-ink)); }
.piece:hover { box-shadow: inset 0 0 0 2px var(--color-ink); }
.piece:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.tray__empty { color: var(--color-muted); font-size: var(--text-sm); }

/* ---------- table ---------- */
.table { position: relative; display: grid; grid-template-rows: 1fr auto; min-height: 0; padding: var(--space-lg); gap: var(--space-sm); }
.board-wrap { position: relative; display: grid; place-items: center; min-height: 0; container-type: size; }
.board { width: min(100cqw, 80cqh); height: auto; aspect-ratio: 4 / 5; border: 6px solid var(--color-white); border-radius: 4px; box-shadow: var(--shadow-card); background: var(--color-paper-3); touch-action: none; cursor: default; }
.board:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 4px; }
.board-hint { position: absolute; max-width: 30ch; text-align: center; color: var(--color-muted); font-weight: 600; pointer-events: none; }
.selbar { position: absolute; left: 50%; bottom: calc(var(--space-lg) + 56px); translate: -50% 0; display: flex; gap: var(--space-xs); padding: var(--space-xs); border: 4px solid var(--color-white); border-radius: var(--radius-pill); background: var(--color-paper-3); box-shadow: var(--shadow-card); z-index: var(--z-raised); }
.grounds { display: flex; justify-content: center; gap: var(--space-sm); }
.ground { width: 32px; height: 32px; border: 3px solid var(--color-white); border-radius: 50%; cursor: pointer; box-shadow: 0 0 0 2px var(--color-ink); }
.ground[data-ground="paper"] { background: var(--color-paper-3); }
.ground[data-ground="ink"] { background: var(--color-ink); }
.ground[data-ground="accent"] { background: var(--color-accent); }
.ground[data-ground="accent-2"] { background: var(--color-accent-2); }
.ground.is-on { box-shadow: 0 0 0 2px var(--color-ink), 0 0 0 5px var(--color-accent-2); }
.ground:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 4px; }

/* ---------- cutter ---------- */
dialog { border: 0; padding: 0; color: var(--color-ink); }
dialog::backdrop { background: color-mix(in oklch, var(--color-ink) 70%, transparent); }
.cutter { width: 100%; max-width: 100%; height: 100dvh; max-height: 100%; margin: 0; background: var(--color-paper); }
.cutter[open] { display: grid; grid-template-rows: auto 1fr auto; }
.cutter__top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-md); padding: var(--space-sm) var(--space-lg); background: var(--color-paper-2); }
.tools { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.cutter__actions { display: flex; gap: var(--space-sm); }
.cutter__stage { display: grid; place-items: center; min-height: 0; padding: var(--space-md); overflow: hidden; container-type: size; }
.cut-canvas { max-width: 100cqw; max-height: 100cqh; touch-action: none; cursor: crosshair; border: 6px solid var(--color-white); box-shadow: var(--shadow-card); background: var(--color-slot); }
.cutter__hint { padding: var(--space-xs) var(--space-lg) var(--space-md); text-align: center; color: var(--color-muted); font-weight: 600; }

/* ---------- info + export ---------- */
.card-dialog { background: transparent; max-width: min(440px, 92vw); overflow: visible; }
.diecut { border: 6px solid var(--color-white); border-radius: var(--radius-card); box-shadow: var(--shadow-card); }
.story { display: grid; gap: var(--space-sm); padding: var(--space-lg); background: var(--color-paper-3); rotate: -1deg; }
.story h3 { font-size: var(--text-xl); }
.story__meta { color: var(--color-muted); font-weight: 600; font-size: var(--text-sm); }
.story a { font-weight: 700; text-decoration-color: var(--color-accent); }
.story a:hover { color: var(--color-accent-deep); }
.story a:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }

.export { width: min(1100px, 94vw); max-height: 92dvh; background: var(--color-paper); border-radius: var(--radius-card); }
.export__inner { display: grid; gap: var(--space-lg); padding: var(--space-lg); }
.export__pair { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: var(--space-lg); align-items: start; }
.export__shot { margin: 0; min-width: 0; }
.export__pair img { width: auto; max-width: 100%; max-height: 62dvh; border: 6px solid var(--color-white); box-shadow: var(--shadow-card); }
.export__shot + .export__shot img { rotate: 1.5deg; }
.export__actions { display: flex; flex-wrap: wrap; gap: var(--space-sm); }

.toast { position: fixed; left: 50%; bottom: var(--space-xl); translate: -50% 0; padding: var(--space-sm) var(--space-lg); border: 4px solid var(--color-white); border-radius: var(--radius-pill); background: var(--color-accent-2); color: var(--color-ink); font-weight: 700; box-shadow: var(--shadow-card); opacity: 0; pointer-events: none; transition: opacity var(--dur-short) var(--ease-out); z-index: var(--z-toast); }
.toast.is-on { opacity: 1; }

/* ---------- narrow ---------- */
.only-narrow { display: none; }
.dock { gap: var(--space-sm); justify-content: center; padding: var(--space-sm); background: var(--color-paper-2); }
@media (max-width: 60rem) {
  body.studio { grid-template-rows: auto 1fr auto; }
  .only-narrow { display: inline-flex; }
  .dock { display: flex; }
  .desk { grid-template-columns: minmax(0, 1fr); }
  .drawer, .tray { position: fixed; inset: auto 0 0 0; max-height: 78dvh; z-index: var(--z-modal); border-top: 6px solid var(--color-white); box-shadow: 0 -4px 0 var(--color-ink); translate: 0 105%; visibility: hidden; transition: translate var(--dur-short) var(--ease-out), visibility var(--dur-short); }
  .drawer.is-open, .tray.is-open { translate: 0 0; visibility: visible; }
  .sheets { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pieces { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .table { padding: var(--space-sm); }
  .bar { padding: var(--space-xs) var(--space-sm); }
  .bar__actions .btn--sm { height: 36px; padding: 0 var(--space-sm); }
  .export__pair { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- toolbar pill (undo, redo, add, new) ---------- */
.bar { display: grid; grid-template-columns: auto 1fr auto; }
.toolpill { justify-self: center; display: flex; align-items: center; gap: var(--space-2xs); padding: var(--space-2xs); border-radius: var(--radius-pill); background: var(--color-paper-3); }
.tp { display: inline-flex; align-items: center; height: 34px; padding: 0 var(--space-sm); border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--color-ink); font-weight: 600; font-size: var(--text-sm); white-space: nowrap; cursor: pointer; }
.tp:hover { background: var(--color-paper-2); }
.tp:active { translate: 1px 1px; }
.tp:focus-visible, .toolpill label.tp:focus-within { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.tp:disabled { opacity: 0.35; cursor: not-allowed; translate: none; }
.tp--new { background: var(--color-accent); color: var(--color-accent-ink); }
.tp--new:hover { background: var(--color-accent-deep); }
.tp__sep { width: 1px; height: 20px; background: var(--color-rule); }
.bar__link { color: var(--color-paper); font-weight: 600; font-size: var(--text-sm); text-decoration: none; }
.bar__link:hover { text-decoration: underline; text-decoration-color: var(--color-accent-2); }
.bar__link:focus-visible { outline: 3px solid var(--color-accent-2); outline-offset: 4px; }
.remix { font-size: var(--text-md); }
@media (max-width: 60rem) {
  .bar { grid-template-columns: auto 1fr; row-gap: var(--space-xs); }
  .toolpill { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; justify-content: space-between; overflow-x: auto; }
  .tp { padding: 0 var(--space-xs); font-size: var(--text-xs); }
  .tp__sep { display: none; }
  .toolpill { gap: 0; }
  .bar__link { display: none; }
}
