/*
 * CleanYourImages / CleanYourContent – shared stylesheet.
 *
 * Themes: html[data-theme="cobalt"] (images), html[data-theme="forest"] (content).
 * Modes:  html[data-mode="light" | "dark"], set before first paint by the
 *         inline head script; prefers-color-scheme is the no-JS fallback.
 * The CSP allows no inline styles: all styling lives in this file.
 */

:root {
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;
  --wrap: 1120px;
  --gutter: 20px;

  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1b2030;
  --text-2: #4a5362;
  --muted: #5f6978;
  --line: #e2e6ed;
  --line-strong: #c7cfdb;
  --tint: #eef1f6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .18);

  --accent: #3055a3;
  --accent-hover: #26478a;
  --accent-text: #2b4d95;
  --accent-soft: #e9eef9;
  --accent-line: #c3d0ec;
  --on-accent: #ffffff;

  --ok-bg: #e8f6ee; --ok-line: #b9e3c9; --ok-text: #176a3a;
  --warn-bg: #fff6e5; --warn-line: #f5d9a3; --warn-text: #8a5a00;
  --err-bg: #fdecec; --err-line: #f3b9b9; --err-text: #9b2020;

  --rb: #e8560c;
  --pz: #009f6b;
  /* Darker brand shades for text on light backgrounds (WCAG AA). */
  --rb-text: #c2410c;
  --pz-text: #007a53;
  --cobalt: #3055a3;
  --forest: #214f3f;
  color-scheme: light;
}
html[data-theme="forest"] {
  --accent: #214f3f;
  --accent-hover: #183d30;
  --accent-text: #1f5443;
  --accent-soft: #e7f1ec;
  --accent-line: #bfd8cb;
}

html[data-mode="dark"] {
  --bg: #0f1216;
  --card: #161a20;
  --text: #e7ebf1;
  --text-2: #aab3c0;
  --muted: #7f8998;
  --line: #262d38;
  --line-strong: #37404d;
  --tint: #1c2229;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -12px rgba(0, 0, 0, .6);
  --accent: #4f78d0;
  --accent-hover: #6189dc;
  --accent-text: #8fb0f0;
  --accent-soft: #1b2638;
  --accent-line: #2d4470;
  --ok-bg: #152a1d; --ok-line: #24513a; --ok-text: #7dd9a0;
  --warn-bg: #2d2415; --warn-line: #5a4520; --warn-text: #f1c979;
  --err-bg: #331a1a; --err-line: #5e2828; --err-text: #f69c9c;
  --cobalt: #8fb0f0;
  --forest: #6fcfa6;
  --rb-text: var(--rb);
  --pz-text: var(--pz);
  color-scheme: dark;
}
html[data-mode="dark"][data-theme="forest"] {
  --accent: #2f7d62;
  --accent-hover: #3a9476;
  --accent-text: #6fcfa6;
  --accent-soft: #142820;
  --accent-line: #245444;
}
/* Fallback when the head script could not set a mode (storage blocked). */
@media (prefers-color-scheme: dark) {
  html:not([data-mode]) {
    --bg: #0f1216; --card: #161a20; --text: #e7ebf1; --text-2: #aab3c0; --muted: #7f8998;
    --line: #262d38; --line-strong: #37404d; --tint: #1c2229;
    --rb-text: var(--rb); --pz-text: var(--pz);
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; } }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
@media (max-width: 640px) { body { font-size: 1rem; } }
[hidden] { display: none !important; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 1.2rem + 2.4vw, 2.75rem); letter-spacing: -.02em; line-height: 1.12; }
@media (max-width: 480px) { h1 { font-size: 1.625rem; } }
h2 { font-size: clamp(1.5rem, 1.2rem + 1vw, 1.9rem); }
h3 { font-size: 1.125rem; }
p { margin: 0; }
p + p { margin-top: .9em; }
small { font-size: .875rem; }
code { font-family: var(--mono); font-size: .9em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
@media (min-width: 900px) { :root { --gutter: 32px; } }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--card); color: var(--text); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
noscript .error { margin-bottom: 16px; }

