/* FormFit — "government form" theme
   Stamp violet ink, white form paper, lavender guide grid, pass green / fail red */
@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400&display=swap');

:root {
  --ink: #4b3f9e;          /* stamp violet */
  --ink-dark: #352b7a;
  --text: #1d1b2e;
  --muted: #5d5a72;
  --paper: #ffffff;
  --grid: #e4e1f3;
  --tint: #f4f2fb;
  --pass: #17724a;
  --fail: #b3261e;
  --radius: 6px;
  --max: 1120px;
  --font: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 1.0625rem; line-height: 1.6;
  color: var(--text); background: var(--paper);
}
img, canvas { max-width: 100%; display: block; }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--ink-dark); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header */
.site-header { border-bottom: 1px solid var(--grid); background: var(--paper); position: relative; z-index: 5; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.25rem; color: var(--text); text-decoration: none; }
.logo svg { width: 28px; height: 28px; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; font-weight: 700; color: var(--ink); padding: 6px 10px; border: 1.5px solid var(--ink); border-radius: var(--radius); }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { background: var(--tint); }
.menu ul { position: absolute; right: 0; top: calc(100% + 6px); background: var(--paper); border: 1.5px solid var(--ink); border-radius: var(--radius); list-style: none; margin: 0; padding: 6px 0; min-width: 240px; box-shadow: 4px 4px 0 var(--grid); }
.menu li a { display: block; padding: 8px 14px; text-decoration: none; color: var(--text); }
.menu li a:hover, .menu li a[aria-current="page"] { background: var(--tint); color: var(--ink); }

/* Type */
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.45em; color: var(--text); }
h1 { font-size: clamp(1.75rem, 4.2vw, 2.6rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; }
.sub { color: var(--muted); font-size: 1.1rem; max-width: 40em; }
.privacy-line { display: inline-flex; align-items: center; gap: 8px; color: var(--pass); font-weight: 700; font-size: 0.98rem; }
.privacy-line svg { flex: none; }

/* Page intro */
.intro { padding-top: 32px; padding-bottom: 20px; }

/* Tool layout */
.tool { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 28px; align-items: start; padding-bottom: 40px; }
.panel { border: 1.5px solid var(--grid); border-radius: var(--radius); padding: 18px; background: var(--paper); }
.panel h2 { font-size: 1.05rem; margin-bottom: 12px; }
.field { margin-bottom: 14px; }
.field label, .field .label { display: block; font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; }
.field .hint { display: block; color: var(--muted); font-size: 0.88rem; margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input[type="number"], input[type="text"], select {
  width: 100%; padding: 10px 11px; font: 1rem var(--font); color: var(--text);
  border: 1.5px solid #c9c4e3; border-radius: var(--radius); background: var(--paper);
}
input:focus, select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--grid); }
input[type="range"] { width: 100%; accent-color: var(--ink); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 0.97rem; margin-bottom: 10px; }
.check input { margin-top: 5px; accent-color: var(--ink); width: 18px; height: 18px; flex: none; }
.preset-note { background: var(--tint); border-left: 3px solid var(--ink); padding: 10px 12px; font-size: 0.92rem; margin: 0 0 14px; border-radius: 0 var(--radius) var(--radius) 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ink); color: #fff; border: 2px solid var(--ink); border-radius: var(--radius);
  padding: 12px 20px; font: 700 1rem var(--font); cursor: pointer; text-decoration: none; min-height: 48px;
}
.btn:hover { background: var(--ink-dark); border-color: var(--ink-dark); color: #fff; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--tint); color: var(--ink-dark); }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: 0.92rem; }
.btn.block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

/* The photo box dropzone — the signature element */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  min-height: 300px; padding: 28px 20px; cursor: pointer;
  background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  border: 2.5px dashed var(--ink); border-radius: 2px;
}
.dropzone::before, .dropzone::after { content: ""; position: absolute; width: 22px; height: 22px; border: 3px solid var(--ink); }
.dropzone::before { top: -9px; left: -9px; border-right: 0; border-bottom: 0; }
.dropzone::after { bottom: -9px; right: -9px; border-left: 0; border-top: 0; }
.dropzone:hover, .dropzone.drag { background-color: var(--tint); }
.dropzone .affix { font-size: 1.35rem; font-weight: 700; color: var(--ink); margin: 0 0 4px; }
.dropzone .or { color: var(--muted); margin: 0 0 14px; }
.dropzone .types { color: var(--muted); font-size: 0.88rem; margin: 12px 0 0; }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone[hidden] { display: none; }

