/* Estilos compartidos de aitorevi.tools — tokens, base, navbar y footer.
   Alineados con www.aitorevi.dev (RGB para poder usar alfa). */

:root {
  color-scheme: light dark;
  --bg: 255 255 255;
  --bg-grad: radial-gradient(ellipse at 30% 20%, #eef2ff 0%, #f8fafc 55%, #e2e8f0 100%);
  --surface: 255 255 255;
  --surface-2: 248 250 252;   /* slate-50 */
  --border: 226 232 240;      /* slate-200 */
  --fg: 21 27 39;             /* #151b27 */
  --muted: 71 85 105;         /* slate-600 */
  --accent: 71 39 204;        /* #4727cc */
  --accent-soft: 124 58 237;  /* violet-600 */
  --ok: 5 150 105;            /* emerald-600 */
  --danger: 220 38 38;        /* red-600 */
  --grad-text: linear-gradient(135deg, #2563eb, #7c3aed, #2563eb);
  --radius: 16px;
}

/* Modo oscuro por clase (.dark en <html>), igual que aitorevi.dev.
   theme.js fija la clase antes del paint según localStorage o el sistema. */
:root.dark {
  --bg: 15 20 25;           /* #0f1419 */
  --bg-grad: radial-gradient(ellipse at 30% 20%, #0f172a 0%, #020617 55%, #000 100%);
  --surface: 17 24 36;      /* #111824 */
  --surface-2: 15 23 42;    /* slate-900 */
  --border: 39 51 74;       /* #27334a */
  --fg: 241 245 249;        /* slate-100 */
  --muted: 148 163 184;     /* slate-400 */
  --accent: 172 145 252;    /* #ac91fc */
  --accent-soft: 96 165 250;/* #60a5fa */
  --ok: 52 211 153;         /* emerald-400 */
  --danger: 248 113 113;    /* red-400 */
  --grad-text: linear-gradient(135deg, #60a5fa, #ac91fc, #60a5fa);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-grad) fixed, rgb(var(--bg));
  color: rgb(var(--fg));
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* Sticky footer: el body ocupa al menos la pantalla y el main crece para
     empujar el footer al fondo cuando el contenido es corto. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.wrap { flex: 1 0 auto; width: 100%; max-width: 760px; margin: 0 auto; padding: 48px 20px 80px; }
.wrap.wide { max-width: 1000px; }
.wrap > header { text-align: center; margin-bottom: 34px; }

.hidden { display: none !important; }
.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; }
h2.sr { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* ── Navbar ── */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgb(var(--bg) / 0.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgb(var(--border));
}
.nav-inner {
  max-width: 1000px; margin: 0 auto; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
}
.brand {
  display: inline-flex; align-items: baseline; gap: 8px;
  font-family: "Outfit", system-ui, sans-serif; font-weight: 900;
  font-size: 1.5rem; letter-spacing: -0.02em;
  color: rgb(var(--fg)); text-decoration: none;
}
.brand .dot { color: rgb(var(--accent)); transition: color .2s; }
.brand:hover .dot { color: rgb(var(--accent-soft)); }
.brand .brand-tag {
  align-self: baseline;
  font-family: "JetBrains Mono", ui-monospace, monospace; font-weight: 400;
  font-size: .68rem; text-transform: uppercase; letter-spacing: 0.22em;
  color: rgb(var(--muted));
}
.nav-links { display: flex; align-items: center; gap: 16px; }
.nav-links a {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: .76rem; text-transform: uppercase; letter-spacing: 0.15em;
  color: rgb(var(--fg)); text-decoration: none; transition: color .2s;
}
.nav-links a:hover { color: rgb(var(--accent)); text-decoration: underline; text-underline-offset: 4px; }
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border: none; background: transparent;
  color: rgb(var(--muted)); cursor: pointer; border-radius: 9px;
  transition: color .2s, background .2s;
}
.theme-toggle:hover { color: rgb(var(--accent)); background: rgb(var(--accent) / 0.1); }
.theme-toggle:focus-visible { outline: 3px solid rgb(var(--accent)); outline-offset: 2px; }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-moon { display: inline; }
.theme-toggle .icon-sun { display: none; }
:root.dark .theme-toggle .icon-moon { display: none; }
:root.dark .theme-toggle .icon-sun { display: inline; }

/* ── Hero ── */
.badge {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px; letter-spacing: 0.02em;
  color: rgb(var(--muted));
  background: rgb(var(--surface) / 0.6);
  border: 1px solid rgb(var(--border));
  padding: 7px 14px; border-radius: 999px; margin-bottom: 22px;
  backdrop-filter: blur(6px);
}
.badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgb(var(--accent));
  box-shadow: 0 0 10px rgb(var(--accent) / 0.7);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }

h1 {
  font-family: "Outfit", system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 6vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.subtitle {
  color: rgb(var(--muted)); margin: 0 auto; max-width: 46ch;
  font-size: 1.05rem;
}

/* ── Card y botones (compartidos) ── */
.card {
  background: rgb(var(--surface) / 0.7);
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 0 40px rgb(var(--accent) / 0.06), 0 18px 40px rgb(0 0 0 / 0.18);
  backdrop-filter: blur(10px);
  padding: 26px;
}

button.btn, a.btn {
  appearance: none; border: 1px solid rgb(var(--border));
  background: rgb(var(--surface-2) / 0.6); color: rgb(var(--fg));
  font: inherit; font-weight: 600; padding: 12px 20px; border-radius: 12px; cursor: pointer;
  transition: transform .06s ease, background .15s, border-color .15s, box-shadow .15s, opacity .15s;
  text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
}
button.btn:hover, a.btn:hover { border-color: rgb(var(--accent)); }
button.btn:active { transform: translateY(1px); }
button.btn.primary, a.btn.primary { background: rgb(var(--accent)); border-color: rgb(var(--accent)); color: #fff; }
button.btn.primary:hover, a.btn.primary:hover { box-shadow: 0 0 24px rgb(var(--accent) / 0.45); }
button.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
button.btn.ghost { background: transparent; }

/* ── Footer ── */
.site-footer {
  margin-top: 64px; width: 100%;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 28px 20px 32px;
  background: rgb(var(--surface) / 0.6);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgb(var(--border));
  font-family: "JetBrains Mono", ui-monospace, monospace;
  color: rgb(var(--muted));
}
.site-footer a { color: inherit; text-decoration: none; }

.foot-social { display: flex; align-items: center; gap: 28px; }
.foot-social a {
  display: inline-flex; color: rgb(var(--muted));
  transition: color .2s ease, transform .2s ease;
}
.foot-social a:hover { color: rgb(var(--accent)); transform: translateY(-1px); }
.foot-social a:focus-visible { outline: 3px solid rgb(var(--accent)); outline-offset: 3px; border-radius: 6px; }
.foot-social svg { width: 22px; height: 22px; }

.foot-line {
  margin: 0; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.2em; text-align: center;
}
.foot-nav {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 8px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.2em;
}
.foot-nav a { padding: 4px 6px; color: rgb(var(--muted)); transition: color .2s ease; }
.foot-nav a:hover { color: rgb(var(--accent)); }
.foot-nav .sep { opacity: .5; user-select: none; }

.foot-legal {
  max-width: 60ch; margin: 2px auto 0; text-align: center;
  font-size: 11px; line-height: 1.7; opacity: .75;
}

details.licenses { max-width: 62ch; margin: 0 auto; text-align: left; }
details.licenses > summary {
  list-style: none; cursor: pointer; text-align: center; user-select: none;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.2em;
  color: rgb(var(--accent)); padding: 6px;
}
details.licenses > summary::-webkit-details-marker { display: none; }
details.licenses > summary::before { content: "▸"; margin-right: 6px; }
details.licenses[open] > summary::before { content: "▾"; }
details.licenses > summary:hover { text-decoration: underline; }
details.licenses > summary:focus-visible { outline: 3px solid rgb(var(--accent)); outline-offset: 3px; border-radius: 4px; }
.license-body {
  margin-top: 12px; padding: 16px;
  background: rgb(var(--surface-2) / 0.5);
  border: 1px solid rgb(var(--border)); border-radius: 12px;
  font-size: 11px; line-height: 1.65;
}
.license-body p { margin: 0 0 10px; }
.license-body p strong { color: rgb(var(--fg)); }
.license-body pre {
  margin: 8px 0 0; white-space: pre-wrap; word-break: break-word;
  font-size: 10.5px; line-height: 1.55; color: rgb(var(--muted));
}

.foot-copy {
  margin: 22px 0 0; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.2em; opacity: .7;
}

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

/* ── Primitivas reutilizables por las herramientas ── */
.dropzone {
  border: 2px dashed rgb(var(--border));
  border-radius: var(--radius);
  padding: 52px 24px; text-align: center; cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
  background: rgb(var(--surface-2) / 0.5);
}
.dropzone:hover { border-color: rgb(var(--accent)); }
.dropzone.dragover {
  border-color: rgb(var(--accent));
  background: rgb(var(--accent) / 0.08);
  box-shadow: 0 0 0 4px rgb(var(--accent) / 0.12), 0 0 30px rgb(var(--accent) / 0.18);
}
.dropzone:focus-visible { outline: 3px solid rgb(var(--accent)); outline-offset: 3px; }
.dropzone > * { pointer-events: none; }
.dropzone .icon { font-size: 2.6rem; line-height: 1; margin-bottom: 14px; }
.dropzone .lead { font-size: 1.05rem; font-weight: 500; }
.dropzone .hint {
  color: rgb(var(--muted)); font-size: .9rem; margin-top: 8px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}
.dropzone strong {
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  font-weight: 700;
}

.actions { display: flex; gap: 12px; flex-wrap: wrap; }

.status { margin-top: 14px; font-size: .9rem; color: rgb(var(--muted)); min-height: 1.2em; font-family: "JetBrains Mono", ui-monospace, monospace; }
.status.error { color: rgb(var(--danger)); }
.status.ok { color: rgb(var(--ok)); }

/* Lista de ficheros reordenable (herramientas multi-archivo) */
.file-list { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid rgb(var(--border)); border-radius: 12px;
  background: rgb(var(--surface-2) / 0.5);
}
.file-row .order {
  flex: 0 0 auto; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px; background: rgb(var(--accent) / 0.12); color: rgb(var(--accent));
  font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .8rem; font-weight: 600;
}
.file-row .info { min-width: 0; flex: 1 1 auto; display: flex; flex-direction: column; }
.file-row .fname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row .fmeta { color: rgb(var(--muted)); font-size: .8rem; font-family: "JetBrains Mono", ui-monospace, monospace; }
.file-row .row-actions { flex: 0 0 auto; display: flex; gap: 4px; }
.icon-btn {
  border: 1px solid rgb(var(--border)); background: transparent; color: rgb(var(--muted));
  width: 30px; height: 30px; border-radius: 8px; cursor: pointer; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center; font-size: .8rem;
  transition: color .15s, border-color .15s, background .15s;
}
.icon-btn:hover:not(:disabled) { color: rgb(var(--accent)); border-color: rgb(var(--accent)); background: rgb(var(--accent) / 0.1); }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn:focus-visible { outline: 3px solid rgb(var(--accent)); outline-offset: 2px; }