/* ---------- buttons ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid transparent;
  font-weight: 600; font-size: 1rem; line-height: 1.2; text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.button.primary { background: var(--accent); color: var(--on-accent); }
.button.primary:hover:not(:disabled) { background: var(--accent-hover); color: var(--on-accent); }
.button.secondary { background: var(--card); color: var(--text); border-color: var(--line-strong); }
.button.secondary:hover:not(:disabled) { border-color: var(--text-2); color: var(--text); }
.button.small { min-height: 36px; padding: 6px 12px; font-size: .9375rem; }
.button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.text-link {
  background: none; border: 0; padding: 4px 2px;
  color: var(--accent-text); font-weight: 600; font-size: .9375rem;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.text-link:hover:not(:disabled) { color: var(--accent-hover); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  background: var(--card); border: 1px solid var(--line); color: var(--text-2);
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- header ---------- */
.header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 72px; padding-block: 12px;
}
.brand { display: inline-flex; align-items: center; flex-shrink: 0; }
.brand-logo-img { height: 30px; width: auto; }
html[data-mode="dark"][data-theme="cobalt"] .brand-logo-img { content: url("../img/images/logo-dark.svg"); }
html[data-mode="dark"][data-theme="forest"] .brand-logo-img { content: url("../img/content/logo-dark.svg"); }
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav-link {
  padding: 8px 12px;
  color: var(--text-2); font-weight: 500; text-decoration: none; white-space: nowrap;
}
.nav-link:hover { color: var(--text); background: var(--tint); }
.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.icon-sun, .icon-moon { display: none; }
html:not([data-mode="dark"]) .icon-moon { display: block; }
html[data-mode="dark"] .icon-sun { display: block; }
@media (max-width: 900px) { .nav { display: none; } .brand-logo-img { height: 26px; } }
@media (max-width: 360px) { .brand-logo-img { height: 22px; } }

/* Language menu: native <details>, so it opens without JavaScript. */
.lang-picker { position: relative; }
.lang-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  height: 40px; padding: 0 10px 0 12px;
  background: var(--card); border: 1px solid var(--line); color: var(--text-2);
  font-weight: 600; font-size: .9375rem; cursor: pointer; list-style: none;
}
.lang-trigger::-webkit-details-marker { display: none; }
.lang-trigger:hover, .lang-picker[open] .lang-trigger { border-color: var(--line-strong); color: var(--text); }
.lang-trigger svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.lang-picker[open] .lang-trigger svg { transform: rotate(180deg); }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40;
  min-width: 132px; margin: 0; padding: 6px; list-style: none;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.lang-option {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 8px 10px; font-size: .9375rem;
  color: var(--text); text-decoration: none;
}
.lang-option:hover { background: var(--tint); color: var(--text); }
.lang-option[aria-current] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }

/* ---------- hero ---------- */
.hero { padding: 40px 0 36px; }
.hero h1 { max-width: 780px; margin-bottom: 20px; }
.lead { font-size: 1.1875rem; color: var(--text-2); max-width: 64ch; }
.trust-list {
  display: flex; flex-wrap: wrap; gap: 12px 24px;
  margin: 28px 0 0; padding: 0; list-style: none;
  font-size: 1rem; font-weight: 600; color: var(--text);
}
.trust-list li { display: inline-flex; align-items: center; gap: 10px; }
.trust-list svg { width: 26px; height: 26px; padding: 5px; flex-shrink: 0; background: var(--accent-soft); fill: none; stroke: var(--accent-text); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 640px) { .hero { padding: 24px 0 28px; } .lead { font-size: 1.0625rem; } }
.not-found { padding: 72px 0 24px; }
.not-found .lead { margin-bottom: 28px; }

