/* =====================================================
   single.css  ·  Post individual del blog
   (hero, byline, layout y contenido del artículo;
    índice, aside, autor y cards van en sus propios CSS)
   ===================================================== */

/* =====================================================
   VARIABLES DE MARCA
   ===================================================== */
body {
  --grafito:        #34383D;
  --grafito-oscuro: #26292D;
  --grafito-suave:  #5E636A;
  --naranja:        #F26B1D;
  --naranja-hover:  #FF8238;
  --fondo-claro:    #F5F4F2;
  --borde:          #E4E2DF;
  --blanco:         #FFFFFF;
  --texto-claro:    #F3F1EE;
  --texto-claro-suave: #B9BCC0;
  --radio:          20px;
  --ancho:          1200px;
  --pad-x: max(6vw, calc((100% - var(--ancho)) / 2));
  --pad-y: 96px;

  /* Si tu header es fijo (sticky), pon aquí su alto, ej: 80px */
  --alto-header: 0px;
}

/* =====================================================
   BASE
   ===================================================== */
:is(#single-hero, #single-hero-text, .post-layout, #blog-related-blogs),
:is(#single-hero, #single-hero-text, .post-layout, #blog-related-blogs) *,
:is(#single-hero, #single-hero-text, .post-layout, #blog-related-blogs) *::before,
:is(#single-hero, #single-hero-text, .post-layout, #blog-related-blogs) *::after {
  box-sizing: border-box;
}

#single-hero-text h1,
.post-content h2, .post-content h3, .post-content h4,
#blog-related-blogs h2 {
  font-weight: 400;          /* Bebas Neue solo tiene 400 */
  letter-spacing: .5px;
}

/* =====================================================
   HERO (mismo estilo que las categorías)
   ===================================================== */
#single-hero {
  position: relative;
  overflow: hidden;
  background: var(--grafito);
}
#single-hero:not(:has(#single-hero-image)) { display: none; }
#single-hero:has(#single-hero-image) { min-height: 62vh; }

#single-hero-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}
#single-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg,
    var(--grafito) 0%,
    rgba(52, 56, 61, .75) 30%,
    rgba(52, 56, 61, .15) 75%,
    rgba(52, 56, 61, 0) 100%);
}

#single-hero-text {
  position: relative;
  z-index: 2;
  padding: 160px var(--pad-x) var(--pad-y);
  background: var(--grafito);
  color: var(--texto-claro);
}
#single-hero:has(#single-hero-image) + #single-hero-text {
  margin-top: -170px;
  padding-top: 0;
  background: linear-gradient(180deg, transparent 0 170px, var(--grafito) 170px);
}

/* Línea naranja a la izquierda (igual que los demás heros) */
#single-hero-text h1,
#single-hero-meta {
  max-width: 880px;
  padding-left: 28px;
  border-left: 4px solid var(--naranja);
}
#single-hero-text h1 {
  margin: 0;
  padding-bottom: 20px;
  line-height: 1.05;
  color: var(--blanco);
}

/* ----- Byline: autor / fecha ----- */
#single-hero-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--texto-claro-suave);
}
/* Icono de calendario naranja */
#single-hero-meta::before {
  content: "";
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-right: 4px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23F26B1D' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4.5' width='18' height='16' rx='3'/%3E%3Cpath d='M3 9.5h18M8 2.5v4M16 2.5v4'/%3E%3C/svg%3E") center / contain no-repeat;
}
#single-hero-meta a {
  color: var(--naranja-hover);
  font-weight: 600;
  text-decoration: none;
  transition: color .25s;
}
#single-hero-meta a:hover { color: var(--blanco); }

/* =====================================================
   LAYOUT: artículo a la izquierda, aside a la derecha
   ===================================================== */
.post-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 64px;
  align-items: start;
  padding: var(--pad-y) var(--pad-x);
  background: var(--blanco);
}
.post-layout > article { min-width: 0; }

