/* ===========================================================================
   article.css — lectura de un artículo
   =========================================================================== */

/* barra de progreso de lectura */
.progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--brand), #FF8A5B);
  box-shadow: 0 0 16px rgba(255, 67, 71, 0.85);
  z-index: 55;
}

/* ------------------------------------------------------------- portada -- */
.cover {
  position: relative;
  min-height: min(86svh, 780px);
  display: flex;
  align-items: flex-end;
  padding-top: calc(var(--head-h) + 60px);
  padding-bottom: clamp(34px, 6vw, 72px);
  overflow: hidden;
}

.cover-media {
  position: absolute;
  inset: -6% 0;
  z-index: -1;
}

.cover-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(0.72) contrast(1.12) brightness(0.62);
  will-change: transform;
}

.cover-media::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to top, var(--bg) 2%, rgba(8,8,10,0.62) 46%, rgba(8,8,10,0.78) 100%),
    radial-gradient(90% 70% at 20% 100%, color-mix(in srgb, var(--c) 26%, transparent), transparent 70%);
}

.cover-inner { width: 100%; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: clamp(22px, 4vw, 42px);
  transition: color 0.3s ease, gap 0.3s var(--ease);
}
.back-link:hover { color: var(--brand); gap: 14px; }

.article-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.article-cat {
  background: var(--c);
  color: #08080A;
  border-radius: 999px;
  padding: 6px 13px;
  font-weight: 700;
}

.article-meta .sep { color: var(--dim-2); }
.article-meta span:not(.article-cat) { color: var(--muted-2); }

.article-title {
  font-size: clamp(30px, 5.4vw, 74px);
  font-weight: 900;
  letter-spacing: -0.042em;
  line-height: 0.94;
  max-width: 19ch;
  margin-bottom: clamp(18px, 3vw, 28px);
}

.article-tags { display: flex; gap: 7px; flex-wrap: wrap; }

.article-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--muted-2);
  background: rgba(8, 8, 10, 0.4);
  backdrop-filter: blur(6px);
}

/* --------------------------------------------------------------- layout */
/* superficie de lectura: apaga el fondo cinematográfico para que el texto
   largo se lea sin ruido, manteniendo la atmósfera en portada y cierre */
.reading-surface {
  position: relative;
  background: rgba(8, 8, 10, 0.9);
  backdrop-filter: blur(20px) saturate(0.9);
  -webkit-backdrop-filter: blur(20px) saturate(0.9);
  border-top: 1px solid var(--line-2);
}

.reader {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 246px;
  gap: clamp(30px, 5vw, 82px);
  padding-block: clamp(42px, 6vw, 84px) var(--pad-y);
  align-items: start;
}

@media (max-width: 1000px) {
  .reader { grid-template-columns: 1fr; }
  .toc { display: none; }
}

/* ------------------------------------------------------------------ TOC */
.toc {
  position: sticky;
  top: calc(var(--head-h) + 34px);
  border-left: 1px solid var(--line);
  padding-left: 20px;
  max-height: calc(100svh - var(--head-h) - 80px);
  overflow: hidden auto;
  scrollbar-width: thin;
  transition: top 0.45s var(--ease);
}

body.nav-up .toc { top: 34px; }

.toc-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--dim-2);
  margin-bottom: 16px;
}

.toc a {
  display: block;
  position: relative;
  font-size: 13.2px;
  line-height: 1.52;
  color: var(--muted-2);
  padding: 7px 0 7px 0;
  transition: color 0.3s ease, transform 0.35s var(--ease);
}

.toc a::before {
  content: '';
  position: absolute;
  left: -21px; top: 50%;
  width: 1px; height: 0;
  background: var(--brand);
  transform: translateY(-50%);
  transition: height 0.35s var(--ease);
}