/* ---------- tool switcher ---------- */
.tool-switcher {
  display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 40px;
  background: var(--tint);
}
.tool-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border: 0;
  background: transparent; color: var(--text-2); font-weight: 600; font-size: .9375rem; text-decoration: none;
}
.tool-tab:hover { color: var(--text); }
.tool-tab.active { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }
.tool-tab svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- tool card ---------- */
.tool {
  background: var(--card); border: 1px solid var(--line);
  padding: 24px; box-shadow: var(--shadow);
}
.tool-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.tool-head h2 { font-size: 1.5rem; }
.formats { font-family: var(--mono); font-size: .8125rem; color: var(--muted); white-space: nowrap; }
.tool-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px; }
@media (max-width: 900px) { .tool-grid { grid-template-columns: 1fr; } .tool { padding: 16px; } .tool-head { flex-wrap: wrap; } }

.dropzone {
  position: relative; min-height: 300px;
  display: flex; align-items: stretch; justify-content: center;
  border: 2px dashed var(--line-strong); background: var(--bg);
  transition: border-color .15s, background-color .15s;
}
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.drop-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 36px 20px 0; width: 100%; }
.drop-icon { width: 48px; height: 48px; margin: 0 auto 14px; color: var(--accent-text); fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.drop-empty h3 { font-size: 1.125rem; margin-bottom: 4px; }
.drop-empty p { color: var(--text-2); }
.drop-choose { margin: 20px 0 36px; }
.drop-sample { align-self: stretch; margin-top: auto; padding: 12px 20px; border-top: 1px solid var(--line); }
.preview { width: 100%; padding: 12px; align-self: flex-start; }
.preview-img-wrap { position: relative; background: var(--tint); overflow: hidden; display: flex; justify-content: center; }
.preview-img-wrap img { max-height: 420px; width: auto; max-width: 100%; object-fit: contain; }
/* Remove button sits on the image corner so the file details get the full width. */
.preview-remove {
  position: absolute; top: 10px; right: 10px;
  display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--text);
  box-shadow: var(--shadow); transition: background-color .15s, color .15s, border-color .15s;
}
.preview-remove:hover:not(:disabled) { background: var(--err-bg); border-color: var(--err-line); color: var(--err-text); }
.preview-remove svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.preview-meta { margin-top: 14px; padding: 0 4px; }
.preview-name { font-size: 1.0625rem; font-weight: 600; overflow-wrap: anywhere; }
.preview-size { margin-top: 2px; font-size: .9375rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.privacy { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; color: var(--text-2); font-size: .9375rem; }
.privacy svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 3px; fill: none; stroke: var(--accent-text); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool-head .privacy { margin-top: 0; }

/* report */
.report-area { min-width: 0; }
/* Breathing room when the script scrolls these into view (images.js reveal()). */
.dropzone, .report { scroll-margin-top: 20px; }
.report-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  height: 100%; min-height: 300px; padding: 32px 24px; background: var(--tint);
}
.report-empty h3 { font-size: 1.125rem; margin: 18px 0 4px; }
.report-empty p { max-width: 34ch; color: var(--text-2); }
.empty-icons { display: flex; gap: 10px; }
@media (max-width: 900px) { .report-empty { min-height: 0; padding: 24px 20px; } }
.empty-icons svg {
  width: 44px; height: 44px; padding: 11px; background: var(--card); color: var(--accent-text);
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.scope-note { margin-top: 14px; color: var(--muted); font-size: .9375rem; }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.metric { padding: 12px 14px; border: 1px solid var(--line); background: var(--bg); }
.metric-value { font-size: 1.625rem; font-weight: 700; line-height: 1.1; }
.metric-label { font-size: .875rem; color: var(--text-2); margin-top: 2px; }
@media (max-width: 480px) { .metrics { grid-template-columns: 1fr 1fr; } .metrics .metric:last-child { grid-column: span 2; } }

.hint-banner {
  padding: 12px 14px; margin-bottom: 14px;
  background: var(--ok-bg); border: 1px solid var(--ok-line); color: var(--ok-text); font-size: .9375rem;
}
.hint-banner:empty { display: none; }
.hint-banner.warning { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-text); }
.hint-head strong, .hint-head span { display: block; }
.hint-table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: .875rem; }
.hint-table th { text-align: left; padding: 6px 8px; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--warn-line); }
.hint-table td { padding: 7px 8px; vertical-align: middle; border-bottom: 1px solid var(--warn-line); color: var(--text); overflow-wrap: anywhere; }
.hint-table tr:last-child td { border-bottom: 0; }
.hint-table th:first-child, .hint-table td:first-child { padding-left: 0; }
.hint-table code { font-family: var(--mono); font-size: .8125rem; }
.hint-kind { display: inline-block; padding: 2px 10px; font-size: .8125rem; font-weight: 600; white-space: nowrap; color: #3d2a00; }
.kind-generated { background: #f2b330; }
.kind-edited { background: #f8d47a; }
.kind-software { background: #fcebbd; }
.hint-more { display: block; margin-top: 6px; font-size: .875rem; }
@media (max-width: 640px) {
  /* One block per hint: type pill, then "Found in" and "Value" as labelled lines. */
  .hint-table thead { display: none; }
  .hint-table, .hint-table tbody { display: block; }
  .hint-table tr { display: grid; gap: 6px; padding: 12px 0; border-bottom: 1px solid var(--warn-line); }
  .hint-table tr:last-child { border-bottom: 0; padding-bottom: 0; }
  .hint-table td, .hint-table td:first-child { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 8px; padding: 0; border: 0; }
  .hint-table td:first-child { display: block; }
  .hint-table td[data-label]::before { content: attr(data-label); padding-top: 1px; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
}

.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--tint); margin-bottom: 12px; }
.tab { padding: 6px 14px; border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: .9375rem; }
.tab.active { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(16, 24, 40, .12); }

.metadata { display: grid; gap: 8px; }
.metadata details { border: 1px solid var(--line); overflow: hidden; }
.metadata summary {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--bg); cursor: pointer; list-style: none; font-weight: 600; font-size: .9375rem;
}
.metadata summary::-webkit-details-marker { display: none; }
.metadata summary::before,
.text-settings > details > summary::before,
.text-filter-group > summary::before {
  content: ""; width: 8px; height: 8px; flex-shrink: 0; margin: 0 4px 3px 2px;
  border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg); transition: transform .15s;
}
.metadata details[open] > summary::before,
.text-settings > details[open] > summary::before,
.text-filter-group[open] > summary::before { transform: rotate(45deg); margin-bottom: 0; }
.metadata summary:hover { background: var(--tint); }
.metadata summary .count {
  margin-left: auto; min-width: 28px; padding: 2px 8px; text-align: center;
  background: var(--accent-soft); color: var(--accent-text);
  font-family: var(--mono); font-size: .8125rem; font-weight: 600;
}
.metadata dl { margin: 0; padding: 4px 14px 8px; }
.metadata .field { display: grid; grid-template-columns: minmax(120px, 36%) 1fr; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: .9375rem; }
.metadata .field:first-child { border-top: 0; }
.metadata dt { color: var(--text-2); overflow-wrap: anywhere; }
.metadata dd { margin: 0; font-family: var(--mono); font-size: .875rem; overflow-wrap: anywhere; }
@media (max-width: 480px) { .metadata .field { grid-template-columns: 1fr; gap: 2px; } }
.report-footnote { margin-top: 12px; color: var(--muted); font-size: .875rem; }

/* actions */
.action-bar { display: flex; flex-wrap: wrap; align-items: stretch; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.mode-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: 1 1 100%; min-width: 0; margin: 0; padding: 0; border: 0; }
@media (max-width: 520px) { .mode-controls { grid-template-columns: 1fr; } }
.mode-option {
  display: grid; grid-template-columns: 20px 1fr; gap: 10px; align-items: start;
  padding: 12px 14px; border: 1px solid var(--line); cursor: pointer;
}
.mode-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.mode-option input { margin: 3px 0 0; accent-color: var(--accent); width: 18px; height: 18px; }
.mode-option strong { display: block; font-size: .9375rem; }
.mode-option small { color: var(--text-2); font-size: .875rem; line-height: 1.4; }
.clean-button { flex: 0 0 auto; align-self: center; }
@media (max-width: 640px) { .clean-button { width: 100%; } }
.mode-controls + .clean-button { flex: 1 1 100%; min-height: 54px; font-size: 1.0625rem; font-weight: 700; }
.status-line, .error { margin-top: 14px; padding: 12px 14px; font-size: .9375rem; }
.mode-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 12px; color: var(--warn-text); font-size: .9375rem; }
.mode-note svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.status-line { background: var(--tint); color: var(--text-2); }
.error { background: var(--err-bg); border: 1px solid var(--err-line); color: var(--err-text); }
.success { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.success-copy { display: flex; gap: 12px; align-items: flex-start; }
.success-copy svg { width: 28px; height: 28px; flex-shrink: 0; fill: none; stroke: var(--ok-text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.success h3 { font-size: 1.125rem; color: var(--ok-text); }
.success p { color: var(--text-2); font-size: .9375rem; }
.success-actions { display: flex; align-items: center; gap: 20px; }
.download-button { min-height: 54px; padding: 0 28px; font-size: 1.0625rem; font-weight: 700; }
@media (max-width: 640px) { .success-actions { flex: 1 1 100%; flex-direction: column-reverse; align-items: stretch; gap: 12px; } }

/* ---------- content sections ---------- */
.section { padding: 56px 0 0; }
.section > h2 { margin-bottom: 20px; }
@media (max-width: 640px) { .section { padding-top: 44px; } }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.step { position: relative; }
.step::before {
  counter-increment: step; content: counter(step); position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-bottom: 14px;
  background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 1.125rem;
}
.step:not(:last-child)::after { content: ""; position: absolute; top: 21px; left: 56px; right: -12px; height: 2px; background: var(--accent-line); }
.step h3 { margin-bottom: 6px; }
.step p { color: var(--text-2); }
@media (max-width: 1000px) { .steps { grid-template-columns: 1fr 1fr; gap: 28px 24px; } .step:not(:last-child)::after { display: none; } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; gap: 20px; } }

.explain { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.explain article { padding: 20px; border: 1px solid var(--line); background: var(--card); }
.explain h3 { margin-bottom: 8px; }
.explain p { color: var(--text-2); font-size: 1rem; }
.explain-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-bottom: 14px; background: var(--accent-soft); color: var(--accent-text); }
.explain-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 760px) { .explain { grid-template-columns: 1fr; gap: 12px; } }

.faq-items { display: grid; gap: 8px; max-width: calc((100% - 48px) / 3 * 2 + 24px); }
@media (max-width: 760px) { .faq-items { max-width: none; } }
.faq-items details { border: 1px solid var(--line); background: var(--card); }
.faq-items summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 18px; cursor: pointer; list-style: none; font-weight: 600; }
.faq-items summary::-webkit-details-marker { display: none; }
.faq-items summary::after { content: "+"; flex-shrink: 0; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; background: var(--tint); color: var(--text-2); font-weight: 500; }
.faq-items details[open] summary::after { content: "\2212"; }
.faq-items details p { padding: 0 18px 16px; color: var(--text-2); }

.tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.tool-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px; border: 1px solid var(--line); border-top: 4px solid var(--tool-color, var(--accent)); background: var(--card);
  color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s;
}
.tool-card:hover { box-shadow: var(--shadow); color: inherit; }
.tool-images { --tool-color: var(--cobalt); }
.tool-content { --tool-color: var(--forest); }
.tool-replybuster { --tool-color: var(--rb); --tool-text: var(--rb-text); }
.tool-promptzauberer { --tool-color: var(--pz); --tool-text: var(--pz-text); }
.tool-card-logo { height: 36px; display: flex; align-items: center; }
.tool-card-logo img { height: 100%; width: auto; }
.tool-card .logo-dark { display: none; }
html[data-mode="dark"] .tool-card .logo-light { display: none; }
html[data-mode="dark"] .tool-card .logo-dark { display: block; }
.tool-card-text { color: var(--text-2); font-size: .9375rem; flex: 1; }
.tool-card-link { font-weight: 600; color: var(--tool-text, var(--tool-color, var(--accent-text))); font-size: .9375rem; }
@media (max-width: 760px) { .tools-grid { grid-template-columns: 1fr; } }

/* Closing summary for search and answer engines. */
.about > h2 { font-size: 1.25rem; margin-bottom: 10px; }
.about p { color: var(--text-2); font-size: 1rem; }

