/*
 * Sitio de Tlaku. Mismos colores que la app (apps/desktop/src/styles/tokens.css): grafito azulado,
 * un solo acento violeta y cifras en monoespaciada. Sin fuentes ni recursos externos: tipografía
 * del sistema. Oscuro por omisión; claro si el sistema lo pide.
 */
:root {
  --font-ui: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --font-num: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --bg-app: #0e1115;
  --bg-chrome: #151920;
  --bg-raised: #1c222b;
  --bg-sunken: #0f1216;
  --bg-hover: #242c38;
  --border: #272f3b;
  --border-strong: #69788c;
  --text: #e9edf3;
  --text-muted: #a1acbb;
  --accent: #8793ff;
  --accent-hover: #a2acff;
  --accent-ink: #a9b2ff;
  --accent-subtle: rgba(135, 147, 255, 0.17);
  --on-accent: #0a0c1d;
  --focus: #c3c9ff;
  --ok: #45d6a4;
  --warn: #ffbd4a;
  --danger: #ff7f7f;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04);
  /* Apoyo (Ko-fi): tono café cálido, aparte del acento violeta para que se distinga. */
  --coffee: #f1a24b;
  --coffee-hover: #ffb766;
  --coffee-ink: #f6b565;
  --on-coffee: #24140a;
  --coffee-subtle: rgba(241, 162, 75, 0.12);
  --coffee-line: rgba(241, 162, 75, 0.45);
  --radius: 5px;
  --radius-lg: 8px;
  --measure: 68ch;
  --wrap: 1080px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg-app: #dde2e9;
    --bg-chrome: #f3f5f8;
    --bg-raised: #ffffff;
    --bg-sunken: #e8ecf1;
    --bg-hover: #e4e8ee;
    --border: #d2d8e1;
    --border-strong: #6c7a8f;
    --text: #141922;
    --text-muted: #465162;
    --accent: #4650e0;
    --accent-hover: #3a43cc;
    --accent-ink: #3640cc;
    --accent-subtle: rgba(70, 80, 224, 0.12);
    --on-accent: #ffffff;
    --focus: #2630c8;
    --ok: #067552;
    --warn: #946200;
    --danger: #c32f3a;
    --shadow: 0 10px 28px rgba(25, 35, 55, 0.2), 0 0 0 1px rgba(25, 35, 55, 0.08);
    --coffee: #8a4510;
    --coffee-hover: #733508;
    --coffee-ink: #7a3a0a;
    --on-coffee: #ffffff;
    --coffee-subtle: rgba(138, 69, 16, 0.09);
    --coffee-line: rgba(138, 69, 16, 0.45);
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg-app);
  color: var(--text);
  font: 16px/1.6 var(--font-ui);
  -webkit-text-size-adjust: 100%;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent-ink); text-underline-offset: 3px; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
code, kbd { font-family: var(--font-num); font-size: 0.92em; }
code { padding: 1px 5px; border-radius: 3px; background: var(--bg-sunken); }

.wrap { width: min(var(--wrap), 100% - 32px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 20; padding: 8px 14px; border-radius: var(--radius); background: var(--accent); color: var(--on-accent); }
.skip:focus { left: 8px; }

/* ---- cabecera ---- */
.top { position: sticky; top: 0; z-index: 10; border-bottom: 1px solid var(--border); background: var(--bg-chrome); }
.top .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 1.15rem; letter-spacing: 0.01em; text-decoration: none; }
.brand img { width: 30px; height: 30px; }
.nav { display: flex; flex-wrap: wrap; gap: 2px 4px; margin-left: auto; }
.nav a { padding: 6px 10px; border-radius: var(--radius); color: var(--text-muted); font-size: 0.92rem; text-decoration: none; }
.nav a:hover { background: var(--bg-hover); color: var(--text); }
.nav .lang { border: 1px solid var(--border-strong); color: var(--text); }

