/* ==========================================================================
   Deepsekk — Sistema de diseño
   Autor: Deepsekk
   Enfoque: tokens CSS, tema claro/oscuro, responsive, accesibilidad.
   ========================================================================== */

/* ----------------------------- Tokens ----------------------------------- */
:root {
  color-scheme: light;

  /* Color */
  --bg: #f6f8fc;
  --bg-alt: #eef2f9;
  --surface: #ffffff;
  --surface-2: #f1f5fb;
  --surface-3: #e6ecf7;
  --text: #0d1526;
  --text-soft: #29344a;
  --muted: #5a6780;
  --line: #dfe6f2;
  --line-strong: #c9d4e6;

  --brand: #4348d6;
  --brand-strong: #3338b8;
  --brand-soft: #e8e9ff;
  --brand-ink: #ffffff;
  --accent: #0891b2;
  --accent-soft: #e0f7fb;
  --highlight: #f59e0b;

  --success: #15803d;
  --success-soft: #dcfce7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;

  --code-bg: #0c1322;
  --code-text: #dbe7ff;

  /* Tipografía */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --fs-xs: 0.78rem;
  --fs-sm: 0.875rem;
  --fs-base: 1.0625rem;
  --fs-md: 1.15rem;
  --fs-lg: clamp(1.35rem, 1.1rem + 1vw, 1.75rem);
  --fs-xl: clamp(1.7rem, 1.3rem + 1.8vw, 2.4rem);
  --fs-2xl: clamp(2.15rem, 1.6rem + 2.8vw, 3.6rem);
  --fs-3xl: clamp(2.6rem, 1.8rem + 4vw, 4.6rem);

  /* Espaciado y forma */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --space-9: 6.5rem;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(13, 21, 38, 0.06),
    0 1px 3px rgba(13, 21, 38, 0.05);
  --shadow: 0 10px 30px -12px rgba(13, 21, 38, 0.18);
  --shadow-lg: 0 28px 60px -24px rgba(13, 21, 38, 0.3);

  --container: 1180px;
  --container-narrow: 820px;
  --header-h: 72px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #070b15;
  --bg-alt: #0a1120;
  --surface: #0e1627;
  --surface-2: #121c31;
  --surface-3: #182542;
  --text: #e9eefb;
  --text-soft: #c8d3e8;
  --muted: #94a2bd;
  --line: #1d2a45;
  --line-strong: #2b3b5e;

  --brand: #8b8ffb;
  --brand-strong: #a5a8ff;
  --brand-soft: #1b2050;
  --brand-ink: #0a0e1d;
  --accent: #22d3ee;
  --accent-soft: #0c2f3a;
  --highlight: #fbbf24;

  --success: #4ade80;
  --success-soft: #0d2b1c;
  --danger: #f87171;
  --danger-soft: #331414;

  --code-bg: #050912;
  --code-text: #d7e5ff;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 14px 34px -14px rgba(0, 0, 0, 0.65);
  --shadow-lg: 0 34px 70px -28px rgba(0, 0, 0, 0.8);
}

