/* =========================================================================
   CompressTo — design system v3
   Editorial paper / archival photo lab.
   No framework. One stylesheet. All class names preserved for JS.
   ========================================================================= */

/* ---------- TOKENS ---------- */
:root {
  /* Palette — warm paper / ink */
  --paper:       #f5f1e8;
  --paper-2:     #ece5d3;
  --paper-3:     #e2d9c2;
  --ink:         #1a1714;
  --ink-2:       #3d342d;
  --ink-3:       #786b5b;
  --rule:        #cfc4ab;
  --rule-strong: #a99a7c;

  /* Accents */
  --accent:      #b8312f; /* passport-stamp vermilion */
  --accent-deep: #8c2421;
  --accent-tint: #f0d6d4;

  --success:     #2f6b3d;
  --success-bg:  #dde7d4;
  --warn:        #9c6a1c;
  --warn-bg:     #eedfc4;
  --error:       #a3231c;
  --error-bg:    #f0d3cf;

  /* Legacy variable aliases so any leftover refs still resolve */
  --bg:          var(--paper);
  --panel:       var(--paper);
  --panel-2:     var(--paper-2);
  --border:      var(--rule);
  --text:        var(--ink);
  --text-dim:    var(--ink-3);
  --accent-hover: var(--accent-deep);

  /* Typography */
  --font-display: 'Fraunces', 'Tiempos Headline', Georgia, serif;
  --font-body:    'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-mono:    'JetBrains Mono', 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Radii */
  --radius:    6px;
  --radius-sm: 3px;
  --radius-lg: 10px;

  /* Shadows — paper card */
  --shadow:        0 1px 0 var(--rule), 0 6px 18px -10px rgba(40, 30, 20, 0.18);
  --shadow-sunken: inset 0 1px 0 rgba(0,0,0,.04);
}

/* ---------- BASE ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "ss01", "cv11"; /* IBM Plex stylistic alts where supported */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Paper grain overlay — soft, sits behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.42;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.15  0 0 0 0 0.12  0 0 0 0 0.08  0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
body > * { position: relative; z-index: 1; }

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

::selection { background: var(--accent); color: var(--paper); }

/* ---------- LAYOUT ---------- */
.container {
  max-width: 940px;
  margin: 0 auto;
  padding: 28px 24px;
}

/* ---------- HEADER ---------- */
header.site {
  border-bottom: 1px solid var(--rule);
  padding: 16px 0;
  margin-bottom: 24px;
  background: var(--paper);
}
header.site .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0;
  padding-bottom: 0;
  gap: 16px;
}
header.site .brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 480;
  font-size: 22px;
  letter-spacing: -0.018em;
  font-variation-settings: "opsz" 36;
  line-height: 1;
}
header.site .brand-mark {
  width: 30px;
  height: 30px;
  display: inline-block;
  object-fit: contain;
}
header.site .brand-text { color: var(--ink); }
header.site .brand-to {
  color: var(--ink-3);
  font-weight: 380;
}
header.site .brand-tld {
  color: var(--ink-3);
  font-size: 0.78em;
  font-weight: 380;
  letter-spacing: 0;
}
header.site nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 18px;
}
header.site nav a {
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.005em;
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: border-color .15s, color .15s;
}
header.site nav a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
  text-decoration: none;
}

/* ---------- TYPOGRAPHY ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 380;
  font-variation-settings: "opsz" 144;
  letter-spacing: -0.02em;
}
h1 {
  font-size: clamp(2.1rem, 2vw + 1.6rem, 3.2rem);
  line-height: 1.04;
  margin: 8px 0 18px;
  font-weight: 360;
}
h2 {
  font-size: clamp(1.45rem, 1vw + 1.15rem, 1.85rem);
  line-height: 1.15;
  margin: 44px 0 14px;
  font-weight: 400;
  font-variation-settings: "opsz" 72;
}
h3 {
  font-size: 1.18rem;
  line-height: 1.25;
  margin: 26px 0 10px;
  font-weight: 450;
  font-variation-settings: "opsz" 36;
  letter-spacing: -0.01em;
}

p { margin: 10px 0; color: var(--ink-2); }
.lead {
  font-size: 1.13rem;
  line-height: 1.5;
  color: var(--ink-2);
  margin: 8px 0 28px;
  max-width: 60ch;
  font-weight: 350;
}
.muted { color: var(--ink-3); font-size: 13.5px; }

/* Tool tiles on the landing page — large clickable product entries */
.tool-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  list-style: none;
  padding: 0;
  margin: 24px 0 28px;
}
.tool-tiles li { margin: 0; }
.tool-tile {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: start;
  gap: 18px;
  padding: 22px 24px 20px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  box-shadow: 0 1px 0 var(--rule);
  transition: border-color .14s, background .14s, transform .14s, box-shadow .14s;
  height: 100%;
}
.tool-tile:hover {
  border-color: var(--accent);
  background: var(--paper);
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 4px 0 var(--rule), 0 14px 28px -16px rgba(140, 36, 33, 0.25);
}
.tool-tile:hover .tool-cta { color: var(--accent-deep); }
.tool-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink-2);
}
.tool-glyph svg { width: 30px; height: 30px; }
.tool-tile:hover .tool-glyph {
  background: var(--accent-tint);
  border-color: var(--accent);
  color: var(--accent-deep);
}
.tool-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.tool-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.tool-title {
  font-family: var(--font-display);
  font-weight: 420;
  font-size: 22px;
  font-variation-settings: "opsz" 36;
  letter-spacing: -0.015em;
  line-height: 1.15;
  margin: 0 0 2px;
  color: var(--ink);
}
.tool-tile p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
}
.tool-cta {
  margin-top: 10px;
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  font-weight: 500;
  color: var(--accent);
  transition: color .12s;
}
@media (max-width: 720px) {
  .tool-tiles { grid-template-columns: 1fr; gap: 12px; }
  .tool-tile { padding: 18px 18px 16px; grid-template-columns: 44px 1fr; gap: 14px; }
  .tool-glyph { width: 44px; height: 44px; }
  .tool-glyph svg { width: 24px; height: 24px; }
  .tool-title { font-size: 19px; }
}

