/* Mecagoenlos - app-shell con rail izquierdo permanente.
   Lateral OSCURO (avatar + nav + categorías + redes) · contenido CLARO a la derecha.
   Marca magenta #e82a6b en títulos · Lato (display) + Open Sans (texto).
   Funciona SIN JavaScript: el menú móvil usa checkbox + label. */

:root {
  --accent: #e82a6b;
  --accent-strong: #ff3d80;
  --accent-soft: rgba(232, 42, 107, 0.1);
  --accent-line: rgba(232, 42, 107, 0.45);

  /* Rail oscuro */
  --rail-bg: #0b0b0e;
  --rail-text: #d8d8de;
  --rail-muted: #8b8b95;
  --rail-line: rgba(255, 255, 255, 0.1);

  /* Contenido claro */
  --bg: #ffffff;
  --text: #1b1b1e;
  --text-soft: #3d3d44;
  --muted: #74747d;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --surface-sunk: #f3f3f5;
  --line: rgba(0, 0, 0, 0.1);
  --line-strong: rgba(0, 0, 0, 0.16);
  --link: #c4185b;

  --rail-w: 280px;
  --content-max: 1040px;
  --article-max: 880px;
  --radius: 12px;
  --radius-sm: 8px;
  --display: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --sans: "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--rail-bg);
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent);
}

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.01em;
}

img,
iframe,
video,
object,
embed {
  max-width: 100%;
}

:target {
  scroll-margin-top: 24px;
}

/* ===================================================================
   APP SHELL
   =================================================================== */

.shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
}

/* ---------- Rail izquierdo (oscuro) ---------- */

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  flex: 0 0 var(--rail-w);
  width: var(--rail-w);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--rail-bg);
  color: var(--rail-text);
  border-right: 1px solid var(--rail-line);
  background-image: radial-gradient(120% 60% at 0% 0%, rgba(232, 42, 107, 0.12), transparent 60%);
}

.rail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--rail-line);
}

.rail-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: #fff;
  text-decoration: none;
}

.rail-avatar {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(232, 42, 107, 0.15);
  background: #111;
  object-fit: cover;
}

.rail-id strong {
  display: block;
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.05rem;
  line-height: 1.1;
  color: #fff;
  letter-spacing: -0.01em;
}

.rail-id small {
  display: block;
  margin-top: 2px;
  color: var(--rail-muted);
  font-size: 0.74rem;
}

.nav-burger {
  display: none;
  width: 44px;
  height: 40px;
  flex: none;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--rail-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.nav-burger span,
.nav-burger span::before,
.nav-burger span::after {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
}

.nav-burger span {
  position: relative;
}

.nav-burger span::before {
  content: "";
  position: absolute;
  top: -6px;
}

.nav-burger span::after {
  content: "";
  position: absolute;
  top: 6px;
}

.rail-nav {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 2px;
  padding: 16px 12px;
}

.rail-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rail-links a {
  color: var(--rail-text);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.96rem;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.rail-links a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.rail-heading {
  margin: 20px 12px 8px;
  color: var(--accent);
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.rail-cats {
  display: flex;
  flex-direction: column;
}

.rail-cats a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--rail-muted);
  font-size: 0.9rem;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.rail-cats a::after {
  content: "›";
  color: var(--accent);
  opacity: 0.55;
  font-size: 1.05rem;
}

.rail-cats a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.rail-cats a:hover::after {
  opacity: 1;
}

.rail-social {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding: 18px 12px 8px;
}

.rail-social a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: var(--rail-text);
  transition: background 0.15s ease, color 0.15s ease, transform 0.12s ease;
}

.rail-social a:hover {
  background: var(--accent);
  color: #fff;
  transform: translateY(-2px);
}

/* ---------- Columna de contenido (clara) ---------- */

.content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

main {
  flex: 1 0 auto;
  min-width: 0;
  padding: clamp(28px, 4vw, 60px) clamp(18px, 2vw, 36px) 56px;
}

/* ---------- Home ---------- */

.home-hero {
  max-width: var(--content-max);
}

.kicker {
  margin: 0 0 14px;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.home-hero h1 {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(1.95rem, 4.6vw, 3.3rem);
  line-height: 1.07;
  letter-spacing: -0.025em;
  color: var(--text);
}

.home-hero h1 span {
  color: var(--accent);
}

.home-hero .lead {
  max-width: 60ch;
  margin: 18px 0 0;
  color: var(--text-soft);
  font-size: clamp(1.02rem, 2.2vw, 1.18rem);
}

.home-list {
  max-width: var(--content-max);
  margin-top: 44px;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent);
}

.section-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
}

.section-heading a {
  flex: none;
  font-size: 0.85rem;
  color: var(--muted);
}

.section-heading a:hover {
  color: var(--accent);
}

.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* Rejilla "auto-fit": tantas columnas como quepan con un mínimo de ~450px (multi-columna en pantallas
   anchas, 1 columna en móvil). El min(450px, 100%) evita overflow horizontal en pantallas estrechas. */
.post-grid.post-grid--auto {
  grid-template-columns: repeat(auto-fit, minmax(min(450px, 100%), 1fr));
}

/* En la rejilla multi-columna, las tarjetas con miniatura se apilan verticalmente (imagen 16:9
   arriba, texto debajo) para que el texto no quede comprimido. */
.post-grid--auto .post-card.has-thumb {
  grid-template-columns: 1fr;
}

/* ---------- Tarjetas ---------- */