/* Aside fijo al bajar */
.post-layout > #blog-aside {
  position: -webkit-sticky;
  position: sticky;
  top: calc(var(--alto-header) + 24px);
  align-self: start;
  min-width: 0;
}
/* overflow: hidden en html/body rompe el sticky; clip recorta igual */
html,
body,
.post-layout {
  overflow-x: clip !important;
  overflow-y: visible !important;
}

/* =====================================================
   CONTENIDO DEL ARTÍCULO
   ===================================================== */
.post-content {
  min-width: 0;
  color: var(--grafito-suave);
  font-size: 17px;
  line-height: 1.85;
  overflow-wrap: break-word;
}
.post-content > *:first-child { margin-top: 0; }
.post-content > *:last-child { margin-bottom: 0; }

.post-content p {
  margin: 0 0 22px;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.85;
}

/* ----- Títulos ----- */
.post-content h2,
.post-content h3,
.post-content h4 {
  color: var(--grafito);
  line-height: 1.1;
  scroll-margin-top: calc(var(--alto-header) + 24px);   /* para los saltos del índice */
}
.post-content h2 {
  margin: 56px 0 22px;
  font-size: 42px;
}
.post-content h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  margin-top: 14px;
  border-radius: 2px;
  background: var(--naranja);
}
.post-content h3 {
  margin: 40px 0 16px;
  font-size: 30px;
}
.post-content h4 {
  margin: 32px 0 14px;
  font-size: 22px;
  color: var(--naranja);
}

/* ----- Texto ----- */
.post-content strong,
.post-content b { font-weight: 600; color: var(--grafito); }

.post-content a {
  color: var(--naranja);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color .2s;
}
.post-content a:hover { color: var(--grafito); }

.post-content mark {
  padding: 0 4px;
  border-radius: 4px;
  background: rgba(242, 107, 29, .18);
  color: var(--grafito);
}

/* ----- Listas ----- */
.post-content ul {
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}
.post-content ul li {
  position: relative;
  margin-bottom: 12px;
  padding-left: 28px;
}
.post-content ul li::before {
  content: "";
  position: absolute;
  left: 5px;
  top: .72em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--naranja);
}
.post-content ol {
  margin: 0 0 24px;
  padding-left: 26px;
}
.post-content ol li {
  margin-bottom: 12px;
  padding-left: 6px;
}
.post-content ol li::marker { color: var(--naranja); font-weight: 700; }
.post-content li > ul,
.post-content li > ol { margin: 12px 0 0; }

/* ----- Citas ----- */
.post-content blockquote,
.post-content .wp-block-quote {
  position: relative;
  margin: 36px 0;
  padding: 32px 36px 32px 84px;
  border: 1px solid var(--borde);
  border-radius: 24px;
  background: var(--fondo-claro);
  color: var(--grafito);
  font-size: 19px;
  font-style: italic;
  line-height: 1.7;
}
.post-content blockquote::before,
.post-content .wp-block-quote::before {
  content: "\201C";
  position: absolute;
  left: 26px;
  top: 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 72px;
  font-style: normal;
  line-height: 1;
  color: var(--naranja);
}
.post-content blockquote p { margin: 0 0 12px; font-size: inherit; line-height: inherit; }
.post-content blockquote p:last-of-type { margin-bottom: 0; }
.post-content blockquote cite,
.post-content .wp-block-quote cite {
  display: block;
  margin-top: 14px;
  font-size: 14px;
  font-style: normal;
  font-weight: 600;
  color: var(--naranja);
}

/* Cita destacada (pullquote): bloque grafito */
.post-content .wp-block-pullquote {
  margin: 40px 0;
  padding: 44px 40px;
  border: 0;
  border-radius: 24px;
  background: var(--grafito);
  color: var(--blanco);
  text-align: center;
}
.post-content .wp-block-pullquote blockquote {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--blanco);
  font-size: 24px;
}
.post-content .wp-block-pullquote blockquote::before { display: none; }
.post-content .wp-block-pullquote cite { color: var(--naranja-hover); }

