/* =====================================================================
   LabelSize — styles
   Visual language: a packaging prep table. Cool paper, ink type, a cutting-
   mat preview, and the three dieline conventions (magenta cut, cyan bleed,
   green safe) as the only strong colours.
   ===================================================================== */

/* 1. Fonts (self-hosted, no third-party requests) ---------------------- */
@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 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;
}

/* 2. Tokens -------------------------------------------------------------- */
:root {
  color-scheme: light;
  --paper: #f2f4f1;
  --sheet: #ffffff;
  --ink: #141a1e;
  --ink-2: #434e49;
  --ink-3: #66716c;
  --rule: #d5dcd7;
  --rule-2: #e6ebe7;
  --mat: #e4ece6;
  --mat-line: rgba(28, 88, 70, 0.1);
  --mat-line-strong: rgba(28, 88, 70, 0.2);
  --accent: #c2125f;
  --accent-ink: #a30e50;
  --accent-soft: #fbe7f0;
  --cut: #e4007c;
  --bleed: #0093d0;
  --safe: #12924a;
  --ok: #11703f;
  --ok-soft: #e3f3ea;
  --err: #b42318;
  --err-soft: #fdecea;
  --busy: #1f5d86;

  --sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --radius: 8px;
  --radius-sm: 6px;
  --gutter: 16px;
  --max: 1240px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow: 0 1px 0 rgba(20, 26, 30, 0.04), 0 8px 24px -16px rgba(20, 26, 30, 0.18);
}

/* 3. Reset & base -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-weight: 400;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-ink); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { line-height: 1.12; letter-spacing: -0.015em; text-wrap: balance; font-weight: 720; }
code, kbd { font-family: var(--mono); font-size: 0.92em; }
code { background: var(--rule-2); padding: 0.08em 0.35em; border-radius: 4px; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* 4. Utilities ----------------------------------------------------------- */
.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; top: -80px; left: 12px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: var(--radius-sm); text-decoration: none; font-weight: 600; }
.skip-link:focus { top: 12px; }
.mono { font-family: var(--mono); }
.eyebrow { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }

.preview-banner { margin: 0; padding: 8px 16px; background: #fff4d6; border-bottom: 1px solid #efd48b; color: #5b4306; font-size: 13px; text-align: center; }

/* 5. Header -------------------------------------------------------------- */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 50;
  background: rgba(242, 244, 241, 0.94);
  backdrop-filter: saturate(1.2) blur(6px);
  -webkit-backdrop-filter: saturate(1.2) blur(6px);
  border-bottom: 1px solid var(--rule);
}
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 780; font-stretch: 112%; font-size: 19px; letter-spacing: -0.02em; }
.brand svg { width: 28px; height: 28px; flex: none; }
.site-nav { margin-left: auto; display: none; }
.site-nav ul { list-style: none; padding: 0; display: flex; gap: 4px; }
.site-nav a { display: block; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--ink-2); text-decoration: none; font-size: 15px; font-weight: 520; }
.site-nav a:hover { background: var(--rule-2); color: var(--ink); }
.lang-switch { display: flex; align-items: center; gap: 2px; margin-left: auto; font-family: var(--mono); font-size: 13px; font-weight: 500; }
.site-nav + .lang-switch { margin-left: 8px; }
.lang-switch a { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; padding: 0 6px; border-radius: var(--radius-sm); color: var(--ink-3); text-decoration: none; }
.lang-switch a:hover { color: var(--ink); background: var(--rule-2); }
.lang-switch a[aria-current="true"] { color: var(--ink); background: var(--sheet); box-shadow: inset 0 0 0 1px var(--rule); }
.lang-switch .sep { color: var(--rule); }
.mobile-nav { position: relative; }
.mobile-nav summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--sheet); font-size: 14px; font-weight: 600; cursor: pointer; }
.mobile-nav summary::-webkit-details-marker { display: none; }
.mobile-nav summary svg { width: 16px; height: 16px; }
.mobile-nav ul { position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; list-style: none; padding: 6px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.mobile-nav a { display: block; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-weight: 520; }
.mobile-nav a:hover { background: var(--rule-2); }

/* 6. Hero ---------------------------------------------------------------- */
.hero { padding-block: 22px 14px; }
.hero-grid { display: grid; gap: 8px; }
.hero h1 { font-size: clamp(27px, 4.4vw, 44px); font-stretch: 110%; font-weight: 780; letter-spacing: -0.025em; }
.hero-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 28px; }
.hero p.sub { color: var(--ink-2); font-size: clamp(15.5px, 1.6vw, 18px); max-width: 60ch; }
.hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 4px; }
.btn-start { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--radius-sm); background: var(--ink); color: #fff; text-decoration: none; font-weight: 620; font-size: 15px; }
.btn-start:hover { background: #000; }
.btn-start svg { width: 16px; height: 16px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 6px 14px; list-style: none; padding: 0; font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); }
.hero-badges li { display: inline-flex; align-items: center; gap: 6px; }
.hero-badges li::before { content: ""; width: 7px; height: 7px; border: 1.5px solid var(--safe); border-radius: 50%; }