/* ---- secciones ---- */
section { padding: 56px 0; border-bottom: 1px solid var(--border); }
section:last-of-type { border-bottom: 0; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { margin: 0 0 16px; font-size: clamp(1.9rem, 4.5vw, 2.8rem); }
h2 { margin: 0 0 20px; font-size: clamp(1.4rem, 3vw, 1.8rem); }
h3 { margin: 0 0 6px; font-size: 1.05rem; }
p { margin: 0 0 14px; max-width: var(--measure); }
.lead { color: var(--text-muted); font-size: 1.12rem; }
.eyebrow { margin: 0 0 10px; color: var(--accent-ink); font: 600 0.8rem/1 var(--font-num); letter-spacing: 0.08em; text-transform: uppercase; }

.hero { padding-top: 48px; }
.hero-grid { display: grid; gap: 32px; align-items: center; }
@media (min-width: 900px) { .hero-grid { grid-template-columns: 1fr 1.25fr; } }

.shot { margin: 0; border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--bg-raised); box-shadow: var(--shadow); overflow: hidden; }
.shot figcaption { padding: 8px 12px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.85rem; }

.notice { max-width: var(--measure); padding: 12px 16px; border-left: 3px solid var(--warn); border-radius: var(--radius); background: var(--bg-sunken); }
.notice strong { color: var(--text); }

/* ---- botones ---- */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 0; }
.btn { display: inline-block; padding: 10px 18px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-raised); color: var(--text); font-weight: 600; text-decoration: none; }
.btn:hover { background: var(--bg-hover); color: var(--text); }
.btn.primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); color: var(--on-accent); }

/* ---- rejillas ---- */
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin: 0; padding: 0; list-style: none; }
.cards li { padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-raised); }
.cards p { margin: 0; color: var(--text-muted); font-size: 0.95rem; }
.gallery { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); margin-top: 28px; }

/* ---- tabla de máquinas ---- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); }
table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 0.93rem; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
thead th { background: var(--bg-chrome); color: var(--text-muted); font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody th { font-weight: 600; }
td:nth-child(3) { color: var(--text-muted); }
.tag { display: inline-block; padding: 1px 8px; border: 1px solid var(--border-strong); border-radius: 99px; font: 600 0.78rem/1.6 var(--font-num); white-space: nowrap; }
.tag.warn { border-color: var(--warn); color: var(--warn); }
.tag.none { color: var(--text-muted); }
.tag.ok { border-color: var(--ok); color: var(--ok); }

/* ---- descargas ---- */
.dl { display: grid; gap: 12px; margin: 0 0 20px; padding: 0; list-style: none; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.dl li { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-raised); }
.dl strong { display: block; }
.dl span { color: var(--text-muted); font-size: 0.92rem; }

/* ---- enlaces opcionales: se ocultan solos si siguen en {{MARCADOR}} o vacíos ---- */
a.opt[href^="{{"], a.opt[href=""] { display: none; }
.fallback { display: none; padding: 12px 16px; border-left: 3px solid var(--border-strong); border-radius: var(--radius); background: var(--bg-sunken); color: var(--text-muted); }
.optgroup:not(:has(a.opt:not([href^="{{"]):not([href=""]))) .fallback { display: block; }
.optgroup:not(:has(a.opt:not([href^="{{"]):not([href=""]))) .actions { display: none; }

/* ---- apoyo (Ko-fi) ---- */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { flex: none; width: 1.25em; height: 1.25em; }
.nav .support { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--coffee-line); background: var(--coffee-subtle); color: var(--coffee-ink); font-weight: 600; }
.nav .support:hover { background: var(--coffee); color: var(--on-coffee); }
.btn.kofi { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-color: var(--coffee); background: var(--coffee); color: var(--on-coffee); box-shadow: 0 4px 16px var(--coffee-subtle); }
.btn.kofi:hover { background: var(--coffee-hover); border-color: var(--coffee-hover); color: var(--on-coffee); }
.btn.kofi:focus-visible { outline-color: var(--coffee-ink); }
.btn.big { padding: 14px 26px; font-size: 1.1rem; }
a.opt.kofi[href^="{{"], a.opt.kofi[href=""] { display: none; }

