/* ==========================================================================
   CloudlessTools
   Dark-first editorial look: geometric sans (Outfit) + italic serif labels
   (Instrument Serif), one orange → rose → violet signature gradient, hairline
   borders. Fonts are self-hosted so pages make no third-party requests.
   ========================================================================== */

@font-face {
  font-family: "Outfit";
  src: url("../vendor/fonts/outfit-latin-variable.woff2") format("woff2-variations"),
       url("../vendor/fonts/outfit-latin-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("../vendor/fonts/instrument-serif-latin-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Dark is the default theme. */
  --bg: #141414;
  --surface: #1c1c1c;
  --surface-2: #252525;
  --text: #f4f2ee;
  --muted: #a8a39c;
  --border: #2c2c2c;
  --border-strong: #4a4744;
  --accent: #ff6b8b;
  --danger: #ff6b6b;
  --success: #4ade80;
  --chip-bg: #f4f2ee;
  --chip-text: #141414;

  /* Signature gradient. Bright stops for decoration; deep stops wherever white text sits on it. */
  --g1: #ff7a2f;
  --g2: #f2416b;
  --g3: #9a5cf5;
  --grad: linear-gradient(120deg, var(--g1), var(--g2) 50%, var(--g3));
  --grad-deep: linear-gradient(120deg, #c93d0a, #c81e5b 50%, #7444e0);
  --grad-hairline: linear-gradient(135deg,
    color-mix(in srgb, var(--g1) 55%, var(--border)),
    color-mix(in srgb, var(--g2) 40%, var(--border)) 50%,
    color-mix(in srgb, var(--g3) 55%, var(--border)));

  /* Category colours, sampled along the gradient. Used for tool icons and headings (≥4.5:1). */
  --cat-pdf: #ff8c4d;
  --cat-image: #ff6b8b;
  --cat-text: #e27ad9;
  --cat-developer: #b294ff;

  --radius: 6px;
  --radius-sm: 4px;
  --sans: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --max: 1120px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f6f4f0;
  --surface: #ffffff;
  --surface-2: #efece6;
  --text: #161616;
  --muted: #5f5a53;
  --border: #e2ded6;
  --border-strong: #b9b2a7;
  --accent: #be123c;
  --danger: #c62828;
  --success: #15803d;
  --chip-bg: #161616;
  --chip-text: #f6f4f0;
  --cat-pdf: #c2410c;
  --cat-image: #be123c;
  --cat-text: #a21caf;
  --cat-developer: #6d28d9;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 0.15em; }
em, .serif { font-family: var(--serif); font-style: italic; font-weight: 400; }

/* ---- Header ---------------------------------------------------------------- */
.site-header { position: relative; z-index: 20; }
.site-header .inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}
.brand img { display: block; width: 40px; height: 40px; }
.tagline { color: var(--muted); font-size: 1.05rem; white-space: nowrap; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 0.6rem; }

.icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  justify-content: center;
}
.icon-btn svg { width: 1.05rem; height: 1.05rem; fill: currentColor; }

.menu-btn {
  width: 2.75rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  background: none;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 7px;
}
.menu-btn:hover { background: none; }
.menu-btn span {
  display: block;
  height: 2px;
  width: 26px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s, width 0.2s;
}
.menu-btn span:last-child { width: 18px; }
.menu-btn[aria-expanded="true"] span:first-child { transform: translateY(4.5px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:last-child { width: 26px; transform: translateY(-4.5px) rotate(-45deg); }

.site-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}
.site-menu .inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2rem 1.5rem 2.25rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem 2rem;
}
.site-menu .eyebrow { margin-bottom: 0.6rem; }
.site-menu ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; }
.site-menu a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.5rem;
  margin-left: -0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 0.98rem;
}
.site-menu a:hover, .site-menu a[aria-current="page"] { background: var(--surface-2); }
.site-menu a svg { width: 1rem; height: 1rem; flex: none; fill: var(--cat); }
@media (max-width: 860px) { .site-menu .inner { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .site-menu .inner { grid-template-columns: 1fr; } }

@media (max-width: 760px) {
  .tagline { display: none; }
  .site-header .inner { padding: 1rem 1.25rem; }
}
@media (max-width: 480px) {
  .header-actions .btn-outline { display: none; }
  .brand { font-size: 1.05rem; }
  .brand img { width: 34px; height: 34px; }
}

/* ---- Layout & type --------------------------------------------------------- */
main {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 3rem;
}
@media (max-width: 760px) { main { padding: 1rem 1.25rem 2.5rem; } }

h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: clamp(2rem, 4.5vw, 2.75rem); margin: 0 0 0.6rem; }
h2 { font-size: 1.4rem; margin: 2.25rem 0 0.6rem; }
h3 { font-size: 1.1rem; }
.lead { color: var(--muted); font-size: 1.1rem; margin: 0 0 1.5rem; max-width: 46rem; }