/* ----------------------------- Reset ------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.no-scroll {
  overflow: hidden;
}

img,
svg,
video {
  max-width: 100%;
  display: block;
}

h1,
h2,
h3,
h4,
h5 {
  margin: 0 0 0.6em;
  font-weight: 750;
  line-height: 1.16;
  letter-spacing: -0.022em;
  text-wrap: balance;
  color: var(--text);
}

h1 {
  font-size: var(--fs-2xl);
}
h2 {
  font-size: var(--fs-xl);
}
h3 {
  font-size: var(--fs-lg);
}
h4 {
  font-size: var(--fs-md);
}

p {
  margin: 0 0 1.15em;
}

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.18s var(--ease);
}

a:hover {
  color: var(--brand-strong);
}

ul,
ol {
  margin: 0 0 1.2em;
  padding-left: 1.3em;
}

li + li {
  margin-top: 0.4em;
}

strong {
  color: var(--text);
  font-weight: 700;
}

small {
  font-size: var(--fs-sm);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--space-6) 0;
}

::selection {
  background: var(--brand);
  color: #fff;
}

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

/* ----------------------------- Utilidades -------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.visually-hidden {
  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: 1rem;
  top: -100px;
  z-index: 200;
  padding: 0.7rem 1.1rem;
  background: var(--brand);
  color: var(--brand-ink);
  border-radius: var(--radius-sm);
  font-weight: 700;
  transition: top 0.2s var(--ease);
}

.skip-link:focus {
  top: 1rem;
  color: var(--brand-ink);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: var(--fs-xs);
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: var(--space-3);
}

.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.section {
  padding-block: var(--space-8);
}

.section--tight {
  padding-block: var(--space-7);
}

.section--flush-top {
  padding-top: 0;
}

.section--legal {
  padding-top: var(--space-6);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.section-head p {
  max-width: 62ch;
  color: var(--muted);
  margin-bottom: 0;
}

.section-head h2 {
  margin-bottom: 0.3rem;
}

.text-muted {
  color: var(--muted);
}

.text-center {
  text-align: center;
}

.mt-0 {
  margin-top: 0;
}
.mb-0 {
  margin-bottom: 0;
}
.mb-4 {
  margin-bottom: var(--space-4);
}
.mb-6 {
  margin-bottom: var(--space-6);
}

/* ----------------------------- Botones ---------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.78rem 1.3rem;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease),
    background-color 0.18s var(--ease), border-color 0.18s var(--ease),
    color 0.18s var(--ease);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn--primary {
  background: var(--brand);
  color: var(--brand-ink);
  box-shadow: 0 10px 24px -12px rgba(67, 72, 214, 0.8);
}

.btn--primary:hover {
  background: var(--brand-strong);
  color: var(--brand-ink);
}

.btn--ghost {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.btn--ghost:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.btn--small {
  padding: 0.5rem 0.95rem;
  font-size: var(--fs-xs);
}

.btn--block {
  width: 100%;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 700;
  font-size: var(--fs-sm);
  text-decoration: none;
}

.link-arrow svg {
  width: 16px;
  height: 16px;
  transition: transform 0.18s var(--ease);
}

.link-arrow:hover svg {
  transform: translateX(3px);
}

/* ----------------------------- Header ----------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
  font-size: 1.16rem;
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}

.brand:hover {
  color: var(--text);
}

.brand__mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
}

.brand__dot {
  color: var(--brand);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav__link {
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  font-weight: 650;
  color: var(--text-soft);
  text-decoration: none;
}

.nav__link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav__link[aria-current="page"] {
  color: var(--brand);
  background: var(--brand-soft);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  transition: border-color 0.18s var(--ease), color 0.18s var(--ease),
    background-color 0.18s var(--ease);
}

.icon-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

.nav-toggle {
  display: none;
}

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex;
  }

  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    padding: 1rem clamp(1rem, 4vw, 2rem) 1.5rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease),
      visibility 0.2s;
  }

  .nav.is-open {
    transform: none;
    opacity: 1;
    visibility: visible;
  }

  .nav__link {
    padding: 0.85rem 1rem;
    font-size: var(--fs-base);
  }
}

/* ----------------------------- Hero ------------------------------------- */
.hero {
  position: relative;
  padding-block: clamp(3rem, 6vw, 5.5rem) clamp(3rem, 6vw, 5rem);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
      55% 65% at 78% 18%,
      color-mix(in srgb, var(--brand) 16%, transparent) 0%,
      transparent 70%
    ),
    radial-gradient(
      45% 55% at 12% 8%,
      color-mix(in srgb, var(--accent) 12%, transparent) 0%,
      transparent 70%
    );
  pointer-events: none;
}

.hero__grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}

.hero__title {
  font-size: var(--fs-3xl);
  letter-spacing: -0.04em;
  margin-bottom: 1rem;
}

