@font-face {
  font-family: Anton;
  src: url("./fonts/anton-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f3ecdf;
  --ink: #1c1612;
  --muted: #4a433c;
  --line: #1c1612;
  --panel: #fffaf3;
  --accent: #b42318;
  --accent-ink: #fffaf3;
  --stamp: #1c1612;
  --sans: "Segoe UI", system-ui, sans-serif;
  --display: Anton, Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141210;
    --ink: #f4efe6;
    --muted: #c8bbaa;
    --line: #f4efe6;
    --panel: #211d18;
    --accent: #ff5a45;
    --accent-ink: #1c1612;
    --stamp: #000;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 420px at 0% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.45;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 20px 72px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 8px 12px;
  z-index: 2;
}

.skip:focus { top: 12px; }

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.4rem, 8vw, 4.25rem);
  letter-spacing: 0.01em;
  line-height: 0.9;
}

.lede {
  max-width: 38rem;
  margin: 10px 0 0;
  font-size: 1.05rem;
}

.studio {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 28px;
  align-items: start;
  margin-top: 28px;
}

.stage canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #111;
  border: 2px solid var(--line);
  box-shadow: 4px 4px 0 var(--stamp);
}

.panel {
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: 4px 4px 0 var(--stamp);
  padding: 16px;
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 650;
}

.field input {
  font: inherit;
  font-weight: 450;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 2px solid var(--line);
  padding: 10px 12px;
  width: 100%;
}

.field input::placeholder { color: color-mix(in srgb, var(--ink) 48%, transparent); }

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 8px;
}

legend {
  font-size: 0.85rem;
  font-weight: 650;
  padding: 0;
}

.templates {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}

.swatch {
  position: relative;
  display: grid;
  gap: 6px;
  font-size: 0.75rem;
  font-weight: 650;
  cursor: pointer;
}

.swatch input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.swatch img {
  width: 100%;
  aspect-ratio: 900 / 720;
  object-fit: cover;
  background: #111;
  border: 2px solid var(--line);
}

.swatch:has(input:checked) img,
.swatch:has(input:focus-visible) img { outline: 3px solid var(--accent); outline-offset: 2px; }
.swatch:has(input:checked) span { color: var(--accent); }

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  appearance: none;
  font: inherit;
  font-weight: 650;
  color: var(--ink);
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: 4px 4px 0 var(--stamp);
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-ghost { box-shadow: none; }

.file { position: relative; }
.file:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.file input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.hint, .foot, .vault-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status { min-height: 1.4em; margin: 10px 0 0; font-weight: 650; }
.status[data-tone="bad"] { color: var(--accent); }

.vault { margin-top: 36px; }

.vault-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: 2.4rem;
  letter-spacing: 0.02em;
  line-height: 1;
}

.empty {
  margin: 14px 0 0;
  padding: 22px;
  border: 2px dashed var(--line);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.grid li { position: relative; }

.card {
  display: block;
  width: 100%;
  padding: 0;
  background: #111;
  border: 2px solid var(--line);
  box-shadow: 4px 4px 0 var(--stamp);
  cursor: pointer;
}

.card img { display: block; width: 100%; height: auto; }

.remove {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 36px;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink);
  background: var(--panel);
  border: 2px solid var(--line);
  cursor: pointer;
}

.foot { margin-top: 28px; }

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

@media (prefers-reduced-motion: no-preference) {
  .btn, .card { transition: transform 80ms linear, box-shadow 80ms linear; }
  .btn:hover, .card:hover { transform: translate(1px, 1px); box-shadow: 3px 3px 0 var(--stamp); }
  .btn:active, .card:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--stamp); }
  .btn-ghost:hover, .btn-ghost:active { box-shadow: none; }
}

@media (max-width: 800px) {
  .studio { grid-template-columns: 1fr; }
  .wrap { padding: 20px 16px 56px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

@media (max-width: 420px) {
  .row .btn { flex: 1 1 auto; }
}