.eyebrow {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--muted);
  margin: 0 0 0.35rem;
  line-height: 1.2;
}
.section-title { font-size: clamp(2rem, 4vw, 2.75rem); margin: 0 0 1.75rem; }
.dash { display: block; width: 26px; height: 3px; background: var(--text); margin-bottom: 1rem; }

/* ---- Buttons & controls ------------------------------------------------------ */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.toolbar .spacer { flex: 1; }

button, .btn, select, input[type="number"] {
  font: inherit;
  font-size: 0.92rem;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.9rem;
}
select, input[type="number"] { background: var(--surface); }
button, .btn {
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, color 0.15s, filter 0.15s, box-shadow 0.15s;
}
button:hover, .btn:hover { border-color: var(--text); background: var(--surface-2); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button:disabled:hover { border-color: var(--border-strong); background: transparent; }
.btn svg, button svg { width: 1rem; height: 1rem; fill: currentColor; flex: none; }

button.primary, .btn.primary {
  background: var(--grad-deep);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}
button.primary:hover, .btn.primary:hover {
  background: var(--grad-deep);
  border-color: transparent;
  filter: brightness(1.12);
  box-shadow: 0 6px 22px color-mix(in srgb, var(--g2) 35%, transparent);
}
button.primary:disabled:hover { filter: none; box-shadow: none; background: var(--grad-deep); }
.btn-lg { padding: 0.8rem 1.35rem; font-size: 1rem; }

button:focus-visible, select:focus-visible, textarea:focus-visible, input:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

label.inline { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.92rem; color: var(--muted); }
input[type="checkbox"], input[type="radio"], input[type="range"] { accent-color: var(--g2); }

textarea.code, .code-output {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.5;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  resize: vertical;
  tab-size: 2;
}

input[type="text"], input[type="url"], input[type="email"], input[type="tel"], input[type="password"], input.field, textarea.field {
  font: inherit;
  font-size: 0.95rem;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
}
input[type="color"] { width: 2.4rem; height: 2rem; padding: 0.1rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  min-height: 60vh;
}
.split > * { min-width: 0; }
.split textarea { height: 100%; min-height: 60vh; resize: none; }
.pane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
}
@media (max-width: 800px) {
  .split { grid-template-columns: 1fr; }
  .split textarea, .split .pane { min-height: 45vh; }
}