.hero__title em {
  font-style: normal;
  background: linear-gradient(
    100deg,
    var(--brand) 10%,
    var(--accent) 55%,
    var(--brand) 95%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__lead {
  font-size: var(--fs-md);
  color: var(--muted);
  max-width: 54ch;
  margin-bottom: var(--space-5);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: var(--space-5);
}

.hero__actions--center {
  justify-content: center;
}

.hero__meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
  max-width: 520px;
}

.hero__stat strong {
  display: block;
  font-size: 1.5rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.hero__stat span {
  display: block;
  font-size: 0.7rem;
  line-height: 1.35;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--text-soft);
  margin-bottom: var(--space-4);
}

.badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 18%, transparent);
}

/* Ventana de código decorativa */
.code-window {
  position: relative;
  background: var(--code-bg);
  border: 1px solid #22304d;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: perspective(1200px) rotateY(-4deg) rotateX(2deg);
  transition: transform 0.5s var(--ease);
}

.code-window:hover {
  transform: perspective(1200px) rotateY(0) rotateX(0);
}

.code-window__bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #1b2740;
  background: #0a1020;
}

.code-window__dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #2c3a58;
}

.code-window__dot:nth-child(1) {
  background: #ff5f57;
}
.code-window__dot:nth-child(2) {
  background: #febc2e;
}
.code-window__dot:nth-child(3) {
  background: #28c840;
}

.code-window__file {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #7d8fae;
}

.code-window pre {
  margin: 0;
  padding: 1.3rem 1.4rem 1.6rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 0.9vw, 0.85rem);
  line-height: 1.75;
  color: #c7d5ef;
  tab-size: 2;
}

.code-window code {
  font-family: inherit;
}

.tok-key {
  color: #c792ea;
}
.tok-fn {
  color: #82aaff;
}
.tok-str {
  color: #c3e88d;
}
.tok-com {
  color: #5c6f8f;
  font-style: italic;
}
.tok-num {
  color: #f78c6c;
}
.tok-var {
  color: #7fdbca;
}

.code-window__glow {
  position: absolute;
  width: 360px;
  height: 360px;
  right: -110px;
  bottom: -130px;
  background: radial-gradient(circle, rgba(91, 95, 240, 0.45) 0%, rgba(91, 95, 240, 0.18) 42%, transparent 70%);
  pointer-events: none;
}

@media (max-width: 960px) {
  .hero__grid {
    grid-template-columns: 1fr;
  }

  .code-window {
    transform: none;
    max-width: 620px;
  }
}

/* ----------------------------- Tarjetas --------------------------------- */
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
    border-color 0.25s var(--ease);
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  overflow: hidden;
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease);
}

.card:hover .card__media img {
  transform: scale(1.03);
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.3rem 1.35rem 1.45rem;
  flex: 1;
}

.card__meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: var(--fs-xs);
  color: var(--muted);
  font-weight: 600;
}

.card__meta .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.card__title {
  font-size: 1.15rem;
  line-height: 1.35;
  margin-bottom: 0;
}

.card__title a {
  color: inherit;
  text-decoration: none;
}

.card__title a:hover {
  color: var(--brand);
}

.card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card {
  position: relative;
}

.card__excerpt {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin-bottom: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 0.6rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.24rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.tag:hover {
  color: var(--brand-strong);
}

.tag--accent {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Tarjeta destacada */
.featured {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 0;
}

.featured .card__media {
  aspect-ratio: auto;
  height: 100%;
  min-height: 320px;
}

.featured .card__body {
  padding: clamp(1.6rem, 3.5vw, 2.6rem);
  justify-content: center;
}

.featured .card__title {
  font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.15rem);
  letter-spacing: -0.03em;
}

.featured .card__excerpt {
  -webkit-line-clamp: unset;
  font-size: var(--fs-base);
}

@media (max-width: 860px) {
  .featured {
    grid-template-columns: 1fr;
  }

  .featured .card__media {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }
}

/* Rejillas */
.grid {
  display: grid;
  gap: var(--space-5);
}

.grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid--4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 980px) {
  .grid--3,
  .grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
  }
}

