/* ==========================================================================
   traductor-funciones-calc-es-en · styles.css?v=1
   CSS vanilla (no Tailwind CDN). Variables CSS + modo claro/oscuro.
   Paleta: azul-morado destacado, neutros suaves, contraste AA.
   Cache-bust: bump ?v=N al modificar.
   ========================================================================== */

/* Reset mínimo */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body, h1, h2, h3, p, ul, ol, li, figure, blockquote, dl, dd { margin: 0; }
body { min-height: 100vh; line-height: 1.55; -webkit-font-smoothing: antialiased; }
img, picture, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* Tokens (tema oscuro = default) */
:root {
  --bg: #0f1115;
  --bg-elev: #171a21;
  --bg-elev-2: #1f232c;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.16);
  --fg: #e8eaed;
  --fg-muted: #9aa0a6;
  --fg-dim: #6c727a;
  --accent: #7c8cff;
  --accent-strong: #5b6bff;
  --accent-soft: rgba(124,140,255,0.18);
  --success: #34d399;
  --warn: #fbbf24;
  --error: #f87171;
  --code-bg: #0b0d12;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.25);
  --shadow: 0 8px 24px rgba(0,0,0,0.4);
  --container: 1100px;
  --transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Tema claro */
[data-theme="light"] {
  --bg: #fafafa;
  --bg-elev: #ffffff;
  --bg-elev-2: #f1f3f5;
  --border: rgba(0,0,0,0.08);
  --border-strong: rgba(0,0,0,0.16);
  --fg: #1a1c20;
  --fg-muted: #5b6168;
  --fg-dim: #8a8f96;
  --accent: #4554d9;
  --accent-strong: #3540c0;
  --accent-soft: rgba(69,84,217,0.12);
  --code-bg: #1a1c20;
  --shadow: 0 4px 16px rgba(0,0,0,0.06);
}

/* Respeta prefers-color-scheme cuando data-theme="auto" */
@media (prefers-color-scheme: light) {
  [data-theme="auto"] {
    --bg: #fafafa;
    --bg-elev: #ffffff;
    --bg-elev-2: #f1f3f5;
    --border: rgba(0,0,0,0.08);
    --border-strong: rgba(0,0,0,0.16);
    --fg: #1a1c20;
    --fg-muted: #5b6168;
    --fg-dim: #8a8f96;
    --accent: #4554d9;
    --accent-strong: #3540c0;
    --accent-soft: rgba(69,84,217,0.12);
    --code-bg: #1a1c20;
    --shadow: 0 4px 16px rgba(0,0,0,0.06);
  }
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  transition: background var(--transition), color var(--transition);
  font-size: 16px;
}

/* Skip-link accesibilidad */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 0 0 var(--radius) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; outline: 3px solid var(--accent); }

/* Visualmente oculto */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 1.2rem;
}
.brand-mark { color: var(--accent); }
.brand-mark-sm { color: var(--fg-muted); margin-left: 0.15em; }
.header-nav { display: flex; align-items: center; gap: 0.5rem; }
.header-nav a, .header-nav button {
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--fg-muted);
  transition: color var(--transition), background var(--transition);
}
.header-nav a:hover, .header-nav button:hover {
  color: var(--fg);
  background: var(--bg-elev-2);
}
.lang-toggle, .theme-toggle {
  font-weight: 600;
  color: var(--accent) !important;
}
@media (max-width: 640px) {
  .header-nav a:not([data-i18n="nav-back"]) { display: none; }
}

/* ===== Hero ===== */
.hero {
  padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(1.5rem, 4vw, 3rem);
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.hero h1 {
  font-size: clamp(1.85rem, 4.5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  max-width: 800px;
  margin: 0 auto 1rem;
  background: linear-gradient(180deg, var(--fg), color-mix(in srgb, var(--fg) 70%, var(--accent)));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-lead {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: var(--fg-muted);
  max-width: 720px;
  margin: 0 auto 2rem;
}
.cta {
  display: inline-block;
  padding: 0.85rem 1.5rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
}
.cta:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--accent-soft);
}

/* ===== Translator ===== */
.translator {
  padding: clamp(2.5rem, 6vw, 4rem) 0;
}
.translator-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 880px) {
  .translator-grid { grid-template-columns: 1fr; }
}

.input-side, .output-side {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.control-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.control-group {
  flex: 1;
  min-width: 160px;
}
.control-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--fg-muted);
  font-weight: 600;
  margin-bottom: 0.4rem;
}
select, input[type="search"], textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit;
}
select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  resize: vertical;
  min-height: 110px;
}
.input-label {
  display: block;
  font-size: 0.85rem;
  color: var(--fg-muted);
  font-weight: 600;
  margin: 0.5rem 0 0.4rem;
}
.input-help {
  font-size: 0.82rem;
  color: var(--fg-dim);
  margin-top: 0.4rem;
}
.action-row {
  display: flex;
  gap: 0.75rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}
