/* Tienda Skizo - app-shell con rail izquierdo permanente.
   Lateral NEGRO (logo + carrito + categorías) · contenido OSCURO (negro y grises) a la derecha.
   Acento lima #c3fc49 con tintes blancos (el rosa #d12799 del legacy queda solo en el logo) · PT Sans Narrow + Open Sans (como el legacy).
   Funciona SIN JavaScript: el menú móvil usa checkbox + label. */

:root {
  /* Acento verde lima (el rosa del logo no se usa en la interfaz: no se aprecia sobre negro).
     Sobre fondo de acento el texto va oscuro (--on-accent). Tintes y líneas, en blanco translúcido. */
  --accent: #c3fc49;
  --accent-strong: #d6ff7a;
  --on-accent: #0d0d0d;
  /* Rosa claro (derivado del #d12799 de la marca), solo para detalles puntuales (flechas del carrusel). */
  --pink: #ec5fb8;
  --pink-strong: #f585cc;
  --accent-soft: rgba(255, 255, 255, 0.08);
  --accent-line: rgba(255, 255, 255, 0.3);

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

  /* Contenido oscuro: fondo gris translúcido sobre el negro del html; tarjetas en el mismo gris. */
  --bg: rgba(27, 27, 27, 0.66);
  --text: #ececef;
  --text-soft: #c9c9d0;
  --muted: #9a9aa3;
  --surface: #1b1b1ba8;
  --surface-2: rgba(255, 255, 255, 0.03);
  --surface-sunk: rgba(0, 0, 0, 0.25);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  /* Borde de las tarjetas: fino pero visible (el fondo de la tarjeta es casi el de la página). */
  --card-line: rgba(255, 255, 255, 0.2);
  --link: #fff;
  --lime: #c3fc49;
  --icon-cart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.7 13.4a2 2 0 0 0 2 1.6h9.7a2 2 0 0 0 2-1.6L23 6H6'/%3E%3C/svg%3E");

  --rail-w: 280px;
  --content-max: 1040px;
  --article-max: 880px;
  --radius: 12px;
  --radius-sm: 8px;
  --display: "PT Sans Narrow", 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(--rail-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: #fff;
}

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);
  font-family: var(--display);
  border-right: 1px solid var(--rail-line);
  background-image: radial-gradient(120% 60% at 0% 0%, rgba(255, 255, 255, 0.06), 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(255, 255, 255, 0.07);
  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;
}

.rail-lang {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--rail-line);
}

.rail-lang .lang-flag {
  display: inline-flex;
  padding: 2px;
  border-radius: 3px;
  line-height: 0;
  opacity: 0.55;
  transition: opacity 0.15s ease, box-shadow 0.15s ease;
}

.rail-lang .lang-flag:hover {
  opacity: 1;
}

.rail-lang .lang-flag.is-current {
  opacity: 1;
  box-shadow: 0 0 0 1px var(--accent);
}

.rail-lang .lang-flag img {
  display: block;
  width: 22px;
  height: 14px;
}

.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: 1.08rem;
  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: #fff;
  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: #fff;
  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: var(--on-accent);
  transform: translateY(-2px);
}

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

.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: #fff;
  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: #fff;
}

.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: 1px solid var(--line-strong);
}

.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: #fff;
}

.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,
article.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: #fff;
}

/* Meta editorial: sección · fecha, en mayúsculas tenues. */
.post-meta {
  margin: 0;
  color: #fff;
  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;
  font-family: var(--display);
  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: #fff;
  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: #fff;
  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: var(--on-accent);
  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: var(--display);
  font-size: clamp(1.7rem, 4.2vw, 2.6rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: #fff;
}

.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: #fff;
  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: #fff;
}

.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;
}

/* Fotos insertadas desde el editor del panel: tamaño (pequeña / mediana; sin clase = grande) y
   posición (centrada por defecto, o flotando a un lado con el texto alrededor). */
.legacy-content img.foto-pequena {
  max-width: min(100%, 260px);
}

.legacy-content img.foto-mediana {
  max-width: min(100%, 480px);
}

.legacy-content img.foto-izquierda,
.legacy-content img.foto-derecha {
  max-width: min(50%, 480px);
}

.legacy-content img.foto-pequena.foto-izquierda,
.legacy-content img.foto-pequena.foto-derecha {
  max-width: min(40%, 260px);
}

.legacy-content img.foto-izquierda {
  float: left;
  margin: 6px 24px 14px 0;
}

.legacy-content img.foto-derecha {
  float: right;
  margin: 6px 0 14px 24px;
}

.legacy-content::after {
  content: "";
  display: table;
  clear: both;
}

@media (max-width: 600px) {
  .legacy-content img.foto-izquierda,
  .legacy-content img.foto-derecha {
    float: none;
    max-width: min(100%, 480px);
    margin: 20px auto;
  }
}

.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: var(--on-accent);
  font: inherit;
  font-family: var(--sans);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease, filter 0.15s ease;
}

/* Sin transform: los botones posicionados con translate (flechas del carrusel y de las migas)
   saltaban al pasar el ratón. Cada botón que se eleva lo declara en su propia regla. */
button:hover {
  filter: brightness(1.08);
}

/* Foco de teclado visible y coherente en toda la web (lima: se ve sobre negro y sobre rosa). */
:focus-visible {
  outline: 2px solid var(--lime);
  outline-offset: 2px;
}

article.comment {
  padding: 16px 18px;
}

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

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

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

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

/* Aviso inline al enviar el comentario (error de captcha/datos o confirmación). */
.comment-feedback {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
}

.comment-feedback.is-error {
  background: var(--accent-soft);
  color: #fff;
  border: 1px solid var(--accent-line);
}

.comment-feedback.is-ok {
  background: rgba(255, 255, 255, 0.04);
  color: rgb(21, 110, 65);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

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(--surface-sunk);
  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[type="radio"],
input[type="checkbox"] {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--lime);
  cursor: pointer;
}

