/* ============================================================
   SizeGlide - site design system
   Hand-written CSS. No framework, no CDN, no build step.
   Mobile-first. Light + dark via prefers-color-scheme and
   an explicit [data-theme] override set by assets/js/site.js.
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --wrap: 1080px;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --bg: #ffffff;
  --bg-soft: #f4f8fa;
  --surface: #ffffff;
  --surface-2: #f7fafb;
  --ink: #0d1728;
  --ink-2: #47586d;
  --ink-3: #6b7c92;
  --line: #e2e9ef;
  --line-strong: #c9d5e2;

  --brand: #0b7d74;
  --brand-hover: #096a62;
  --brand-ink: #ffffff;
  --brand-soft: #e3f3f0;
  --brand-ring: rgba(11, 125, 116, 0.28);

  --ok: #146c37;
  --ok-soft: #e2f6e9;
  --warn: #8a5205;
  --warn-soft: #fdf0d8;
  --bad: #a8231c;
  --bad-soft: #fdebea;

  --shadow-sm: 0 1px 2px rgba(13, 23, 40, 0.06);
  --shadow: 0 8px 24px -12px rgba(13, 23, 40, 0.22);
  --shadow-lg: 0 28px 56px -28px rgba(13, 23, 40, 0.32);
  --focus: 0 0 0 3px var(--brand-ring);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #0a1220;
    --bg-soft: #0e1828;
    --surface: #111c2e;
    --surface-2: #16233a;
    --ink: #e9f0f9;
    --ink-2: #a4b4c9;
    --ink-3: #8296b0;
    --line: #22314a;
    --line-strong: #33455f;

    --brand: #3ec7b7;
    --brand-hover: #63d6c8;
    --brand-ink: #052522;
    --brand-soft: #0f2f2c;
    --brand-ring: rgba(62, 199, 183, 0.32);

    --ok: #74d996;
    --ok-soft: #102c1c;
    --warn: #f0b45c;
    --warn-soft: #2f2411;
    --bad: #ff9d95;
    --bad-soft: #331414;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 28px 56px -28px rgba(0, 0, 0, 0.8);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0a1220;
  --bg-soft: #0e1828;
  --surface: #111c2e;
  --surface-2: #16233a;
  --ink: #e9f0f9;
  --ink-2: #a4b4c9;
  --ink-3: #8296b0;
  --line: #22314a;
  --line-strong: #33455f;

  --brand: #3ec7b7;
  --brand-hover: #63d6c8;
  --brand-ink: #052522;
  --brand-soft: #0f2f2c;
  --brand-ring: rgba(62, 199, 183, 0.32);

  --ok: #74d996;
  --ok-soft: #102c1c;
  --warn: #f0b45c;
  --warn-soft: #2f2411;
  --bad: #ff9d95;
  --bad-soft: #331414;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 8px 24px -12px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 28px 56px -28px rgba(0, 0, 0, 0.8);
}

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

/* The hidden attribute must win over any display value set by a class below
   (control blocks are grids, result panels are flex, and so on). */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  line-height: 1.2;
  letter-spacing: -0.015em;
  font-weight: 700;
  text-wrap: balance;
}

h1 { font-size: clamp(1.65rem, 5.2vw, 2.5rem); }
h2 { font-size: clamp(1.3rem, 3.6vw, 1.7rem); }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }

p { margin: 0 0 1em; }

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover { color: var(--brand-hover); }

img { max-width: 100%; height: auto; display: block; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: 6px;
}

::selection { background: var(--brand-soft); color: var(--ink); }

/* ---------- Layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 16px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; box-shadow: var(--focus); }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  min-height: 60px;
  padding-top: 6px;
  padding-bottom: 6px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.logo:hover { color: var(--ink); }

.logo__mark {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--brand), var(--brand-hover));
  color: var(--brand-ink);
  font-size: 0.82rem;
  font-weight: 800;
  flex: none;
}

.logo__name { color: inherit; }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.site-nav a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}
.site-nav a:hover { color: var(--ink); background: var(--surface-2); }

@media (max-width: 419px) {
  .site-nav a { font-size: 0.86rem; padding: 8px 7px; }
  .site-nav { gap: 2px; }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .icon-moon { display: none; }
:root[data-theme="dark"] .icon-btn .icon-moon { display: block; }
:root[data-theme="dark"] .icon-btn .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .icon-moon { display: block; }
  :root:not([data-theme="light"]) .icon-btn .icon-sun { display: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 0.96rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.06s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { background: var(--brand-hover); color: var(--brand-ink); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn--ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}
.btn--ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn--quiet {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--ink-2);
}
.btn--quiet:hover { background: var(--surface); color: var(--ink); }

.btn--sm { min-height: 38px; padding: 8px 13px; font-size: 0.88rem; }
.btn--block { width: 100%; }

.btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- Hero ---------- */
.hero {
  padding: 34px 0 26px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(70% 120% at 12% -10%, var(--brand-soft), transparent 62%),
    radial-gradient(60% 100% at 100% 0%, var(--surface-2), transparent 60%);
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 14px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.hero__eyebrow .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}