/* Two side-by-side pitch cards under the H1 — explain the two modes */
.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 12px 0 16px;
}
.mode-card {
  position: relative;
  padding: 18px 20px 16px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 var(--rule);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.mode-card:hover {
  border-color: var(--rule-strong);
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--rule), 0 8px 18px -10px rgba(40,30,20,.18);
}
.mode-card-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}
.mode-card-title {
  font-family: var(--font-display);
  font-weight: 420;
  font-size: 20px;
  font-variation-settings: "opsz" 36;
  letter-spacing: -0.012em;
  line-height: 1.18;
  margin: 0 0 6px;
  color: var(--ink);
}
.mode-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-2);
}
@media (max-width: 640px) {
  .mode-cards { grid-template-columns: 1fr; gap: 10px; margin: 8px 0 14px; }
  .mode-card { padding: 16px 16px 14px; }
  .mode-card-title { font-size: 18px; }
  .mode-card p { font-size: 13.5px; }
}

/* Editorial decoration: a tiny rule + label that sits above the H1 */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-3);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--ink-3);
}

/* Breadcrumb (used on preset / country pages) */
.crumb {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 4px 0 6px;
}
.crumb a {
  color: var(--ink-3);
  text-decoration: none;
  border-bottom: 1px dotted var(--rule);
}
.crumb a:hover { color: var(--ink); border-bottom-color: var(--ink-3); }
.crumb .sep {
  display: inline-block;
  margin: 0 7px;
  opacity: .55;
}

/* ---------- TOOL CARD ---------- */
.tool {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 26px 26px 22px;
  margin-top: 8px;
  box-shadow: var(--shadow);
}

/* Registration crosshairs — printer's marks at the four corners */
.tool::before, .tool::after,
.tool > .reg-tl, .tool > .reg-tr,
.tool > .reg-bl, .tool > .reg-br { display: none; } /* hide if any old refs */

.tool {
  /* Use inline backgrounds for the 4 corners — a 12×12 crosshair drawn into a tiny SVG */
  --crosshair: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><g stroke='%23a99a7c' stroke-width='1' fill='none'><line x1='7' y1='0' x2='7' y2='14'/><line x1='0' y1='7' x2='14' y2='7'/></g></svg>");
  background-image: var(--crosshair), var(--crosshair), var(--crosshair), var(--crosshair);
  background-repeat: no-repeat;
  background-position: 8px 8px, calc(100% - 8px) 8px, 8px calc(100% - 8px), calc(100% - 8px) calc(100% - 8px);
  background-size: 12px 12px;
}

/* ---------- DROP ZONE ---------- */
#drop, #pdf-drop, #ps-drop {
  position: relative;
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius);
  padding: 28px 18px 22px;
  text-align: center;
  cursor: pointer;
  transition: border-color .18s, background .18s;
  background: linear-gradient(180deg, var(--paper-2), var(--paper));
}
#drop::after, #pdf-drop::after, #ps-drop::after {
  content: "DROP ZONE";
  position: absolute;
  top: 10px;
  right: 14px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  color: var(--ink-3);
  opacity: .7;
  pointer-events: none;
}
#drop:hover, #drop.dragover,
#pdf-drop:hover, #pdf-drop.dragover,
#ps-drop:hover, #ps-drop.dragover {
  border-color: var(--accent);
  background: var(--accent-tint);
}
#drop.has-file, #pdf-drop.has-file, #ps-drop.has-file {
  border-style: solid;
  border-color: var(--success);
  background: var(--success-bg);
}
#drop.has-file::after, #pdf-drop.has-file::after, #ps-drop.has-file::after {
  content: "FILE LOADED";
  color: var(--success);
  opacity: 1;
}
/* When the image stage is showing two images (after compress), widen the prompt label */
#drop.has-result::after { content: "BEFORE  /  AFTER"; }