/* ----------------------------- Categorías -------------------------------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

.cat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.2s var(--ease), transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}

.cat-card:hover {
  border-color: var(--brand);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  color: var(--text);
}

.cat-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  margin-bottom: 0.35rem;
}

.cat-card__icon svg {
  width: 22px;
  height: 22px;
}

.cat-card strong {
  font-size: 1.02rem;
}

.cat-card span {
  font-size: var(--fs-sm);
  color: var(--muted);
}

@media (max-width: 860px) {
  .cat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .cat-grid {
    grid-template-columns: 1fr;
  }
}

/* ----------------------------- Newsletter ------------------------------- */
.newsletter {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(
    120deg,
    var(--surface) 0%,
    var(--surface-2) 100%
  );
  padding: clamp(1.75rem, 4vw, 3rem);
  box-shadow: var(--shadow);
}

.newsletter::after {
  content: "";
  position: absolute;
  width: 320px;
  height: 320px;
  right: -110px;
  top: -140px;
  background: radial-gradient(
    circle,
    color-mix(in srgb, var(--brand) 26%, transparent),
    transparent 68%
  );
  pointer-events: none;
}

.newsletter__grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.9fr);
  gap: var(--space-6);
  align-items: center;
}

.newsletter h2 {
  font-size: var(--fs-xl);
  margin-bottom: 0.5rem;
}

.newsletter p {
  color: var(--muted);
  margin-bottom: 0;
}

.field-row {
  display: flex;
  gap: 0.6rem;
}

.field-row input {
  flex: 1;
  min-width: 0;
}

.form-note {
  font-size: var(--fs-xs);
  color: var(--muted);
  margin: 0.7rem 0 0;
}

.form-note a {
  color: inherit;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: var(--fs-sm);
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent);
}

input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

.form-status {
  margin-top: 0.75rem;
  font-size: var(--fs-sm);
  font-weight: 600;
  min-height: 1.4em;
}

.form-status.is-success {
  color: var(--success);
}

.form-status.is-error {
  color: var(--danger);
}

@media (max-width: 760px) {
  .newsletter__grid {
    grid-template-columns: 1fr;
  }

  .field-row {
    flex-direction: column;
  }
}

/* ----------------------------- FAQ -------------------------------------- */
.faq {
  display: grid;
  gap: 0.75rem;
  max-width: 820px;
}

.faq details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 1.25rem;
  transition: border-color 0.2s var(--ease);
}

.faq details[open] {
  border-color: var(--brand);
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 0;
  font-weight: 700;
  font-size: var(--fs-sm);
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  font-size: 1.35rem;
  font-weight: 400;
  color: var(--brand);
  line-height: 1;
  transition: transform 0.2s var(--ease);
}

.faq details[open] summary::after {
  transform: rotate(45deg);
}

.faq details p {
  color: var(--muted);
  font-size: var(--fs-sm);
  padding-bottom: 1.05rem;
  margin: 0;
}

/* ----------------------------- Página de artículos ----------------------- */
.page-head {
  padding-block: clamp(2.5rem, 5vw, 4rem) var(--space-6);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-alt), var(--bg));
}

.page-head h1 {
  margin-bottom: 0.55rem;
}

.page-head p {
  max-width: 62ch;
  color: var(--muted);
  margin: 0;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: var(--space-5);
}

.filter-btn {
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-soft);
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: 650;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}