.hero h1 { max-width: 20ch; margin-bottom: 14px; }
.hero__lede {
  max-width: 56ch;
  font-size: clamp(1rem, 2.4vw, 1.12rem);
  color: var(--ink-2);
  margin-bottom: 22px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

.trust {
  display: grid;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
  color: var(--ink-2);
}
.trust li { display: flex; align-items: flex-start; gap: 9px; }
.trust svg {
  width: 17px;
  height: 17px;
  margin-top: 3px;
  flex: none;
  color: var(--brand);
}

/* The three trust points open the "Why nothing gets uploaded" section.
   Same copy and icons as before; the panel keeps them from floating
   alone between two blocks of prose. */
.trust--lead {
  gap: 12px;
  margin: 14px 0 24px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

@media (min-width: 760px) {
  .trust--lead {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
  }
}

/* ---------- Sections ---------- */
.section { padding: 34px 0; }
.section--tight { padding: 24px 0; }

.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.section__head h2 { margin-bottom: 0; }
.section__note { color: var(--ink-3); font-size: 0.88rem; }

.section__intro {
  max-width: 62ch;
  color: var(--ink-2);
  margin: 6px 0 18px;
}

/* ---------- Tool cards ---------- */
.tool-group + .tool-group { margin-top: 26px; }

.tool-group__label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.tool-group__label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.tool-card {
  position: relative;
  display: flex;
  gap: 13px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
a.tool-card:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  color: var(--ink);
}

.tool-card__icon {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--brand-soft);
  color: var(--brand);
}
.tool-card__icon svg { width: 20px; height: 20px; }

.tool-card__body { min-width: 0; }
.tool-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 3px;
  font-size: 1rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.tool-card__desc {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.tool-card--soon { opacity: 0.72; cursor: default; }
.tool-card--soon:hover { border-color: var(--line); box-shadow: var(--shadow-sm); transform: none; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-3);
}
.tag--live { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.tag--brand { background: var(--brand-soft); border-color: transparent; color: var(--brand); }
.tag--off { background: var(--surface-2); border-color: var(--line); color: var(--ink-3); opacity: 0.85; }

/* ---------- Colour tools ---------- */
.swatch {
  height: 92px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  display: grid;
  place-items: end center;
  padding: 10px;
}

.swatch__hex {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.9rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.86);
  color: #0b1220;
  border-radius: 999px;
  padding: 2px 10px;
}

.ramp-grid {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 4px;
  margin-top: 8px;
}

.swatch-chip {
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  cursor: pointer;
  padding: 0;
}

.swatch-chip:hover { outline: 2px solid var(--brand); outline-offset: 1px; }

.contrast-demo {
  margin-top: 10px;
  padding: 18px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  text-align: center;
  font-weight: 700;
  font-size: 1.05rem;
}

.output-row {
  display: grid;
  grid-template-columns: 4.2rem 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.output-row:last-child { border-bottom: 0; }

.output-row__label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.output-row__value {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

/* Unit converter: value + two unit pickers, the result card, the all-units table */
.conv-inputs {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.conv-inputs__value { grid-column: 1 / -1; }

.conv-swap { margin-top: 10px; }

.conv-out {
  margin-top: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  display: grid;
  gap: 6px;
}

.conv-out__eq {
  margin: 0;
  font-size: 0.8rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.conv-out__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.conv-out__value {
  margin: 0;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.conv-out__unit {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-2);
}

.conv-all { margin-top: 16px; }

.conv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.conv-table thead th {
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 0 6px;
  border-bottom: 1px solid var(--line);
}

.conv-table thead th:last-child { text-align: right; }

.conv-table tbody th,
.conv-table tbody td {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.conv-table tbody th { font-weight: 600; }

.conv-table tbody td {
  text-align: right;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.conv-table tbody tr:last-child th,
.conv-table tbody tr:last-child td { border-bottom: 0; }

.conv-table__sys {
  display: block;
  font-weight: 500;
  font-size: 0.72rem;
  color: var(--ink-3);
}

.conv-table tr.is-target th,
.conv-table tr.is-target td { color: var(--brand); }

@media (min-width: 620px) {
  .conv-inputs { grid-template-columns: 1fr 1fr; }
}

/* BMI calculator: both input systems on one screen, then the result card */
.bmi-systems {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.bmi-system {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.bmi-system.is-active {
  border-color: var(--brand);
  box-shadow: inset 3px 0 0 var(--brand);
}

.bmi-fields {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
}

.bmi-out {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  display: grid;
  gap: 6px;
}

.bmi-out__value {
  margin: 0;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.bmi-out__unit {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}

.bmi-out__band {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bmi-out__band .muted { font-size: 0.8rem; }

/* JSON formatter: actions, the error panel and the output block */
.json-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.json-error {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--warn);
  border-radius: var(--radius);
  background: var(--warn-soft);
  display: grid;
  gap: 8px;
}

.json-error__msg {
  margin: 0;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.json-error .tag { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }

.json-out {
  margin: 10px 0 0;
  padding: 12px 14px;
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.85rem;
  line-height: 1.55;
}

.json-out code {
  font-family: var(--font-mono, ui-monospace, monospace);
  white-space: pre;
  display: block;
}

.json-output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* Timestamp converter: label above value, so long ISO strings never squeeze a
   fixed-width label column. */
.ts-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.ts-row__label {
  grid-column: 1 / -1;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.ts-row__value {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

/* Regex tester: flag pills, the highlighted preview and the match list */
.flag {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.85rem;
  cursor: pointer;
}

.flag input {
  margin: 0;
  accent-color: var(--brand);
  align-self: center;
}

.flag span {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-weight: 700;
  color: var(--ink);
}

.flag em {
  font-style: normal;
  font-size: 0.76rem;
  color: var(--ink-3);
}

.flag:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.re-preview {
  margin: 10px 0 0;
  padding: 12px 14px;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.85rem;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.re-preview mark {
  background: var(--brand-soft);
  color: var(--ink);
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px var(--brand);
}

.re-matches { display: grid; gap: 8px; }

.re-match {
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.re-match:last-child { border-bottom: 0; }

.re-match__index {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.78rem;
  color: var(--ink-3);
  text-align: right;
  padding-top: 3px;
}

.re-match__body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.re-match__text {
  justify-self: start;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.re-match__groups {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.78rem;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

/* ---------- Breadcrumbs ---------- */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 14px 0 0;
  list-style: none;
  font-size: 0.82rem;
  color: var(--ink-3);
}
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--brand); text-decoration: underline; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line-strong); }

/* ---------- Tool page ---------- */
.tool-page { padding-bottom: 10px; }

.tool-head { padding: 14px 0 18px; }
.tool-head h1 { max-width: 26ch; margin-bottom: 10px; }
.tool-head__lede {
  max-width: 62ch;
  margin: 0;
  color: var(--ink-2);
  font-size: 0.98rem;
}

.tool-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 16px;
}
.tool-panel + .tool-panel { margin-top: 14px; }

.privacy-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 600;
}
.privacy-chip svg { width: 14px; height: 14px; }

/* Dropzone */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 178px;
  padding: 22px 16px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.dropzone:hover { border-color: var(--brand); background: var(--brand-soft); }
.dropzone:focus-visible { box-shadow: var(--focus); border-color: var(--brand); }
.dropzone.is-dragover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.dropzone__icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--brand);
}
.dropzone__icon svg { width: 22px; height: 22px; }

.dropzone__title { font-weight: 650; font-size: 1rem; }
.dropzone__hint { font-size: 0.85rem; color: var(--ink-3); }
.dropzone__formats { font-size: 0.76rem; color: var(--ink-3); }

/* Controls */
.controls { margin-top: 16px; display: grid; gap: 16px; }

.control-block { display: grid; gap: 8px; }

.control-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 650;
  color: var(--ink-2);
}
.control-label .muted { font-weight: 500; color: var(--ink-3); font-size: 0.78rem; }

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset {
  min-height: 38px;
  min-width: 62px;
  padding: 7px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.13s ease;
}
.preset:hover { border-color: var(--brand); color: var(--brand); }
.preset[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.field { display: grid; gap: 6px; min-width: 0; }
.field > label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
}
.field__hint { font-size: 0.76rem; color: var(--ink-3); margin: 0; }

.input,
.select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.95rem;
  transition: border-color 0.13s ease;
}
.input:hover, .select:hover { border-color: var(--ink-3); }
.input:focus, .select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus);
}
.input::placeholder { color: var(--ink-3); }

.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: 10px 0 0 10px; }
.input-group__unit {
  display: grid;
  place-items: center;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-left: 0;
  border-radius: 0 10px 10px 0;
  background: var(--surface-2);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-3);
  white-space: nowrap;
}

/* Multi-line text field (word counter, and any later text tool) */
.textarea {
  width: 100%;
  min-height: 220px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.13s ease;
}
.textarea:hover { border-color: var(--ink-3); }
.textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus);
}
.textarea::placeholder { color: var(--ink-3); }

/* Thumbnail list for tools that take several files at once */
.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.thumbs[hidden] { display: none; }
.thumb {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
}
.thumb img { display: block; width: 100%; height: 72px; object-fit: cover; }
.thumb.is-dragging { opacity: 0.45; }
.thumb__tools { display: flex; justify-content: space-between; padding: 2px 4px; }
.thumb__btn {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.75rem;
  line-height: 1.7;
  padding: 0 4px;
  border-radius: 6px;
  cursor: pointer;
}
.thumb__btn:hover { background: var(--surface); color: var(--ink); }
.thumb__btn[disabled] { opacity: 0.35; cursor: default; }

.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 32px;
  margin: 0;background: transparent;
  cursor: pointer;
}
.range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: var(--line-strong);
}
.range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--line-strong);
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--brand);
  border: 3px solid var(--surface);
  box-shadow: 0 1px 4px rgba(13, 23, 40, 0.35);
}
.range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand);
  border: 3px solid var(--surface);
  box-shadow: 0 1px 4px rgba(13, 23, 40, 0.35);
}
.range:focus-visible { box-shadow: var(--focus); border-radius: 999px; }

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.86rem;
  color: var(--ink-2);
  cursor: pointer;
}
.check input {
  width: 18px;
  height: 18px;
  flex: none;
  accent-color: var(--brand);
}