input[type="radio"]:focus,
input[type="checkbox"]:focus {
  box-shadow: none;
}

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);
  }

  .nav-switch:checked ~ .shell .nav-burger span,
  .nav-switch:checked ~ .shell .nav-burger span::before,
  .nav-switch:checked ~ .shell .nav-burger span::after {
    background: var(--on-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(255, 255, 255, 0.12);
}

.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::before,
.rail-links a.is-active::before {
  transform: scaleY(1);
}

.rail-links a.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

/* ===================================================================
   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: var(--on-accent);
  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: var(--on-accent);
  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: #fff;
}

/* ===================================================================
   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(255, 255, 255, 0.13), 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: #fff;
  padding-left: 20px;
}

.latest-all {
  display: inline-block;
  margin-top: 14px;
  color: #fff;
  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: #fff;
}

.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(255, 255, 255, 0.09);
  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(255, 255, 255, 0.11);
}

.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: #fff;
}

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

.splash-role span {
  color: #fff;
}

.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(255, 255, 255, 0.1);
}

.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: #fff;
}

.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: #fff;
}

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

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

.qs-text {
  margin: 0;
}

.qs-text a {
  color: #fff;
  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: #fff;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.skill:hover .skill-ico {
  background: var(--accent);
  color: var(--on-accent);
  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: #fff;
  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(255, 255, 255, 0.05));
}

.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: #fff;
}

.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(255, 255, 255, 0.09), 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: 1px solid var(--line-strong);
}

.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: #fff;
}

.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;
  }
}

/* El "sidebar" ya no es una columna lateral: va debajo del contenido principal, a todo el ancho,
   con sus enlaces repartidos en columnas. */
.with-aside .sidebar {
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.with-aside .sidebar .category-nav {
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  column-gap: 32px;
}

.with-aside .sidebar .category-nav a:last-child {
  border-bottom: 1px solid var(--line);
}

/* Tarjetas de subcategoría sin contador debajo: el nombre (un <h3>) lleva el margen inferior. */
.with-aside .sidebar .cat-card-name {
  margin: 0;
  padding-bottom: 12px;
}

/* ===================================================================
   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(255, 255, 255, 0.07);
}

.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: var(--on-accent);
  transform: translateY(-1px) rotate(-4deg);
}

.rail-links a.is-active .rail-ico {
  background: var(--accent);
  color: var(--on-accent);
  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: #fff;
  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: #fff;
  opacity: 0.5;
  font-size: 1.05rem;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.category-nav a:hover {
  color: #fff;
  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: #fff;
}

/* 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(255, 255, 255, 0.07); }
    50% { box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.15), 0 0 24px rgba(255, 255, 255, 0.17); }
  }
}

/* ===================================================================
   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: var(--on-accent);
  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: #fff;
}

.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: #fff;
}

.rail-sub-all {
  color: #fff !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: #fff;
  transform: translateY(-1px);
}

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

.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: #fff;
}

.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: rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
  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: #fff;
}

/* 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: #fff;
}

.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: #fff;
  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;
  }
}

/* ===================================================================
   Columna de lectura: ocupa todo el ancho a la derecha del rail
   =================================================================== */

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

.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),
     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: #fff;
}

/* 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(255, 255, 255, 0.04);
  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: #fff;
}

.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(255, 255, 255, 0.09);
  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: #fff !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.98rem;
  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: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

.rail-node-link.is-active:hover {
  background: var(--accent-strong);
  color: var(--on-accent);
}

.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: #fff;
}

.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;
}

/* Nodos con hijos PRECARGADOS: <details>/<summary> — el desplegable funciona sin JS.
   El enlace del nombre navega; el resto de la fila (incluido el caret) pliega/despliega. */
details.rail-node > summary {
  list-style: none;
  cursor: pointer;
}

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

.rail-node-caret {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: var(--rail-muted);
  font-size: 1rem;
  font-weight: 700;
  transition: transform 0.15s ease, color 0.15s ease, background 0.15s ease;
}

details.rail-node > summary:hover .rail-node-caret {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

details.rail-node[open] > summary .rail-node-caret {
  transform: rotate(90deg);
  color: #fff;
}

.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: #fff;
  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: #fff;
  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: #fff;
  background: var(--accent-soft);
}

/* Tarjetas de comentario rediseñadas (avatar con inicial + cuerpo) */
article.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(255, 255, 255, 0.1));
  color: #fff;
  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: #fff;
}

.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: var(--on-accent);
  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; }
}

/* --- Descargas (tabla `archivos`) y galería (tabla `imagenes`) por artículo --- */
.article-downloads,
.article-gallery {
  margin: 2rem 0;
}
.article-downloads h2,
.article-gallery h2 {
  font-family: var(--display);
  font-size: 1.25rem;
  color: #fff;
  margin: 0 0 0.75rem;
}
.download-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.download-list a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.download-list a:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.dl-ext {
  flex: 0 0 auto;
  min-width: 3.2rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 4px;
  padding: 0.25rem 0.4rem;
}
.dl-name {
  font-weight: 600;
}
.gallery-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.9rem;
}
.gallery-grid li {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.gallery-grid img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.gallery-cap {
  font-size: 0.82rem;
  color: var(--muted);
}

/* ===================================================================
   TEMAS POR SECCIÓN + CABECERA DE ARTÍCULO v2
   El tema entra como custom properties inline en .article-shell
   (ver src/lib/section-themes.ts): todo lo que usa var(--accent…)
   dentro del artículo hereda el color de la rama automáticamente.
   =================================================================== */

/* Cabecera de sección (hub): banda tintada con el color de la rama para que las páginas de
   categoría se distingan de los modelos individuales. */
.article-header.is-hub {
  margin-top: 4px;
  padding: 26px 28px 22px;
  border: 1px solid var(--accent-line);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 160% at 100% 0%, var(--accent-soft), transparent 55%),
    linear-gradient(180deg, var(--accent-soft), transparent 80%);
}

/* Chip "PDF" en la meta: salto directo al visor/descargas. */
.pdf-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 11px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.pdf-jump:hover {
  background: var(--accent-soft);
}

/* ===================================================================
   SUBCATEGORÍAS (hijos con hijos) en páginas de sección
   =================================================================== */

.subcats {
  margin-bottom: 24px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.subcats-title {
  margin: 0 0 10px;
  color: #fff;
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.subcats ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.subcats a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-soft);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.subcats a:hover {
  border-color: rgb(255 255 255 / 45%);
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.subcats a:hover .subcat-count {
  background: var(--lime);
  color: #0d0d0d;
}

.subcat-count {
  display: inline-flex;
  min-width: 22px;
  height: 19px;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 700;
}

/* ===================================================================
   VISOR DE PDF (Descargas) — <object> nativo, funciona sin JS;
   el fallback del object garantiza el acceso al documento siempre.
   =================================================================== */

.pdf-viewer {
  margin: 0 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 18px 40px -28px rgba(0, 0, 0, 0.45);
}

.pdf-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--rail-bg);
  color: #fff;
}

