/*FONTS*/
@font-face { font-family: 'Archivo'; src: url('fonts/archivo-var.woff2') format('woff2'); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('fonts/plex-sans-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('fonts/plex-sans-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'IBM Plex Sans'; src: url('fonts/plex-sans-600.woff2') format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('fonts/plex-mono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('fonts/plex-mono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }
/*/FONTS*/
/* Layout: workbench \2014  settings rail on the left, imposed sheets laid out on a cutting mat on the right */
:root {
  --paper: #ECEEE8;
  --surface: #F7F8F4;
  --mat: #DDE1D8;
  --ink: #1B2030;
  --muted: #5A6171;
  --line: #C8CDC4;
  --pink: #DE2F7C;
  --blue: #2D52AD;
  --on-accent: #FFFFFF;
  --sheet: #FFFFFF;
  --sheet-line: #C3C8D2;
  --cell: #F1F2EF;
  --badge-bg: #1B2030;
  --badge-fg: #FFFFFF;
  --f-display: 'Archivo', 'Arial Black', system-ui, sans-serif;
  --f-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14161C; --surface: #1B1E26; --mat: #0E1015; --ink: #E7E9E2; --muted: #9AA0AD;
    --line: #2D313B; --pink: #FF5FA6; --blue: #86A2FF; --on-accent: #12141A;
    --sheet: #F1F2ED; --sheet-line: #B4B9C4; --cell: #E4E6E0; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14161C; --surface: #1B1E26; --mat: #0E1015; --ink: #E7E9E2; --muted: #9AA0AD;
  --line: #2D313B; --pink: #FF5FA6; --blue: #86A2FF; --on-accent: #12141A;
  --sheet: #F1F2ED; --sheet-line: #B4B9C4; --cell: #E4E6E0; color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--blue); text-underline-offset: 2px; }
html, body { background: var(--paper); color: var(--ink); }
body {
  font-family: var(--f-body); font-size: 15px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px 48px;
}
.app { max-width: 1320px; margin: 0 auto; display: flex; flex-direction: column; gap: 24px; }

.top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 20px; }
.logo {
  margin: 0; font-family: var(--f-display); font-weight: 900; font-stretch: 125%;
  font-size: 26px; line-height: 1; letter-spacing: -0.02em;
  color: var(--blue); text-shadow: 2px 2px 0 var(--pink); text-decoration: none;
}
.tag { margin: 0; color: var(--muted); max-width: 60ch; flex: 1 1 320px; }
.coffee {
  margin-left: auto; align-self: center; flex: 0 0 auto;
  font-weight: 600; font-size: 14px; text-decoration: none; color: var(--ink);
  border: 1px solid var(--ink); border-radius: 999px; padding: 7px 14px;
  box-shadow: 2px 2px 0 var(--pink);
}
.coffee:hover { background: var(--surface); }
.coffee:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

.layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .layout { grid-template-columns: minmax(0, 1fr); } }

.panel {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + 12px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  display: flex; flex-direction: column;
}
@media (max-width: 860px) { .panel { position: static; } }
.panel > section { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.panel > section + section { border-top: 1px solid var(--line); }

.drop { text-align: left; }
.drop.over { outline: 2px dashed var(--pink); outline-offset: -6px; }
.drop-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.drop-hint { color: var(--muted); font-size: 13px; }
.fname { font-family: var(--f-mono); font-size: 12.5px; color: var(--ink); overflow-wrap: anywhere; margin: 0; }
.fname .sample { color: var(--pink); }

.label {
  font-family: var(--f-mono); font-size: 11px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); margin: 0 0 6px;
}
.field { display: flex; flex-direction: column; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label {
  display: flex; flex-direction: column; gap: 2px; padding: 9px 10px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 4px; background: var(--paper);
  font-weight: 600; font-size: 14px; line-height: 1.25;
}
.seg label small { font-weight: 400; color: var(--muted); font-size: 12px; }
.seg input:checked + label { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); background: var(--surface); }
.seg input:focus-visible + label { outline: 2px solid var(--pink); outline-offset: 2px; }

select, input[type="number"] {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 4px; padding: 7px 9px; width: 100%;
}
input[type="number"] { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
select:focus-visible, input:focus-visible, button:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
.unit { position: relative; }
.unit input { padding-right: 34px; }
.unit::after { content: "mm"; position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-family: var(--f-mono); font-size: 12px; color: var(--muted); pointer-events: none; }
.check { display: flex; gap: 9px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--blue); }
.check small { display: block; color: var(--muted); font-size: 12px; }
.help { font-size: 12px; color: var(--muted); margin: 4px 0 0; }

.btn {
  font: inherit; font-weight: 600; font-size: 14px; cursor: pointer;
  border: 1px solid var(--ink); background: transparent; color: var(--ink);
  border-radius: 4px; padding: 8px 14px;
}
.btn:hover { background: var(--mat); }
.btn.primary { background: var(--pink); border-color: var(--pink); color: var(--on-accent); font-size: 15px; padding: 11px 16px; width: 100%; }
.btn.primary:hover { filter: brightness(1.06); }
.btn:disabled { opacity: 0.5; cursor: progress; }
.btn.small { font-size: 13px; padding: 5px 10px; font-weight: 500; }

.stats { font-family: var(--f-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; margin: 0; line-height: 1.6; }
.stats b { font-weight: 500; color: var(--blue); }
.status { font-size: 13px; min-height: 1.4em; margin: 0; color: var(--muted); }
.status.err { color: var(--pink); }
.howto { font-size: 13px; color: var(--ink); margin: 0; }
.howto ol { margin: 4px 0 0; padding-left: 18px; color: var(--muted); }

main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
h2 { font-family: var(--f-display); font-stretch: 112%; font-weight: 800; font-size: 20px; margin: 0; letter-spacing: -0.01em; }
.block-head p { margin: 0; color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Reading order strip */
.strip {
  display: flex; gap: 10px; overflow-x: auto; padding: 12px; min-height: 150px;
  background: var(--mat); border-radius: 6px; scroll-snap-type: x proximity;
}
.pg { flex: 0 0 auto; width: 88px; display: flex; flex-direction: column; gap: 5px; scroll-snap-align: start; position: relative; }
.pg .thumb {
  aspect-ratio: var(--ar, 0.707); background: var(--sheet); border: 1px solid var(--sheet-line);
  display: grid; place-items: center; overflow: hidden; cursor: grab; border-radius: 2px;
}
.pg .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.pg.blank .thumb { background: repeating-linear-gradient(135deg, var(--sheet) 0 6px, var(--cell) 6px 12px); }
.pg.pad { opacity: 0.6; }
.pg.pad .thumb { cursor: default; border-style: dashed; }
.pg.drag-over .thumb { outline: 3px solid var(--pink); outline-offset: 2px; }
.pg.dragging { opacity: 0.35; }
.pg .meta { font-family: var(--f-mono); font-size: 11px; line-height: 1.3; display: flex; justify-content: space-between; gap: 4px; }
.pg .meta b { font-weight: 500; }
.pg .meta span { color: var(--muted); }
.pg .role { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--pink); font-family: var(--f-mono); min-height: 13px; }
.pg .tools { position: absolute; top: 4px; right: 4px; display: flex; gap: 3px; opacity: 0; transition: opacity .12s; }
.pg:hover .tools, .pg:focus-within .tools { opacity: 1; }
@media (hover: none) { .pg .tools { opacity: 1; } }
.pg .tools button {
  width: 20px; height: 20px; border-radius: 3px; border: 0; padding: 0; cursor: pointer;
  background: var(--badge-bg); color: var(--badge-fg); font: 500 12px/20px var(--f-mono);
}
.pg .tools button:hover { background: var(--pink); }

/* Sheets */
.sheets { display: flex; flex-direction: column; gap: 22px; background: var(--mat); border-radius: 6px; padding: 18px; }
.sheet-row { display: flex; flex-direction: column; gap: 8px; }
.sheet-row h3 { margin: 0; font-family: var(--f-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.04em; color: var(--muted); }
.sheet-row h3 b { color: var(--ink); font-weight: 500; }
.sides { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.side { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.side-label { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.sheet { position: relative; width: 100%; background: var(--sheet); box-shadow: 0 1px 2px rgb(0 0 0 / .12), 0 6px 18px -8px rgb(0 0 0 / .25); max-width: 100%; }
.cell { position: absolute; outline: 1px dashed var(--sheet-line); outline-offset: -0.5px; }
.cell.blank { background: repeating-linear-gradient(135deg, transparent 0 7px, var(--cell) 7px 14px); }
.clip { position: absolute; overflow: hidden; background: var(--cell); }
.clip img { position: absolute; display: block; max-width: none; }
.num {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 6px;
  background: var(--badge-bg); color: var(--badge-fg); font: 500 11px/1 var(--f-mono);
  padding: 4px 6px; border-radius: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; z-index: 2;
}
.cell.blank .num { background: transparent; color: #6B7080; border: 1px dashed #9CA1AE; }
.fold { position: absolute; z-index: 3; pointer-events: none; }
.fold.v { top: 0; bottom: 0; border-left: 1px dashed var(--blue); }
.fold.h { left: 0; right: 0; border-top: 1px dashed var(--blue); }
.cut { position: absolute; z-index: 3; height: 0; border-top: 2px solid var(--pink); pointer-events: none; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 18px; vertical-align: middle; margin-right: 6px; }
.legend .lf::before { border-top: 1px dashed var(--blue); }
.legend .lc::before { border-top: 2px solid var(--pink); }
.legend .lr::before { content: "\21bb "; width: auto; color: var(--ink); }

.loading { position: fixed; inset: auto 0 0 0; padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); background: var(--ink); color: var(--paper); font-family: var(--f-mono); font-size: 13px; z-index: 20; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- site chrome & content pages ---------- */
.top { align-items: center; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; }
.site-nav a { color: var(--ink); text-decoration: none; padding-block: 4px; border-bottom: 2px solid transparent; }
.site-nav a:hover { border-bottom-color: var(--line); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--pink); }
.hero { display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.hero h1 {
  margin: 0; font-family: var(--f-display); font-weight: 850; font-stretch: 112%;
  font-size: clamp(30px, 5vw, 48px); line-height: 1.05; letter-spacing: -0.02em; text-wrap: balance;
}
.hero .lede { margin: 0; font-size: 17px; color: var(--muted); max-width: 60ch; }
.content { display: flex; flex-direction: column; gap: 56px; margin-top: 32px; }
.content > section { display: flex; flex-direction: column; gap: 14px; }
.content h2 { font-size: clamp(22px, 3vw, 30px); text-wrap: balance; }
.content h3 { font-family: var(--f-display); font-stretch: 105%; font-weight: 700; font-size: 17px; margin: 0; }
.prose { max-width: 68ch; display: flex; flex-direction: column; gap: 12px; }
.prose p, .prose ul, .prose ol { margin: 0; }
.prose li + li { margin-top: 4px; }
.eyebrow { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--pink); margin: 0; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; counter-reset: st; }
.steps > li { counter-increment: st; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.steps > li::before { content: counter(st, decimal-leading-zero); font-family: var(--f-mono); font-size: 13px; color: var(--pink); }
.steps p { margin: 0; color: var(--muted); }
.steps .art { background: var(--mat); border-radius: 6px; padding: 12px; display: grid; place-items: center; }
.steps .art svg { width: 100%; height: auto; max-width: 220px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 8px; padding: 18px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); text-decoration: none; min-width: 0; }
.card:hover { border-color: var(--blue); }
.card p { margin: 0; color: var(--muted); }
.card .go { margin-top: auto; font-weight: 600; color: var(--blue); }
.card svg { width: 100%; height: auto; }

.faq { max-width: 76ch; border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 14px 28px 14px 0; font-weight: 600; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 12px; font-family: var(--f-mono); font-size: 18px; color: var(--pink); }
.faq details[open] summary::after { content: "\2013 "; }
.faq .a { padding: 0 0 16px; color: var(--muted); max-width: 68ch; }
.faq .a p { margin: 0 0 8px; }

.table-wrap { overflow-x: auto; max-width: 100%; }
table.data { border-collapse: collapse; font-size: 14px; min-width: 420px; }
table.data th, table.data td { text-align: left; padding: 8px 14px 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-family: var(--f-mono); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
table.data td.n { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

.diagram { background: var(--mat); border-radius: 6px; padding: 16px; max-width: 640px; }
.diagram svg { width: 100%; height: auto; display: block; }
.diagram figcaption { font-size: 13px; color: var(--muted); margin-top: 10px; }
svg .d-sheet { fill: var(--sheet); stroke: var(--sheet-line); }
svg .d-fold { stroke: var(--blue); stroke-dasharray: 5 4; fill: none; stroke-width: 1.5; }
svg .d-cut { stroke: var(--pink); stroke-width: 3; fill: none; }
svg .d-num { font-family: var(--f-display); font-weight: 800; font-size: 34px; fill: #1B2030; }
svg .d-lbl { font-family: var(--f-mono); font-size: 10px; fill: #5A6171; }
svg .d-arrow { stroke: var(--ink); stroke-width: 1.8; fill: none; }
svg .d-head { fill: var(--ink); }
svg .d-pink { fill: var(--pink); }

.callout { border-left: 3px solid var(--pink); padding: 4px 0 4px 14px; max-width: 68ch; margin: 0; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; }
.btn.link { display: inline-block; text-decoration: none; width: auto; }

.site-foot { margin-top: 64px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 13px; color: var(--muted); }
.site-foot a { color: var(--ink); }