#drop .icon, #pdf-drop .icon, #ps-drop .icon {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
  color: var(--ink-2);
}
#drop .icon svg, #pdf-drop .icon svg, #ps-drop .icon svg {
  width: 34px; height: 34px; stroke-width: 1.3;
}
#drop strong, #pdf-drop strong, #ps-drop strong {
  display: block;
  margin: 2px 0 4px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 18px;
  font-variation-settings: "opsz" 36;
  letter-spacing: -0.01em;
  color: var(--ink);
}
#drop .muted, #pdf-drop .muted, #ps-drop .muted { font-size: 13px; color: var(--ink-3); }
#drop .file-name, #pdf-drop .file-name, #ps-drop .file-name {
  display: block;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--rule);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  word-break: break-all;
}

/* All native file inputs are hidden — the drop zone is the click target */
#file, #pdf-file, #ps-file { display: none; }

/* The drop-zone prompt (icon + text) — hidden once a file is loaded */
.drop-prompt { display: block; }
#drop.has-file .drop-prompt { display: none; }

/* ---------- IMAGE COMPARE STAGE (inside the drop zone) ---------- */
.drop-stage {
  display: none;
  gap: 16px;
  align-items: stretch;
  justify-content: center;
  width: 100%;
}
#drop.has-file .drop-stage { display: flex; }

.stage-img {
  margin: 0;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: max-width .3s ease;
}
/* When only the original is shown, it sits centred and larger */
#drop:not(.has-result) .stage-original { max-width: 280px; }
#drop.has-result .stage-img { max-width: 240px; flex: 1 1 0; }

.stage-img img {
  display: block;
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  background: var(--paper);
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 0 var(--rule), 0 6px 14px -8px rgba(40,30,20,.18);
}
.stage-img.stage-compressed img { border-color: var(--success); }

/* The compressed image is hidden until a compression result exists */
.stage-compressed { display: none; }
#drop.has-result .stage-compressed { display: flex; }

/* ---------- PRINT-SHEET LOADED STATE (thumbnail of the handed-off / chosen photo) ---------- */
#ps-drop.has-file .drop-prompt { display: none; }
.ps-loaded { display: none; flex-direction: column; align-items: center; gap: 8px; }
#ps-drop.has-file .ps-loaded { display: flex; }
.ps-loaded img {
  max-width: 180px;
  max-height: 200px;
  object-fit: contain;
  background: var(--paper);
  padding: 6px;
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 0 var(--rule), 0 6px 14px -8px rgba(40,30,20,.18);
}
.ps-loaded .ps-loaded-cap {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
  text-align: center;
  word-break: break-all;
}
.ps-loaded .ps-loaded-cap .cap-label {
  display: block;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--success);
  margin-bottom: 2px;
}

.stage-cap {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  text-align: center;
  line-height: 1.5;
}
.stage-cap .cap-label {
  display: block;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 2px;
}
.stage-cap .cap-size {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.stage-compressed .stage-cap .cap-size { color: var(--success); }
.stage-cap .cap-meta { display: block; font-size: 10px; color: var(--ink-3); margin-top: 2px; }

/* The "−NN%" chip between the two images */
.stage-arrow {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: center;
  flex: 0 0 auto;
  gap: 4px;
}
#drop.has-result .stage-arrow { display: flex; }
.stage-arrow .arrow-glyph {
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--ink-3);
  line-height: 1;
}
.stage-arrow .arrow-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
  background: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: 999px;
  padding: 2px 9px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
@media (max-width: 560px) {
  #drop.has-result .drop-stage { flex-direction: column; align-items: center; }
  #drop.has-result .stage-img { max-width: 220px; }
  .stage-arrow .arrow-glyph { transform: rotate(90deg); }
}

/* ---------- MODE SELECTOR (two big cards inside the tool) ---------- */
.mode-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 0 0 18px;
}
/* Hide the mode selector once a file is loaded (mode is committed) or in a locked preset workspace */
.tool.has-file .mode-select,
.tool[data-mode-locked="1"] .mode-select { display: none; }