.pdf-badge {
  flex: none;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--display);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.pdf-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 0.92rem;
}

.pdf-name small {
  margin-left: 8px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.78rem;
  font-weight: 400;
}

.pdf-actions {
  flex: none;
  display: inline-flex;
  gap: 8px;
}

.pdf-actions a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pdf-actions a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.pdf-actions a.is-primary {
  background: var(--accent);
  border-color: transparent;
}

.pdf-actions a.is-primary:hover {
  filter: brightness(1.12);
}

.pdf-frame {
  display: block;
  width: 100%;
  height: min(76vh, 720px);
  background: var(--surface-sunk);
  border: 0;
}

.pdf-fallback {
  display: grid;
  place-content: center;
  gap: 14px;
  height: 100%;
  padding: 28px;
  text-align: center;
  color: var(--text-soft);
}

.pdf-fallback p {
  margin: 0;
  max-width: 38ch;
}

.pdf-fallback .btn {
  justify-self: center;
}

.pdf-fallback-open {
  font-size: 0.9rem;
  font-weight: 600;
}

/* Tarjetas del resto de descargas: tamaño + icono de acción. */
.dl-size {
  flex: none;
  margin-left: auto;
  color: var(--muted);
  font-size: 0.8rem;
}

.dl-cta {
  flex: none;
  display: inline-flex;
  color: #fff;
}

.download-list a:hover .dl-cta {
  transform: translateY(1px);
}

/* ===================================================================
   EJEMPLOS — "hoja de documento" (.doc-example, ver decorateExampleBlocks)
   =================================================================== */

.doc-example {
  clear: both;
  margin: 2.2rem 0;
}

.doc-example-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
}

.doc-example-badge {
  display: inline-flex;
  padding: 3px 11px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.doc-example-hint {
  color: var(--muted);
  font-size: 0.84rem;
}

/* La "hoja": papel claro, tipografía de documento, sombra y doblez de esquina. */
.doc-paper {
  position: relative;
  max-width: 100%;
  padding: clamp(26px, 5vw, 48px) clamp(22px, 5.5vw, 56px);
  border: 1px solid var(--line-strong);
  border-top: 3px solid var(--accent);
  border-radius: 4px;
  background:
    linear-gradient(135deg, transparent 0, transparent calc(100% - 26px), var(--surface-sunk) calc(100% - 26px)) top right / 27px 27px no-repeat,
    #fffdf8;
  box-shadow: 0 22px 44px -30px rgba(0, 0, 0, 0.5), 0 2px 6px rgba(0, 0, 0, 0.06);
  color: #2a2a2e;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
  line-height: 1.85;
  overflow-wrap: anywhere;
}

/* Doblez de la esquina superior derecha. */
.doc-paper::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 27px;
  height: 27px;
  background: linear-gradient(135deg, #efece3 50%, transparent 50%);
  border-bottom-left-radius: 4px;
  box-shadow: -2px 2px 4px rgba(0, 0, 0, 0.07);
}

/* El encabezado del modelo (primer <strong>/<u> de la hoja) como título de documento. */
.doc-paper > :is(u, strong):first-child,
.doc-paper > :is(u, strong):first-child strong {
  display: block;
  margin-bottom: 0.6em;
  text-align: center;
  text-decoration: none;
  font-size: 1.08em;
  letter-spacing: 0.05em;
  color: #1b1b1e;
}

.doc-paper p,
.doc-paper ul,
.doc-paper ol,
.doc-paper blockquote {
  max-width: none;
}

/* Hueco a rellenar (sustituye las rachas de "......" del legacy). */
.doc-blank {
  display: inline-block;
  min-width: 110px;
  max-width: 100%;
  height: 0.95em;
  vertical-align: baseline;
  border-bottom: 1.5px dotted color-mix(in srgb, var(--accent) 65%, #777);
  background: linear-gradient(180deg, transparent 72%, var(--accent-soft) 72%);
}

/* Acciones de la hoja (copiar/imprimir): las inyecta site.js — sin JS no aparecen y la hoja
   sigue siendo perfectamente legible e imprimible desde el navegador. */
.doc-example-actions {
  display: inline-flex;
  gap: 8px;
  margin-left: auto;
}

.doc-example-actions button {
  min-height: 0;
  padding: 5px 13px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  background: var(--bg);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: none;
}

.doc-example-actions button:hover {
  background: var(--accent-soft);
  transform: none;
  filter: none;
}

/* ===================================================================
   IMPRESIÓN: imprimir un modelo saca solo la hoja, limpia y a página
   completa (sin rail, sidebar, comentarios ni chrome).
   =================================================================== */

@media print {
  .rail,
  .sidebar,
  .site-footer,
  .to-top,
  .breadcrumbs-scroll,
  .comments,
  .related-posts,
  .section-children,
  .view-toggle,
  .pdf-viewer,
  .doc-example-actions {
    display: none !important;
  }

  body,
  .content,
  main {
    background: #fff;
    padding: 0;
  }

  .doc-paper {
    border: none;
    box-shadow: none;
    padding: 0;
    background: #fff;
  }

  .doc-paper::before {
    display: none;
  }
}

/* Modo "imprimir solo el ejemplo" (botón de la hoja, ver site.js). */
@media print {
  html.print-doc-only main > :not(.with-aside),
  html.print-doc-only .with-aside > :not(.article-shell),
  html.print-doc-only .article-shell > :not(.legacy-content),
  html.print-doc-only .legacy-content > :not(.doc-example),
  html.print-doc-only .doc-example-bar {
    display: none !important;
  }
}

/* ===================================================================
   HOME — rejilla de categorías tematizadas (cada rama con su color)
   =================================================================== */

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.cat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-soft), transparent 65%) var(--surface);
  text-decoration: none;
  transition: transform 0.14s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.cat-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-line);
  border-left-color: var(--accent);
  box-shadow: 0 14px 30px -18px var(--accent);
}

.cat-name {
  color: var(--text);
  font-family: var(--display);
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.25;
}

.cat-card:hover .cat-name {
  color: #fff;
}