/* Workspace */
.workspace[hidden] { display: none; }
.stage { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: start; }
.editor-wrap { background-color: var(--tint); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 24px 24px; border: 1.5px solid var(--grid); border-radius: var(--radius); padding: 16px; display: flex; justify-content: center; }
.editor { touch-action: none; cursor: grab; outline: 2px solid var(--ink); background: #fff; max-height: 420px; width: auto; }
.editor:active { cursor: grabbing; }
.zoom-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.zoom-row label { font-weight: 700; font-size: 0.92rem; }
.drag-hint { color: var(--muted); font-size: 0.88rem; margin-top: 6px; }

/* Result card with stamp */
.result { border: 1.5px solid var(--grid); border-radius: var(--radius); padding: 16px; min-width: 220px; position: relative; }
.result .preview { border: 1px solid var(--grid); background: #fff; margin-bottom: 12px; max-height: 220px; width: auto; }
.result dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0 0 12px; font-size: 0.95rem; }
.result dt { color: var(--muted); }
.result dd { margin: 0; font-weight: 700; }
.size-big { font-size: 2.1rem; font-weight: 700; line-height: 1; margin: 2px 0 10px; }
.stamp {
  display: inline-block; transform: rotate(-4deg); border: 2.5px solid currentColor; border-radius: 4px;
  padding: 3px 10px; font-weight: 700; font-size: 1rem; letter-spacing: 0.02em; margin-bottom: 10px;
}
.stamp.pass { color: var(--pass); }
.stamp.fail { color: var(--fail); }
.stamp.busy { color: var(--muted); }

.msg { padding: 10px 12px; border-radius: var(--radius); font-size: 0.95rem; margin: 12px 0 0; }
.msg.error { background: #fcebea; color: var(--fail); border: 1px solid #f2c4c0; }
.msg.info { background: var(--tint); color: var(--ink-dark); border: 1px solid var(--grid); }
.msg[hidden] { display: none; }

/* File list (converter, pdf) */
.file-list { list-style: none; margin: 16px 0 0; padding: 0; border-top: 1px solid var(--grid); }
.file-list li { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.file-list .thumb { width: 48px; height: 48px; object-fit: cover; border: 1px solid var(--grid); background: var(--tint); display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: var(--ink); }
.file-list .name { font-weight: 700; word-break: break-all; font-size: 0.95rem; }
.file-list .meta { color: var(--muted); font-size: 0.86rem; }
.file-list .btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.icon-btn { width: 36px; height: 36px; border: 1.5px solid #c9c4e3; background: var(--paper); border-radius: var(--radius); cursor: pointer; font-size: 1rem; color: var(--text); }
.icon-btn:hover { border-color: var(--ink); color: var(--ink); }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Home: tool index */
.hero-home { padding-top: 44px; padding-bottom: 28px; }
.hero-home h1 { max-width: 18em; }
.tool-index { list-style: none; margin: 0 0 48px; padding: 0; border-top: 2px solid var(--text); }
.tool-index li { border-bottom: 1px solid var(--grid); }
.tool-index a { display: grid; grid-template-columns: 56px 1fr auto; gap: 16px; align-items: center; padding: 18px 4px; text-decoration: none; color: var(--text); }
.tool-index a:hover { background: var(--tint); }
.tool-index .ico { width: 48px; height: 48px; border: 2px dashed var(--ink); display: flex; align-items: center; justify-content: center; color: var(--ink); }
.tool-index h2 { font-size: 1.2rem; margin: 0; }
.tool-index p { margin: 2px 0 0; color: var(--muted); font-size: 0.96rem; }
.tool-index .spec { font-weight: 700; color: var(--ink); white-space: nowrap; font-size: 0.95rem; }

.spec-table { width: 100%; border-collapse: collapse; font-size: 0.96rem; margin: 12px 0 8px; }
.spec-table th, .spec-table td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--grid); vertical-align: top; }
.spec-table th { background: var(--tint); font-size: 0.9rem; }
.table-scroll { overflow-x: auto; }

/* Content */
.content { padding-top: 12px; padding-bottom: 48px; }
.content > * { max-width: 46rem; }
.content h2 { margin-top: 1.6em; }
.steps { padding-left: 1.3em; }
.steps li { margin-bottom: 8px; }
.faq details { border-bottom: 1px solid var(--grid); padding: 12px 0; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq details p { margin: 8px 0 0; color: var(--muted); }
.band { background: var(--tint); border-top: 1px solid var(--grid); border-bottom: 1px solid var(--grid); padding: 28px 0; margin-bottom: 40px; }
.band .wrap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.band h3 { font-size: 1.05rem; margin-bottom: 4px; }
.band p { color: var(--muted); font-size: 0.96rem; margin: 0; }
.more-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.more-tools a { border: 1.5px solid var(--grid); border-radius: 999px; padding: 6px 14px; text-decoration: none; font-size: 0.94rem; }
.more-tools a:hover { border-color: var(--ink); }

/* Footer */
.site-footer { border-top: 2px solid var(--text); padding: 28px 0 36px; font-size: 0.93rem; color: var(--muted); }
.site-footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 24px; }
.site-footer h3 { font-size: 0.95rem; color: var(--text); }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li { margin-bottom: 4px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--ink); }

/* Responsive */
@media (max-width: 880px) {
  .tool { grid-template-columns: 1fr; }
  .stage { grid-template-columns: 1fr; }
  .band .wrap { grid-template-columns: 1fr; }
  .site-footer .cols { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .tool-index a { grid-template-columns: 44px 1fr; }
  .tool-index .spec { grid-column: 2; white-space: normal; }
  .tool-index .ico { width: 40px; height: 40px; }
  .file-list li { grid-template-columns: 40px 1fr; }
  .file-list .btns { grid-column: 1 / -1; justify-content: flex-start; }
  .dropzone { min-height: 220px; }
  .site-footer .cols { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