.control-actions {
  display: grid;
  gap: 10px;
  margin-top: 2px;
}

.hints {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.hints .field__hint { margin: 0; }

/* Status / alerts */
.status {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 0.9rem;
  color: var(--ink-2);
}
.status svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.status[hidden] { display: none; }
.status--ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.status--warn { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.status--bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }

/* Result */
.result { margin-top: 18px; }
.result[hidden] { display: none; }

/* ---------- File queue (PDF merge) ---------- */
.file-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.file-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.file-row__name {
  grid-column: 1 / -1;
  font-weight: 600;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.file-row__meta { color: var(--ink-2); font-size: 0.85rem; }

.file-row__tools { display: flex; gap: 4px; justify-content: flex-end; }

.file-row__btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
}

.file-row__btn:hover { color: var(--ink); border-color: var(--ink-3); }
.file-row__btn[disabled] { opacity: 0.35; cursor: default; }

/* ---------- QR code plate ---------- */
/* Always light: a code has to stay dark-on-light even in the dark theme, and
   the quiet zone must not sit on a pattern. */
.qr-plate {
  display: grid;
  place-items: center;
  margin: 12px 0;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #ffffff;
}

.qr-plate canvas {
  display: block;
  width: 100%;
  max-width: 288px;
  height: auto;
  image-rendering: pixelated;
}

.result__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 12px;
}
.result__head h2 { margin: 0; font-size: 1.1rem; }