.cat-count {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Responsive del visor PDF y la cabecera hub en pantallas estrechas. */
@media (max-width: 600px) {
  .pdf-bar {
    flex-wrap: wrap;
  }

  .pdf-name {
    flex: 1 1 100%;
    order: -1;
    white-space: normal;
  }

  .pdf-frame {
    height: 70vh;
  }

  .article-header.is-hub {
    padding: 18px 16px 16px;
  }
}

/* ===================================================================
   GENERADOR "RELLENA LOS HUECOS" — estados del hueco editable.
   El JS convierte cada .doc-blank en contenteditable; sin JS estas
   reglas no aplican (no hay [contenteditable]) y queda la línea punteada.
   =================================================================== */

.doc-blank[contenteditable] {
  cursor: text;
  min-width: 110px;
  height: auto;
  min-height: 1.1em;
  padding: 0 4px;
  white-space: pre-wrap;
  outline: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

/* Pista dentro del hueco vacío (desaparece al escribir). */
.doc-blank[contenteditable]:empty::before {
  content: "rellenar…";
  color: color-mix(in srgb, var(--accent) 55%, #999);
  font-size: 0.82em;
  font-style: italic;
}

.doc-blank[contenteditable]:hover {
  background: var(--accent-soft);
}

.doc-blank[contenteditable]:focus {
  background: var(--accent-soft);
  border-bottom: 1.5px solid var(--accent);
  box-shadow: 0 1px 0 0 var(--accent);
}

/* Hueco con contenido: subrayado sólido y texto entintado (se distingue del texto del modelo). */
.doc-blank[contenteditable]:not(:empty) {
  border-bottom: 1.5px solid color-mix(in srgb, var(--accent) 70%, #555);
  background: none;
  color: #fff;
  font-weight: 600;
}

/* Al imprimir, los huecos se ven como texto normal del documento (sin tinta de interfaz). */
@media print {
  .doc-blank[contenteditable]:not(:empty) {
    color: inherit;
    font-weight: inherit;
    border-bottom-color: #777;
  }

  .doc-blank[contenteditable]:empty::before {
    content: "";
  }
}

/* ===================================================================
   VIGENCIA DOCUMENTAL — aviso de fuente oficial y versiones anteriores
   (los documentos antiguos siguen enlazados con su URL de siempre).
   =================================================================== */

.official-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--accent-line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.5;
}

.official-note svg {
  flex: none;
  margin-top: 2px;
  color: #fff;
}

.pdf-old,
.dl-old {
  flex: none;
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

/* En la barra oscura del visor */
.pdf-old {
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: rgba(255, 255, 255, 0.8);
}

/* En las tarjetas de descarga */
.dl-old {
  border: 1px solid var(--line-strong);
  background: var(--surface-sunk);
  color: var(--muted);
}

/* ===================================================================
   TIENDA SKIZO — rail (logo + carrito), avisos, catálogo, ficha,
   home y carrito/pedido. Paleta: negro, rosa var(--accent), lima var(--lime).
   =================================================================== */

.rail-logo {
  display: block;
  width: 168px;
  height: auto;
}

.rail-brand {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.rail-cart {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--rail-line);
  border-radius: 50%;
  color: #fff;
  text-decoration: none;
}

.rail-cart:hover {
  border-color: var(--accent);
  color: var(--lime);
}

.rail-cart-count {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #333;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.rail-cart.has-items .rail-cart-count {
  background: var(--lime);
  color: #000;
}

/* Avisos (carrito añadido, errores del formulario…) */
.notice {
  margin: 0 0 18px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.notice.is-ok {
  border-color: rgba(195, 252, 73, 0.6);
  background: rgba(195, 252, 73, 0.08);
  color: var(--lime);
}

.notice.is-warn {
  border-color: #f0c36d;
  background: rgba(240, 195, 109, 0.1);
}

.notice.is-error {
  border-color: #e3707a;
  background: rgba(227, 112, 122, 0.1);
}

.notice ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.cart-notice {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
  font-weight: 600;
}

/* Botones de compra. Primario rosa (pedido, «ver la tienda»); el de añadir al carrito, lima.
   Mismo esqueleto para <a> y <button>: alto fijo, se eleva 1px en hover y se hunde al pulsar. */
.btn-cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font: 700 0.9rem/1.2 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.btn-cart:hover,
.btn-cart:focus-visible {
  background: var(--accent-strong);
  color: var(--on-accent);
  filter: none;
  transform: translateY(-1px);
  box-shadow: 0 10px 22px -12px rgba(0, 0, 0, 0.9);
}

.btn-cart:active {
  transform: translateY(0) scale(0.97);
}

/* Añadir al carrito (tarjetas y ficha): lima con texto negro; en hover, lima más clara y destello. */
.add-form .btn-cart {
  background: var(--lime);
  color: #0d0d0d;
}

.add-form .btn-cart:hover,
.add-form .btn-cart:focus-visible {
  background: #d6ff7a;
  color: #0d0d0d;
  box-shadow: 0 8px 22px -10px var(--lime);
}

/* En las tarjetas el botón es más compacto para que quepa junto al precio. */
.product-card .btn-cart {
  min-height: 36px;
  padding: 0 15px;
  font-size: 0.85rem;
}

.btn-cart-lg {
  min-height: 50px;
  padding: 0 30px;
  font-size: 1.02rem;
}

/* Icono de carrito en el botón grande de la ficha. */
.add-form .btn-cart-lg::before {
  content: "";
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: var(--icon-cart) center / contain no-repeat;
          mask: var(--icon-cart) center / contain no-repeat;
}

/* Acción secundaria (p. ej. «Quitar» del carrito): chip discreto, sin el estilo del botón global. */
.btn-link {
  min-height: 0;
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: 600 0.8rem/1.3 var(--sans);
  text-decoration: none;
  cursor: pointer;
}

.btn-link:hover,
.btn-link:focus-visible {
  border-color: rgb(255 255 255 / 45%);
  color: #fff;
  filter: none;
}

.add-form {
  margin: 0;
}

/* Rejilla de productos/categorías */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

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

/* Hover común de todas las tarjetas: borde y destello blancos (el rosa no se aprecia sobre negro).
   Va después de las reglas propias de cada tarjeta para prevalecer sobre ellas. */
.product-card:hover,
.cat-card:hover,
.post-card:hover,
.media-card:hover,
.skill:hover,
.client:hover {
  transform: translateY(-2px);
  border-color: rgb(255 255 255 / 45%);
  box-shadow: 0 14px 30px -20px #ffffff;
}

.product-thumb {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--surface-sunk);
}

/* Posición absoluta: con aspect-ratio, una foto muy alta (p. ej. unos cordones en vertical)
   estiraría la caja y, con ella, toda la fila de tarjetas. Así la foto se encaja en el cuadrado. */
.product-thumb img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-thumb-empty {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  font: 900 1.4rem var(--display);
}

.product-flag {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  padding: 3px 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(13, 13, 13, 0.8);
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
  color: #fff;
  font: 700 0.72rem/1.4 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.product-card.is-soldout .product-price {
  color: var(--muted);
}

.product-card.is-soldout .product-thumb img {
  opacity: 0.55;
}

.product-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 12px;
}

.product-card-title {
  margin: 0;
  font: 700 0.95rem/1.3 var(--display);
}

.product-card-title a {
  color: var(--text);
  text-decoration: none;
}

.product-card-title a:hover {
  color: #fff;
}

.product-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.product-price {
  color: #fff;
  font: 900 1.05rem var(--display);
}

.product-more {
  margin-top: auto;
  color: var(--lime);
  font-weight: 600;
  font-size: 0.9rem;
}

.product-card.is-category .product-card-title {
  font-size: 1.02rem;
}

/* Ficha de producto */
.article-shell.is-product {
  max-width: none;
}

.product-page {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.product-main {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-sunk);
}

/* Posición absoluta: con `height: 100%` dentro de la rejilla, una foto vertical conservaba su
   alto y el overflow la recortaba. Así se encaja ENTERA en el cuadrado (como .product-thumb img). */
.product-main img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-main.is-empty {
  color: var(--muted);
}

.product-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.product-thumbs a {
  display: block;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-sunk);
}

.product-thumbs a[aria-current="true"] {
  border-color: var(--accent);
}

.product-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-buy-price {
  margin: 0 0 6px;
  color: #fff;
  font: 900 2rem/1.1 var(--display);
}

.product-buy-price small {
  color: var(--muted);
  font: 400 0.8rem var(--sans);
}

.product-stock {
  margin: 0 0 16px;
  font-weight: 700;
}

.product-stock.is-ok {
  color: var(--lime);
}

.product-stock.is-out {
  color: #ff6b6b;
}

.product-stock:is(.is-ok, .is-out) {
  display: flex;
  align-items: center;
  gap: 9px;
}

.product-stock:is(.is-ok, .is-out)::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 22%, transparent);
}

.product-note {
  margin: 14px 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.product-description {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

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

  /* En móvil el botón de compra ocupa todo el ancho: más fácil de pulsar con el pulgar. */
  .product-buy .btn-cart-lg {
    width: 100%;
  }
}

/* Home */
.shop-hero {
  margin: 0 0 28px;
  padding: 28px 26px;
  border-radius: var(--radius);
  background: radial-gradient(120% 120% at 100% 0%, rgba(255, 255, 255, 0.17), transparent 55%) #0d0d0d;
  color: #fff;
}

.shop-hero h1 {
  margin: 4px 0 10px;
  color: #fff;
  font: 900 clamp(1.6rem, 3.6vw, 2.4rem)/1.1 var(--display);
}

.shop-hero-kicker {
  margin: 0;
  color: var(--lime);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shop-hero-lead {
  max-width: 62ch;
  margin: 0;
  color: #e6e6ea;
}

.shop-hero-lead a {
  color: var(--lime);
}

.home-block {
  margin: 0 0 34px;
}

.home-block > h2 {
  margin: 0 0 4px;
  font: 900 1.4rem var(--display);
}

.home-info p {
  max-width: 70ch;
}

.cat-grid {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.cat-card {
  position: relative;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--card-line);
  background: var(--surface);
}

.cat-card-img {
  position: relative;
  display: block;
  flex: none;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--surface-sunk);
}

/* La foto se ve entera (las de producto suelen ser verticales y `cover` les cortaba arriba y abajo). */
.cat-card-img img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.cat-card-name {
  padding: 10px 12px 2px;
  color: var(--text);
  font: 800 1rem/1.2 var(--display);
}

.cat-card:hover .cat-card-name {
  color: #fff;
}

.cat-card-count {
  padding: 0 12px 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Carrito y pedido */
.checkout {
  max-width: 900px;
}

.cart-table {
  width: 100%;
  margin: 10px 0 30px;
  border-collapse: collapse;
}

.cart-table th,
.cart-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.cart-table th {
  color: var(--muted);
  font: 700 0.78rem/1.3 var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.cart-table td a {
  color: var(--text);
  font-weight: 600;
}

.cart-table tfoot td {
  border-bottom: 0;
  padding-top: 16px;
  font-size: 1.05rem;
}

.cart-table tfoot strong {
  font: 700 1.4rem/1 var(--display);
}

.cart-foto img {
  width: 64px;
  height: 64px;
  border-radius: 6px;
  object-fit: contain;
  background: var(--surface-sunk);
}

.cart-ref {
  color: var(--muted);
}

.cart-empty {
  padding: 30px 0;
}

.checkout-form .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin-bottom: 18px;
}

.checkout-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
  font-size: 0.92rem;
}

.checkout-form .span-2 {
  grid-column: 1 / -1;
}

.checkout-form input:not([type="radio"]):not([type="checkbox"]),
.checkout-form textarea {
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 400;
}

.checkout-form .pago {
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.checkout-form .pago legend {
  margin-bottom: 10px;
  padding: 0;
  font: 700 1.2rem/1.2 var(--display);
}

.checkout-form .check {
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  margin: 6px 0;
  font-weight: 400;
}

/* Cada forma de pago es una tarjeta seleccionable (nombre, precio del envío y condiciones en
   lista, como en el legacy); la elegida se marca en lima. */
.checkout-form .pago-opciones {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.checkout-form .pago-opcion {
  gap: 8px;
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  font-weight: 400;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.checkout-form .pago-opcion:hover {
  border-color: rgb(255 255 255 / 30%);
}

.checkout-form .pago-opcion:has(input:checked) {
  border-color: var(--lime);
  background: rgba(195, 252, 73, 0.06);
  color: var(--text);
}

.checkout-form .pago-opcion.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.checkout-form .pago-opcion.is-disabled:hover {
  border-color: var(--line);
}

.checkout-form .pago-cabecera {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkout-form .pago-cabecera input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--lime);
}

.checkout-form .pago-nombre {
  color: #fff;
  font: 700 1.15rem/1.2 var(--display);
}

.checkout-form .pago-precio {
  color: var(--lime);
  font-size: 1.25rem;
  font-weight: 700;
}

.checkout-form .pago-precio small {
  color: var(--text-soft);
  font-size: 0.85rem;
  font-weight: 400;
}

.checkout-form .pago-detalles {
  margin: 0;
  padding-left: 18px;
  list-style: square;
  font-size: 0.92rem;
  line-height: 1.5;
}

.checkout-form .pago-detalles li::marker {
  color: var(--accent);
}

.checkout-form .pago-aviso {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.checkout-form .antispam {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin: 16px 0;
}

.checkout-form .antispam input {
  width: 70px;
}

.checkout-form .trap {
  position: absolute;
  left: -9999px;
}

.checkout-form .legal {
  color: var(--muted);
  font-size: 0.8rem;
}

.checkout-total {
  font-size: 1.15rem;
}

@media (max-width: 600px) {
  .checkout-form .form-grid,
  .checkout-form .pago-opciones {
    grid-template-columns: 1fr;
  }

  .cart-table th:nth-child(3),
  .cart-table td:nth-child(3) {
    display: none;
  }
}

/* ===================================================================
   Efectos al añadir al carrito (public/scripts/site.js)
   =================================================================== */

.btn-cart.is-added,
.btn-cart.is-added:hover {
  background: #fff;
  color: var(--on-accent);
  animation: cart-btn-pop 0.35s ease;
}

.rail-cart.is-bump {
  animation: cart-bump 0.55s ease;
  border-color: var(--lime);
}

.rail-cart.is-bump .rail-cart-count {
  animation: cart-count-pop 0.55s ease;
}

.cart-fly {
  position: fixed;
  z-index: 1000;
  margin: 0;
  object-fit: contain;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.cart-toast {
  position: fixed;
  /* left+right con width max-content y margin auto: centrado sin limitar el ancho a media pantalla */
  left: 16px;
  right: 16px;
  bottom: 24px;
  z-index: 1001;
  width: max-content;
  margin-inline: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-left: 4px solid var(--lime);
  border-radius: var(--radius-sm);
  background: #0d0d0d;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.2s ease, transform 0.25s ease;
  pointer-events: none;
}

.cart-toast.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.cart-toast.is-error {
  border-left-color: var(--accent);
}

.cart-toast-text::before {
  content: "✓ ";
  color: var(--lime);
}

.cart-toast.is-error .cart-toast-text::before {
  content: "";
}

.cart-toast a {
  color: var(--lime);
  white-space: nowrap;
}

@keyframes cart-bump {
  0% { transform: scale(1); }
  30% { transform: scale(1.25); }
  60% { transform: scale(0.92); }
  100% { transform: scale(1); }
}

@keyframes cart-count-pop {
  0% { transform: scale(1); }
  35% { transform: scale(1.5); }
  100% { transform: scale(1); }
}

@keyframes cart-btn-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .btn-cart.is-added,
  .rail-cart.is-bump,
  .rail-cart.is-bump .rail-cart-count {
    animation: none;
  }

  .cart-toast {
    transition: none;
  }
}

/* ===================================================================
   Zoom de las fotos del producto (script de [section]/[slug].astro)
   =================================================================== */

.product-main {
  position: relative;
  cursor: zoom-in;
}

.product-main img {
  transition: transform 0.2s ease;
}

/* Ratón encima: la foto se amplía en su sitio; el origen sigue al cursor (lo fija el script). */
.product-main.is-hover-zoom img {
  transform: scale(var(--zoom, 2));
}

.product-zoom-hint {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(13, 13, 13, 0.75);
  color: #fff;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.product-main.is-hover-zoom .product-zoom-hint {
  opacity: 0;
}

/* Visor a pantalla completa */
html.zoom-open {
  overflow: hidden;
}

.zoom-box {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: rgba(8, 8, 8, 0.94);
  touch-action: none;
}

.zoom-box[hidden] {
  display: none;
}

.zoom-img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  cursor: zoom-in;
  transition: transform 0.25s ease;
  user-select: none;
  -webkit-user-drag: none;
}

.zoom-box.is-zoomed .zoom-img {
  transform: scale(var(--zoom, 2));
  cursor: zoom-out;
}

.zoom-box button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(13, 13, 13, 0.7);
  color: #fff;
  font: 400 1.6rem/1 var(--sans);
  cursor: pointer;
}

.zoom-box button:hover,
.zoom-box button:focus-visible {
  border-color: var(--lime);
  color: var(--lime);
}

.zoom-close {
  top: 16px;
  right: 16px;
  font-size: 1.2rem !important;
}

.zoom-prev,
.zoom-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 2rem !important;
}

.zoom-prev {
  left: 16px;
}

.zoom-next {
  right: 16px;
}

.zoom-count {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  margin: 0;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  text-align: center;
  pointer-events: none;
}

/* Con la foto ampliada, los controles no estorban */
.zoom-box.is-zoomed .zoom-prev,
.zoom-box.is-zoomed .zoom-next,
.zoom-box.is-zoomed .zoom-count {
  opacity: 0;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .product-main img,
  .zoom-img {
    transition: none;
  }
}

/* ===================================================================
   Rail: rama activa desplegada bajo su categoría principal
   (las reglas genéricas .rail-links a se anulan con selectores más específicos)
   =================================================================== */

.rail-group.is-branch > summary {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.rail-group.is-branch > summary .rail-ico {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 6px 14px -6px var(--accent);
}

.rail-branch {
  margin: 4px 0 10px 26px;
  padding-left: 8px;
  border-left: 1px solid var(--rail-line);
}

.rail-branch .rail-node-link,
.rail-branch .rail-node-toggle {
  position: static;
  font-weight: 500;
}

.rail-branch .rail-node-link {
  display: block;
  padding: 6px 8px 6px 10px;
  color: #fff;
  font-size: 0.97rem;
  line-height: 1.3;
}

.rail-branch .rail-node-link::before,
.rail-branch .rail-node-toggle::before,
.rail-branch .rail-sub-all::before {
  content: none;
}

.rail-branch .rail-node-link.is-active {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}

.rail-branch .rail-node-toggle {
  display: inline-flex;
  padding: 0;
}

.rail-branch .rail-branch-all {
  color: var(--rail-muted);
  font-size: 0.82rem;
}

.rail-branch .rail-branch-all.is-active {
  color: #fff;
}

.rail-branch .rail-sub-all {
  display: inline-block;
  padding: 6px 10px;
  font-size: 0.84rem;
}

/* Enlace a la categoría en los títulos "Más X a la venta": mismo aspecto que el texto del título
   (anula .section-heading a, que pinta los enlaces de cabecera pequeños y grises). */
.section-heading a.title-link,
.sidebar-heading a.title-link {
  flex: initial;
  color: inherit;
  font: inherit;
  text-decoration: none;
}

.section-heading a.title-link:hover,
.sidebar-heading a.title-link:hover {
  color: inherit;
  text-decoration: underline;
}

/* ===================================================================
   Carrusel de una fila de "Más {categoría} a la venta"
   (script de [section]/[slug].astro; --card-w = ancho de una columna de la rejilla)
   =================================================================== */

.product-carousel {
  position: relative;
  margin: 0 0 16px;
}

.product-carousel[hidden],
.product-grid[hidden] {
  display: none; /* el display de la regla base anularía el atributo hidden */
}

.carousel-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 2px; /* el snap respeta el padding: no recorta el borde de la 1.ª tarjeta */
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  scrollbar-width: none; /* la posición la indica .carousel-progress */
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

/* Degradado en el borde por el que continúa el carrusel: la tarjeta cortada «se pierde» bajo la
   flecha y se entiende que sigue. Se oculta al llegar a ese extremo (clases del script). */
.product-carousel::before,
.product-carousel::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 22px;
  z-index: 1;
  width: 80px;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.product-carousel::before {
  left: 0;
  background: linear-gradient(to left, transparent, rgba(22, 22, 22, 0.92));
}

.product-carousel::after {
  right: 0;
  background: linear-gradient(to right, transparent, rgba(22, 22, 22, 0.92));
}

.product-carousel.is-start::before,
.product-carousel.is-end::after {
  opacity: 0;
}

/* Barra de progreso bajo el carrusel: ancho = parte visible, posición = desplazamiento. */
.carousel-progress {
  height: 4px;
  margin: 8px 2px 0;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.carousel-progress span {
  display: block;
  height: 100%;
  width: 30%;
  border-radius: inherit;
  background: var(--lime);
  transition: transform 0.15s linear, width 0.2s ease;
}

.carousel-track > .product-card {
  flex: 0 0 var(--card-w, 200px);
  scroll-snap-align: start;
}

/* Arrastre con el ratón (script): sin snap ni scroll suave mientras se arrastra */
.carousel-track {
  cursor: grab;
}

.carousel-track.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  scroll-behavior: auto;
  user-select: none;
}

.carousel-track.is-dragging a,
.carousel-track.is-dragging button {
  pointer-events: none;
}

.carousel-btn {
  position: absolute;
  top: 40%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  min-height: 0;
  padding: 0;
  /* Rosa con flecha blanca: destaca sobre las fotos y sobre el fondo negro. */
  border: 2px solid var(--pink);
  border-radius: 50%;
  background: var(--pink);
  color: #fff;
  font: 700 1.7rem/1 var(--sans);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transform: translateY(-50%);
  transition: opacity 0.15s ease, background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.carousel-btn:hover:not(:disabled),
.carousel-btn:focus-visible {
  background: var(--pink-strong);
  border-color: var(--pink-strong);
  color: #fff;
  filter: none;
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.6);
}

.carousel-btn svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.carousel-btn:disabled {
  opacity: 0;
  pointer-events: none;
}

.carousel-btn.is-prev {
  left: -14px;
}

.carousel-btn.is-next {
  right: -14px;
}

/* Empujón de la flecha «ver más» la primera vez que el carrusel aparece en pantalla. */
@media (prefers-reduced-motion: no-preference) {
  .carousel-btn.is-nudge {
    animation: carousel-nudge 0.9s ease-in-out 2;
  }
}

@keyframes carousel-nudge {
  0%, 100% { transform: translateY(-50%) translateX(0); }
  40% { transform: translateY(-50%) translateX(8px); }
  70% { transform: translateY(-50%) translateX(-2px); }
}

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

/* Móvil: rejillas de producto a 2 columnas (con una sola, cada tarjeta ocupaba casi la pantalla). */
@media (max-width: 600px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .carousel-track {
    gap: 10px;
  }

  .carousel-btn {
    width: 42px;
    height: 42px;
  }

  .carousel-btn svg {
    width: 22px;
    height: 22px;
  }

  .product-carousel::before,
  .product-carousel::after {
    width: 48px;
  }

  .carousel-btn.is-prev {
    left: -6px;
  }

  .carousel-btn.is-next {
    right: -6px;
  }
}

/* ===================================================================
   LISTADOS DE CATEGORÍA (estilo tienda de moda)
   Páginas con hijos (.with-aside.is-listing): cabecera editorial, subcategorías en una fila de
   chips, rejilla de fotos grandes en 4:5 y tarjetas sin caja (foto + nombre + precio).
   La foto va sobre una baldosa clara con `multiply`: el fondo blanco de las fotos de catálogo se
   funde con ella y todas parecen del mismo estudio. Ficha, portada y buscador no cambian.
   =================================================================== */

/* Contenedor de la foto de cualquier tarjeta (referencia del aviso "Agotado" y del botón rápido). */
.product-media {
  position: relative;
}

.is-listing {
  --tile: #f1f0ec;
}

/* Cabecera: sin caja, título grande en mayúsculas con un trazo lima debajo. */
.is-listing .article-header.is-hub {
  margin-top: 6px;
  padding: 6px 0 26px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: none;
}

.is-listing .article-header.is-hub h1 {
  margin: 0;
  font-size: clamp(2.3rem, 6vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.is-listing .article-header.is-hub h1::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  margin-top: 18px;
  background: var(--lime);
}

/* Subcategorías: chips sueltos (sin recuadro). */
.is-listing .subcats {
  margin: 0 0 30px;
  padding: 0;
  border: 0;
  background: none;
}

.is-listing .subcats a {
  padding: 9px 16px;
  font-size: 0.92rem;
  white-space: nowrap;
}

.is-listing .section-children {
  margin-top: 34px;
}

/* Barra sobre la rejilla: «Comprar X» a la izquierda y el número de artículos a la derecha. */
.listing-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.listing-title {
  margin: 0;
  color: var(--muted);
  font: 700 0.82rem/1.3 var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.listing-title strong {
  color: #fff;
}

.listing-count {
  flex: none;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Rejilla: 3 columnas en un portátil, 4 en pantallas anchas, 2 en móvil. */
.product-grid.listing-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 46px 24px;
  margin: 0;
}

/* Tarjeta sin caja: la foto manda. */
.product-card.is-listing {
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: none;
}

.product-card.is-listing:hover {
  transform: none;
  box-shadow: none;
}

.is-listing .product-media {
  overflow: hidden;
  border-radius: 6px;
  background: var(--tile);
}

.is-listing .product-thumb {
  aspect-ratio: 4 / 5;
  background: var(--tile);
}

/* La foto, entera y con aire alrededor; crece un poco al pasar el ratón. */
.is-listing .product-thumb img {
  top: 6%;
  left: 6%;
  width: 88%;
  height: 88%;
  mix-blend-mode: multiply;
  transition: transform 0.5s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.product-card.is-listing:hover .product-thumb img {
  transform: scale(1.05);
}

.is-listing .product-thumb-empty {
  color: #b9b8b2;
}

.product-card.is-listing.is-soldout .product-thumb img {
  opacity: 0.45;
  filter: grayscale(1);
}

.product-card.is-listing .product-card-body {
  gap: 6px;
  padding: 14px 2px 0;
}

.product-card.is-listing .product-card-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font: 700 1.06rem/1.25 var(--display);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.product-card.is-listing .product-card-title a {
  color: var(--text-soft);
  transition: color 0.15s ease;
}

.product-card.is-listing:hover .product-card-title a {
  color: #fff;
}

.product-card.is-listing .product-card-foot {
  margin-top: 0;
}

.product-card.is-listing .product-price {
  font: 700 1.2rem var(--display);
}

/* Categoría dentro del listado: «Ver colección» subrayado en lima con flecha que avanza. */
.product-card.is-listing .product-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  color: var(--lime);
  font: 700 0.8rem/1.3 var(--display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
}

.product-card.is-listing .product-more::after {
  content: "→";
  transition: transform 0.2s ease;
}

.product-card.is-listing:hover .product-more::after {
  transform: translateX(4px);
}

/* Botón rápido sobre la foto. Con ratón: barra a lo ancho que aparece al pasar por la tarjeta
   (o al llegar con el teclado). En táctil: botón redondo con el icono, siempre visible. */
.product-quick {
  position: absolute;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 2;
}

.product-quick .btn-cart {
  width: 100%;
  min-height: 44px;
  font-size: 0.88rem;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.7);
}

.product-quick .btn-cart::before {
  content: "";
  flex: none;
  width: 17px;
  height: 17px;
  background: currentColor;
  -webkit-mask: var(--icon-cart) center / contain no-repeat;
          mask: var(--icon-cart) center / contain no-repeat;
}

/* Con ratón: aparece al pasar por la tarjeta (sube y se funde). Sobre el propio botón, el lima se
   oscurece (no se aclara: sobre la foto clara no se notaba), se eleva con más sombra y el carrito
   se inclina. Al añadir queda lima con «✓ Añadido», sin el rebote del resto de botones. */
@media (hover: hover) and (pointer: fine) {
  .product-quick {
    right: 14px;
    bottom: 14px;
    left: 14px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .product-card.is-listing:hover .product-quick,
  .product-card.is-listing:focus-within .product-quick {
    opacity: 1;
    transform: none;
  }

  .add-form.product-quick .btn-cart {
    font-size: 0.84rem;
    box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.45);
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  }

  .add-form.product-quick .btn-cart::before {
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  }

  .add-form.product-quick .btn-cart:hover,
  .add-form.product-quick .btn-cart:focus-visible {
    background: #b0ec2c;
    color: #0d0d0d;
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.55);
  }

  .add-form.product-quick .btn-cart:hover::before {
    transform: translateX(-2px) rotate(-8deg);
  }

  .add-form.product-quick .btn-cart.is-added {
    background: var(--lime);
    color: #0d0d0d;
    animation: none;
  }
}

@media (hover: none), (pointer: coarse) {
  .product-quick {
    left: auto;
    right: 10px;
    bottom: 10px;
  }

  .product-quick .btn-cart {
    width: 44px;
    padding: 0;
    font-size: 0;
  }

  .product-quick .btn-cart::before {
    width: 19px;
    height: 19px;
  }
}

/* «Otras categorías» al pie del listado: mismas baldosas 4:5, algo menores. */
.is-listing .cat-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr));
  gap: 30px 18px;
}

.is-listing .cat-card {
  border: 0;
  border-radius: 0;
  background: none;
}

.is-listing .cat-card:hover {
  transform: none;
  box-shadow: none;
}

.is-listing .cat-card-img {
  aspect-ratio: 4 / 5;
  border-radius: 6px;
  background: var(--tile);
}

.is-listing .cat-card-img img {
  top: 6%;
  left: 6%;
  width: 88%;
  height: 88%;
  mix-blend-mode: multiply;
  transition: transform 0.5s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.is-listing .cat-card:hover .cat-card-img img {
  transform: scale(1.05);
}

.with-aside.is-listing .sidebar .cat-card-name {
  padding: 12px 2px 0;
  color: var(--text-soft);
  font: 700 1rem/1.25 var(--display);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.is-listing .cat-card:hover .cat-card-name {
  color: #fff;
}

/* Baldosa sin foto (p. ej. una página informativa): la marca en gris, como en las tarjetas. */
.is-listing .cat-card-img:empty::after {
  content: "Skizo";
  display: grid;
  place-items: center;
  height: 100%;
  color: #b9b8b2;
  font: 900 1.4rem var(--display);
}

/* Título del bloque del pie, con el mismo estilo que la barra del listado. */
.is-listing .sidebar-heading .panel-title {
  color: var(--muted);
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

@media (max-width: 760px) {
  /* Subcategorías en una sola fila deslizable. */
  .is-listing .subcats ul {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .is-listing .subcats ul::-webkit-scrollbar {
    display: none;
  }

  .is-listing .subcats li {
    flex: none;
  }
}

@media (max-width: 600px) {
  .product-grid.listing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 30px 12px;
  }

  .is-listing .cat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 12px;
  }

  .product-card.is-listing .product-card-title {
    font-size: 0.95rem;
  }

  .product-card.is-listing .product-price {
    font-size: 1.08rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .is-listing .product-thumb img,
  .is-listing .cat-card-img img,
  .product-quick,
  .product-quick .btn-cart {
    transition: none;
  }

  .product-card.is-listing:hover .product-thumb img,
  .is-listing .cat-card:hover .cat-card-img img {
    transform: none;
  }
}