.mode-opt {
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  cursor: pointer;
  font-family: var(--font-body);
  box-shadow: 0 1px 0 var(--rule);
  transition: border-color .14s, background .14s, transform .12s, box-shadow .14s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mode-opt:hover {
  border-color: var(--rule-strong);
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--rule), 0 8px 18px -10px rgba(40,30,20,.18);
}
.mode-opt.active {
  border-color: var(--ink);
  background: var(--paper);
  box-shadow: 0 2px 0 var(--ink), inset 0 0 0 1px var(--ink);
}
.mode-opt .mode-opt-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.mode-opt.active .mode-opt-label { color: var(--accent); }
.mode-opt .mode-opt-title {
  font-family: var(--font-display);
  font-weight: 440;
  font-size: 19px;
  font-variation-settings: "opsz" 36;
  letter-spacing: -0.012em;
  line-height: 1.15;
  color: var(--ink);
}
.mode-opt .mode-opt-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
  margin: 0;
}
.mode-opt .mode-opt-check {
  position: absolute;
}
@media (max-width: 560px) {
  .mode-select { grid-template-columns: 1fr; gap: 8px; }
  .mode-opt { padding: 13px 15px 12px; }
  .mode-opt .mode-opt-title { font-size: 17px; }
}

/* Legacy .mode-tabs kept hidden (superseded by .mode-select) */
.mode-tabs { display: none; }

#mode-quick.hidden, #mode-preset.hidden { display: none; }

/* ---------- QUICK-MODE PRESETS (chips) ---------- */
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 16px;
}
.preset {
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--ink-2);
  padding: 6px 13px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all .12s;
}
.preset:hover { border-color: var(--ink); color: var(--ink); }
.preset.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* ---------- CONTROLS ---------- */
.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 14px 0 16px;
}
.controls label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: block;
  margin-bottom: 6px;
}
.input-row { display: flex; gap: 8px; }
.controls input, .controls select,
.preset-filters input, .preset-filters select {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--ink);
  padding: 9px 11px;
  font-family: var(--font-body);
  font-size: 14.5px;
  width: 100%;
  transition: border-color .12s, background .12s;
}
.controls input,
.preset-filters input { font-family: var(--font-mono); font-size: 13.5px; }
.controls input:focus, .controls select:focus,
.preset-filters input:focus, .preset-filters select:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--paper);
  box-shadow: 0 0 0 3px rgba(26, 23, 20, 0.08);
}

/* ---------- ACTIONS / BUTTONS ---------- */
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 4px;
}

button.primary, a.primary {
  background: var(--accent);
  color: var(--paper);
  border: 1px solid var(--accent);
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0.005em;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  transition: background .12s, transform .12s, box-shadow .12s;
  box-shadow: 0 1px 0 var(--accent-deep);
}
button.primary:hover, a.primary:hover {
  background: var(--accent-deep);
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--accent-deep), 0 6px 14px -8px rgba(140, 36, 33, 0.4);
}
button.primary:active, a.primary:active {
  transform: translateY(1px);
  box-shadow: 0 0 0 var(--accent-deep);
}
button.primary:disabled {
  background: var(--paper-3);
  color: var(--ink-3);
  border-color: var(--rule);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}
button.primary:disabled:hover {
  background: var(--paper-3);
  transform: none;
}

button.secondary {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--rule);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}
button.secondary:hover {
  color: var(--ink);
  border-color: var(--ink-2);
  background: var(--paper-2);
}
button.secondary:disabled {
  opacity: .45;
  cursor: not-allowed;
}
button.secondary:disabled:hover {
  color: var(--ink-2);
  border-color: var(--rule);
  background: transparent;
}

/* ---------- PRIVACY BADGE ---------- */
.privacy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--success-bg);
  border: 1px solid var(--success);
  color: var(--success);
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  font-weight: 500;
  margin-top: 4px;
}

/* ---------- STATUS LINE ---------- */
#status {
  margin-top: 16px;
  padding: 8px 10px;
  border-left: 2px solid transparent;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  min-height: 22px;
  color: var(--ink-2);
}
#status:empty { padding: 0; min-height: 0; }
#status.success { color: var(--success); border-color: var(--success); }
#status.error   { color: var(--error); border-color: var(--error); background: var(--error-bg); }
#status.working { color: var(--warn); border-color: var(--warn); }
#status.warning { color: var(--warn); border-color: var(--warn); }
#status.info    { color: var(--ink-2); border-color: var(--rule-strong); }

/* ---------- RESULT BLOCK ---------- */
#result { margin-top: 22px; }
#result.hidden { display: none; }

.size-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 14px 0;
}
.size-box {
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  position: relative;
}
.size-box .label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 500;
}
.size-box .value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  color: var(--ink);
  margin-top: 4px;
  letter-spacing: -0.01em;
}
.size-box.after { background: var(--success-bg); border-color: var(--success); }
.size-box.after .value { color: var(--success); }
.size-box .meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 6px;
  letter-spacing: 0.04em;
}