/* ----- Imágenes, galerías y videos ----- */
.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 18px;
}
.post-content figure {
  max-width: 100%;
  margin: 36px 0;
}
/* ----- Leyendas (texto debajo de imágenes, videos y tablas) ----- */
.post-content figcaption,
.post-content .wp-element-caption,
.post-content .wp-caption-text {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0 12px;
  font-size: 14px;
  font-style: italic;
  line-height: 1.55;
  text-align: center;
  color: var(--grafito-suave);
}
/* Rayita naranja delante de la leyenda */
.post-content figcaption::before,
.post-content .wp-element-caption::before,
.post-content .wp-caption-text::before {
  content: "";
  flex-shrink: 0;
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: var(--naranja);
  transform: translateY(-4px);
}
.post-content figcaption a,
.post-content .wp-caption-text a { font-style: normal; }

/* Editor clásico: la caja de la imagen trae un ancho fijo que en móvil se salía */
.post-content .wp-caption {
  max-width: 100% !important;
  margin: 36px 0;
}
.post-content .wp-caption img { display: block; margin: 0 auto; }

/* Galerías: la leyenda de cada foto va encima de la imagen, en blanco */
.post-content .wp-block-gallery .wp-block-image figcaption {
  display: block;
  margin: 0;
  padding: 24px 12px 10px;
  border-radius: 0 0 14px 14px;
  background: linear-gradient(0deg, rgba(38, 41, 45, .8), rgba(38, 41, 45, 0));
  color: var(--blanco);
  font-size: 13px;
}
.post-content .wp-block-gallery .wp-block-image figcaption::before { display: none; }
/* Leyenda general de la galería (debajo de todas las fotos) */
.post-content .wp-block-gallery > figcaption { flex-basis: 100%; }
.post-content .alignwide,
.post-content .alignfull { width: 100%; max-width: 100%; margin-left: 0; margin-right: 0; }
.post-content .aligncenter { margin-left: auto; margin-right: auto; }
.post-content .alignleft  { float: left;  margin: 6px 28px 16px 0; max-width: 50%; }
.post-content .alignright { float: right; margin: 6px 0 16px 28px; max-width: 50%; }

.post-content .wp-block-gallery { gap: 12px; }
.post-content .wp-block-gallery img { border-radius: 14px; }

.post-content iframe,
.post-content video,
.post-content embed {
  max-width: 100%;
  border: 0;
  border-radius: 18px;
}
.post-content .wp-block-embed__wrapper iframe,
.post-content .wp-block-video video {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
}

/* ----- Tablas ----- */
.post-content table {
  width: 100%;
  max-width: 100%;
  margin: 0;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--borde);
  border-radius: 16px;
}
.post-content .wp-block-table {
  margin: 32px 0;
  overflow-x: auto;                  /* tablas anchas se deslizan de lado */
}
.post-content th {
  padding: 16px 20px;
  background: var(--grafito);
  color: var(--blanco);
  font-weight: 600;
  text-align: left;
}
.post-content td {
  padding: 16px 20px;
  border-top: 1px solid var(--borde);
  color: var(--grafito);
}
.post-content tr:nth-child(even) td { background: var(--fondo-claro); }

/* ----- Código ----- */
.post-content code {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--fondo-claro);
  color: var(--grafito);
  font-size: .9em;
}
.post-content pre {
  margin: 28px 0;
  padding: 22px 24px;
  overflow-x: auto;
  border-radius: 18px;
  background: var(--grafito);
  color: var(--texto-claro);
  font-size: 15px;
  line-height: 1.6;
}
.post-content pre code { padding: 0; background: none; color: inherit; }