.toc a:hover { color: var(--text); }
.toc a.is-on { color: var(--brand); transform: translateX(3px); }
.toc a.is-on::before { height: 76%; }
.toc a.lvl-3 { padding-left: 14px; font-size: 12.4px; opacity: 0.8; }

/* ----------------------------------------------------------------- prosa */
.prose {
  max-width: 72ch;
  font-size: 17.8px;
  line-height: 1.84;
  color: var(--para);
}

.prose > * { margin-bottom: 1.35em; }

.prose .lead {
  font-size: 20.5px;
  line-height: 1.74;
  color: var(--text);
  font-weight: 400;
}

.prose h2 {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.7vw, 34px);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 1.08;
  color: var(--text);
  margin-top: 2.1em;
  margin-bottom: 0.7em;
  padding-top: 0.5em;
  scroll-margin-top: calc(var(--head-h) + 26px);
  position: relative;
}

.prose h2::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 42px; height: 2px;
  background: var(--c);
}

.prose h3 {
  font-family: var(--font-display);
  font-size: clamp(18px, 1.8vw, 22px);
  font-weight: 800;
  letter-spacing: -0.026em;
  color: var(--text);
  margin-top: 1.7em;
  margin-bottom: 0.55em;
  scroll-margin-top: calc(var(--head-h) + 26px);
}

.prose strong { color: var(--text); font-weight: 700; }
.prose em { color: var(--text); font-style: italic; }

.prose a {
  color: var(--brand);
  border-bottom: 1px solid rgba(255, 67, 71, 0.4);
  transition: border-color 0.3s ease;
}
.prose a:hover { border-color: var(--brand); }

.prose ul { padding-left: 0; list-style: none; }

.prose li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 0.62em;
}

.prose li::before {
  content: '';
  position: absolute;
  left: 3px; top: 0.75em;
  width: 6px; height: 1px;
  background: var(--c);
}

.prose hr {
  border: 0;
  height: 1px;
  background: var(--line);
  margin-block: 2.6em;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  padding: 2px 6px;
}

.prose blockquote {
  border-left: 2px solid var(--c);
  padding: 4px 0 4px 22px;
  color: var(--text);
  font-size: 18.5px;
  font-style: italic;
}

/* párrafos que entran al hacer scroll */
.prose > p, .prose > ul, .prose > blockquote {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s var(--ease), transform 0.8s var(--ease);
}
.prose > p.is-in, .prose > ul.is-in, .prose > blockquote.is-in { opacity: 1; transform: none; }

/* ---------------------------------------------------------- pie del post */
.article-foot {
  max-width: 74ch;
  margin-top: clamp(40px, 6vw, 70px);
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.share {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim-2);
}

.share a, .share button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  color: var(--muted-2);
  transition: color 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}
.share a:hover, .share button:hover { color: var(--text); border-color: var(--line-3); background: rgba(255,255,255,0.04); }

/* ------------------------------------------------------- prev / next --- */
.pager {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 16px;
  margin-top: clamp(34px, 5vw, 58px);
}

.pager-link {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  background: var(--surface);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  transition: border-color 0.4s ease, transform 0.45s var(--ease);
}
.pager-link:hover { border-color: var(--brand-line); transform: translateY(-4px); }

.pager-label {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: 10px;
  display: block;
}

.pager-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.28;
}

.pager-link.is-next { text-align: right; }

/* ------------------------------------------------------------ relacionados */
.related { border-top: 1px solid var(--line); padding-block: clamp(44px, 6vw, 84px); }

.related-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 28px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 18px;
}

/* --------------------------------------------------------------- error -- */
.error-box {
  max-width: 560px;
  margin: calc(var(--head-h) + 120px) auto 140px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 40px;
  text-align: center;
  background: var(--surface);
  backdrop-filter: blur(9px);
}
.error-box h2 { font-size: 30px; font-weight: 900; margin-bottom: 14px; }
.error-box p { color: var(--dim); font-size: 16px; margin-bottom: 24px; }