/* 7. Ad slots (placeholders reserve space so real ads cause no layout shift) */
.ad-slot { position: relative; display: flex; align-items: center; justify-content: center; margin-inline: auto; width: 100%; overflow: hidden; }
.show-ad-placeholders .ad-slot:not(.is-live) { border: 1px dashed #c3cbc5; border-radius: var(--radius-sm); background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(28, 88, 70, 0.03) 10px 20px); }
.ad-slot__label { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: #8a948f; pointer-events: none; user-select: none; }
.ad-slot.is-live .ad-slot__label { position: absolute; top: 2px; left: 6px; font-size: 9px; }
html:not(.show-ad-placeholders) .ad-slot:not(.is-live) { display: none; }
.ad-slot--leaderboard { max-width: 970px; min-height: 100px; }
.ad-slot--banner { max-width: 728px; min-height: 100px; }
.ad-slot--rectangle { max-width: 336px; min-height: 280px; }
.ad-slot--sidebar { width: 300px; min-height: 600px; }
.ad-slot--in-content { min-height: 250px; }
.ad-slot--footer { max-width: 970px; min-height: 100px; }
.ad-band { padding-block: 10px; }
.ad-band--tight { padding-block: 6px 12px; }

/* 8. Tool ------------------------------------------------------------------ */
.tool { padding-block: 8px 20px; }
.tool-grid { display: grid; gap: 16px; align-items: start; }
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: var(--shadow); }
.noscript-note { padding: 16px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet); }

/* controls */
.controls { padding: 4px 0 0; }
.step { border: 0; padding: 16px 16px 18px; min-width: 0; border-top: 1px solid var(--rule-2); }
.step:first-of-type { border-top: 0; }
.step legend { float: left; width: 100%; display: flex; align-items: baseline; gap: 10px; padding: 0; margin-bottom: 12px; font-weight: 700; font-size: 16px; font-stretch: 108%; }
.step legend + * { clear: both; }
.step-n { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--accent); letter-spacing: 0.04em; }
.step-body { display: grid; gap: 12px; }