/* ----- Separador ----- */
.post-content hr {
  width: 80px;
  height: 4px;
  margin: 48px auto;
  border: 0;
  border-radius: 2px;
  background: var(--naranja);
}

/* ----- Botones del editor ----- */
.post-content .wp-block-button__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  border-radius: 999px;
  background: var(--naranja);
  color: var(--blanco);
  font-weight: 600;
  text-decoration: none;
  transition: background .25s;
}
.post-content .wp-block-button__link:hover {
  background: var(--grafito);
  color: var(--blanco);
}

/* Limpia los flotados (imágenes alineadas) al final */
.post-content::after { content: ""; display: table; clear: both; }

/* =====================================================
   BLOGS RELACIONADOS (la sección; las cards en cards-related.css)
   ===================================================== */
#blog-related-blogs {
  padding: var(--pad-y) var(--pad-x);
  background: var(--fondo-claro);
}
#blog-related-blogs h2 {
  margin: 0 0 20px;
  line-height: 1.05;
  color: var(--grafito);
}
#blog-related-blogs h2::after {
  content: "";
  display: block;
  width: 56px;
  height: 4px;
  margin-top: 16px;
  border-radius: 2px;
  background: var(--naranja);
}
#blog-related-blogs-desc {
  max-width: none;
  margin: 0 0 44px;
  font-weight: 400;
  line-height: 1.75;
  color: var(--grafito-suave);
  overflow-wrap: break-word;
}
#blog-related-blogs .related-card-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
#blog-related-blogs .related-card-list > * { min-width: 0; }

/* =====================================================
   RESPONSIVE: TABLET (hasta 1024px)
   ===================================================== */
@media (max-width: 1024px) {
  body { --pad-y: 72px; }
  #single-hero-text h1 { font-size: 56px; }
  #blog-related-blogs h2 { font-size: 40px; }
  .post-content h2 { font-size: 38px; }

  #single-hero:has(#single-hero-image) { min-height: 50vh; }

  /* El aside pasa debajo del artículo y deja de estar fijo */
  .post-layout { grid-template-columns: minmax(0, 1fr); gap: 56px; }
  .post-layout > #blog-aside { position: static; }

  #blog-related-blogs .related-card-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* =====================================================
   RESPONSIVE: MÓVIL (hasta 767px)
   ===================================================== */
@media (max-width: 767px) {
  body { --pad-y: 56px; --pad-x: 20px; }
  #single-hero-text h1 { font-size: 42px; padding-bottom: 16px; }
  #blog-related-blogs h2 { font-size: 34px; }

  #single-hero:has(#single-hero-image) { min-height: 44vh; }
  #single-hero:has(#single-hero-image) + #single-hero-text {
    margin-top: -120px;
    background: linear-gradient(180deg, transparent 0 120px, var(--grafito) 120px);
  }
  #single-hero:not(:has(#single-hero-image)) + #single-hero-text { padding-top: 96px; }
  #single-hero-text h1,
  #single-hero-meta { padding-left: 18px; }
  #single-hero-meta { font-size: 14px; }

  .post-layout { gap: 40px; }

  .post-content,
  .post-content p { font-size: 16px; }
  .post-content h2 { margin-top: 44px; font-size: 32px; }
  .post-content h3 { font-size: 26px; }
  .post-content h4 { font-size: 20px; }

  .post-content blockquote,
  .post-content .wp-block-quote {
    padding: 58px 20px 22px;
    font-size: 17px;
    border-radius: 20px;
  }
  .post-content blockquote::before,
  .post-content .wp-block-quote::before { left: 18px; top: 8px; font-size: 60px; }
  .post-content .wp-block-pullquote { padding: 32px 22px; }

  .post-content .alignleft,
  .post-content .alignright { float: none; max-width: 100%; margin: 24px 0; }
  .post-content > table { display: block; overflow-x: auto; }

  #blog-related-blogs .related-card-list { grid-template-columns: minmax(0, 1fr); gap: 20px; }
}