.status {
  font-size: 0.9rem;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  background: var(--surface);
}
.status.ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); }
.status.err { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

.dropzone {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover { border-color: var(--text); }
.dropzone.drag {
  border-style: solid;
  border-color: transparent;
  background: linear-gradient(var(--surface-2), var(--surface-2)) padding-box, var(--grad) border-box;
}
.dropzone strong { color: var(--text); font-weight: 600; }

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button {
  border: none;
  border-radius: 0;
  background: none;
  padding: 0.65rem 0.9rem;
  color: var(--muted);
}
.tabs button:hover { color: var(--text); background: none; }
.tabs button[aria-selected="true"] {
  color: var(--text);
  background: var(--grad) left bottom / 100% 2px no-repeat;
}

.file-list { list-style: none; padding: 0; margin: 0.75rem 0; display: grid; gap: 0.4rem; }
.file-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.6rem;
  font-size: 0.92rem;
}
.file-list li .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list li img { width: 40px; height: 40px; object-fit: cover; border-radius: var(--radius-sm); }
.file-list li button { padding: 0.2rem 0.55rem; }

.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.thumb-grid figure { margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.5rem; text-align: center; }
.thumb-grid img { max-width: 100%; display: block; margin: 0 auto 0.4rem; border: 1px solid var(--border); }
.thumb-grid figcaption { font-size: 0.82rem; color: var(--muted); }

/* ---- Home: hero ------------------------------------------------------------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: 2rem;
  padding: 3.5rem 0 4.5rem;
}
.hero-stat { display: flex; align-items: flex-end; gap: 1.1rem; margin-bottom: 2.25rem; }
.big-num {
  font-family: var(--sans);
  font-weight: 700;
  font-size: clamp(4.75rem, 11vw, 8rem);
  line-height: 0.8;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
}
.stat-label { font-family: var(--serif); font-style: italic; font-size: 1.3rem; line-height: 1.3; color: var(--text); padding-bottom: 0.2rem; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.5rem); line-height: 1.05; letter-spacing: -0.03em; margin-bottom: 1rem; max-width: 15ch; }
.hero .lead { margin-bottom: 2rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero-art { width: 100%; height: auto; display: block; overflow: visible; }
/* Hero illustration: theme-aware colours, so it works in dark and light mode. */
.hero-art .a-surface { fill: var(--surface); }
.hero-art .a-surface2 { fill: var(--surface-2); }
.hero-art .a-hair { stroke: var(--border); }
.hero-art .a-dot { fill: var(--border-strong); }
.hero-art .a-line { fill: var(--border-strong); }
.hero-art .a-gap { stroke: var(--surface); }
.hero-art .a-dash { stroke: var(--muted); fill: none; }
.hero-art .a-stop { stroke: var(--danger); }
.hero-art .a-stop-x { stroke: var(--danger); }
.hero-art .a-pdf { stroke: var(--cat-pdf); }
.hero-art .a-image { stroke: var(--cat-image); }
.hero-art .a-dev { stroke: var(--cat-developer); }
.hero-art .a-fill-pdf { fill: var(--cat-pdf); }
.hero-art .a-fill-image { fill: var(--cat-image); }
.hero-art .a-fill-dev { fill: var(--cat-developer); }
.hero-art text { font-family: var(--sans); }
.hero-art .a-chip { fill: var(--bg); font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; }
.hero-art .a-code { fill: var(--cat-developer); font-family: var(--mono); font-size: 15px; font-weight: 700; }
.hero-art .a-muted { fill: var(--muted); }
.hero-art .a-small { font-size: 10px; }
.hero-art .a-text { fill: var(--text); }
.hero-art .a-badge { font-size: 12.5px; font-weight: 500; }
@media (prefers-reduced-motion: no-preference) {
  .hero-art .art-cloud { animation: art-float 6s ease-in-out infinite; }
  .hero-art .art-file { animation: art-bob 5s ease-in-out infinite; }
  .hero-art .art-file.f2 { animation-delay: -1.6s; }
  .hero-art .art-file.f3 { animation-delay: -3.2s; }
}
@keyframes art-float { 50% { translate: 0 -6px; } }
@keyframes art-bob { 50% { translate: 0 -4px; } }
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 2rem 0 3rem; }
  .hero-art { display: none; }
}

/* ---- Tool sections & cards ---------------------------------------------------- */
.tool-section { margin-top: 4.5rem; scroll-margin-top: 1.5rem; }
.tool-section:first-child { margin-top: 0; }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1.1rem; }

.tool-card {
  --cat: var(--accent);
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 15rem;
  padding: 1.35rem 1.35rem 1.15rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad-hairline) border-box;
  color: var(--text);
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
.tool-card[data-cat="pdf"] { --cat: var(--cat-pdf); }
.tool-card[data-cat="image"] { --cat: var(--cat-image); }
.tool-card[data-cat="text"] { --cat: var(--cat-text); }
.tool-card[data-cat="developer"] { --cat: var(--cat-developer); }
.tool-card:hover {
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad) border-box;
  box-shadow: 0 14px 36px color-mix(in srgb, var(--g2) 16%, transparent);
  transform: translateY(-3px);
}

.card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.6rem; }
.chip {
  display: inline-block;
  background: var(--chip-bg);
  color: var(--chip-text);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.18rem 0.5rem;
  border-radius: 2px;
}
.tool-card .icon { display: inline-flex; color: var(--cat); }
.tool-card .icon svg { width: 1.5rem; height: 1.5rem; fill: currentColor; }
.tool-card h3 { margin: 0 0 0.45rem; font-size: 1.4rem; line-height: 1.15; color: var(--cat); }
.tool-card p { margin: 0; color: var(--muted); font-size: 0.93rem; }
.card-foot {
  margin-top: auto;
  padding-top: 1.35rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.tags { display: flex; flex-wrap: wrap; align-items: center; gap: 0.15rem 0.55rem; }
.tags span + span::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  vertical-align: middle;
  margin-right: 0.55rem;
}
.tool-card .go { width: 1.6rem; height: 1.2rem; flex: none; color: var(--text); transition: transform 0.2s; }
.tool-card:hover .go { transform: translateX(5px); }

