/* ============================================================
   Contador de Palabras y Caracteres · 1000HW v3
   Vanilla CSS, mobile-first, sin dependencias externas
   Skip-link · WCAG 2.1 AA · Theme toggle (auto/light/dark)
   ============================================================ */

/* ─── Skip link (WCAG 2.1) ───────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0.5rem;
  z-index: 1000;
  background: var(--acid);
  color: var(--void);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 200ms ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(calc(100px + 0.5rem));
  outline: 2px solid var(--acid);
  outline-offset: 2px;
}

/* ─── Reset y variables ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

:root {
  --void: #050505;
  --void-2: #0a0a0a;
  --soft-gray: #1a1a1a;
  --structure: #333333;
  --structure-2: #444444;
  --concrete: #e0e0e0;
  --neutral-300: #cccccc;
  --neutral-400: #aaaaaa;
  --neutral-500: #888888;
  --neutral-600: #666666;
  --acid: #ccff00;
  --acid-dim: #b3e600;
  --warn: #f5c518;
  --warn-bg: rgba(245, 197, 24, 0.12);
  --warn-border: rgba(245, 197, 24, 0.5);
  --err: #ff6b6b;
  --err-bg: rgba(255, 107, 107, 0.1);
  --err-border: rgba(255, 107, 107, 0.5);
  --ok: #5ee68a;
  --ok-bg: rgba(94, 230, 138, 0.1);
  --ok-border: rgba(94, 230, 138, 0.5);

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;

  --radius: 4px;
  --gap: 1rem;
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 24px rgba(204, 255, 0, 0.2);
  --max-width: 880px;
  --transition: 200ms ease;
}

/* ─── Base ──────────────────────────────────────────────────── */
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--concrete);
  background-color: var(--void);
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--acid); color: var(--void); }

a {
  color: var(--acid);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover, a:focus-visible { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 2px;
}

h1, h2, h3, h4 { margin: 0 0 0.6em; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }

/* ─── Offline-ready banner ──────────────────────────────────── */
.offline-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  background: var(--acid);
  color: var(--void);
  font-size: 0.875rem;
  font-weight: 600;
  animation: slide-down 350ms ease-out;
}
.offline-banner[hidden] { display: none; }
.offline-banner__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--void);
  color: var(--acid);
  font-weight: 800;
  font-size: 0.75rem;
}
.offline-banner__text { flex: 1; }
.offline-banner__close {
  background: transparent;
  border: 0;
  color: var(--void);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.4rem;
  border-radius: var(--radius);
}
.offline-banner__close:hover { background: rgba(0, 0, 0, 0.15); }

@keyframes slide-down {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .offline-banner { animation: none; }
}

/* ─── Site header / nav ─────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(5, 5, 5, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--structure);
}
.offline-banner:not([hidden]) ~ .site-header { top: 38px; }

.site-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.site-nav__back {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--neutral-500);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: color var(--transition);
}
.site-nav__back:hover { color: var(--acid); text-decoration: none; }
.site-nav__brand {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}
.site-nav__brand-accent { color: var(--acid); }

/* ─── Main / hero ───────────────────────────────────────────── */
.site-main {
  flex: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
}

.tool-hero {
  border-bottom: 1px solid var(--structure);
  padding-bottom: 1.75rem;
  margin-bottom: 2rem;
}
.tool-hero__cat {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  border: 1px solid var(--acid);
  color: var(--acid);
  padding: 0.25rem 0.6rem;
  margin-bottom: 1rem;
}
.tool-hero__title {
  font-size: clamp(2rem, 5vw + 1rem, 3.2rem);
  line-height: 1.05;
  color: #ffffff;
  margin: 0 0 1rem;
}
.tool-hero__lead {
  font-size: clamp(1rem, 1.5vw + 0.6rem, 1.15rem);
  color: var(--neutral-400);
  max-width: 60ch;
  margin: 0;
}

/* ─── Tool card ─────────────────────────────────────────────── */
.tool {
  background: var(--void-2);
  border: 1px solid var(--structure);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 2.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.tool::after {
  content: "TXT";
  position: absolute;
  top: 0.5rem; right: 0.75rem;
  font-size: 5rem;
  font-weight: 800;
  color: var(--structure);
  opacity: 0.35;
  letter-spacing: -0.04em;
  pointer-events: none;
  user-select: none;
}

/* ─── Toolbar ───────────────────────────────────────────────── */
.tool__toolbar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: stretch;
  background: var(--soft-gray);
  padding: 0.75rem 1rem;
  border: 1px solid var(--structure);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 1;
}