.support-sec { background: linear-gradient(180deg, var(--coffee-subtle), transparent 70%); }
.support-sec .lead { max-width: var(--measure); }
.support-sec h3.sub { margin: 32px 0 12px; font-size: 1.05rem; }
.support-sec .cards { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.support-sec .cards li { border-top: 3px solid var(--coffee-line); }
.donate { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px; margin: 28px 0 0; padding: 20px; border: 1px solid var(--coffee-line); border-radius: var(--radius-lg); background: var(--bg-raised); }
.donate .optgroup { margin: 0; }
.donate .actions { margin: 0; }
.donate p { margin: 0; }
.donate .small { flex: 1 1 260px; color: var(--text-muted); font-size: 0.92rem; }
.alt.actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 0; }
a.alt-card { display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-raised); color: var(--text-muted); font-size: 0.93rem; text-decoration: none; }
a.alt-card strong { display: block; margin-bottom: 2px; color: var(--accent-ink); font-size: 1rem; }
a.alt-card:hover { background: var(--bg-hover); color: var(--text); }
.footer-support { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.footer-support a { display: inline-flex; align-items: center; gap: 6px; color: var(--coffee-ink); font-weight: 600; }
.footer-support a:hover { color: var(--text); }

/* Botón flotante: aparece con JS tras bajar; sin JS queda oculto (atributo hidden). */
.fab { position: fixed; right: 16px; bottom: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 15; display: flex; align-items: stretch; border: 1px solid var(--coffee); border-radius: 99px; background: var(--coffee); color: var(--on-coffee); box-shadow: var(--shadow); }
.fab[hidden] { display: none; }
.fab a, .fab button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; color: inherit; font: inherit; font-weight: 600; font-size: 0.92rem; text-decoration: none; cursor: pointer; }
.fab a { padding: 9px 6px 9px 16px; border-radius: 99px 0 0 99px; }
.fab button { justify-content: center; min-width: 40px; padding: 0 12px 0 6px; border-radius: 0 99px 99px 0; font-size: 1.25rem; line-height: 1; }
.fab a:hover, .fab button:hover { background: var(--coffee-hover); color: var(--on-coffee); }
.fab :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .fab { animation: fab-in 0.25s ease-out; }
  @keyframes fab-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
}

/* ---- páginas de guía (comparación, Falcon2, preguntas frecuentes) ---- */
.guides h3 a { color: var(--accent-ink); text-decoration: none; }
.guides h3 a:hover { text-decoration: underline; }
.crumbs { margin: 0 0 14px; color: var(--text-muted); font-size: 0.88rem; }
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--text); }
.page-head { padding: 40px 0 36px; border-bottom: 1px solid var(--border); }
.page-head .lead { max-width: var(--measure); }
.prose h2 { margin-top: 36px; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 22px; font-size: 1.1rem; }
.prose ul, .prose ol { max-width: var(--measure); margin: 0 0 14px; padding-left: 1.3em; }
.prose li { margin-bottom: 6px; }
.prose pre { max-width: var(--measure); margin: 0 0 14px; padding: 12px 16px; overflow-x: auto; border-radius: var(--radius); background: var(--bg-sunken); font: 0.9rem/1.5 var(--font-num); }
.prose pre code { padding: 0; background: none; }
.prose .table-wrap { margin: 0 0 18px; }
.prose .shot { max-width: 760px; margin: 22px 0; }
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.toc a { display: inline-block; padding: 4px 12px; border: 1px solid var(--border-strong); border-radius: 99px; color: var(--text); font-size: 0.9rem; text-decoration: none; }
.toc a:hover { background: var(--bg-hover); }
.qa { padding: 20px 0; border-bottom: 1px solid var(--border); }
.qa:last-of-type { border-bottom: 0; }
.qa h3 { margin: 0 0 8px; font-size: 1.15rem; }
.qa .a p:last-child, .qa .a ul:last-child, .qa .a ol:last-child { margin-bottom: 0; }
.qa .a ul, .qa .a ol { max-width: var(--measure); margin: 0 0 14px; padding-left: 1.3em; }
.qa h3:target { color: var(--accent-ink); }
.foot-nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 16px; }
.foot-nav a { color: var(--accent-ink); }

footer { padding: 28px 0 40px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.9rem; }
footer p { max-width: none; margin-bottom: 6px; }

/* Que el botón flotante no tape el final de la página, sobre todo en móvil. */
@media (max-width: 700px) { footer { padding-bottom: 88px; } }

/* Móvil: el menú va en una sola fila desplazable para que la cabecera fija no ocupe media pantalla. */
@media (max-width: 700px) {
  .top .wrap { padding-block: 4px; }
  .nav { flex: 1 0 100%; flex-wrap: nowrap; margin-left: 0; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; white-space: nowrap; }
}