.filter-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.filter-btn[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.search-box {
  position: relative;
  margin-top: var(--space-4);
  max-width: 420px;
}

.search-box svg {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}

.search-box input {
  padding-left: 2.6rem;
  border-radius: var(--radius-pill);
  background: var(--surface);
}

.results-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: var(--space-5);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.empty-state {
  grid-column: 1 / -1;
  padding: var(--space-7) var(--space-4);
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
}

.empty-state strong {
  display: block;
  color: var(--text);
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

/* ----------------------------- Artículo --------------------------------- */
.article-hero {
  padding-block: var(--space-6) 0;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: var(--fs-xs);
  color: var(--muted);
  margin-bottom: var(--space-4);
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.breadcrumbs span[aria-hidden] {
  opacity: 0.6;
}

.article-header {
  max-width: 860px;
}

.article-header h1 {
  font-size: clamp(2rem, 1.5rem + 2.2vw, 3.05rem);
  letter-spacing: -0.035em;
  margin-bottom: 0.8rem;
}

.article-dek {
  font-size: var(--fs-md);
  color: var(--muted);
  max-width: 70ch;
  margin-bottom: var(--space-5);
}

.article-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
  padding-block: var(--space-4);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: #fff;
  font-weight: 800;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.article-byline strong {
  color: var(--text);
  font-size: var(--fs-sm);
  display: block;
  line-height: 1.3;
}

.byline-sep {
  width: 1px;
  height: 24px;
  background: var(--line);
}

.share {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
}

.share a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  transition: all 0.18s var(--ease);
}

.share a:hover {
  color: var(--brand);
  border-color: var(--brand);
}

.share svg {
  width: 15px;
  height: 15px;
}

.article-cover {
  margin: var(--space-5) 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--surface-2);
  aspect-ratio: 16 / 7;
}

.article-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: start;
  padding-block: var(--space-7);
}

.article-layout > * {
  min-width: 0;
}

.prose {
  max-width: 72ch;
  font-size: 1.075rem;
  color: var(--text-soft);
}

.prose > p:first-child {
  font-size: 1.14rem;
  color: var(--text);
}

.prose h2 {
  font-size: clamp(1.4rem, 1.1rem + 1.1vw, 1.8rem);
  margin-top: 2.2em;
  margin-bottom: 0.55em;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.prose h3 {
  font-size: 1.22rem;
  margin-top: 1.8em;
  margin-bottom: 0.45em;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.prose h2 + h3 {
  margin-top: 0.8em;
}

.prose ul,
.prose ol {
  padding-left: 1.35em;
}

.prose li::marker {
  color: var(--brand);
  font-weight: 700;
}

.prose blockquote {
  margin: 1.6em 0;
  padding: 1rem 1.35rem;
  border-left: 4px solid var(--brand);
  background: var(--surface-2);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text);
  font-size: 1.06em;
}

.prose blockquote p:last-child {
  margin-bottom: 0;
}

.prose code:not(pre code) {
  padding: 0.15em 0.4em;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.87em;
  overflow-wrap: anywhere;
}

.prose pre {
  margin: 1.6em 0;
  padding: 1.25rem 1.35rem;
  border-radius: var(--radius);
  background: var(--code-bg);
  color: var(--code-text);
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.7;
  border: 1px solid #22304d;
}

.prose pre code {
  font-family: var(--font-mono);
  background: none;
  padding: 0;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  margin: 1.6em 0;
  border-radius: var(--radius-sm);
}

.table-scroll:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.table-scroll table {
  margin: 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 0.92rem;
}

.prose th,
.prose td {
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose thead th {
  background: var(--surface-2);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.prose tbody tr:nth-child(even) {
  background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

.callout {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.9rem;
  margin: 1.7em 0;
  padding: 1.1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.96rem;
}

.callout__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand);
  flex-shrink: 0;
}

.callout__icon svg {
  width: 18px;
  height: 18px;
}

.callout strong {
  display: block;
  margin-bottom: 0.2rem;
}

.callout p {
  margin: 0;
  color: var(--muted);
}

.callout--warn {
  background: color-mix(in srgb, var(--highlight) 9%, var(--surface));
  border-color: color-mix(in srgb, var(--highlight) 35%, var(--line));
}

.callout--warn .callout__icon {
  background: color-mix(in srgb, var(--highlight) 20%, transparent);
  color: var(--highlight);
}

/* Índice del artículo */
.toc {
  position: sticky;
  top: calc(var(--header-h) + 1.5rem);
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: var(--fs-sm);
}

.toc h2 {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: toc;
}

.toc li {
  counter-increment: toc;
  margin: 0;
}

.toc a {
  display: flex;
  gap: 0.55rem;
  padding: 0.36rem 0.5rem;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.4;
  font-size: 0.84rem;
}

.toc ol a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  opacity: 0.65;
  padding-top: 0.15em;
}

.toc a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.toc a.is-active {
  color: var(--brand);
  background: var(--brand-soft);
  font-weight: 650;
}

.toc__cta {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.toc__cta a {
  padding-left: 0;
  padding-right: 0;
}

.article-layout > aside {
  align-self: stretch;
}

@media (max-width: 700px) {
  .article-cover {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 1000px) {
  .article-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .article-sidebar {
    order: -1;
  }

  .toc {
    position: static;
  }
}

/* Barra de progreso de lectura */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--brand), var(--accent));
  z-index: 120;
  pointer-events: none;
}