.tool__toolbar-left,
.tool__toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.tool__toolbar-right { justify-content: flex-start; }

.tool__status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--neutral-500);
}
.tool__status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--acid);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .tool__status-dot { animation: none; }
}

.tool__toolbar-group {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  border-left: 1px solid var(--structure);
  padding-left: 0.6rem;
}

.tool__divider {
  color: var(--structure);
  font-weight: 300;
  user-select: none;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--neutral-400);
  font-size: 1.1rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--acid);
}
.icon-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.ghost-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--neutral-400);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  min-height: 32px;
}
.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--acid);
}
.ghost-btn--danger:hover {
  color: var(--err);
}

.file-btn {
  background: transparent;
  border: 1px solid var(--structure);
  color: var(--neutral-400);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}
.file-btn:hover { color: var(--acid); border-color: var(--acid); }

/* ─── Editor ────────────────────────────────────────────────── */
.tool__editor-wrap {
  border: 1px solid var(--structure);
  border-radius: var(--radius);
  background: var(--void);
  position: relative;
  z-index: 1;
}

.tool__editor {
  display: block;
  width: 100%;
  min-height: 360px;
  padding: 1rem;
  background: transparent;
  color: var(--concrete);
  border: 0;
  outline: 0;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  line-height: 1.6;
  resize: vertical;
}
.tool__editor::placeholder { color: var(--neutral-600); }
.tool__editor:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: -2px;
  border-radius: var(--radius);
}

/* ─── Alerts ────────────────────────────────────────────────── */
.alert {
  background: var(--ok-bg);
  border: 1px solid var(--ok-border);
  color: var(--ok);
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin: 1rem 0;
}
.alert[hidden] { display: none; }
.alert--info { color: var(--acid); border-color: var(--acid); background: rgba(204, 255, 0, 0.08); }
.alert--warn { color: var(--warn); border-color: var(--warn-border); background: var(--warn-bg); }

/* ─── Dashboard de métricas ─────────────────────────────────── */
.dashboard {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
  position: relative;
  z-index: 1;
}

.metric {
  background: var(--soft-gray);
  border: 1px solid var(--structure);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  position: relative;
}
.metric--hero {
  background: linear-gradient(180deg, rgba(204, 255, 0, 0.05), rgba(204, 255, 0, 0));
  border-color: rgba(204, 255, 0, 0.3);
}

.metric__label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--neutral-500);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin: 0 0 0.5rem;
}
.metric__value {
  font-weight: 800;
  color: #ffffff;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.metric__value--xl { font-size: clamp(2.4rem, 6vw + 1rem, 3.6rem); }
.metric__sub {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--neutral-500);
  margin-top: 0.4rem;
}
.metric__hint {
  font-size: 0.8rem;
  color: var(--neutral-500);
  margin: 0.8rem 0 0;
  line-height: 1.5;
}
.metric__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}
.metric__pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--acid);
  color: var(--void);
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius);
  font-weight: 700;
}
.metric__pill--ghost {
  background: transparent;
  border: 1px solid var(--structure);
  color: var(--neutral-400);
}

/* ─── Grid de métricas secundarias ──────────────────────────── */
.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.metric-grid .metric__value {
  font-size: clamp(1.4rem, 2.5vw + 0.6rem, 1.85rem);
}

@media (min-width: 600px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ─── WPM control ───────────────────────────────────────────── */
.wpm-control {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--neutral-500);
}
.wpm-control__label { font-weight: 400; }
.wpm-control__input {
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--structure);
  color: var(--concrete);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.15rem 0.2rem;
  width: 60px;
  text-align: right;
  transition: border-color var(--transition);
}
.wpm-control__input:focus {
  outline: 0;
  border-bottom-color: var(--acid);
}
.wpm-control__unit { color: var(--neutral-600); }

/* ─── Lectura (barras) ──────────────────────────────────────── */
.reading-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 600px) {
  .reading-row { grid-template-columns: 1fr 1fr; }
}