.compare {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.compare__item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}

.compare__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.compare__figure {
  display: grid;
  place-items: center;
  height: 168px;
  padding: 10px;
  background:
    linear-gradient(45deg, rgba(127, 127, 127, 0.12) 25%, transparent 25%, transparent 75%, rgba(127, 127, 127, 0.12) 75%) 0 0 / 16px 16px,
    linear-gradient(45deg, rgba(127, 127, 127, 0.12) 25%, transparent 25%, transparent 75%, rgba(127, 127, 127, 0.12) 75%) 8px 8px / 16px 16px,
    var(--surface);
}
.compare__figure img {
  max-width: 100%;
  max-height: 148px;
  width: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
}

.compare__meta {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  font-size: 0.85rem;
  color: var(--ink-2);
}
.compare__meta strong { color: var(--ink); font-weight: 700; }
.compare__meta .dim { color: var(--ink-3); font-variant-numeric: tabular-nums; }

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.stats li {
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.stats dt {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 2px;
}
.stats dd {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.stats dd.is-good { color: var(--ok); }
.stats dd.is-bad { color: var(--bad); }

.result__actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

/* ---------- Prose (SEO copy) ---------- */
.prose {
  max-width: 70ch;
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.72;
}
.prose h2 { color: var(--ink); margin-top: 1.6em; }
.prose h3 { color: var(--ink); margin-top: 1.4em; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.25em; margin: 0 0 1em; }
.prose li { margin-bottom: 0.4em; }
.prose strong { color: var(--ink); }
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.2em;
  font-size: 0.9rem;
}
.prose th, .prose td {
  padding: 9px 10px;
  border: 1px solid var(--line);
  text-align: left;
}
.prose th { background: var(--surface-2); color: var(--ink); }

/* A wide table scrolls inside its own box instead of pushing the page sideways.
   Three-column tables with long unbreakable tokens need this on narrow phones. */
.table-scroll {
  margin: 0 0 1.2em;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-scroll table { margin-bottom: 0; }
.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  /* Long identifiers and ISO strings have no spaces to break at; without this a
     single inline code span can push a 320px page sideways. */
  overflow-wrap: anywhere;
}

/* Code blocks scroll inside their own box; unbroken code lines must never
   widen the page on a phone. */
.prose pre {
  margin: 0 0 1.2em;
  padding: 12px 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.82rem;
  line-height: 1.6;
}

.prose pre code {
  padding: 0;
  border: 0;
  background: none;
  font-size: 1em;
}

/* FAQ */
.faq { display: grid; gap: 10px; margin-top: 8px; }
.faq details {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.faq summary {
  padding: 14px 16px;
  font-weight: 650;
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--ink-3);
  flex: none;
}
.faq details[open] summary::after { content: "\2212"; }
.faq details[open] summary { border-bottom: 1px solid var(--line); }
.faq .faq__answer {
  padding: 12px 16px 15px;
  font-size: 0.92rem;
  color: var(--ink-2);
}
.faq .faq__answer p:last-child { margin-bottom: 0; }

/* ---------- Next steps ---------- */
.next-up {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface-2);
}
.next-up h2 { font-size: 1.05rem; margin-bottom: 8px; }
.next-up ul { margin: 0; padding-left: 1.2em; font-size: 0.92rem; color: var(--ink-2); }
.next-up li { margin-bottom: 4px; }
.next-up a { text-decoration: none; font-weight: 600; }
.next-up a:hover { text-decoration: underline; }