/* Autor y relacionados */
.author-box {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  margin-top: var(--space-6);
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.author-box .avatar {
  width: 56px;
  height: 56px;
  font-size: 1rem;
}

.author-box p {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin: 0.35rem 0 0;
}

.author-box strong {
  font-size: 1.02rem;
}

.related {
  margin-top: var(--space-7);
}

.related h2 {
  font-size: var(--fs-lg);
  margin-bottom: var(--space-4);
}

/* Anuncio */
.ad {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 120px;
  margin-block: var(--space-6);
  padding: 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-2) 60%, transparent);
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-xs);
}

.ad__label {
  font-size: 0.66rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

/* ----------------------------- Páginas legales --------------------------- */
.legal {
  max-width: 78ch;
  padding-block: var(--space-6) var(--space-8);
}

.legal--flush {
  padding-block: 0;
}

.legal h1 {
  margin-bottom: 0.4rem;
}

.legal .updated {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-bottom: var(--space-5);
}

.legal h2 {
  font-size: 1.35rem;
  margin-top: 2em;
  margin-bottom: 0.5em;
}

.legal h3 {
  font-size: 1.1rem;
  margin-top: 1.5em;
}

.legal p,
.legal li {
  color: var(--text-soft);
  font-size: 0.98rem;
}

.legal .table-scroll {
  margin: 1.2em 0;
}

.legal table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 1.2em 0;
}

.legal .table-scroll table {
  margin: 0;
}

.legal th,
.legal td {
  border: 1px solid var(--line);
  padding: 0.6rem 0.7rem;
  text-align: left;
  vertical-align: top;
}

.legal th {
  background: var(--surface-2);
}

/* ----------------------------- Contacto --------------------------------- */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
  padding-block: var(--space-6) var(--space-8);
}