/* ---------- footer ---------- */
.footer { margin-top: 64px; padding: 24px 0 32px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 24px; color: var(--muted); font-size: .9375rem; }
.footer-left { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.footer-links { display: flex; gap: 16px; align-items: center; }
.footer-link-btn { background: none; border: 0; padding: 4px 0; color: var(--text-2); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }
.footer-link-btn:hover { color: var(--text); }
.footer-note { width: 100%; font-size: .875rem; }

/* ---------- dialogs (native <dialog>) ---------- */
.dialog {
  width: min(100% - 40px, 640px); max-height: calc(100dvh - 40px); padding: 0; overflow: auto;
  background: var(--card); color: var(--text); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.dialog::backdrop { background: rgba(10, 14, 20, .55); }
.dialog-header { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 22px; background: var(--accent-soft); }
.dialog-header h2 { font-size: 1.25rem; color: var(--accent-text); }
.dialog-close { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0; margin-right: -8px; border: 0; background: transparent; color: var(--accent-text); }
.dialog-close:hover { background: var(--card); color: var(--text); }
.dialog-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.dialog-body { padding: 20px 22px 24px; font-size: .9375rem; }
.dialog-sub { color: var(--text-2); margin-bottom: 14px; }
.dialog-note { padding: 10px 14px; margin-bottom: 14px; background: var(--accent-soft); color: var(--accent-text); }
/* Plain sections separated by whitespace only; boxes and rules inside a dialog read as clutter. */
.dialog-card { margin-top: 22px; overflow-wrap: anywhere; }
.dialog-card h3 { font-size: .875rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 8px; }
.dialog-card p + p { margin-top: 8px; }
.dialog-notes { margin: 0; padding-left: 18px; color: var(--text-2); }
.dialog-muted { color: var(--muted); }
.obf-mail { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--accent-text); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; cursor: pointer; }
.obf-mail:hover { color: var(--accent-hover); }
/* The address is stored reversed and displayed in order by the bidi override. */
.bidi-rev { unicode-bidi: bidi-override; direction: rtl; }

/* ---------- text tool ---------- */
.editor-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; min-height: 32px; }
.editor-head label { font-weight: 600; }
.editor-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.editor textarea {
  display: block; width: 100%; min-height: 200px; padding: 14px; resize: vertical;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--text);
  font-size: 1rem; line-height: 1.55;
}
.editor textarea::placeholder { color: var(--muted); }
.editor textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.editor textarea[readonly] { background: var(--tint); }
.editor-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: .875rem; color: var(--muted); font-family: var(--mono); }
.copy-status { color: var(--ok-text); font-family: var(--font); font-weight: 600; }