/* ---------- Ad slots ---------- */
.ad-slot {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100px;
  margin: 26px 0;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.ad-slot[data-slot="in-article"] { min-height: 250px; }
.ad-slot[data-slot="mid"] { min-height: 280px; }
.ad-slot[data-slot="footer"] { min-height: 90px; }

@media (min-width: 760px) {
  .ad-slot[data-slot="mid"] { min-height: 250px; }
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 40px;
  padding: 30px 0 26px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  font-size: 0.88rem;
  color: var(--ink-2);
}
.footer__top {
  display: grid;
  gap: 22px;
  margin-bottom: 24px;
}
.footer__brand p { margin: 10px 0 0; max-width: 34ch; color: var(--ink-3); font-size: 0.85rem; }
.footer__cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.footer__col h3 {
  margin: 0 0 8px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.footer__col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer__col a { color: var(--ink-2); text-decoration: none; }
.footer__col a:hover { color: var(--brand); text-decoration: underline; }

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--ink-2);
  text-align: left;
  cursor: pointer;
}
.link-btn:hover { color: var(--brand); text-decoration: underline; }
.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: space-between;
  align-items: center;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--ink-3);
}
.footer__bottom p { margin: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 12px);
  z-index: 80;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.86rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
  .wrap { padding: 0 24px; }
  .hero { padding: 56px 0 40px; }
  .section { padding: 44px 0; }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-panel { padding: 22px; }
  .compare { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result__actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .footer__top { grid-template-columns: 1.1fr 1.4fr; align-items: start; }
  .footer__cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
  .card-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero__actions { margin-bottom: 28px; }
}

/* ---------- Motion / print ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .site-header, .site-footer, .ad-slot, .hero__actions { display: none !important; }
  body { background: #fff; color: #000; }
}