.post-card,
.comment,
.comment-form {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.post-card {
  position: relative;
  min-height: 100%;
  padding: 20px 22px;
  overflow: hidden;
  border-color: rgba(0, 0, 0, 0.18);
  box-shadow: 0 2px 8px -4px rgba(0, 0, 0, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.post-card-body {
  display: grid;
  gap: 8px;
  align-content: start;
}

/* Con miniatura (primera <img> del descripM): imagen a la izquierda + texto a la derecha. */
.post-card.has-thumb {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: start;
}

.post-thumb {
  display: block;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}

/* La miniatura adopta la proporción real de cada imagen (16:9, 4:3, etc.) sin JS: el ancho lo fija
   la columna y la altura es automática, con un tope de 280px. Las imágenes muy altas (capturas
   largas) se recortan por arriba en vez de crecer sin límite; las normales no se ven afectadas. */
.post-thumb img {
  width: 100%;
  height: auto;
  max-height: 280px;
  object-fit: cover;
  object-position: top;
  display: block;
}

/* En móvil la tarjeta con miniatura se apila: imagen ancha (16:9) arriba, texto debajo. */
@media (max-width: 600px) {
  .post-card.has-thumb {
    grid-template-columns: 1fr;
  }
}

/* Al pasar el ratón la tarjeta se eleva: sombra más profunda, ligero desplazamiento y borde de
   acento; sin barra lateral. */
.post-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-line);
  box-shadow: 0 22px 44px -16px rgba(0, 0, 0, 0.22);
}

.post-card-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.22rem;
  font-weight: 800;
  line-height: 1.28;
  letter-spacing: -0.01em;
}

.post-card-title a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s ease;
}

.post-card:hover .post-card-title a {
  color: var(--accent);
}

/* Meta editorial: sección · fecha, en mayúsculas tenues. */
.post-meta {
  margin: 0;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.post-date {
  color: var(--muted);
  font-size: 0.8rem;
}

.post-excerpt {
  margin: 2px 0 0;
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.58;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.read-more {
  justify-self: start;
  margin-top: 2px;
  color: var(--link);
  font-size: 0.88rem;
  font-weight: 700;
}

.read-more::before {
  content: "→ ";
  transition: margin-right 0.15s ease;
}

.read-more:hover::before {
  margin-right: 6px;
}

/* Pie de tarjeta: fecha a la izquierda y "Seguir leyendo" a la derecha, en la misma fila (igual en
   desktop y móvil). */
.post-card-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.post-card-foot .read-more {
  margin-top: 0;
  margin-left: auto;
}

/* ---------- Artículo ---------- */

.article-shell {
  max-width: var(--article-max);
}

.breadcrumbs {
  display: flex;
  gap: 8px;
  align-items: center;
  /* Carrusel sin JS: una sola línea con scroll horizontal (en móvil no envuelve a varias líneas,
     que ocupaban demasiada altura). La barra se oculta; en táctil se desliza con el dedo. */
  flex-wrap: nowrap;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* Pista de scroll: difumina el borde derecho. Cuando hay overflow, el último chip visible se ve
     "a medias"; si todo cabe (desktop), el degradado cae sobre el vacío y no afecta. */
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 38px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 38px), transparent);
  padding: 2px 0;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 0.85rem;
}

.breadcrumbs::-webkit-scrollbar {
  display: none;
}