.reading-row__col {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.reading-row__label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.85rem;
  color: var(--neutral-400);
}
.reading-row__hint {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--neutral-600);
  letter-spacing: 0.05em;
}
.reading-row__bar {
  width: 100%;
  height: 4px;
  background: var(--structure);
  border-radius: 999px;
  overflow: hidden;
}
.reading-row__fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width 280ms ease;
}
.reading-row__fill--gray { background: var(--neutral-500); }
.reading-row__fill--acid {
  background: var(--acid);
  box-shadow: 0 0 10px rgba(204, 255, 0, 0.35);
}
.reading-row__value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
}

/* ─── Fernández-Huerta ──────────────────────────────────────── */
.flesch-row {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
@media (min-width: 600px) {
  .flesch-row { flex-direction: row; align-items: center; gap: 1.5rem; }
}

.flesch-row__score {
  font-size: clamp(2.2rem, 5vw + 1rem, 3rem);
  font-weight: 800;
  color: var(--acid);
  text-shadow: 0 0 14px rgba(204, 255, 0, 0.3);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
  text-align: center;
  line-height: 1;
}

.flesch-row__info { flex: 1; min-width: 0; }

.flesch-row__scale {
  position: relative;
  height: 36px;
  margin: 0 0 0.5rem;
  border-bottom: 1px solid var(--structure);
  border-radius: 0;
}
.flesch-row__scale-tick {
  position: absolute;
  bottom: -2px;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--neutral-600);
}
.flesch-row__scale-marker {
  position: absolute;
  bottom: -8px;
  width: 2px;
  height: 24px;
  background: var(--acid);
  box-shadow: 0 0 6px rgba(204, 255, 0, 0.7);
  transform: translateX(-50%);
  transition: left 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.flesch-row__legend {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
}
.legend-chip {
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius);
  border: 1px solid var(--structure);
  color: var(--neutral-400);
  background: var(--void-2);
}
.legend-chip--hard { color: var(--err); border-color: rgba(255, 107, 107, 0.4); }
.legend-chip--med { color: var(--warn); border-color: rgba(245, 197, 24, 0.4); }
.legend-chip--easy { color: var(--ok); border-color: rgba(94, 230, 138, 0.4); }

/* ─── Densidad ──────────────────────────────────────────────── */
.density-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.density-list__empty {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--neutral-600);
  font-style: italic;
}
.density-list li {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.density-list__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.9rem;
  font-family: var(--font-mono);
}
.density-list__word { color: var(--concrete); }
.density-list__count {
  color: var(--acid);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.density-list__count span { color: var(--neutral-600); font-weight: 400; }
.density-list__bar {
  width: 100%;
  height: 2px;
  background: var(--structure);
  border-radius: 999px;
  overflow: hidden;
}
.density-list__bar-fill {
  height: 100%;
  background: var(--acid);
  border-radius: 999px;
  transition: width 280ms ease;
}

/* ─── Prose (contenido corto + largo) ───────────────────────── */
.prose, .long-content {
  max-width: 70ch;
  margin: 0 auto 3rem;
  color: var(--neutral-400);
  line-height: 1.65;
}
.prose h2, .long-content h2 {
  color: #ffffff;
  font-size: 1.6rem;
  margin-top: 2.2rem;
  border-bottom: 1px solid var(--structure);
  padding-bottom: 0.4rem;
}
.prose h2:first-child, .long-content h2:first-child { margin-top: 0; }
.prose h3, .long-content h3 {
  color: var(--acid);
  font-size: 1.2rem;
  margin-top: 1.8rem;
}
.prose p, .long-content p { margin: 0 0 1em; }
.prose ul, .prose ol, .long-content ul, .long-content ol {
  padding-left: 1.4em;
  margin: 0 0 1em;
}
.prose li, .long-content li { margin-bottom: 0.4em; }
.prose code, .long-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--soft-gray);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  color: var(--acid);
}
.prose sub, .long-content sub {
  font-size: 0.7em;
  vertical-align: sub;
}
.prose details, .long-content details {
  border: 1px solid var(--structure);
  border-radius: var(--radius);
  padding: 0.7rem 1rem;
  margin: 0 0 0.6em;
  background: var(--void-2);
}
.prose details summary, .long-content details summary {
  cursor: pointer;
  font-weight: 600;
  color: #ffffff;
  list-style: none;
}
.prose details summary::-webkit-details-marker,
.long-content details summary::-webkit-details-marker { display: none; }
.prose details summary::before,
.long-content details summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.5rem;
  transition: transform var(--transition);
}
.prose details[open] summary::before,
.long-content details[open] summary::before { transform: rotate(90deg); }
.prose details p, .long-content details p { margin: 0.6em 0 0; }

