/* ═══ 2. BASE ═════════════════════════════════════════════════════════ */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: Helvetica, Arial, sans-serif;
  font-size: var(--text-base);
  line-height: var(--lh-heading);
  color: var(--ink);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

body.no-anim, body.no-anim * { transition: none !important; animation: none !important; }

/* Component classes like .btn/.frow declare their own `display`, which at
   equal specificity beats the UA [hidden]{display:none} rule — so a hidden
   button/row would still render. Force it everywhere, once. */
[hidden] { display: none !important; }

.mono { font-family: "SF Mono", Consolas, Menlo, monospace; font-variant-numeric: tabular-nums; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea {
  font: inherit; color: var(--ink);
  background: transparent;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  height: var(--control-h);
}
/* Multi-line field — opts out of the single-line control height. */
textarea { height: auto; padding: 6px 8px; }
/* Native <select> chrome carries its own minimum height that padding alone
   can't override consistently — appearance:none plus an explicit height is
   the only way to make it match input/button heights exactly. The dropdown
   arrow is redrawn as a background image since <select> ignores ::after. */
select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  padding-right: 24px;
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 9px 6px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 6'%3E%3Cpath d='M1 1l3.5 3.5L8 1' fill='none' stroke='%235c5953' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
body.dark select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 6'%3E%3Cpath d='M1 1l3.5 3.5L8 1' fill='none' stroke='%239c9c9c' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* background-color (not the `background` shorthand) — the shorthand resets
   background-image/repeat/size to their initial values, which broke the
   select's custom arrow (it fell back to the SVG's oversized intrinsic
   dimensions, tiled) every time a select was hovered or focused. */
input:hover, select:hover, textarea:hover { border-color: var(--fg); background-color: var(--hover-bg); }
select option { background: var(--panel-bg); color: var(--ink); }
::placeholder { color: var(--ink-faint); }

:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

::selection { background: var(--fg); color: var(--bg); }

/* Inner scroll areas share one slim scrollbar visual. Modal bodies and the
   project list previously fell through to the native OS scrollbar whenever
   their content overflowed — folded into this shared rule rather than opting
   each one in via a class, since every current and future modal/list body
   should get it automatically. */
.scrollable, .modal-body, .pm-list, .viewport {
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.scrollable::-webkit-scrollbar, .modal-body::-webkit-scrollbar,
.pm-list::-webkit-scrollbar, .viewport::-webkit-scrollbar { width: 8px; height: 8px; }
.scrollable::-webkit-scrollbar-track, .modal-body::-webkit-scrollbar-track,
.pm-list::-webkit-scrollbar-track, .viewport::-webkit-scrollbar-track { background: transparent; }
.scrollable::-webkit-scrollbar-thumb, .modal-body::-webkit-scrollbar-thumb,
.pm-list::-webkit-scrollbar-thumb, .viewport::-webkit-scrollbar-thumb {
  background: var(--line-strong); border-radius: var(--radius-bar);
}

/* ═══ 3. VIEWPORT / ARTBOARD (fluid, laptop-proportioned, capped) ══════ */

.viewport {
  position: fixed; inset: 0;
  /* Both axes: horizontal is the deliberate fallback for windows narrower
     than --ab-min-w (scroll instead of cramping/reflowing); vertical is a
     safety net for the rare case min-height also can't be met. */
  overflow: auto;
  background: var(--bg);
}
/* The modal scrim lives inside the artboard, so on wider-than-max-width
   windows it only darkens the artboard — the margins around it stay light.
   Darken those margins to match: compositing --scrim over --bg here yields
   the exact same color the scrim produces over the artboard's own --bg
   padding ring, so the two meet seamlessly. */
.viewport:has(.scrim.open) {
  background: linear-gradient(var(--scrim), var(--scrim)), var(--bg);
}
.artboard {
  box-sizing: border-box;
  width: min(100%, var(--ab-max-w));
  min-width: var(--ab-min-w);
  height: 100dvh;
  min-height: 620px;
  margin: 0 auto;
  padding: var(--ab-pad-y) var(--ab-pad-x);
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(9, 1fr);
  gap: 14px;
  background: var(--bg);
  overflow: hidden;
}