#preview {
  max-width: 100%;
  max-height: 320px;
  display: block;
  margin: 14px auto;
  background: var(--paper);
  padding: 8px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  box-shadow: 0 1px 0 var(--rule), 0 6px 14px -8px rgba(40,30,20,.18);
}

#download.primary { padding: 13px 26px; font-size: 15.5px; }

.hidden { display: none !important; }

/* ---------- RESULT CONFIDENCE PANEL ("VERIFIED" stamp moment) ---------- */
.result-confidence {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--success);
  border-radius: var(--radius);
  padding: 18px 20px 16px;
  margin: 16px 0;
  overflow: hidden;
}
.result-confidence.has-warn { border-left-color: var(--warn); }
.result-confidence.has-err  { border-left-color: var(--error); }

.result-confidence-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}
.result-confidence-icon {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 26px;
  color: var(--paper);
  background: var(--success);
  border-radius: 50%;
}
.result-confidence-icon.warn { background: var(--warn); }
.result-confidence-icon.err  { background: var(--error); }
.result-confidence-title {
  font-family: var(--font-display);
  font-weight: 420;
  font-size: 20px;
  font-variation-settings: "opsz" 72;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--ink);
}
.result-confidence-sub {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 3px;
}

/* The big stamp — only shown on full success */
.verified-stamp {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 96px;
  height: 96px;
  pointer-events: none;
  transform: rotate(-8deg);
  opacity: 0;
  animation: stamp-down .42s cubic-bezier(.2,.7,.3,1.4) .15s forwards;
}
.verified-stamp svg { width: 100%; height: 100%; }
@keyframes stamp-down {
  0%   { opacity: 0; transform: rotate(-22deg) scale(1.7); }
  60%  { opacity: 1; transform: rotate(-6deg) scale(.92); }
  100% { opacity: 0.88; transform: rotate(-8deg) scale(1); }
}
@media (max-width: 640px) {
  .verified-stamp { width: 78px; height: 78px; top: 10px; right: 10px; }
}

/* ---------- COMPLIANCE LIST ---------- */
.compliance-list {
  display: grid;
  gap: 0;
  margin: 10px 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--paper);
  overflow: hidden;
}
.compliance-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  font-size: 13.5px;
  color: var(--ink-2);
}
.compliance-row:last-child { border-bottom: 0; }
.compliance-row .check {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border-radius: 50%;
  font-size: 11px;
  flex-shrink: 0;
}
.compliance-pass .check { background: var(--success); color: var(--paper); }
.compliance-warn .check { background: var(--warn); color: var(--paper); }
.compliance-fail .check { background: var(--error); color: var(--paper); }
.compliance-row .what { color: var(--ink); }
.compliance-row .what strong {
  font-weight: 500;
  font-family: var(--font-mono);
  color: var(--ink);
  background: var(--paper-2);
  padding: 1px 6px;
  border-radius: 3px;
}
.compliance-row .why {
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.manual-checks {
  margin-top: 12px;
  padding: 11px 14px;
  background: var(--paper-2);
  border-left: 2px solid var(--rule-strong);
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-2);
}
.manual-checks strong {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}
.manual-checks ul { margin: 0; padding-left: 16px; }

/* Background swatch chip inside compliance row */
.bg-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-2);
}
.bg-chip .swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  display: inline-block;
}

/* ---------- PRESET MODE ---------- */
.preset-filters {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper);
  padding: 6px 0 10px;
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 10px;
}

#preset-list {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--paper);
  padding: 4px;
  margin-bottom: 12px;
}
.preset-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--ink);
  padding: 11px 13px;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body);
  border-radius: 3px;
  transition: background .12s;
  margin: 1px 0;
  border-left: 2px solid transparent;
}
.preset-item:hover { background: var(--paper-2); }
.preset-item.selected {
  background: var(--paper-2);
  border-left-color: var(--accent);
}
.preset-name { font-size: 14.5px; font-weight: 500; color: var(--ink); }
.preset-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  margin-top: 3px;
  letter-spacing: 0.04em;
}

#mode-preset.collapsed .preset-filters,
#mode-preset.collapsed #preset-list { display: none; }

/* ---------- PRESET WORKSPACE — numbered steps (left) + requirements card (right) ---------- */
.preset-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  margin-top: 12px;
}
@media (max-width: 720px) {
  .preset-workspace { grid-template-columns: 1fr; gap: 14px; }
}

/* Hide the workspace when no preset is selected (the search/list takes over) */
.preset-workspace:empty,
#mode-preset:not(.collapsed) .preset-workspace > #preset-steps:empty + #preset-detail .muted {
  /* still display detail "Pick a preset" hint */
}
/* If no preset selected, hide the empty workspace's left column entirely so
   the "Pick a preset above" hint reads cleanly */
#preset-steps:empty {
  display: none;
}
#preset-steps:empty + #preset-detail {
  grid-column: 1 / -1;
}