.long-content {
  border-top: 1px solid var(--structure);
  padding-top: 2.5rem;
}

/* Glosario */
.glossary { margin: 0; }
.glossary dt {
  font-weight: 700;
  color: #ffffff;
  margin-top: 0.8em;
}
.glossary dd {
  margin: 0.2em 0 0 0;
  padding-left: 0;
}

/* ─── Footer ────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--structure);
  padding: 1.5rem 1rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--neutral-600);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.site-footer a { color: var(--neutral-500); }
.site-footer a:hover { color: var(--acid); text-decoration: none; }
.site-footer p { margin: 0.3em 0; }
.site-footer__small { text-transform: none; letter-spacing: 0.02em; }

/* ─── Donation toast ────────────────────────────────────────── */
.donation-toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 200;
  max-width: min(360px, calc(100vw - 2rem));
  background: var(--void-2);
  border: 1px solid var(--structure);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.85rem 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  animation: toast-in 600ms cubic-bezier(0.16, 1, 0.3, 1);
}
.donation-toast[hidden] { display: none; }
@keyframes toast-in {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .donation-toast { animation: none; }
}

.donation-toast__icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  background: rgba(204, 255, 0, 0.12);
  color: var(--acid);
  border-radius: var(--radius);
}
.donation-toast__body { flex: 1; min-width: 0; }
.donation-toast__title {
  margin: 0 0 0.2em;
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
}
.donation-toast__sub {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--neutral-500);
  line-height: 1.35;
}
.donation-toast__actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-left: 0.6rem;
  border-left: 1px solid var(--structure);
}
.donation-toast__btn {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border: 0;
  background: transparent;
  padding: 0.35rem 0;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  border-radius: var(--radius);
  min-height: 28px;
}
.donation-toast__btn--primary { color: var(--acid); font-weight: 700; }
.donation-toast__btn--primary:hover { color: var(--acid-dim); text-decoration: underline; }
.donation-toast__btn--ghost { color: var(--neutral-600); }
.donation-toast__btn--ghost:hover { color: var(--concrete); }