.text-settings { margin-top: 20px; }
.text-settings > details { border: 1px solid var(--line); }
.text-settings > details > summary {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; list-style: none; font-weight: 600;
}
.text-settings > details > summary::-webkit-details-marker { display: none; }
.filter-count { margin-left: auto; flex-shrink: 0; white-space: nowrap; padding: 2px 10px; background: var(--accent-soft); color: var(--accent-text); font-family: var(--mono); font-size: .8125rem; font-weight: 600; }
.filter-count:empty { display: none; }
.text-settings-intro { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 16px 14px; color: var(--text-2); font-size: .9375rem; border-bottom: 1px solid var(--line); }
.text-filter-list { display: grid; gap: 8px; padding: 14px 16px; }
.text-filter-group { border: 1px solid var(--line); }
.text-filter-group > summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; list-style: none; font-weight: 600; font-size: .9375rem; background: var(--bg); }
.text-filter-group[open] > summary { border-bottom: 1px solid var(--line); }
.text-filter-group > summary::-webkit-details-marker { display: none; }
.text-group-select { display: flex; align-items: center; gap: 10px; padding: 10px 12px; font-size: .9375rem; font-weight: 600; border-bottom: 1px solid var(--line); cursor: pointer; }
.text-rule { display: grid; grid-template-columns: 18px 36px auto 1fr; align-items: center; gap: 10px; padding: 7px 12px; font-size: .9375rem; cursor: pointer; }
.text-rule:hover, .text-group-select:hover { background: var(--tint); }
.text-rule input, .text-group-select input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.rule-glyph, .char-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; height: 24px; padding: 0 6px; background: var(--tint); font-family: var(--mono); font-size: .8125rem; }
.rule-code, .finding-code { font-family: var(--mono); font-size: .8125rem; color: var(--muted); }
.rule-name, .finding-name { overflow-wrap: anywhere; }
.text-language-note { padding: 0 16px 14px; color: var(--muted); font-size: .875rem; }
.text-action-bar { align-items: center; margin-top: 16px; padding-top: 0; border-top: 0; }
.editor-output { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.text-found { font-weight: 600; }
.text-findings { margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--line); }
.text-findings h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 1.125rem; }
.text-findings h3 .filter-count { margin-left: 0; }
.text-findings p { color: var(--muted); font-size: .9375rem; }
.findings-wrap { border: 1px solid var(--line); overflow: hidden; }
.text-findings table { width: 100%; border-collapse: collapse; font-size: .9375rem; }
.text-findings th { text-align: left; padding: 10px 16px; background: var(--tint); border-bottom: 1px solid var(--line); font-size: .8125rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.text-findings td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.text-findings tbody tr:last-child td { border-bottom: 0; }
.text-findings th:nth-child(2), .text-findings td:nth-child(2) { width: 110px; text-align: center; }
.text-findings th:nth-child(3), .text-findings td:nth-child(3) { width: 180px; text-align: right; }
.finding-char { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
@media (max-width: 560px) {
  /* One compact card per character: glyph + name on top, code, count and action below. */
  .text-findings thead { display: none; }
  .text-findings tr { display: grid; grid-template-columns: 72px max-content max-content minmax(0, 1fr); grid-template-areas: "glyph name name name" "glyph code count action"; gap: 6px 12px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .text-findings tbody tr:last-child { border-bottom: 0; }
  .text-findings td, .text-findings td:nth-child(2), .text-findings td:nth-child(3) { display: block; width: auto; padding: 0; border: 0; text-align: left; }
  .text-findings td:first-child, .finding-char { display: contents; }
  .text-findings .char-pill { grid-area: glyph; justify-self: start; font-size: .75rem; }
  .text-findings .finding-name { grid-area: name; font-size: .875rem; line-height: 1.3; }
  .text-findings .finding-code { grid-area: code; font-size: .75rem; }
  .text-findings td:nth-child(2) { grid-area: count; justify-self: start; }
  .text-findings td:nth-child(3) { grid-area: action; justify-self: end; }
  .text-findings .count-pill::after { content: "×"; }
}
.count-pill { font-family: var(--mono); font-weight: 600; }
.action-pill { display: inline-block; padding: 2px 10px; font-size: .875rem; font-weight: 600; white-space: nowrap; }
.badge-keep { background: var(--tint); color: var(--text-2); }
.badge-remove { background: var(--err-bg); color: var(--err-text); }
.badge-replace { background: var(--ok-bg); color: var(--ok-text); }
@media (max-width: 640px) {
  .text-rule { grid-template-columns: 18px 36px 1fr; }
  .text-rule .rule-code { display: none; }
}