/* Step buttons — big, two-line, numbered */
.preset-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.preset-step {
  display: grid;
  grid-template-columns: 38px 1fr;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 14px 14px;
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body);
  transition: border-color .14s, background .14s, transform .12s, box-shadow .12s;
  position: relative;
  box-shadow: 0 1px 0 var(--rule);
}
.preset-step:hover {
  border-color: var(--ink);
  background: var(--paper-2);
  transform: translateY(-1px);
  box-shadow: 0 3px 0 var(--rule-strong);
}
.preset-step:active {
  transform: translateY(0);
  box-shadow: 0 1px 0 var(--rule);
}
.preset-step:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.preset-step:disabled:hover {
  border-color: var(--rule);
  background: var(--paper);
  transform: none;
  box-shadow: 0 1px 0 var(--rule);
}

.preset-step .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  font-variation-settings: "opsz" 36;
  color: var(--ink);
}
.preset-step .step-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.preset-step .step-title {
  font-family: var(--font-display);
  font-weight: 420;
  font-size: 17px;
  font-variation-settings: "opsz" 36;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: var(--ink);
}
.preset-step .step-sub {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  line-height: 1.4;
  text-transform: none;
}

/* Step 2 (Compress) — primary visual treatment */
.preset-step-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
  box-shadow: 0 2px 0 var(--accent-deep);
}
.preset-step-primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
  box-shadow: 0 4px 0 var(--accent-deep), 0 8px 16px -8px rgba(140, 36, 33, 0.5);
}
.preset-step-primary .step-num {
  background: rgba(245, 241, 232, 0.18);
  border-color: rgba(245, 241, 232, 0.4);
  color: var(--paper);
}
.preset-step-primary .step-title { color: var(--paper); }
.preset-step-primary .step-sub { color: rgba(245, 241, 232, 0.8); }
.preset-step-primary:disabled {
  background: var(--paper-3);
  border-color: var(--rule);
  color: var(--ink-3);
  box-shadow: none;
}
.preset-step-primary:disabled .step-num {
  background: var(--paper-2);
  border-color: var(--rule);
  color: var(--ink-3);
}
.preset-step-primary:disabled .step-title { color: var(--ink-3); }
.preset-step-primary:disabled .step-sub { color: var(--ink-3); }

/* Step 1 (Crop) — helper accent */
.preset-step-helper .step-num {
  background: var(--paper);
  border-color: var(--rule-strong);
}

/* Hide the original action row when the preset workspace is active */
.tool[data-workspace="preset"] > .actions { display: none; }

/* ---------- REQUIREMENTS CARD ---------- */
.preset-detail-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px 18px 14px;
  margin-bottom: 0;
}
.preset-detail-title {
  font-family: var(--font-display);
  font-weight: 440;
  font-size: 19px;
  font-variation-settings: "opsz" 36;
  letter-spacing: -0.012em;
  margin-bottom: 2px;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  line-height: 1.2;
}
.preset-detail-jur {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 12px;
}
.preset-detail-rows {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  font-size: 13.5px;
  border-top: 1px solid var(--rule);
}
.preset-detail-rows > div {
  display: grid;
  grid-template-columns: 100px 1fr;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
}
.preset-detail-rows > div:last-child { border-bottom: 0; }
.preset-detail-rows .muted {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  margin: 0;
  padding: 0;
}
.preset-detail-rows > div > *:not(.muted) {
  font-family: var(--font-mono);
  font-size: 13px;
}
.preset-detail-notes {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.5;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
}
.preset-detail-warning {
  margin-top: 10px;
  padding: 8px 11px;
  background: var(--warn-bg);
  border-left: 2px solid var(--warn);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.45;
}
.preset-source {
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.preset-source a {
  color: var(--accent);
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid var(--success);
  color: var(--success);
  padding: 2px 9px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.verified-badge::before { content: "✓"; font-weight: 700; }
.verified-badge.verified-badge-warn {
  border-color: var(--warn);
  color: var(--warn);
}
.verified-badge.verified-badge-warn::before { content: "!"; }

#mode-preset .muted {
  padding: 16px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ---------- SPEC BADGES (preset landing pages) ---------- */
.spec-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 4px;
}
.spec-badge {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  background: var(--paper);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.spec-badge .label {
  color: var(--ink-3);
  font-size: 9.5px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 500;
}

/* ---------- COUNTRY GRID (passport-stamp cards) ---------- */
.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin: 18px 0;
  list-style: none;
  padding: 0;
}
.country-grid li { margin: 0; }
.country-grid a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: border-color .14s, background .14s, transform .14s;
  position: relative;
}
.country-grid a:hover {
  border-color: var(--ink);
  background: var(--paper-2);
  text-decoration: none;
  transform: translateY(-1px);
}
.country-grid .flag {
  font-size: 22px;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--paper);
}
.country-grid .count {
  margin-left: auto;
  color: var(--ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

/* Businesses card — same shape as country cards, accent border */
.country-grid a.business-card-link {
  background: linear-gradient(180deg, var(--paper), var(--paper-2));
  border-color: var(--rule-strong);
  position: relative;
}
.country-grid a.business-card-link::before {
  content: "";
  position: absolute;
  top: -1px; bottom: -1px; left: -1px;
  width: 3px;
  background: var(--accent);
  border-radius: 3px 0 0 3px;
}
.country-grid a.business-card-link:hover {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent-deep);
}
.country-grid a.business-card-link .flag {
  background: var(--accent-tint);
  border-color: var(--accent);
}

/* Best-effort spec disclaimer — appears on uncertain preset pages */
.best-effort-notice {
  margin: 14px 0 18px;
  padding: 12px 16px;
  background: var(--warn-bg);
  border: 1px solid var(--warn);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
.best-effort-notice strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--warn);
  font-weight: 600;
  margin-bottom: 4px;
}
.best-effort-notice a { color: var(--accent); }