.btn-primary, .btn-secondary {
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform var(--transition), background var(--transition);
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-strong); transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-elev-2);
  color: var(--fg);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-elev); }

.privacy-inline {
  font-size: 0.82rem;
  color: var(--fg-muted);
  padding: 0.65rem 0.85rem;
  background: var(--bg-elev-2);
  border-left: 3px solid var(--success);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: 0.5rem;
}

/* ===== Output area ===== */
.output-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.85rem;
  color: var(--fg);
}
.output-area { min-height: 220px; }
.output-empty {
  color: var(--fg-dim);
  font-style: italic;
  padding: 1rem 0;
}
.output-card {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
.output-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}
.output-func-name {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  padding: 0.25rem 0.5rem;
  background: var(--accent-soft);
  border-radius: var(--radius);
  display: inline-block;
}
.output-formula {
  font-family: var(--font-mono);
  background: var(--code-bg);
  color: #fff;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.output-actions {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0;
  flex-wrap: wrap;
}
.output-copy-btn {
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius);
  transition: background var(--transition), transform var(--transition);
}
.output-copy-btn:hover { background: var(--accent-strong); transform: translateY(-1px); }
.output-copy-btn.copied { background: var(--success); }

.output-desc {
  margin: 0.65rem 0;
  color: var(--fg-muted);
  font-size: 0.95rem;
}
.output-args-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}
.output-args-table th, .output-args-table td {
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.output-args-table th {
  color: var(--fg-muted);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.output-args-table code {
  font-family: var(--font-mono);
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.85em;
}
.output-platforms {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.platform-badge {
  font-size: 0.78rem;
  padding: 0.2rem 0.5rem;
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--fg-muted);
}
.platform-badge.on {
  background: var(--success);
  border-color: var(--success);
  color: #0d2c1c;
}
.output-notes {
  font-size: 0.85rem;
  color: var(--fg-muted);
  padding: 0.5rem 0.75rem;
  background: var(--bg-elev);
  border-left: 3px solid var(--warn);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: 0.65rem;
}
.output-warning {
  color: var(--warn);
  font-size: 0.9rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-elev-2);
  border: 1px dashed var(--warn);
  border-radius: var(--radius);
}
.output-error {
  color: var(--error);
  font-size: 0.95rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-elev-2);
  border: 1px dashed var(--error);
  border-radius: var(--radius);
}

/* ===== Examples ===== */
.examples {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
}
.examples h2 {
  font-size: 1.35rem;
  margin-bottom: 1rem;
}
.examples-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.example-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  transition: border-color var(--transition);
}
.example-card:hover { border-color: var(--accent); }
.example-card code {
  flex: 1;
  word-break: break-word;
}
.example-load-btn {
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--radius);
  font-weight: 600;
  font-family: var(--font-sans);
  transition: background var(--transition);
  white-space: nowrap;
}
.example-load-btn:hover { background: var(--accent); color: #fff; }

/* ===== Browse ===== */
.browse {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
}
.browse h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
}
.browse-controls {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 640px) {
  .browse-controls { grid-template-columns: 1fr; }
}
.browse-count {
  color: var(--fg-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.browse-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.75rem;
}
.browse-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  transition: border-color var(--transition), transform var(--transition);
  cursor: pointer;
}
.browse-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.browse-card-title {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
}
.browse-card-pair {
  font-size: 0.82rem;
  color: var(--fg-muted);
  margin-top: 0.2rem;
  font-family: var(--font-mono);
  word-break: break-word;
}
.browse-card-cat {
  font-size: 0.75rem;
  margin-top: 0.35rem;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.browse-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--fg-dim);
  font-style: italic;
}

/* ===== SEO copy section ===== */
.seo-copy {
  padding: 3rem 0;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
}
.seo-copy h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
  letter-spacing: -0.015em;
}
.seo-copy p {
  color: var(--fg-muted);
  margin-bottom: 1rem;
  max-width: 800px;
}
.seo-copy strong { color: var(--fg); }

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0 3rem;
  background: var(--bg-elev);
}
.footer-inner {
  text-align: center;
  max-width: 760px;
}
.footer-line {
  color: var(--fg-muted);
  font-size: 0.9rem;
  margin: 0.4rem 0;
}
.footer-donation { color: var(--fg); }
.footer-meta a { color: var(--accent); }
.footer-meta a:hover { text-decoration: underline; }

/* ===== Responsive small fixes ===== */
@media (max-width: 480px) {
  .header-inner { height: 56px; }
  .hero { padding-top: 1.5rem; }
  .cta { width: 100%; }
  .control-row { flex-direction: column; }
  .btn-primary, .btn-secondary { flex: 1; }
}