.type-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.type-opt { position: relative; }
.type-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.type-opt label { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 76px; padding: 8px 4px 7px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--sheet); color: var(--ink-2); font-size: 12px; line-height: 1.2; text-align: center; font-weight: 560; cursor: pointer; transition: border-color .15s var(--ease), background .15s var(--ease); }
.type-opt svg { width: 30px; height: 36px; color: var(--ink-3); }
.type-opt input:checked + label { border-color: var(--ink); background: #f7f9f7; color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.type-opt input:checked + label svg { color: var(--ink); }
.type-opt input:checked + label .band { fill: var(--cut); }
.type-opt input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.type-opt label:hover { border-color: #a9b3ad; }
.type-tip { font-size: 13.5px; color: var(--ink-3); }

.field { display: grid; gap: 5px; min-width: 0; }
.field > label, .field-label { font-size: 13.5px; font-weight: 620; color: var(--ink); }
.field-help { font-size: 12.5px; color: var(--ink-3); line-height: 1.45; }
.field-error { font-size: 13px; color: var(--err); font-weight: 560; line-height: 1.4; display: flex; gap: 6px; }
.field-error::before { content: "!"; flex: none; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-top: 1px; border-radius: 50%; background: var(--err); color: #fff; font-size: 11px; font-weight: 800; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap input, .select, .field textarea {
  width: 100%; min-height: 44px; padding: 0 44px 0 12px;
  border: 1px solid #c9d1cc; border-radius: var(--radius-sm); background: #fff;
  font-family: var(--mono); font-size: 15px; font-weight: 500; color: var(--ink);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.input-wrap input:hover, .select:hover { border-color: #a9b3ad; }
.input-wrap input:focus, .select:focus, .field textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(194, 18, 95, 0.18); }
.input-wrap input[aria-invalid="true"] { border-color: var(--err); background: #fffafa; }
.input-wrap .unit { position: absolute; right: 12px; font-family: var(--mono); font-size: 13px; color: var(--ink-3); pointer-events: none; }
.select { padding: 0 36px 0 12px; appearance: none; -webkit-appearance: none; font-family: var(--sans); font-weight: 520; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23434e49' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; cursor: pointer; }
.field textarea { padding: 10px 12px; min-height: 150px; font-size: 13px; line-height: 1.5; resize: vertical; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; align-items: start; }
.pair .field-error, .pair .field-help.span { grid-column: 1 / -1; }
.pair-link { position: relative; }
.or-hint { font-size: 12.5px; color: var(--ink-3); }

.check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; font-weight: 560; cursor: pointer; line-height: 1.4; }
.check input { width: 20px; height: 20px; margin-top: 0; flex: none; accent-color: var(--ink); cursor: pointer; }
.check small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12.5px; }

.seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; padding: 3px; border-radius: var(--radius-sm); background: var(--rule-2); border: 1px solid var(--rule); }
.seg-opt { position: relative; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-opt label { display: flex; align-items: center; justify-content: center; min-height: 36px; min-width: 52px; padding: 0 12px; border-radius: 4px; font-family: var(--mono); font-size: 13.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.seg-opt input:checked + label { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 26, 30, 0.14); }
.seg-opt input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 1px; }
.row-between { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }

.detect { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: start; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--ok-soft); border: 1px solid #bfe0cc; }
.detect::before { content: ""; grid-row: span 2; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--ok); background: radial-gradient(circle, var(--ok) 0 3px, transparent 3.5px); }
.detect[data-kind="tapered"] { background: var(--accent-soft); border-color: #f2b8d1; }
.detect[data-kind="tapered"]::before { border-color: var(--accent); border-radius: 3px; transform: perspective(40px) rotateX(35deg); background: none; }
.detect strong { font-size: 14.5px; font-weight: 700; }
.detect[data-kind="tapered"] strong { color: var(--accent-ink); }
.detect span { font-size: 13px; color: var(--ink-2); }

.wrap-modes { display: grid; gap: 6px; }
.wrap-opt { position: relative; }
.wrap-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.wrap-opt label { display: grid; grid-template-columns: 38px 1fr; gap: 2px 12px; align-items: center; padding: 9px 12px; border: 1px solid var(--rule); border-radius: var(--radius-sm); cursor: pointer; }
.wrap-opt label svg { grid-row: span 2; width: 38px; height: 38px; }
.wrap-opt strong { font-size: 14px; font-weight: 650; }
.wrap-opt span { font-size: 12.5px; color: var(--ink-3); line-height: 1.35; }
.wrap-opt input:checked + label { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: #f7f9f7; }
.wrap-opt input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 36px; padding: 0 12px; border: 1px solid var(--rule); border-radius: 999px; background: var(--sheet); font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--ink-2); }
.chip:hover { border-color: #a9b3ad; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.explain { border: 1px solid var(--rule-2); border-radius: var(--radius-sm); background: #fafbfa; }
.explain summary { padding: 10px 12px; font-size: 13.5px; font-weight: 620; cursor: pointer; }
.explain-body { display: grid; gap: 10px; padding: 0 12px 12px; font-size: 13.5px; color: var(--ink-2); }
.explain-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.explain-figs figure { display: grid; gap: 4px; justify-items: center; text-align: center; font-size: 12.5px; }
.explain-figs svg { width: 96px; height: 96px; }

.quality { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.quality::before { content: ""; width: 34px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--q, var(--ok)) var(--qw, 60%), var(--rule) 0); }
.quality[data-level="low"] { --q: var(--err); --qw: 15%; }
.quality[data-level="basic"] { --q: #b7791f; --qw: 35%; }
.quality[data-level="good"] { --q: #7a8f2a; --qw: 60%; }
.quality[data-level="pro"] { --q: var(--ok); --qw: 80%; }
.quality[data-level="high"] { --q: var(--ok); --qw: 100%; }
.color-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.color-field { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 13.5px; font-weight: 600; }
.color-field input[type="color"] { width: 44px; height: 36px; padding: 2px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: #fff; cursor: pointer; }

.form-actions { position: sticky; bottom: 0; display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--rule-2); background: rgba(255, 255, 255, 0.96); border-radius: 0 0 var(--radius) var(--radius); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid transparent; font-weight: 640; font-size: 14.5px; text-decoration: none; line-height: 1.2; transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease); }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: #000; }
.btn-outline { background: var(--sheet); border-color: #b9c2bc; color: var(--ink); }
.btn-outline:hover { border-color: var(--ink); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn-ghost:hover { background: var(--rule-2); color: var(--ink); }
.form-actions .btn-primary { flex: 1; }
.btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

/* stage: preview + results */
.stage { display: grid; gap: 16px; min-width: 0; }
.preview { overflow: hidden; }
.preview-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 14px 10px; border-bottom: 1px solid var(--rule-2); }
.preview-head h2 { font-size: 15px; font-weight: 700; font-stretch: 108%; }
.tabs { display: inline-flex; gap: 3px; padding: 3px; border-radius: var(--radius-sm); background: var(--rule-2); border: 1px solid var(--rule); }
.tab { min-height: 34px; padding: 0 12px; border: 0; border-radius: 4px; background: transparent; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.tab[aria-selected="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 26, 30, 0.14); }
.mat {
  position: relative;
  background-color: var(--mat);
  background-image:
    linear-gradient(var(--mat-line-strong) 1px, transparent 1px),
    linear-gradient(90deg, var(--mat-line-strong) 1px, transparent 1px),
    linear-gradient(var(--mat-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--mat-line) 1px, transparent 1px);
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
  background-position: -1px -1px;
}
/* registration-style corner marks on the mat */
.mat::before, .mat::after { content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none; z-index: 1; }
.mat::before { top: 10px; left: 10px; border-top: 1.5px solid var(--ink-3); border-left: 1.5px solid var(--ink-3); }
.mat::after { bottom: 10px; right: 10px; border-bottom: 1.5px solid var(--ink-3); border-right: 1.5px solid var(--ink-3); }
.view { position: relative; }
.dieline-box { width: 100%; height: 300px; }
.dieline-box svg { width: 100%; height: 100%; }
.container-box { width: 100%; aspect-ratio: 7 / 5; max-height: 420px; min-height: 220px; padding: 8px 8px 0; }
.container-box svg { width: 100%; height: 100%; }
.container-caption { position: relative; z-index: 1; padding: 0 16px 14px; font-size: 13px; color: var(--ink-2); text-align: center; }
.container-caption strong { font-family: var(--mono); font-weight: 500; color: var(--ink); }
.three-host { position: relative; width: 100%; aspect-ratio: 16 / 11; max-height: 460px; min-height: 260px; touch-action: none; }
.three-host canvas { width: 100% !important; height: 100% !important; cursor: grab; }
.three-host canvas:active { cursor: grabbing; }
.view-status { position: absolute; inset: auto 12px 12px 12px; z-index: 2; padding: 10px 12px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.95); border: 1px solid var(--rule); font-size: 13.5px; color: var(--ink-2); }
.view-status[data-error] { color: var(--err); }
.view-tools { position: absolute; top: 10px; right: 10px; z-index: 2; display: flex; gap: 6px; }
.view-tools .btn { min-height: 36px; padding: 0 12px; font-size: 13px; background: rgba(255, 255, 255, 0.95); }
.view-hint { position: absolute; left: 30px; top: 12px; z-index: 2; font-size: 12px; color: var(--ink-3); font-family: var(--mono); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 10px 14px 12px; border-top: 1px solid var(--rule-2); font-size: 12.5px; color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 8px; list-style: none; }
.legend svg { width: 28px; height: 8px; }
.legend ul { display: contents; }
.form-stale { position: absolute; inset: 0; z-index: 3; display: none; place-items: center; padding: 16px; background: rgba(242, 244, 241, 0.8); text-align: center; font-weight: 600; color: var(--ink-2); }
#lf-form[data-invalid] ~ .stage .form-stale { display: grid; }

.results { padding: 14px; display: grid; gap: 12px; }
.results-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.results-head h2 { font-size: 15px; font-weight: 700; font-stretch: 108%; }
.results-head h2:focus { outline: none; }
.privacy-note { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.privacy-note svg { width: 14px; height: 14px; color: var(--safe); }
.results-empty { padding: 12px; border-radius: var(--radius-sm); background: var(--err-soft); color: var(--err); font-weight: 600; font-size: 14px; }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.card { display: grid; align-content: start; gap: 3px; padding: 12px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: #fbfcfb; min-width: 0; }
.card h3 { font-size: 12.5px; font-weight: 620; color: var(--ink-3); letter-spacing: 0; }
.card .val { font-family: var(--mono); font-size: clamp(17px, 2.2vw, 20px); font-weight: 500; letter-spacing: -0.01em; line-height: 1.25; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.card .note { font-size: 12.5px; color: var(--ink-3); line-height: 1.4; }
.card--main { grid-column: 1 / -1; background: var(--sheet); border-color: var(--ink); border-width: 1.5px; position: relative; }
.card--main h3 { color: var(--ink); font-size: 13px; }
.card--main .val { font-size: clamp(24px, 4.6vw, 34px); font-weight: 500; letter-spacing: -0.02em; }
.card--main::after { content: ""; position: absolute; top: 12px; right: 12px; width: 18px; height: 12px; border: 2px solid var(--cut); border-radius: 2px; }
.card--type[data-kind="tapered"] { background: var(--accent-soft); border-color: #f2b8d1; }
.card--type[data-kind="tapered"] .val { color: var(--accent-ink); }
.results[data-stale] .cards, .results[data-stale] .geo { opacity: 0.4; }
.geo { border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 10px 12px; }
.geo h3 { font-size: 13px; font-weight: 650; margin-bottom: 6px; }
.geo dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; font-size: 13px; }
.geo dl div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dotted var(--rule); padding-block: 3px; }
.geo dt { color: var(--ink-3); }
.geo dd { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }

.exports { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--rule-2); }
.exports h3 { font-size: 14px; font-weight: 700; }
.export-opts { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.export-opts fieldset { border: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; min-width: 0; }
.export-opts legend { font-size: 12.5px; font-weight: 620; color: var(--ink-3); margin-bottom: 4px; width: 100%; }
.export-opts .check { font-size: 13px; font-weight: 520; align-items: center; }
.export-opts .check input { width: 18px; height: 18px; }
.paper-field { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.paper-field .select { min-height: 38px; width: auto; font-size: 13.5px; }
.export-btns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.export-btns .btn { padding: 0 10px; }
.export-btns .span-2 { grid-column: span 2; }
.export-status { min-height: 1.4em; font-size: 13.5px; font-weight: 560; color: var(--ink-2); }
.export-status[data-kind="ok"] { color: var(--ok); }
.export-status[data-kind="error"] { color: var(--err); }
.export-status[data-kind="busy"] { color: var(--busy); }
.confirm { display: grid; gap: 10px; padding: 12px; border: 1px solid #f0c98a; background: #fff8ec; border-radius: var(--radius-sm); font-size: 13.5px; }
.confirm-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.confirm-actions .btn { min-height: 38px; font-size: 13.5px; }
.export-disabled-note { font-size: 13px; color: var(--ink-3); }
.results-ad { padding-top: 8px; }

/* 9. Content ------------------------------------------------------------- */
.content-area { padding-block: 28px 12px; }
.content-grid { display: grid; gap: 32px; }
.content-grid > * { min-width: 0; }
.prose { max-width: 72ch; }
.prose > section { padding-block: 22px; border-top: 1px solid var(--rule); }
.prose > section:first-child { border-top: 0; padding-top: 0; }
.prose h2 { font-size: clamp(23px, 3.2vw, 30px); font-stretch: 108%; margin-bottom: 12px; }
.prose h3 { font-size: 18px; margin: 18px 0 6px; font-stretch: 104%; }
.prose p, .prose li { color: #28312d; }
.prose p + p { margin-top: 10px; }
.prose ul, .prose ol { padding-left: 1.2em; display: grid; gap: 6px; margin-top: 8px; }
.prose dl { display: grid; gap: 12px; margin-top: 10px; }
.prose dt { font-weight: 700; }
.prose dd { margin-left: 0; color: #28312d; }
.steps { display: grid; gap: 12px; counter-reset: s; list-style: none; padding: 0 !important; }
.steps li { display: grid; grid-template-columns: 44px 1fr; gap: 2px 14px; align-items: start; padding: 14px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); }
.steps li::before { counter-increment: s; content: counter(s, decimal-leading-zero); grid-row: span 2; font-family: var(--mono); font-size: 14px; font-weight: 500; color: var(--accent); padding-top: 2px; }
.steps h3 { margin: 0; font-size: 17px; }
.formula { display: grid; gap: 8px; margin-top: 12px; padding: 16px; background: var(--sheet); border: 1px solid var(--rule); border-left: 3px solid var(--cut); border-radius: var(--radius-sm); }
.formula .eq { font-family: var(--mono); font-size: clamp(16px, 2.4vw, 20px); font-weight: 500; }
.figure { margin: 16px 0 6px; padding: 14px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); }
.figure svg { width: 100%; height: auto; }
.figure figcaption { margin-top: 8px; font-size: 13px; color: var(--ink-3); grid-column: 1 / -1; }
.figure-grid { display: grid; gap: 14px; align-items: center; }
.figure-grid svg { max-width: 300px; margin-inline: auto; }
.fig-legend { list-style: none; padding: 0 !important; display: grid; gap: 10px !important; margin: 0 !important; font-size: 14px; }
.fig-legend li { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: baseline; }
.fig-legend b.mono { font-weight: 500; font-size: 15px; }
.fig-legend .swatch { width: 20px; height: 12px; border: 2px solid; border-radius: 2px; display: inline-block; }
.fig-legend .line { display: inline-block; width: 24px; height: 0; border-top: 2px solid; transform: translateY(-4px); }
.fig-legend .line--bleed { border-top: 1.6px dashed var(--bleed); }
.fig-legend .line--cut { border-top: 2.4px solid var(--cut); }
.fig-legend .line--safe { border-top: 2.4px dotted var(--safe); }
.fig-legend strong { display: block; }
.fig-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; font-size: 13.5px; }
.fig-pair p { margin: 0 !important; }
.fig-pair .bad { color: var(--err); }
.fig-pair .good { color: var(--ok); }
.table-wrap { overflow-x: auto; margin-top: 12px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
caption { text-align: left; padding: 12px 14px 0; font-size: 13px; color: var(--ink-3); }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--rule-2); vertical-align: top; }
th { font-size: 12.5px; font-weight: 650; color: var(--ink-3); white-space: nowrap; }
td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.callout { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); border: 1px solid #f2b8d1; font-weight: 600; color: var(--accent-ink); font-size: 14.5px; }
.dpi-rows { display: grid; gap: 8px; margin-top: 12px; }
.dpi-row { display: grid; grid-template-columns: 76px 1fr; gap: 12px; padding: 12px 14px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-sm); }
.dpi-row b { font-family: var(--mono); font-weight: 500; font-size: 17px; }
.uses { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; list-style: none; padding: 0 !important; }
.uses li { padding: 12px 14px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-sm); font-size: 14px; }
.uses li strong { display: block; font-size: 14.5px; margin-bottom: 2px; }
.sidebar { display: none; }

/* related tools */
.tools-area { padding-block: 24px 12px; }
.tools-area h2, .faq-area h2 { font-size: clamp(23px, 3.2vw, 30px); font-stretch: 108%; margin-bottom: 6px; }
.tools-area > .wrap > p { color: var(--ink-2); margin-bottom: 14px; }
.tool-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; list-style: none; padding: 0; }
.tool-card { display: grid; gap: 4px; align-content: start; padding: 14px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--sheet); min-height: 96px; }
.tool-card--soon { background: transparent; border-style: dashed; color: var(--ink-2); }
.tool-card .status { justify-self: start; font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; background: var(--rule-2); color: var(--ink-3); }
.tool-card--current .status { background: var(--ok-soft); color: var(--ok); }
.tool-card h3 { font-size: 15px; font-weight: 680; }
.tool-card a { color: var(--ink); text-decoration: none; }
.tool-card a:hover { text-decoration: underline; }
.tool-card p { font-size: 13px; color: var(--ink-3); line-height: 1.45; }

/* FAQ */
.faq-area { padding-block: 24px 28px; }
.faq-list { display: grid; gap: 8px; margin-top: 14px; max-width: 860px; }
.faq-list details { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius-sm); }
.faq-list summary { display: flex; justify-content: space-between; gap: 14px; padding: 14px 16px; font-weight: 650; font-size: 15.5px; cursor: pointer; list-style: none; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; flex: none; font-family: var(--mono); font-weight: 500; color: var(--accent); font-size: 18px; line-height: 1.2; }
.faq-list details[open] summary::after { content: "−"; }
.faq-list .answer { padding: 0 16px 16px; color: #28312d; }
.faq-list .answer p + p { margin-top: 8px; }

/* 10. Legal / simple pages ---------------------------------------------- */
.page { padding-block: 24px 48px; }
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 14px; }
.crumbs ol { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--rule); }
.crumbs a { color: var(--ink-2); }
.page h1 { font-size: clamp(28px, 5vw, 40px); font-stretch: 110%; margin-bottom: 6px; }
.page .updated { font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); margin-bottom: 20px; }
.page .prose > section { padding-block: 16px; }
.placeholder-note { margin: 14px 0 6px; padding: 12px 14px; border: 1px dashed #d8a24a; border-radius: var(--radius-sm); background: #fff8ec; font-size: 14px; color: #6d4a0e; }
.back-link { display: inline-flex; margin-top: 24px; }
.notfound { padding-block: 48px 64px; }
.notfound .code { font-family: var(--mono); color: var(--accent); font-size: 14px; letter-spacing: 0.08em; }
.notfound h1 { font-size: clamp(30px, 6vw, 48px); font-stretch: 110%; margin: 6px 0 10px; }
.notfound .links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* 11. Footer --------------------------------------------------------------- */
.site-footer { margin-top: 12px; padding-block: 28px 32px; border-top: 1px solid var(--rule); background: #eaeeea; font-size: 14px; color: var(--ink-2); }
.footer-grid { display: grid; gap: 18px; }
.footer-brand { display: grid; gap: 6px; max-width: 42ch; }
.footer-brand .brand { font-size: 17px; }
.footer-links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-links a { color: var(--ink-2); }
.footer-meta { font-size: 12.5px; color: var(--ink-3); display: grid; gap: 4px; }

/* 12. Responsive -------------------------------------------------------- */
@media (max-width: 379px) {
  .header-inner { gap: 8px; }
  .brand { font-size: 17px; gap: 8px; }
  .brand svg { width: 26px; height: 26px; }
  .mobile-nav summary { padding: 0 10px; }
  .mobile-nav summary .menu-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .export-btns #lf-dl-pdf, .export-btns #lf-copy { grid-column: 1 / -1; }
  .type-opt label { font-size: 11px; min-height: 70px; }
  .type-opt svg { width: 26px; height: 32px; }
  .pair { grid-template-columns: 1fr; }
  .export-btns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .export-btns .span-2 { grid-column: 1 / -1; }
  .cards { grid-template-columns: 1fr; }
  .geo dl { grid-template-columns: 1fr; }
  .explain-figs { grid-template-columns: 1fr; }
  .lang-switch a { min-width: 36px; }
}
@media (min-width: 540px) {
  :root { --gutter: 20px; }
  .ad-slot--leaderboard, .ad-slot--banner, .ad-slot--footer { min-height: 100px; }
}
@media (min-width: 720px) {
  .hero { padding-block: 28px 16px; }
  .figure-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
  .type-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .controls .type-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .steps li { grid-template-columns: 1fr; }
  .steps li::before { grid-row: auto; }
  .footer-grid { grid-template-columns: 1.2fr 1fr; align-items: start; }
  .ad-slot--leaderboard, .ad-slot--banner, .ad-slot--footer { min-height: 90px; }
}
@media (min-width: 960px) {
  :root { --gutter: 24px; }
  .mobile-nav { display: none; }
  .site-nav { display: block; }
  .tool-grid { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 20px; }
  .stage { position: sticky; top: 76px; }
  .hero-meta { flex-wrap: nowrap; }
  .hero-badges { max-width: 360px; }
}
.form-live { display: none; }
@media (max-width: 959px) {
  .form-actions { flex-wrap: wrap; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -8px 18px -14px rgba(20, 26, 30, 0.35); }
  .form-live { display: block; width: 100%; font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--ink); }
  .form-live[data-invalid] { color: var(--err); font-family: var(--sans); }
}
@media (min-width: 1280px) {
  .tool-grid { grid-template-columns: 450px minmax(0, 1fr); }
  .content-grid { grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; }
  .sidebar { display: block; }
  .sidebar .sticky { position: sticky; top: 84px; }
}

/* 13. Motion & print ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
@media print {
  .site-header, .ad-slot, .form-actions, .exports, .site-footer, .tabs { display: none !important; }
  body { background: #fff; }
}