/* ---------- ARTICLE / SIZE LANDING ---------- */
article { margin-top: 36px; }
article p, article li { color: var(--ink-2); }
article ul, article ol { padding-left: 20px; }
article ul li, article ol li { margin: 8px 0; }
article a { color: var(--accent); }

article table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-family: var(--font-mono);
  font-size: 13px;
}
article th, article td {
  border-bottom: 1px solid var(--rule);
  padding: 9px 12px;
  text-align: left;
}
article th {
  background: var(--paper-2);
  font-weight: 500;
  font-family: var(--font-body);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- FAQ ---------- */
.faq details {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin: 8px 0;
  transition: border-color .14s, background .14s;
}
.faq details[open] { background: var(--paper-2); border-color: var(--rule-strong); }
.faq summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--ink);
  list-style: none;
  position: relative;
  padding-right: 28px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 0;
  top: 0;
  font-family: var(--font-mono);
  font-size: 18px;
  color: var(--ink-3);
  transition: transform .15s;
}
.faq details[open] summary::after { content: "−"; }
.faq summary:hover { color: var(--accent); }
.faq p { margin: 10px 0 0; color: var(--ink-2); font-size: 14px; }

/* ---------- RELATED SIZES ---------- */
.related-sizes {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px;
  margin-top: 28px;
}
.related-sizes h3 { margin-top: 0; }
.related-sizes ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}
.related-sizes li { margin: 0; }
.related-sizes a {
  display: block;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-2);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: border-color .12s, background .12s, color .12s;
}
.related-sizes a:hover {
  border-color: var(--ink);
  color: var(--ink);
  text-decoration: none;
  background: var(--paper);
}

/* ---------- FOOTER ---------- */
footer.site {
  margin-top: 72px;
  padding: 28px 0 36px;
  border-top: 1px solid var(--rule);
  color: var(--ink-3);
  font-size: 13px;
}
footer.site .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
footer.site nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}
footer.site nav a {
  color: var(--ink-3);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
footer.site nav a:hover { color: var(--ink); }

/* ---------- CROP MODAL ---------- */
.crop-modal {
  position: fixed;
  inset: 0;
  background: rgba(26, 23, 20, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.crop-modal-inner {
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 680px;
  width: 100%;
  max-height: calc(100vh - 32px);
  overflow: auto;
  box-shadow: 0 20px 60px -20px rgba(0,0,0,.4);
}
.crop-modal h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 420;
  font-size: 22px;
  font-variation-settings: "opsz" 72;
}
.crop-modal .crop-hint {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.05em;
  margin-bottom: 14px;
}
.crop-stage {
  position: relative;
  margin: 12px auto;
  overflow: hidden;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.crop-stage img {
  max-width: 100%;
  max-height: 70vh;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
  user-drag: none;
}
.crop-box {
  position: absolute;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 9999px rgba(245, 241, 232, 0.55);
  cursor: move;
  touch-action: none;
}
.crop-box::before, .crop-box::after,
.crop-box .v1, .crop-box .v2 {
  content: "";
  position: absolute;
  background: rgba(184, 49, 47, .35);
}
.crop-box::before { top: 33.3%; left: 0; right: 0; height: 1px; }
.crop-box::after  { top: 66.6%; left: 0; right: 0; height: 1px; }
.crop-box .v1, .crop-box .v2 {
  position: absolute;
  top: 0; bottom: 0; width: 1px;
}
.crop-box .v1 { left: 33.3%; }
.crop-box .v2 { left: 66.6%; }
.crop-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border: 2px solid var(--paper);
  border-radius: 50%;
}
.crop-handle.nw { top: -8px; left: -8px; cursor: nwse-resize; }
.crop-handle.ne { top: -8px; right: -8px; cursor: nesw-resize; }
.crop-handle.sw { bottom: -8px; left: -8px; cursor: nesw-resize; }
.crop-handle.se { bottom: -8px; right: -8px; cursor: nwse-resize; }
.crop-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ---------- CONTACT FORM ---------- */
.contact-form {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}
.contact-form label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  display: block;
  margin-bottom: 5px;
}
.contact-form input,
.contact-form textarea,
.contact-form select {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--ink);
  padding: 11px 13px;
  font-family: var(--font-body);
  font-size: 14.5px;
  width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
.contact-form textarea { min-height: 130px; resize: vertical; line-height: 1.55; }
.contact-form input:focus,
.contact-form textarea:focus,
.contact-form select:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(26, 23, 20, 0.08);
}

