/* ghs.nielsveck.com — tokens and type follow DESIGN.md in the repo root. */
@font-face {
  font-family: "Inter"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/static/fonts/inter-latin-wght-normal.woff2) format("woff2");
}
@font-face {
  font-family: "Fraunces"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url(/static/fonts/fraunces-latin-opsz-normal.woff2) format("woff2");
}

:root {
  --bg: #FAF7F2; --bg-raised: #FFFFFF; --ink: #1B1917; --ink-soft: #5E5852;
  --line: #E6DFD5; --accent: #B4531F; --accent-ink: #FFFFFF; --warn: #9A3412;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151311; --bg-raised: #1D1A17; --ink: #EFEAE3; --ink-soft: #A79F95;
    --line: #2C2823; --accent: #E08A5A; --accent-ink: #151311; --warn: #F0A274;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.6 "Inter", system-ui, sans-serif;
}
@media (min-width: 768px) { body { font-size: 17px; } }
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 768px) { .wrap { padding: 0 32px; } }

.top { padding: 24px 0 8px; }
.top-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 4px; }
.top-row .pills { flex-wrap: nowrap; }
.kicker, .label, .fine, .foot, .step, .code {
  font-family: var(--mono); font-size: 13px; letter-spacing: .06em; color: var(--ink-soft);
}
.kicker { margin: 0 0 4px; text-transform: uppercase; }
.kicker a { text-decoration: none; }
h1, h2 { font-family: "Fraunces", Georgia, serif; font-weight: 560; letter-spacing: -0.02em; line-height: 1.1; }
h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0; }
h2 { font-size: 1.25rem; margin: 0 0 16px; display: flex; align-items: center; gap: 10px; }
.lead { color: var(--ink-soft); margin: 8px 0 0; max-width: 60ch; }

/* minmax(0, …): the label in the preview has a fixed physical width and is
   scaled down with a transform; without this the column grows to fit it
   and the page scrolls sideways on phones. */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 16px; padding-bottom: 32px; }
.col-form, .col-preview { min-width: 0; }
@media (min-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .sticky { position: sticky; top: 16px; }
}
.card {
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: 10px;
  padding: 20px 16px; margin-bottom: 16px;
}
@media (min-width: 768px) { .card { padding: 24px; } }
.step {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 999px;
  border: 1px solid var(--line); font-size: 12px; letter-spacing: 0;
}

label, .label { display: block; margin: 16px 0 6px; }
label { font-weight: 500; font-size: .95em; }
.label { text-transform: uppercase; margin-top: 24px; }
.card > .label:first-of-type, h2 + label { margin-top: 0; }
input, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; min-height: 44px;
}
textarea { resize: vertical; }
input:focus, textarea:focus { border-color: var(--accent); outline: none; }

/* Upload */
.drop {
  position: relative; display: grid; gap: 4px; place-items: center; text-align: center;
  margin: 0; padding: 28px 16px; border: 1.5px dashed var(--line); border-radius: 10px;
  cursor: pointer; transition: border-color .15s, background-color .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop-main { font-weight: 600; }
.drop-sub { color: var(--ink-soft); font-size: .9em; font-weight: 400; max-width: 44ch; }
.status { margin: 12px 0 0; min-height: 1.6em; font-size: .95em; }
.status.err { color: var(--warn); }

/* Pills */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font: 500 14px/1 "Inter", system-ui, sans-serif; color: var(--ink); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; min-height: 44px; padding: 0 18px;
  cursor: pointer; transition: border-color .15s, background-color .15s;
}
.pill:hover { border-color: var(--ink-soft); }
.pill[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Pictogram toggles */
.pictos { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.picto-btn {
  display: grid; justify-items: center; gap: 4px; padding: 8px 4px; background: transparent;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer; color: var(--ink);
  font: 400 12px/1.25 "Inter", system-ui, sans-serif; transition: border-color .15s, background-color .15s;
}
.picto-btn img { width: 48px; height: 48px; opacity: .35; filter: grayscale(1); transition: opacity .15s; }
.picto-btn[aria-pressed="true"] { border-color: var(--accent); border-width: 2px; padding: 7px 3px; }
.picto-btn[aria-pressed="true"] img { opacity: 1; filter: none; }

/* Statement lists */
.stmts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.stmts li {
  display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: start;
  padding: 10px; border: 1px solid var(--line); border-radius: 6px;
}
.stmts .code { letter-spacing: 0; color: var(--ink); font-weight: 600; font-size: 13px; }
.stmts textarea { grid-column: 1 / -1; min-height: 44px; padding: 8px 10px; font-size: .95em; }
.stmts .edited { color: var(--ink-soft); font-size: 12px; font-family: var(--mono); }
.stmts .x {
  width: 44px; height: 32px; border: 1px solid var(--line); border-radius: 6px; background: transparent;
  color: var(--ink-soft); cursor: pointer; font-size: 18px; line-height: 1;
}
.stmts .x:hover { border-color: var(--warn); color: var(--warn); }
.stmts .note { grid-column: 1 / -1; font-size: .85em; color: var(--warn); margin: 0; }
.stmts:empty::before { content: "—"; color: var(--ink-soft); }
.add { margin-top: 8px; }
.hint { font-size: .9em; color: var(--ink-soft); margin: 8px 0 0; }
#sub_note { margin-top: 6px; }
#sub_note:empty { display: none; }
.hint.warn { color: var(--warn); }

/* Preview */
.preview {
  margin-top: 16px; padding: 12px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden;
}
.preview-inner { transform-origin: top left; }

/* The label itself: always black on white, in physical units (mm/pt). */
.label-box {
  background: #fff; color: #000; font-family: Arial, "Liberation Sans", Helvetica, sans-serif;
  line-height: 1.22; border: 1.4pt solid #000; padding: 2.2mm; overflow: hidden;
  display: flex; flex-direction: column;
}
.label-box.land { flex-direction: row; gap: 3mm; }
.label-box .col { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; min-height: 0; }
.label-box .flow { flex: 1 1 auto; min-height: 0; overflow: hidden; }
.label-box .sw { font-weight: 700; text-transform: uppercase; line-height: 1; margin-bottom: .15em; flex: none; }
.label-box .pics { display: grid; gap: 1.5mm; margin: 1mm 0 .5mm; flex: none; align-content: start; }
.label-box.land .pics { margin: 0; }
.label-box .pics img { display: block; }
.label-box .nm { font-weight: 700; font-size: 1.35em; line-height: 1.15; }
.label-box .sm { font-size: .92em; }
.label-box .pn { font-weight: 700; }
.label-box .hd { font-weight: 700; margin-top: .5em; }
.label-box .st b { font-weight: 700; }
.label-box .sup { margin-top: .6em; white-space: pre-line; }

.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.btn {
  font: 600 15px/1 "Inter", system-ui, sans-serif; min-height: 44px; padding: 0 20px;
  border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink);
  cursor: pointer; transition: border-color .15s, background-color .15s;
}
.btn:hover { border-color: var(--ink-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(.95); }
.btn.quiet { border-color: transparent; color: var(--ink-soft); }
.btn[disabled] { opacity: .6; cursor: progress; }
.fine { font-size: 12px; letter-spacing: .02em; margin: 16px 0 0; }
.foot { padding-bottom: 32px; }

#print_area { display: none; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