/* Featured card: filled with the deep gradient, so all text turns white. */
.tool-card.featured {
  background: var(--grad-deep) padding-box, var(--grad-deep) border-box;
  color: #fff;
}
.tool-card.featured:hover {
  background: var(--grad-deep) padding-box, var(--grad-deep) border-box;
  box-shadow: 0 16px 40px color-mix(in srgb, var(--g2) 35%, transparent);
}
.tool-card.featured h3, .tool-card.featured .icon, .tool-card.featured .go, .tool-card.featured .card-foot { color: #fff; }
.tool-card.featured p { color: #fff; }
.tool-card.featured .chip { background: rgba(20, 20, 20, 0.3); color: #fff; }

/* Compact cards in "More free tools". */
#related-tools { margin-top: 3.5rem; }
#related-tools h2 { margin-top: 0; }
.tool-grid.compact { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 0.75rem; }
.tool-grid.compact .tool-card { min-height: 0; padding: 1rem 1rem 0.85rem; }
.tool-grid.compact .card-top { margin-bottom: 0.9rem; }
.tool-grid.compact .tool-card .icon svg { width: 1.2rem; height: 1.2rem; }
.tool-grid.compact .tool-card h3 { font-size: 1.05rem; }
.tool-grid.compact .tool-card p { font-size: 0.85rem; }
.tool-grid.compact .card-foot { padding-top: 0.75rem; justify-content: flex-end; }
.tool-grid.compact .tool-card:hover { transform: translateY(-2px); }

/* ---- Home: "how it works" strip ---------------------------------------------- */
.why { margin-top: 5rem; }
.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.stat-strip > div { display: flex; align-items: flex-end; gap: 0.9rem; padding: 1.5rem 0; border-top: 1px solid var(--border); }
.stat-strip .big-num { font-size: clamp(3rem, 6vw, 4.5rem); }
.stat-strip .stat-label { font-size: 1.1rem; }
.why-copy { color: var(--muted); max-width: 46rem; font-size: 1.05rem; }
@media (max-width: 760px) { .stat-strip { grid-template-columns: 1fr; gap: 0; } }

/* ---- Tool pages ------------------------------------------------------------- */
html[data-cat="pdf"] { --page-cat: var(--cat-pdf); }
html[data-cat="image"] { --page-cat: var(--cat-image); }
html[data-cat="text"] { --page-cat: var(--cat-text); }
html[data-cat="developer"] { --page-cat: var(--cat-developer); }
h1.tool-title { color: var(--page-cat, var(--text)); }
.tool-title { display: flex; align-items: center; gap: 0.85rem; }
.title-icon {
  flex: none;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--page-cat, var(--accent));
  border: 1px solid transparent;
  background:
    linear-gradient(color-mix(in srgb, var(--page-cat, var(--accent)) 12%, var(--bg)), color-mix(in srgb, var(--page-cat, var(--accent)) 12%, var(--bg))) padding-box,
    var(--grad-hairline) border-box;
}
.title-icon svg { width: 1.4rem; height: 1.4rem; fill: currentColor; }

.content { max-width: 760px; }
.content h2 { font-size: 1.35rem; }
.content p, .content li { color: var(--muted); }

.form-grid { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); margin-bottom: 0.75rem; }
.form-grid label:not(.inline), .stack label:not(.inline) { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.88rem; color: var(--muted); }
.stack label.inline { align-items: flex-start; }
.stack label.inline input { margin-top: 0.25rem; }
.stack { display: grid; gap: 0.75rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
}

/* Stats (word counter etc.) */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 0.6rem; margin-bottom: 0.75rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.8rem 0.9rem; }
.stat .num { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .label { font-family: var(--serif); font-style: italic; font-size: 0.95rem; color: var(--muted); }

/* Diff */
.diff-out { font-family: var(--mono); font-size: 0.86rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; padding: 0; }
.diff-out .row { display: grid; grid-template-columns: 3.2em 3.2em 1.4em 1fr; }
.diff-out .ln { color: var(--muted); text-align: right; padding-right: 0.5em; user-select: none; opacity: 0.7; }
.diff-out .sign { color: var(--muted); user-select: none; text-align: center; }
.diff-out .row.add { background: color-mix(in srgb, var(--success) 14%, transparent); }
.diff-out .row.del { background: color-mix(in srgb, var(--danger) 14%, transparent); }
.diff-out ins, .diff-inline ins { background: color-mix(in srgb, var(--success) 35%, transparent); text-decoration: none; border-radius: 2px; }
.diff-out del, .diff-inline del { background: color-mix(in srgb, var(--danger) 35%, transparent); text-decoration: line-through; border-radius: 2px; }
.diff-inline { padding: 0.75rem 1rem; font-size: 0.95rem; white-space: pre-wrap; word-break: break-word; }

/* Signature pad / PDF page picker */
.sig-pad { width: 100%; height: 200px; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); touch-action: none; cursor: crosshair; display: block; }
.page-stage { position: relative; display: inline-block; max-width: 100%; box-shadow: 0 2px 16px rgba(0,0,0,.35); background: #fff; user-select: none; }
.page-stage canvas { display: block; max-width: 100%; height: auto; }
.placed-sig { position: absolute; border: 1px dashed var(--g2); cursor: move; touch-action: none; }
.placed-sig img { width: 100%; height: 100%; display: block; pointer-events: none; }
.placed-sig .handle { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; background: var(--g2); border-radius: 50%; cursor: nwse-resize; }
.placed-sig .remove { position: absolute; right: -10px; top: -10px; width: 20px; height: 20px; padding: 0; border-radius: 50%; font-size: 0.7rem; justify-content: center; background: var(--danger); color: #fff; border: 0; }

.qr-preview { display: flex; align-items: center; justify-content: center; min-height: 280px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.qr-preview canvas { max-width: 100%; height: auto; image-rendering: pixelated; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.sign-layout { grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); }
.sign-panel { position: sticky; top: 1rem; }
@media (max-width: 800px) {
  .two-col, .sign-layout { grid-template-columns: 1fr; }
  .sign-panel { position: static; }
}

.result-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; background: var(--surface); }
.result-table th, .result-table td { border: 1px solid var(--border); padding: 0.45rem 0.65rem; text-align: left; vertical-align: middle; }
.result-table th { background: var(--surface-2); font-weight: 600; }
.result-table img { width: 48px; height: 48px; object-fit: cover; border-radius: var(--radius-sm); display: block; }
.saving { color: var(--success); font-weight: 600; }
.worse { color: var(--danger); }

/* Markdown preview */
.md-body { padding: 1rem 1.25rem; }
.md-body img { max-width: 100%; }
.md-body pre { background: var(--surface-2); padding: 0.75rem; border-radius: var(--radius); overflow: auto; }
.md-body code { font-family: var(--mono); font-size: 0.88em; background: var(--surface-2); padding: 0.1em 0.3em; border-radius: var(--radius-sm); }
.md-body pre code { background: none; padding: 0; }
.md-body blockquote { margin: 0; padding-left: 1rem; border-left: 3px solid var(--border-strong); color: var(--muted); }
.md-body table { border-collapse: collapse; }
.md-body th, .md-body td { border: 1px solid var(--border); padding: 0.35rem 0.6rem; }
.md-body h1, .md-body h2 { border-bottom: 1px solid var(--border); padding-bottom: 0.25rem; }

iframe.preview { width: 100%; height: 100%; min-height: 60vh; border: 0; background: #fff; border-radius: var(--radius); }

/* Ads: hidden until configured in assets/js/common.js */
.ad-slot { display: none; margin: 1.5rem auto; text-align: center; min-height: 90px; }
.ad-slot.active { display: block; }

.toast {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%) translateY(150%);
  background: var(--text);
  color: var(--bg);
  padding: 0.6rem 1.05rem;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  transition: transform 0.2s;
  z-index: 100;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---- Contact & 404 ------------------------------------------------------------ */
.contact-card {
  margin: 1.5rem 0 0.5rem;
  padding: 1.5rem 1.6rem;
  border: 1px solid transparent;
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--grad-hairline) border-box;
}
.contact-card .eyebrow { margin-bottom: 0.25rem; }
.contact-email {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  word-break: break-all;
}
.contact-email:hover { color: var(--accent); }
.not-found { padding: 3.5rem 0 1rem; }
.not-found h1 { font-size: clamp(2rem, 4.5vw, 3rem); }

/* ---- Footer ------------------------------------------------------------------ */
.site-footer { border-top: 1px solid var(--border); color: var(--muted); }
.site-footer .inner { max-width: var(--max); margin: 0 auto; padding: 2.5rem 1.5rem 2rem; }
.footer-sign {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.6rem, 3.5vw, 2.25rem);
  color: var(--text);
  margin: 0 0 1.75rem;
  line-height: 1.15;
}
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.75rem 1.5rem; font-size: 0.9rem; }
.footer-row nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

[hidden] { display: none !important; }
.print-only { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  .tool-card:hover, .tool-card:hover .go { transform: none; }
}

@media print {
  .print-only { display: block !important; }
  :root, [data-theme="light"] {
    --bg: #fff; --surface: #fff; --surface-2: #f0f2f5;
    --text: #000; --muted: #444; --border: #ccc;
    color-scheme: light;
  }
  .no-print, .ad-slot, .toast, .site-header, .site-footer { display: none !important; }
  body { background: #fff; color: #000; }
  main { padding: 0; max-width: none; }
  .split { display: block; min-height: 0; }
  .pane { border: 0; overflow: visible; }
  .md-body { padding: 0; }
}

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