/* ─── Print ─────────────────────────────────────────────────── */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    background-image: none !important;
  }
  .site-header, .offline-banner, .donation-toast,
  .tool__toolbar, .site-footer { display: none !important; }
  .tool { box-shadow: none; border: 1px solid #999; }
  .tool::after { display: none; }
  .metric { background: #fff; color: #000; border-color: #999; }
  .metric__value, .flesch-row__score { color: #000 !important; text-shadow: none !important; }
  .prose, .long-content { color: #000; }
  .prose h2, .prose h3, .long-content h2, .long-content h3 { color: #000; }
}

/* ─── Breakpoints ───────────────────────────────────────────── */
@media (min-width: 600px) {
  .site-main { padding: 3rem 1.5rem 4rem; }
  .tool { padding: 1.75rem; }
  .tool__toolbar { flex-direction: row; justify-content: space-between; align-items: center; }
  .donation-toast { bottom: 2rem; right: 2rem; }
}
@media (min-width: 900px) {
  .site-main { padding: 4rem 2rem 5rem; }
  .tool { padding: 2.25rem; }
}
/* ════════════════════════════════════════════════════════════════
   v3 additions · i18n toggle, theme toggle (auto/light/dark),
   skip-link nav, light-theme palette
   ════════════════════════════════════════════════════════════════ */

/* ─── Site nav · right cluster (brand + toggles) ──────────────── */
.site-nav__right {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* ─── Toggle buttons (lang + theme) ───────────────────────────── */
.toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: 1px solid var(--structure);
  color: var(--neutral-400);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.3rem 0.55rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  min-height: 28px;
  line-height: 1;
}
.toggle-btn:hover {
  color: var(--acid);
  border-color: var(--acid);
}
.toggle-btn:focus-visible {
  outline: 2px solid var(--acid);
  outline-offset: 2px;
}
.toggle-btn__icon {
  font-size: 0.95rem;
  line-height: 1;
}
.toggle-btn__label {
  font-weight: 700;
}

/* ─── Theme toggle variants (data-attribute approach) ─────────── */
/*
   Body classes:
     - .theme-dark  → forced dark
     - .theme-light → forced light
     - .theme-auto  → follows prefers-color-scheme via JS bootstrapping
*/

body.theme-light {
  --void: #fafafa;
  --void-2: #ffffff;
  --soft-gray: #f0f0f0;
  --structure: #d4d4d4;
  --structure-2: #bbbbbb;
  --concrete: #1a1a1a;
  --neutral-300: #2a2a2a;
  --neutral-400: #444444;
  --neutral-500: #555555;
  --neutral-600: #777777;
  --warn: #b88800;
  --warn-bg: rgba(184, 136, 0, 0.08);
  --warn-border: rgba(184, 136, 0, 0.4);
  --err: #c0392b;
  --err-bg: rgba(192, 57, 43, 0.08);
  --err-border: rgba(192, 57, 43, 0.4);
  --ok: #2f9e57;
  --ok-bg: rgba(47, 158, 87, 0.08);
  --ok-border: rgba(47, 158, 87, 0.4);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 24px rgba(204, 255, 0, 0.18);
  color-scheme: light;
}

body.theme-light {
  background-color: var(--void);
  background-image:
    radial-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--concrete);
  -webkit-font-smoothing: antialiased;
}
body.theme-light ::selection { background: var(--acid); color: var(--void); }
body.theme-light .site-header {
  background: rgba(250, 250, 250, 0.92);
  border-bottom-color: var(--structure);
}
body.theme-light .offline-banner__icon {
  background: var(--void);
  color: var(--acid);
}
body.theme-light .tool {
  background: var(--void-2);
  border-color: var(--structure);
}
body.theme-light .tool::after { color: #e8e8e8; opacity: 0.5; }
body.theme-light .tool__editor-wrap {
  background: var(--void-2);
  border-color: var(--structure);
}
body.theme-light .tool__editor {
  color: var(--concrete);
}
body.theme-light .tool__editor::placeholder { color: var(--neutral-500); opacity: 0.7; }
body.theme-light .metric {
  background: var(--soft-gray);
  border-color: var(--structure);
}
body.theme-light .metric__value { color: #000000; }
body.theme-light .metric--hero {
  background: linear-gradient(180deg, rgba(204, 255, 0, 0.12), rgba(204, 255, 0, 0));
}
body.theme-light .donation-toast {
  background: var(--void-2);
  border-color: var(--structure);
}
body.theme-light .donation-toast__title { color: #000000; }
body.theme-light .prose details,
body.theme-light .long-content details {
  background: var(--void-2);
  border-color: var(--structure);
}
body.theme-light .prose details summary,
body.theme-light .long-content details summary { color: #000000; }
body.theme-light .tool-hero__title { color: #000000; }
body.theme-light .reading-row__value { color: #000000; }
body.theme-light .legend-chip { background: var(--void-2); color: var(--neutral-400); }
body.theme-light .icon-btn:hover { background: rgba(0, 0, 0, 0.05); }
body.theme-light .ghost-btn:hover { background: rgba(0, 0, 0, 0.04); }
body.theme-light a:hover { text-decoration: underline; }
body.theme-light .flesch-row__score {
  color: #6a8a00;
  text-shadow: none;
}
body.theme-light .flesch-row__scale { border-bottom-color: var(--structure); }
body.theme-light .reading-row__fill--acid {
  background: #9bbf00;
  box-shadow: 0 0 8px rgba(155, 191, 0, 0.4);
}

/* Print tweak: light theme keeps white background */
@media print {
  body.theme-light .prose,
  body.theme-light .long-content { color: #000; }
  body.theme-light .metric { background: #fff; color: #000; }
  body.theme-light .metric__value,
  body.theme-light .flesch-row__score { color: #000 !important; text-shadow: none !important; }
}

/* ─── Lang toggle — current-lang label ──────────────────────── */
.toggle-btn--lang .toggle-btn__label { min-width: 2.2ch; text-align: center; }