.contact-form {
  display: grid;
  gap: 1.1rem;
  padding: clamp(1.4rem, 3vw, 2.2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.contact-form .field {
  display: grid;
  gap: 0.4rem;
}

.contact-form label {
  font-size: var(--fs-sm);
  font-weight: 650;
}

.contact-form .error {
  font-size: var(--fs-xs);
  color: var(--danger);
  min-height: 1em;
}

.contact-form textarea {
  min-height: 150px;
  resize: vertical;
}

.field--check {
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 0.6rem;
}

.field--check input {
  width: 18px;
  height: 18px;
  margin-top: 0.25rem;
}

.field--check label {
  font-weight: 500;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.hp-field {
  position: absolute !important;
  left: -9999px;
  opacity: 0;
  height: 0;
  overflow: hidden;
}

.contact-info {
  display: grid;
  gap: 1rem;
}

.info-card {
  padding: 1.2rem 1.3rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.info-card h3 {
  font-size: 0.98rem;
  margin-bottom: 0.25rem;
}

.info-card p {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin: 0;
}

.info-card a {
  font-weight: 650;
}

@media (max-width: 820px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

/* ----------------------------- Footer ----------------------------------- */
.site-footer {
  margin-top: var(--space-8);
  border-top: 1px solid var(--line);
  background: var(--bg-alt);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: var(--space-6);
  padding-block: var(--space-7) var(--space-6);
}

.footer-brand p {
  font-size: var(--fs-sm);
  color: var(--muted);
  max-width: 34ch;
  margin-top: 0.9rem;
}

.footer-col h2 {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.9rem;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

.footer-col a {
  font-size: var(--fs-sm);
  color: var(--text-soft);
  text-decoration: none;
}

.footer-col a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-block: 1.15rem;
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.footer-bottom p {
  margin: 0;
}

.footer-social {
  display: flex;
  gap: 0.5rem;
}

.footer-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
}

.footer-social a:hover {
  color: var(--brand);
  border-color: var(--brand);
}

.footer-social svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 860px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 520px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

/* ----------------------------- Consentimiento ---------------------------- */
.consent {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 150;
  max-width: 520px;
  margin-inline: auto;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-xs);
  color: var(--muted);
  display: none;
}

.consent.is-visible {
  display: block;
  animation: slide-up 0.35s var(--ease);
}

.consent p {
  margin-bottom: 0.8rem;
}

.consent strong {
  color: var(--text);
  font-size: var(--fs-sm);
  display: block;
  margin-bottom: 0.25rem;
}

.consent__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ----------------------------- 404 -------------------------------------- */
.error-page {
  display: grid;
  place-items: center;
  min-height: 62vh;
  padding-block: var(--space-8);
  text-align: center;
}

.error-code {
  font-family: var(--font-mono);
  font-size: clamp(4.5rem, 14vw, 9rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.06em;
  background: linear-gradient(120deg, var(--brand), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.4rem;
}

.error-page p {
  max-width: 48ch;
  margin-inline: auto;
  color: var(--muted);
}

/* ----------------------------- Animaciones ------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
  }

  .js .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ----------------------------- Método / pasos ---------------------------- */
.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  counter-reset: step;
}

.step {
  position: relative;
  padding: 1.4rem 1.35rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.step::before {
  counter-increment: step;
  content: "0" counter(step);
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 0.9rem;
}

.step h3 {
  font-size: 1.02rem;
  margin-bottom: 0.4rem;
}

.step p {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin: 0;
}

.step__line {
  position: absolute;
  top: 1.55rem;
  right: 1rem;
  width: 26px;
  height: 1px;
  background: var(--line-strong);
}

@media (max-width: 980px) {
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .steps {
    grid-template-columns: 1fr;
  }
}

/* ----------------------------- Copiar código ----------------------------- */
[hidden] {
  display: none !important;
}

.code-wrap {
  position: relative;
  margin: 1.6em 0;
}

.code-wrap pre {
  margin: 0;
}

.copy-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid #2c3b5c;
  border-radius: 6px;
  background: #111b30;
  color: #9fb2d4;
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 650;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.18s var(--ease), color 0.18s var(--ease),
    border-color 0.18s var(--ease);
}

.code-wrap:hover .copy-btn,
.copy-btn:focus-visible {
  opacity: 1;
}

.copy-btn:hover {
  color: #fff;
  border-color: #4b6191;
}

@media (hover: none) {
  .copy-btn {
    opacity: 1;
  }
}

/* ----------------------------- Impresión --------------------------------- */
@media print {
  .site-header,
  .site-footer,
  .consent,
  .toc,
  .share,
  .read-progress,
  .ad,
  .related,
  .newsletter {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .article-layout {
    display: block;
  }

  a {
    color: #000;
    text-decoration: underline;
  }
}