/* Cada miga mantiene su ancho (no se comprime ni se parte en varias líneas). */
.breadcrumbs > * {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Enlaces como "chip" para que se intuya que son clicables. */
.breadcrumbs a {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.breadcrumbs a:hover,
.breadcrumbs a:focus-visible {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

/* Separadores "/" discretos. */
.breadcrumbs [aria-hidden="true"] {
  color: var(--line-strong);
}

/* Página actual: chip relleno, sin aspecto de enlace. */
.breadcrumbs > span:last-child {
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

/* Contenedor para anclar la flecha (que no scrollea con las migas). */
.breadcrumbs-scroll {
  position: relative;
}

/* Flecha clicable que desplaza las migas. Mejora progresiva: el JS la muestra solo cuando hay
   overflow (en cualquier tamaño) y la oculta al llegar al final; sin JS queda oculta (atributo
   [hidden]) y las migas se deslizan a mano. */
.breadcrumbs-arrow {
  position: absolute;
  top: 50%;
  right: 2px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  /* Anula el min-height: 44px de la regla global `button` (que la hacía rectangular). */
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  line-height: 1;
  cursor: pointer;
  /* Halo del color de fondo para destacar sobre el borde difuminado de las migas. */
  box-shadow: 0 0 0 5px var(--bg);
  transition: background 0.15s ease;
}

/* Drag horizontal en desktop: cursor "grab" cuando hay overflow, "grabbing" mientras se arrastra. */
.breadcrumbs.is-scrollable {
  cursor: grab;
}

.breadcrumbs.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.breadcrumbs-arrow[hidden] {
  display: none;
}

.breadcrumbs-arrow:hover,
.breadcrumbs-arrow:focus-visible {
  background: var(--accent-strong);
}

@media (prefers-reduced-motion: no-preference) {
  .breadcrumbs-arrow:not([hidden]) {
    animation: bc-scroll-hint 1.3s ease-in-out infinite;
  }

  @keyframes bc-scroll-hint {
    0%, 100% { transform: translateY(-50%) translateX(0); }
    50% { transform: translateY(-50%) translateX(-3px); }
  }
}

.article-header {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.article-header h1 {
  margin: 0 0 14px;
  font-family: "Open Sans", Arial, sans-serif;
  font-size: clamp(1.7rem, 4.2vw, 2.6rem);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--accent);
}

.article-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.article-meta .byline strong {
  color: var(--text);
  font-weight: 700;
}

.article-cat {
  padding: 3px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text-soft);
}

.legacy-content {
  margin-top: 30px;
  color: var(--text-soft);
  font-size: 1.06rem;
  line-height: 1.75;
  overflow-wrap: anywhere;
}

.legacy-content > *:first-child {
  margin-top: 0;
}

.legacy-content :is(h2, h3, h4) {
  clear: both;
  color: var(--accent);
  font-family: var(--display);
  line-height: 1.28;
  margin: 1.8em 0 0.6em;
}

.legacy-content h2 {
  font-size: clamp(1.35rem, 3.2vw, 1.8rem);
}

.legacy-content h3 {
  font-size: clamp(1.15rem, 2.6vw, 1.4rem);
}

.legacy-content a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 0.16em;
}

.legacy-content a:hover {
  text-decoration-color: currentColor;
}

.legacy-content p,
.legacy-content ul,
.legacy-content ol,
.legacy-content blockquote {
  max-width: 70ch;
}

.legacy-content p {
  margin: 0 0 1.15rem;
}

.legacy-content ul,
.legacy-content ol {
  padding-left: 1.35rem;
}

.legacy-content li + li {
  margin-top: 0.3rem;
}

.legacy-content li::marker {
  color: var(--accent);
}

.legacy-content div {
  max-width: 100%;
}

.legacy-content [align="center"],
.legacy-content div[style*="text-align: center"] {
  text-align: center;
}

.legacy-content img {
  display: block;
  width: auto;
  max-width: min(100%, 820px);
  height: auto;
  margin: 26px auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.legacy-content a img {
  margin-block: 18px;
}

.legacy-content table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
}

.legacy-content th {
  background: var(--surface-sunk);
  color: var(--text);
  text-align: left;
  font-weight: 700;
}

.legacy-content td,
.legacy-content th {
  border: 1px solid var(--line);
  padding: 9px 12px;
  vertical-align: top;
}

.legacy-content pre {
  overflow-x: auto;
  max-width: 100%;
  margin: 1.4rem 0;
  padding: 16px 18px;
  background: #0e0e12;
  color: #f1f1f4;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  line-height: 1.6;
}

.legacy-content pre code {
  color: inherit;
  background: none;
  padding: 0;
}

.legacy-content code {
  font-family: var(--mono);
  font-size: 0.9em;
}

.legacy-content :not(pre) > code {
  padding: 0.12em 0.4em;
  background: var(--accent-soft);
  color: var(--link);
  border-radius: 5px;
}

.legacy-content blockquote {
  margin: 1.5rem 0;
  padding: 12px 18px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.related-posts,
.comments {
  margin-top: 44px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.related-posts .post-list {
  display: grid;
  gap: 14px;
}

/* ---------- Botones y formularios ---------- */

button {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 22px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-family: var(--sans);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 22px -10px var(--accent);
  transition: filter 0.15s ease, transform 0.12s ease;
}

button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.comment {
  padding: 16px 18px;
}

.comment + .comment {
  margin-top: 12px;
}

.comment header {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.comment header strong {
  color: var(--text);
  font-size: 0.95rem;
}

.comment-form {
  display: grid;
  gap: 15px;
  max-width: 640px;
  margin-top: 26px;
  padding: 22px;
}

label {
  display: grid;
  gap: 7px;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 9px;
}

input,
textarea,
select {
  width: 100%;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font: inherit;
  font-family: var(--sans);
}

.checkbox input {
  width: auto;
}

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

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- Pie ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 18px;
  padding: 24px clamp(20px, 4vw, 60px) 40px;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer p {
  margin: 0;
}

/* ---------- Utilidades / sin uso ---------- */

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

.camufla-enlace {
  color: var(--link);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

/* ===================================================================
   RESPONSIVE
   =================================================================== */

/* Tarjetas a 2 columnas */
@media (min-width: 720px) {
  .post-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* La portada del blog muestra un artículo por fila (no dos). */
  .post-grid.post-grid--single {
    grid-template-columns: 1fr;
  }

  .comment-form {
    grid-template-columns: 1fr 1fr;
  }

  .comment-form > .section-title,
  .comment-form > label:has(textarea),
  .comment-form > .checkbox,
  .comment-form > button {
    grid-column: 1 / -1;
  }
}

/* Tarjetas a 3 columnas en pantallas amplias */
/* La portada del blog se queda en 2 columnas como máximo (1 en móvil, 2 desde 720px). */

/* ---- Móvil / tablet: el rail pasa arriba y el menú se despliega sin JS ---- */
@media (max-width: 999px) {
  .shell {
    flex-direction: column;
    align-items: stretch;
  }

  .rail {
    position: static;
    z-index: 40;
    height: auto;
    width: auto;
    flex: none;
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid var(--rail-line);
  }

  .rail-top {
    border-bottom: none;
  }

  .nav-burger {
    display: inline-flex;
  }

  .rail-nav {
    display: none;
    border-top: 1px solid var(--rail-line);
  }

  .nav-switch:checked ~ .shell .rail-nav {
    display: flex;
  }

  .nav-switch:checked ~ .shell .nav-burger {
    background: var(--accent);
    border-color: var(--accent);
  }

  .rail-cats {
    /* en móvil las categorías en dos columnas para no alargar tanto */
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 8px;
  }

  .rail-social {
    margin-top: 8px;
  }

  .content {
    min-height: 0;
  }

  /* En móvil el rail (cabecera) ya muestra la caricatura; ocultar el avatar del hero para no
     verla duplicada justo al lado. */
  .splash-avatar {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ===================================================================
   EFECTOS DEL RAIL + estado activo
   =================================================================== */

.rail-brand:hover .rail-avatar {
  transform: rotate(-3deg) scale(1.05);
  box-shadow: 0 0 0 5px rgba(232, 42, 107, 0.25);
}

.rail-avatar {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rail-links a {
  position: relative;
  padding-left: 14px;
}

.rail-links a::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform 0.18s ease;
}

.rail-links a:hover {
  padding-left: 18px;
}

.rail-links a:hover::before,
.rail-links a.is-active::before {
  transform: scaleY(1);
}

.rail-links a.is-active {
  color: #fff;
  background: rgba(232, 42, 107, 0.16);
}

/* ===================================================================
   BOTONES (enlaces de acción)
   =================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 24px -12px var(--accent);
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  background: var(--accent-strong);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 16px 30px -12px var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ===================================================================
   HOME - splash + bio + timeline + cta
   =================================================================== */

.splash,
.bio-row,
.cta-blog,
.page-hero {
  max-width: var(--content-max);
}

.splash {
  display: flex;
  align-items: center;
  gap: clamp(20px, 4vw, 48px);
  flex-wrap: wrap;
  padding: clamp(26px, 4vw, 46px);
  border-radius: 18px;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(232, 42, 107, 0.26), transparent 52%),
    radial-gradient(90% 130% at 100% 100%, rgba(96, 102, 255, 0.16), transparent 60%),
    linear-gradient(160deg, #111219, #0a0a0d);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: #fff;
  box-shadow: 0 30px 70px -45px rgba(0, 0, 0, 0.7);
}

/* "He trabajado con": rejilla de logos en escala de grises que se colorean al pasar el ratón. */
.bio-row:has(.clients) .bio-body {
  max-width: none;
}

/* "Lo último en el blog": lista de enlaces a artículos recientes. */
.latest-posts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.latest-posts li a {
  display: block;
  padding: 11px 14px;
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

.latest-posts li a:hover {
  background: var(--accent-soft);
  color: var(--accent);
  padding-left: 20px;
}

.latest-all {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent);
  font-weight: 700;
}

.latest-all:hover {
  text-decoration: underline;
}

.clients {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

@media (min-width: 600px) {
  .clients {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.client {
  display: grid;
  place-items: center;
  min-height: 88px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.client img {
  max-height: 42px;
  max-width: 100%;
  width: auto;
  object-fit: contain;
  filter: grayscale(1);
  opacity: 0.62;
  transition: filter 0.25s ease, opacity 0.25s ease;
}

.client--text span {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.02rem;
  text-align: center;
  color: var(--muted);
  transition: color 0.25s ease;
}

.client:hover {
  border-color: var(--accent-line);
  transform: translateY(-3px);
  box-shadow: 0 16px 32px -22px rgba(0, 0, 0, 0.4);
}

.client:hover img {
  filter: grayscale(0);
  opacity: 1;
}

.client--text:hover span {
  color: var(--accent);
}

.splash-avatar {
  flex: none;
  width: clamp(118px, 16vw, 168px);
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 4px solid var(--accent);
  box-shadow: 0 0 0 6px rgba(232, 42, 107, 0.18);
  background: #111;
  object-fit: cover;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.splash:hover .splash-avatar {
  transform: rotate(-3deg) scale(1.03);
  box-shadow: 0 0 0 8px rgba(232, 42, 107, 0.22);
}

.splash-id {
  min-width: 0;
}

.splash-handle {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.3rem, 3vw, 2rem);
  line-height: 1;
  color: rgba(255, 255, 255, 0.5);
}

.splash-name {
  margin: 0.04em 0 0;
  font-family: "Open Sans", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(2rem, 5.2vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--accent);
}

.splash-role {
  margin: 12px 0 0;
  color: #fff;
  font-weight: 700;
}

.splash-role span {
  color: var(--accent);
}

.splash-lead {
  margin: 12px 0 0;
  max-width: 54ch;
  color: rgba(255, 255, 255, 0.78);
}

.splash-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.splash-actions .btn-ghost {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.splash-actions .btn-ghost:hover {
  color: #fff;
  border-color: var(--accent);
  background: rgba(232, 42, 107, 0.2);
}

.bio-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px 36px;
  margin-top: 46px;
  padding-top: 34px;
  border-top: 1px solid var(--line);
}

.bio-label {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bio-label span {
  display: inline-grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 9px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--accent);
}

.bio-label h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  color: var(--text);
}

.bio-body {
  max-width: 70ch;
  color: var(--text-soft);
  font-size: 1.05rem;
  line-height: 1.7;
}

.bio-body p {
  margin: 0 0 1rem;
}

.bio-body p:last-child {
  margin-bottom: 0;
}

.bio-body strong {
  color: var(--text);
}

/* La sección "A qué me dedico" usa todo el ancho de su columna (no el 70ch del texto). */
.bio-row:has(.skills) .bio-body {
  max-width: none;
}

/* Sección "¿Quién soy?": cada párrafo es una tarjeta con etiqueta + icono a la izquierda, línea
   vertical de acento y efecto al pasar el ratón (estilo afín al timeline "Dónde he trabajado"). */
.bio-row:has(.qs-list) .bio-body {
  max-width: none;
}

.qs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.qs-item {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 6px 30px;
  padding: 18px 20px 18px 22px;
  border-left: 2px solid var(--line);
  border-radius: 0 14px 14px 0;
  transition: border-color 0.22s ease, background 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

.qs-item:hover {
  border-left-color: var(--accent);
  background: linear-gradient(90deg, var(--accent-soft), transparent 72%);
  transform: translateX(5px);
  box-shadow: 0 16px 34px -26px rgba(0, 0, 0, 0.4);
}

.qs-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: start;
  padding-top: 2px;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.qs-ico {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  transition: background 0.22s ease, color 0.22s ease, transform 0.22s ease;
}

.qs-item:hover .qs-ico {
  background: var(--accent);
  color: #fff;
  transform: scale(1.08) rotate(-3deg);
}

.qs-text {
  margin: 0;
}

.qs-text a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 680px) {
  .qs-item {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-left: 18px;
  }
}

.skills {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 600px) {
  .skills {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.skill {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 13px;
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* Barra de acento superior que crece al pasar el ratón. */
.skill::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}

.skill:hover {
  transform: translateY(-4px);
  border-color: var(--accent-line);
  box-shadow: 0 18px 38px -22px rgba(0, 0, 0, 0.35);
}

.skill:hover::after {
  transform: scaleX(1);
}

/* Badge del icono. */
.skill-ico {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.skill:hover .skill-ico {
  background: var(--accent);
  color: #fff;
  transform: scale(1.06) rotate(-3deg);
}

.skill h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.1rem;
  color: var(--text);
}

.skill p {
  grid-column: 1 / -1;
  margin: 12px 0 0;
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.62;
}

/* ===================================================================
   Página de error (404)
   =================================================================== */

.error-page {
  max-width: 600px;
  margin: clamp(24px, 7vh, 80px) auto;
  text-align: center;
}

/* Robot ASCII (homenaje a la 404 y al robots.txt de producción). */
.error-robot {
  display: inline-block;
  margin: 0 auto 20px;
  font-family: var(--mono);
  font-size: clamp(0.42rem, 1.9vw, 0.8rem);
  line-height: 1.25;
  white-space: pre;
  text-align: left;
  color: var(--text-soft);
  overflow-x: auto;
  max-width: 100%;
}

.robot-err {
  color: var(--accent);
  font-weight: 700;
  font-size: 1.7em;
}

/* Texto solo para lectores de pantalla. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.error-lead {
  margin: 0 0 28px;
  color: var(--text-soft);
  font-size: 1.05rem;
  line-height: 1.6;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 28px;
}

.error-search {
  display: flex;
  gap: 8px;
  max-width: 440px;
  margin: 0 auto;
}

.error-search input {
  flex: 1;
  min-width: 0;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 6px;
  bottom: 10px;
  width: 2px;
  background: linear-gradient(var(--accent), rgba(232, 42, 107, 0.1));
}

.tl-item {
  position: relative;
  padding: 0 0 22px 30px;
}

.tl-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.tl-item:hover::before {
  transform: scale(1.25);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.tl-when {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
}

.tl-main h3 {
  margin: 3px 0 2px;
  font-family: var(--display);
  font-size: 1.08rem;
  color: var(--text);
}

.tl-place {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.tl-desc {
  margin: 6px 0 0;
  color: var(--text-soft);
  font-size: 0.95rem;
  max-width: 60ch;
}

.cta-blog {
  margin-top: 52px;
  padding: clamp(28px, 4vw, 44px);
  border-radius: 18px;
  text-align: center;
  background:
    radial-gradient(130% 150% at 50% 0%, rgba(232, 42, 107, 0.18), transparent 60%),
    var(--surface-2);
  border: 1px solid var(--line);
}

.cta-blog h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--text);
}

.cta-blog p {
  margin: 10px 0 18px;
  color: var(--text-soft);
}

/* ===================================================================
   PORTADA DE BLOG + contenido con sidebar derecho
   =================================================================== */

.page-hero {
  margin-bottom: 10px;
}

.page-hero h1 {
  margin: 0;
  font-family: "Open Sans", Arial, sans-serif;
  font-weight: 900;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  letter-spacing: -0.02em;
  color: var(--text);
}

.page-hero .lead {
  margin: 12px 0 0;
  max-width: 60ch;
  color: var(--text-soft);
  font-size: 1.1rem;
}

.with-aside {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  max-width: 1200px;
}

.with-aside .article-shell,
.with-aside .blog-list {
  max-width: none;
  min-width: 0;
}

.sidebar {
  display: grid;
  gap: 22px;
  align-content: start;
}

.sidebar-heading {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}

.sidebar-heading .panel-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.sidebar-item {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.sidebar-item:last-child {
  border-bottom: none;
}

.sidebar-item h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.3;
}

.sidebar-item h3 a {
  color: var(--text);
  text-decoration: none;
}

.sidebar-item h3 a:hover {
  color: var(--accent);
}

.sidebar-item time {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.sidebar-comment strong {
  color: var(--text);
  font-size: 0.92rem;
}

.sidebar-comment p {
  margin: 4px 0;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.sidebar-comment a {
  font-size: 0.82rem;
}

.sidebar-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ===================================================================
   ANIMACIÓN DE ENTRADA (solo si el usuario no pide menos movimiento)
   =================================================================== */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    animation: reveal-up 0.55s cubic-bezier(0.2, 0.6, 0.2, 1) both;
  }

  .bio-row.reveal { animation-delay: 0.05s; }
  .cta-blog.reveal { animation-delay: 0.1s; }

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

/* ---- Anchos grandes: contenido + sidebar a la derecha ---- */
@media (min-width: 680px) {
  .skills {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 860px) {
  .bio-row {
    grid-template-columns: 220px 1fr;
  }

  .bio-label {
    position: sticky;
    top: 24px;
    align-self: start;
  }
}

@media (min-width: 1100px) {
  .with-aside {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 40px;
    align-items: start;
  }

  .sidebar {
    position: sticky;
    top: 24px;
    /* Scroll propio y discreto: si el contenido (categorías + últimos artículos/comentarios) supera
       la ventana, la columna scrollea por sí misma en vez de obligar a desplazar el artículo. */
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
  }
}

/* Scrollbar fina tipo "pill" de la columna lateral (WebKit/Blink) */
.sidebar::-webkit-scrollbar {
  width: 10px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
.sidebar:hover::-webkit-scrollbar-thumb {
  background: var(--accent-line);
  background-clip: padding-box;
}

/* ===================================================================
   RAIL v2 - buscador + menús de interés con iconos
   =================================================================== */

.rail-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 8px;
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--rail-line);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.rail-search:focus-within {
  border-color: var(--accent);
  background: rgba(232, 42, 107, 0.14);
}

.rail-search-icon {
  display: inline-flex;
  color: var(--rail-muted);
}

.rail-search input {
  flex: 1;
  min-width: 0;
  width: auto;
  background: none;
  border: none;
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  padding: 0;
}

.rail-search input::placeholder {
  color: var(--rail-muted);
}

.rail-search input:focus {
  outline: none;
  box-shadow: none;
}

.rail-links a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px 8px 14px;
}

.rail-ico {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--rail-muted);
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.rail-links a:hover .rail-ico {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px) rotate(-4deg);
}

.rail-links a.is-active .rail-ico {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 14px -6px var(--accent);
}

.rail-ext {
  margin-left: auto;
  color: var(--rail-muted);
  font-size: 0.78rem;
}

/* ===================================================================
   CATEGORÍAS (ahora en el sidebar derecho)
   =================================================================== */

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-heading span {
  display: inline-flex;
  min-width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 700;
}

.category-nav {
  display: grid;
}

.category-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  padding: 0 2px;
  color: var(--text-soft);
  font-size: 0.92rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  transition: color 0.15s ease, padding-left 0.15s ease;
}

.category-nav a:last-child {
  border-bottom: none;
}

.category-nav a::after {
  content: "›";
  color: var(--accent);
  opacity: 0.5;
  font-size: 1.05rem;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.category-nav a:hover {
  color: var(--accent);
  padding-left: 6px;
}

.category-nav a:hover::after {
  opacity: 1;
  transform: translateX(3px);
}

/* ===================================================================
   CONTENIDO ADAPTABLE (centrado, deja de quedarse a la izquierda)
   =================================================================== */

/* Home: secciones alineadas a la izquierda (pegadas al rail), no centradas. */
.splash,
.bio-row,
.cta-blog {
  margin-left: 0;
  margin-right: auto;
}

.page-hero,
.home-list {
  margin-inline: auto;
}

/* En blog/buscar el hero precede a la columna con sidebar (alineada a la izquierda); el título debe
   alinearse igual -pegado al rail- y no centrado, o queda desplazado respecto al grid de debajo. */
.page-hero:has(+ .with-aside) {
  margin-inline: 0;
}

/* La cabecera del blog vive DENTRO de la columna central (.blog-list), no como hermana del
   .with-aside: así pertenece solo a la columna del listado y no se extiende sobre el sidebar. */
.blog-list > .blog-splash,
.blog-list > .blog-hero {
  max-width: none;
  margin: 0 0 26px;
}

/* La cabecera del blog vive en una columna más estrecha: avatar algo menor y, cuando hay sitio,
   en la misma fila que el texto (no debajo). En móvil sí se apila. */
.blog-splash .splash-avatar {
  width: clamp(96px, 12vw, 132px);
}

@media (min-width: 760px) {
  .blog-splash {
    flex-wrap: nowrap;
  }
}

/* Encabezado "Últimos artículos" sobre el grid del blog. */
.blog-list > .section-title {
  margin-bottom: 18px;
}

.with-aside {
  max-width: 1280px;
  margin-inline: auto;
}

.search-big {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  max-width: 640px;
}

.search-big input {
  flex: 1;
}

.search-big button {
  flex: none;
}

/* Autocompletado del buscador. */
.search-suggest {
  position: relative;
  max-width: 640px;
}

.search-suggest-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 20px 44px -24px rgba(0, 0, 0, 0.45);
}

.search-suggest-item a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}

.search-suggest-item.is-active a,
.search-suggest-item a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

/* El hero del buscador crea su propio contexto de apilado (animación reveal), igual que la lista de
   resultados que viene después; sin esto, el desplegable de sugerencias quedaría tapado por las
   tarjetas. Elevarlo lo mantiene por encima. */
.page-hero:has(.search-suggest) {
  position: relative;
  z-index: 20;
}

/* ===================================================================
   EFECTOS: avatar (rail) + breadcrumb
   =================================================================== */

/* (El estilo "chip" del breadcrumb está en la sección de breadcrumbs, más arriba.) */

@media (prefers-reduced-motion: no-preference) {
  .rail-avatar {
    animation: avatar-glow 3.6s ease-in-out infinite;
  }

  @keyframes avatar-glow {
    0%, 100% { box-shadow: 0 0 0 4px rgba(232, 42, 107, 0.15); }
    50% { box-shadow: 0 0 0 5px rgba(232, 42, 107, 0.3), 0 0 24px rgba(232, 42, 107, 0.35); }
  }
}

/* ===================================================================
   FIX ANCHO: el texto del artículo llena la columna (no se topa en 70ch)
   =================================================================== */

.legacy-content p,
.legacy-content ul,
.legacy-content ol,
.legacy-content blockquote {
  max-width: none;
}

.with-aside {
  max-width: 1140px;
}

.legacy-content pre {
  width: 100%;
}

/* ===================================================================
   SUBMENÚS DEL RAIL (desplegable sin JS, con caret indicador)
   =================================================================== */

.rail-group > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 12px 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--rail-text);
  font-weight: 600;
  font-size: 0.96rem;
  cursor: pointer;
}

.rail-group > summary::-webkit-details-marker {
  display: none;
}

.rail-group > summary:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.rail-group > summary:hover .rail-ico {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px) rotate(-4deg);
}

.rail-caret {
  margin-left: auto;
  display: inline-flex;
  color: var(--rail-muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.rail-group[open] > summary .rail-caret {
  transform: rotate(90deg);
  color: var(--accent);
}

.rail-sub {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 8px 30px;
  padding-left: 12px;
  border-left: 1px solid var(--rail-line);
}

.rail-sub a {
  color: var(--rail-muted);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.86rem;
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.rail-sub a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.rail-sub a.is-active {
  color: var(--accent);
}

.rail-sub-all {
  color: var(--accent) !important;
  font-weight: 700;
}

/* ===================================================================
   PAGINACIÓN
   =================================================================== */

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* Cuando la paginación va arriba (precede al listado), separar para que no quede pegada. */
.pagination + .post-list,
.pagination + .post-grid {
  margin-top: 24px;
}

.pg-nums {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pg-nums a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-soft);
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, transform 0.12s ease;
}

.pg-nums a:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.pg-nums a.is-current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pg-gap {
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  color: var(--muted);
}

.pg-step {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.pg-step:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pg-step.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ===================================================================
   SECCIÓN CON HIJOS (submenús "que cuelgan")
   =================================================================== */

.section-children {
  margin-top: 40px;
}

.section-count {
  display: inline-flex;
  min-width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

/* Cuando el .section-heading lleva el toggle, alinear vertical al centro (los botones no tienen
   baseline definida) y empujar el toggle a la derecha (neutraliza el space-between del padre). */
.section-heading:has(.view-toggle) {
  align-items: center;
}

.view-toggle {
  margin-left: auto;
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
  background: var(--surface);
}

.view-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

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

.view-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Vista cuadrícula (por defecto): mismo formato que la home del blog (post-grid--auto). */
.section-children[data-view="grid"] .post-list,
.related-posts[data-view="grid"] .post-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(450px, 100%), 1fr));
  gap: 16px;
}

.section-children[data-view="grid"] .post-list .post-card.has-thumb,
.related-posts[data-view="grid"] .post-list .post-card.has-thumb {
  grid-template-columns: 1fr;
}

/* Vista lista: una tarjeta por fila, miniatura horizontal a la izquierda. */
.section-children[data-view="list"] .post-list,
.related-posts[data-view="list"] .post-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.section-children[data-view="list"] .post-list .post-card.has-thumb,
.related-posts[data-view="list"] .post-list .post-card.has-thumb {
  grid-template-columns: 240px 1fr;
}

/* En móvil el toggle se oculta y se fuerza siempre la vista cuadrícula (aunque el usuario haya
   elegido lista en desktop): la vista de lista comprimiría demasiado el texto. */
@media (max-width: 600px) {
  .view-toggle {
    display: none;
  }

  .section-children[data-view="list"] .post-list,
  .related-posts[data-view="list"] .post-list {
    grid-template-columns: repeat(auto-fit, minmax(min(450px, 100%), 1fr));
  }

  .section-children[data-view="list"] .post-list .post-card.has-thumb,
  .related-posts[data-view="list"] .post-list .post-card.has-thumb {
    grid-template-columns: 1fr;
  }
}

/* ===================================================================
   PRESENTACIONES Y VÍDEOS
   =================================================================== */

.media-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.media-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.media-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-line);
  box-shadow: 0 16px 34px -20px rgba(0, 0, 0, 0.3);
}

.media-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  display: block;
}

.media-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.media-embed-link {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.media-body {
  padding: 16px 18px;
}

.media-body h3 {
  margin: 6px 0 4px;
  font-family: var(--display);
  font-size: 1.05rem;
  color: var(--accent);
}

.media-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.media-desc {
  margin: 8px 0;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.media-tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (min-width: 680px) {
  .media-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===================================================================
   SEPARACIÓN artículo / sidebar derecho (que no quede "pegado")
   =================================================================== */

@media (min-width: 1100px) {
  .with-aside {
    gap: 48px;
  }

  .with-aside .article-shell {
    padding-right: clamp(8px, 2vw, 28px);
  }

  .with-aside .sidebar {
    border-left: 1px solid var(--line);
    padding-left: clamp(28px, 3vw, 44px);
  }
}

/* ===================================================================
   Columna de lectura: ocupa todo el ancho entre el rail y el sidebar
   =================================================================== */

.with-aside {
  max-width: 1500px;
  /* Pegado al rail (sin centrar): el hueco a la izquierda pasa a ser solo el padding de main;
     el espacio sobrante en pantallas anchas queda a la derecha. */
  margin-left: 0;
  margin-right: auto;
}

@media (min-width: 1100px) {
  .with-aside .article-shell {
    padding-right: 0;
  }

  /* El contenido del artículo llena su celda (de borde a borde entre rail y sidebar),
     sin centrarse en una columna estrecha que dejaba hueco a la izquierda. */
  .with-aside .article-shell > * {
    max-width: none;
    margin-inline: 0;
  }
}

.sidebar-subsections .category-nav a {
  font-weight: 600;
}

.sidebar-more {
  display: inline-block;
  margin-top: 10px;
  color: var(--link);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
}

.sidebar-more:hover {
  color: var(--accent);
}

/* Subsecciones contextuales integradas en el rail izquierdo */
.rail-context {
  margin-top: 2px;
}

.rail-sub--context {
  margin-left: 4px;
}

/* Bloque de subsecciones en el rail: primero, destacado, texto blanco, con efectos */
.rail-context {
  margin: 0 2px 10px;
  padding: 10px 10px 12px;
  background: rgba(232, 42, 107, 0.08);
  border: 1px solid var(--accent-line);
  border-radius: 12px;
}

.rail-heading--context {
  margin: 2px 8px 8px;
  color: #fff;
}

.rail-sub--context {
  margin: 0;
  padding-left: 0;
  border-left: none;
  gap: 2px;
}

.rail-sub--context a {
  position: relative;
  color: #fff;
  padding: 7px 10px 7px 14px;
  border-radius: 8px;
}

.rail-sub--context a::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
  transform: scaleY(0);
  transition: transform 0.18s ease;
}

.rail-sub--context a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding-left: 18px;
}

.rail-sub--context a:hover::before,
.rail-sub--context a.is-active::before {
  transform: scaleY(1);
}

.rail-sub--context a.is-active {
  color: var(--accent);
}

.rail-context .rail-sub-all {
  padding: 7px 10px;
}

/* Rail: barra de scroll FINA y discreta (no la fea por defecto, pero alcanzable)
   + reflejos blancos (no magenta) */
.rail {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
  overscroll-behavior: contain;
  background-image: radial-gradient(120% 60% at 0% 0%, rgba(255, 255, 255, 0.07), transparent 60%);
}

.rail::-webkit-scrollbar {
  width: 8px;
}

.rail::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.rail::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
  background-clip: padding-box;
}

.rail::-webkit-scrollbar-track {
  background: transparent;
}

.rail-context {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.14);
}

/* Árbol contextual del rail: padre (principal) > hermanos (actual resaltado) > hijos */
a.rail-heading--context {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 4px 10px;
  padding: 7px 9px;
  color: #fff;
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.96rem;
  letter-spacing: -0.01em;
  text-transform: none;
  text-decoration: none;
  border-radius: 8px;
}

a.rail-heading--context:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.rail-sub--context a.is-active {
  color: #fff;
  background: rgba(232, 42, 107, 0.18);
  font-weight: 700;
}

.rail-subsub {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 6px 14px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.14);
}

.rail-subsub a {
  color: var(--rail-muted);
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 0.82rem;
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.rail-subsub a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.rail-subsub .rail-sub-all {
  color: var(--accent) !important;
  font-weight: 700;
}

/* ===================================================================
   Árbol de navegación del rail (SSR + expansión AJAX con JS)
   =================================================================== */

.rail-tree {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.rail-node-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.rail-node-link {
  flex: 1;
  min-width: 0;
  color: #fff;
  padding: 7px 8px 7px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  line-height: 1.3;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.rail-node-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.rail-node-link.is-active {
  background: #e82a6bcf;
  color: #fff;
  font-weight: 700;
}

.rail-node-link.is-active:hover {
  background: #e82a6b;
  color: #fff;
}

.rail-node-toggle {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 30px;
  color: var(--rail-muted);
  font-size: 1.1rem;
  line-height: 1;
  text-decoration: none;
  border-radius: 7px;
  transition: transform 0.18s ease, color 0.15s ease, background 0.15s ease;
}

.rail-node-toggle:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.rail-node.is-open > .rail-node-row > .rail-node-toggle {
  transform: rotate(90deg);
  color: var(--accent);
}

.rail-node.is-loading > .rail-node-row > .rail-node-toggle {
  opacity: 0.45;
}

.rail-node-children {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 1px 0 3px 11px;
  padding-left: 10px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.rail-node-children[hidden] {
  display: none;
}

.rail-empty {
  margin: 4px 10px;
  color: var(--rail-muted);
  font-size: 0.8rem;
}

.rail-tree .rail-sub-all {
  display: inline-block;
  padding: 6px 10px;
}

/* Ruta de ancestros en el rail (navegar hacia arriba) */
.rail-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 2px;
  margin: 0 4px 8px;
  font-size: 0.74rem;
  line-height: 1.3;
}

.rail-path::before {
  content: "↑";
  color: var(--accent);
  margin-right: 5px;
  font-weight: 700;
}

.rail-path a {
  color: var(--rail-muted);
  text-decoration: none;
  padding: 2px 5px;
  border-radius: 5px;
}

.rail-path a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.rail-path a:not(:last-child)::after {
  content: "›";
  color: var(--rail-muted);
  margin-left: 7px;
}

/* Comentarios: cabecera con contador + lista con scroll cuando hay muchos */
.comments-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.comments-count {
  display: inline-flex;
  min-width: 26px;
  height: 24px;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

.comment-list {
  max-height: 540px;
  overflow-y: auto;
  margin-top: 8px;
  padding: 2px 8px 2px 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.comment-list .comment {
  background: var(--surface);
}

.comment-list::-webkit-scrollbar {
  width: 10px;
}

.comment-list::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
  border: 3px solid var(--surface-2);
}

/* Indicador de comentarios en la cabecera del artículo */
.comment-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text-soft);
  font-weight: 700;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.comment-jump:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* Tarjetas de comentario rediseñadas (avatar con inicial + cuerpo) */
.comment {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
}

.comment-avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, var(--accent-soft), rgba(232, 42, 107, 0.2));
  color: var(--accent);
  border: 1px solid var(--accent-line);
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.05rem;
}

.comment-body {
  flex: 1;
  min-width: 0;
}

.comment-body header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}

.comment-body header strong {
  color: var(--text);
  font-size: 0.95rem;
}

.comment-tw {
  font-size: 0.82rem;
  color: var(--link);
  text-decoration: none;
}

.comment-tw:hover {
  color: var(--accent);
}

.comment-body header time {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.78rem;
}

.comment-body p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.95rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

/* Icono de comentarios alineado a la derecha en la meta del artículo */
.comment-jump {
  margin-left: auto;
}

/* Botón subir al inicio (aparece al hacer scroll) */
.to-top {
  position: fixed;
  right: clamp(14px, 3vw, 28px);
  bottom: clamp(14px, 3vw, 28px);
  z-index: 50;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 26px -10px var(--accent), 0 2px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, background 0.15s ease;
}

.to-top.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.to-top:hover {
  background: var(--accent-strong);
  transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
  .to-top { transition: opacity 0.2s ease; transform: none; }
}
