/* K-Snag · estilos base del sitio (tokens, layout, cabecera, pie y componentes comunes).
   Mismos colores que la app: oscuro #101218 / claro #F6F7FB, acento #6366F1 → #8B5CF6 → #F97362. */

:root {
  color-scheme: dark light;

  /* Superficies (oscuro por defecto) */
  --bg: #101218;
  --bg-elev: #141720;
  --surface: #171a23;
  --surface-2: #1f2330;
  --surface-3: #282d3c;
  --border: rgb(255 255 255 / 0.08);
  --border-strong: rgb(255 255 255 / 0.14);

  /* Texto */
  --text: #eef0f6;
  --text-muted: #a6acbd;
  --text-faint: #8a91a5;

  /* Marca */
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --coral: #f97362;
  --accent-text: #a5b4fc;
  --accent-soft: rgb(99 102 241 / 0.14);
  --accent-ring: rgb(129 140 248 / 0.65);
  --success: #34d399;
  --success-soft: rgb(52 211 153 / 0.14);
  --warning: #fbbf24;
  --warning-soft: rgb(251 191 36 / 0.12);
  --danger: #f87171;
  --danger-text: #fca5a5;

  --brand-gradient: linear-gradient(120deg, #6366f1 0%, #8b5cf6 55%, #f97362 100%);
  --text-gradient: linear-gradient(100deg, #818cf8 0%, #a78bfa 55%, #fb8a7b 100%);
  /* Botón principal: misma familia de color, con contraste AA para texto blanco */
  --button-gradient: linear-gradient(120deg, #5a54e6 0%, #7c3aed 100%);
  --button-shadow: 0 10px 30px -10px rgb(99 102 241 / 0.7), inset 0 1px 0 rgb(255 255 255 / 0.18);

  --header-bg: rgb(16 18 24 / 0.72);
  --shadow-lg: 0 30px 80px -30px rgb(0 0 0 / 0.75), 0 0 0 1px var(--border);
  --shadow-md: 0 12px 32px -16px rgb(0 0 0 / 0.6);

  /* Tipografía */
  --font-sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --font-mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;

  /* Forma y movimiento */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --ease: cubic-bezier(0.1, 0.9, 0.2, 1);
  --dur: 200ms;

  --container: 1120px;
  --gutter: 16px;
  --header-h: 64px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7fb;
    --bg-elev: #eef0f7;
    --surface: #ffffff;
    --surface-2: #eef0f6;
    --surface-3: #e4e7f0;
    --border: rgb(18 20 28 / 0.09);
    --border-strong: rgb(18 20 28 / 0.16);

    --text: #14161d;
    --text-muted: #4b5163;
    --text-faint: #5f6578;

    --accent-text: #4f46e5;
    --accent-soft: rgb(99 102 241 / 0.1);
    --accent-ring: rgb(79 70 229 / 0.55);
    --success: #047857;
    --success-soft: rgb(4 120 87 / 0.1);
    --warning: #b45309;
    --warning-soft: rgb(217 119 6 / 0.1);
    --danger: #dc2626;
    --danger-text: #b91c1c;

    --text-gradient: linear-gradient(100deg, #4f46e5 0%, #7c3aed 60%, #c2410c 100%);
    --button-shadow: 0 10px 24px -10px rgb(79 70 229 / 0.55), inset 0 1px 0 rgb(255 255 255 / 0.2);

    --header-bg: rgb(246 247 251 / 0.78);
    --shadow-lg: 0 30px 70px -30px rgb(30 34 60 / 0.35), 0 0 0 1px var(--border);
    --shadow-md: 0 12px 28px -16px rgb(30 34 60 / 0.3);
  }
}

@media (min-width: 640px) {
  :root { --gutter: 24px; }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
p, li { text-wrap: pretty; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
code, kbd {
  font-family: var(--font-mono);
  font-size: 0.875em;
}
kbd {
  display: inline-block;
  padding: 0.05em 0.45em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  white-space: nowrap;
}
::selection { background: rgb(139 92 246 / 0.35); }

:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 3px;
  border-radius: 6px;
}

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-md);
}
.skip-link:focus { top: 12px; }

/* ---------- Íconos ---------- */
.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
}
.icon-sm { width: 1em; height: 1em; }
.icon-lg { width: 1.5em; height: 1.5em; }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
main { flex: 1; }
.section { padding-block: 72px; position: relative; }
@media (min-width: 900px) {
  .section { padding-block: 104px; }
}
.section-head {
  max-width: 680px;
  margin-bottom: 40px;
}
.section-head.center { margin-inline: auto; text-align: center; }
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--accent-text);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.section-title {
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.625rem);
  font-weight: 750;
}
.section-lead {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 1.0625rem;
}
.gradient-text {
  background: var(--text-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Cabecera ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--border); }