/* ---------- AD SLOTS (CLS-safe + tasteful) ---------- */
.ad-slot {
  position: relative;
  min-height: 90px;
  background: transparent;
  margin: 28px 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-slot::before {
  content: "SPONSORED";
  position: absolute;
  top: -10px;
  left: 0;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  color: var(--ink-3);
  background: var(--paper);
  padding: 2px 8px;
  border: 1px solid var(--rule);
  border-radius: 2px;
}
.ad-slot[data-position="below-tool"] { min-height: 250px; }
@media (min-width: 768px) {
  .ad-slot[data-position="below-tool"] { min-height: 90px; }
}
.ad-slot[data-position="end-article"] { min-height: 250px; margin: 40px 0 24px; }
@media (min-width: 768px) {
  .ad-slot[data-position="end-article"] { min-height: 90px; }
}
.ad-slot[data-position="sticky-footer"] {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  min-height: 60px;
  background: var(--paper);
  border-top: 1px solid var(--rule);
  z-index: 100;
  margin: 0;
}
.ad-slot[data-position="sticky-footer"]::before {
  /* On the sticky bar, the "Sponsored" label sits on the right edge */
  top: 50%;
  left: auto;
  right: 14px;
  transform: translateY(-50%);
}
/* Reserve space at the bottom of the page across all viewports for the sticky ad */
body { padding-bottom: 70px; }

/* ---------- ENTRY ANIMATIONS ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
main.container > h1,
main.container > .lead,
main.container > .eyebrow,
main.container > .crumb,
main.container > .tool,
main.container > .spec-badges,
main.container > .mode-cards {
  animation: rise .55s cubic-bezier(.2,.7,.2,1) both;
}
main.container > .eyebrow { animation-delay: 0ms; }
main.container > .crumb   { animation-delay: 0ms; }
main.container > h1       { animation-delay: 60ms; }
main.container > .spec-badges { animation-delay: 90ms; }
main.container > .mode-cards { animation-delay: 120ms; }
main.container > .lead    { animation-delay: 160ms; }
main.container > .tool    { animation-delay: 200ms; }
@media (prefers-reduced-motion: reduce) {
  main.container > * { animation: none !important; }
  .verified-stamp { animation: none !important; opacity: 0.85 !important; }
}

/* ---------- MOBILE TUNING ---------- */
@media (max-width: 640px) {
  .container { padding: 20px 16px; }
  header.site .container { padding: 0 16px; gap: 12px; }
  header.site .brand { font-size: 20px; }
  header.site nav { gap: 4px 14px; }
  header.site nav a { font-size: 12.5px; }
  h1 { margin: 4px 0 12px; }
  .lead { font-size: 1rem; line-height: 1.55; margin: 4px 0 22px; }
  .tool { padding: 18px 16px; background-size: 10px 10px; }
  .tool { --crosshair: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'><g stroke='%23a99a7c' stroke-width='1' fill='none'><line x1='7' y1='0' x2='7' y2='14'/><line x1='0' y1='7' x2='14' y2='7'/></g></svg>"); }
  #drop { padding: 22px 14px 18px; }
  #drop .icon svg { width: 28px; height: 28px; }
  #drop strong { font-size: 16px; }
  .controls { grid-template-columns: 1fr; gap: 12px; }
  .size-compare { grid-template-columns: 1fr; }
  .mode-tab { font-size: 10.5px; padding: 8px 10px; }
  .preset-filters { grid-template-columns: 1fr; }
  .preset-detail-rows > div { grid-template-columns: 92px 1fr; gap: 10px; }
  .compliance-row { grid-template-columns: 20px 1fr; row-gap: 2px; padding: 9px 12px; }
  .compliance-row .why { grid-column: 1 / -1; padding-left: 28px; }
  .result-confidence { padding: 14px 14px 12px; }
  .result-confidence-title { font-size: 17px; }
  .verified-stamp { width: 72px; height: 72px; }
  footer.site { margin-top: 56px; }
  button.primary, a.primary { padding: 11px 18px; font-size: 14px; }
}