.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  border-radius: 10px;
}
.brand img { width: 32px; height: 32px; }
.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.site-nav a:not(.btn) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 550;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.site-nav a:not(.btn):hover { color: var(--text); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--text); }
.site-nav a.nav-optional { display: none; }
.site-nav .btn { margin-left: 8px; }
@media (min-width: 760px) {
  .site-nav a.nav-optional { display: inline-flex; }
}
@media (max-width: 420px) {
  .site-nav .nav-github-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
}

/* ---------- Botones ---------- */
.btn {
  --btn-h: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: var(--btn-h);
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 650;
  font-size: 0.9375rem;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), filter var(--dur) var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary {
  background: var(--button-gradient);
  color: #fff;
  box-shadow: var(--button-shadow);
}
.btn-primary:hover { filter: brightness(1.08) saturate(1.05); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0) scale(0.99); }
.btn-secondary {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { --btn-h: 36px; padding: 0 14px; font-size: 0.875rem; border-radius: 9px; }
.btn-lg {
  --btn-h: 58px;
  padding: 0 28px;
  border-radius: 14px;
  font-size: 1.1875rem;
  font-weight: 700;
}
.btn-lg .icon { width: 1.3em; height: 1.3em; }
@media (max-width: 420px) {
  .btn-lg { padding: 0 20px; }
}

/* ---------- Tarjetas y avisos ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.callout {
  display: flex;
  gap: 14px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  border: 1px solid rgb(99 102 241 / 0.28);
}
.callout > .icon { margin-top: 3px; color: var(--accent-text); }
.callout p + p { margin-top: 8px; }
.callout.warning { background: var(--warning-soft); border-color: rgb(251 191 36 / 0.3); }
.callout.warning > .icon { color: var(--warning); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
}

/* ---------- Pie ---------- */
.site-footer {
  margin-top: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text-muted);
  font-size: 0.9375rem;
}
.footer-grid {
  display: grid;
  gap: 32px;
  padding-block: 48px 32px;
}
@media (min-width: 760px) {
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
}
.footer-brand p { margin-top: 12px; max-width: 360px; }
.footer-col h2 {
  margin-bottom: 12px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.footer-col ul { list-style: none; padding: 0; display: grid; gap: 8px; }
.footer-col a { color: var(--text-muted); text-decoration: none; }
.footer-col a:hover { color: var(--text); text-decoration: underline; }
.footer-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  justify-content: space-between;
  padding-block: 20px 32px;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-faint);
}
.footer-legal a { color: inherit; }

/* ---------- Prosa ---------- */
.prose { max-width: 720px; }
.prose > * + * { margin-top: 16px; }
.prose > :first-child { margin-top: 0; }
.prose h2 { margin-top: 48px; font-size: clamp(1.375rem, 1.1rem + 1vw, 1.75rem); }
.prose h3 { margin-top: 28px; font-size: 1.1875rem; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 8px; }
.prose li::marker { color: var(--accent-text); }
.prose strong { color: var(--text); }
.muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* El atributo hidden gana siempre (los avisos que se muestran según la plataforma). */
[hidden] { display: none !important; }

/* ---------- Donar: menú, franja de apoyo y aviso después de descargar ---------- */
.site-nav a.nav-donate .icon { color: var(--coral); }
.site-nav a.nav-donate:hover .icon { transform: scale(1.12); }
.site-nav a.nav-donate .icon { transition: transform var(--dur) var(--ease); }
/* En celulares angostos el corazón reemplaza a GitHub en el menú (GitHub sigue en el pie de página). */
@media (max-width: 420px) {
  .site-nav a.nav-donate ~ a:not(.btn)[href^="https://github.com"] { display: none; }
}
@media (max-width: 520px) {
  .site-nav .nav-donate-label {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
}

.support-band { padding-block: 8px 40px; }
.support-card {
  display: grid;
  gap: 16px;
  align-items: center;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}
.support-card h2 { font-size: 1.375rem; margin-bottom: 6px; }
.support-card p { color: var(--text-muted); font-size: 0.9375rem; max-width: 640px; }
.support-card .btn { justify-self: start; }
.support-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgb(249 115 98 / 0.14);
  color: var(--coral);
}
@media (min-width: 760px) {
  .support-card { grid-template-columns: auto minmax(0, 1fr) auto; gap: 20px; padding: 24px 28px; }
  .support-card .btn { justify-self: end; }
}

.download-toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(560px, calc(100% - 32px));
  padding: 12px 12px 12px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translate(-50%, 16px);
  transition: opacity 250ms var(--ease), transform 250ms var(--ease);
}
.download-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.download-toast .toast-icon { flex: none; color: var(--success); display: grid; }
.download-toast .toast-text { display: grid; gap: 2px; flex: 1 1 auto; min-width: 0; font-size: 0.875rem; }
.download-toast .toast-text span { color: var(--text-muted); }
.download-toast .btn { flex: none; margin: 0; }
.toast-close {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.toast-close:hover { background: var(--surface-2); color: var(--text); }
@media (max-width: 480px) {
  .download-toast { flex-wrap: wrap; }
  .download-toast .toast-text { flex-basis: calc(100% - 80px); }
  .download-toast .btn { margin-left: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .download-toast { transition: none; }
}
