/* ==========================================================================
   Artificracia para España (29-N 2026)
   Estilos de /espana-2026/ y del aviso de la portada. Se apoya en los tokens
   de style.css (que no se toca: sigue igual que en artificracy.com). Todo lo
   nuevo lleva prefijo: .page-espana, .es-, .espana-teaser.
   ========================================================================== */

/* ---------- Cabecera: un enlace más sin que el menú se desborde ---------- */

@media (max-width: 1100px) { .wordmark small { display: none; } }
@media (max-width: 1000px) {
  .nav { gap: 1.1rem; }
  .nav a[hreflang="en"] { display: none; }
}

/* ---------- Aviso en la portada ---------- */

.espana-teaser { padding-block: clamp(1.25rem, 3vw, 2.5rem) clamp(2.5rem, 5vw, 4rem); }
.teaser {
  display: grid; grid-template-columns: 1fr auto; gap: 1.5rem; align-items: center;
  padding: clamp(1.25rem, 2.6vw, 2rem) clamp(1.25rem, 2.8vw, 2.4rem);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  color: var(--paper); text-decoration: none;
  transition: border-color 180ms var(--ease-out);
}
.teaser:hover { border-color: var(--earth); color: var(--paper); }
.teaser-kicker { font-size: var(--t-s); color: var(--mist); margin-bottom: 0.45rem; }
.teaser h2 { font-size: var(--t-2xl); margin-bottom: 0.55rem; }
.teaser-text { color: var(--paper-dim); font-size: var(--t-m); max-width: 46rem; }
.teaser .arrow {
  width: 2.6rem; height: 2.6rem; flex: none;
  border: 1px solid var(--line-strong); border-radius: 50%;
  display: grid; place-items: center;
}
.teaser .arrow svg { width: 1.1rem; height: 1.1rem; }

/* ==========================================================================
   Página /espana-2026/
   ========================================================================== */

/* The particle field stays, but quieter: this page is for reading. */
.page-espana #field { opacity: 0.5; }
.page-espana main > .section { background: rgba(0, 0, 0, 0.5); }
.page-espana button.btn { appearance: none; -webkit-appearance: none; cursor: pointer; }

/* Source markers */
.page-espana sup { font-size: 0.66em; line-height: 0; vertical-align: super; margin-left: 0.1em; white-space: nowrap; }
.page-espana sup a {
  font-family: var(--sans); color: var(--glow); text-decoration: none;
  font-variant-numeric: lining-nums; padding: 0 0.08em;
}
.page-espana sup a:hover { text-decoration: underline; }

/* ---------- Portada de la página ---------- */

.es-hero { position: relative; padding-block: clamp(2.5rem, 8vh, 6rem) clamp(3rem, 9vh, 6.5rem); }
.es-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(65% 75% at 25% 45%, rgba(0,0,0,0.82), rgba(0,0,0,0) 72%);
}
.es-hero .wrap {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(2rem, 5vw, 5rem); align-items: center;
}
.es-hero h1 {
  font-size: var(--t-4xl); line-height: 1.02; letter-spacing: -0.02em;
  margin-bottom: 1.5rem; max-width: 13em;
}
.es-hero .lede {
  font-size: var(--t-l); line-height: 1.45; color: var(--paper-dim);
  max-width: 36rem; margin-bottom: 2rem;
}

/* The hemicycle: 350 seats, the one bold element on the page. */
.hemicycle { margin: 0; width: 100%; max-width: 560px; justify-self: center; }
.hemi-plot { position: relative; padding-bottom: 1.5rem; }
.hemi { width: 100%; height: auto; display: block; overflow: visible; }
.hemi .s { transform-box: fill-box; transform-origin: center; }
.hemi .y { fill: var(--paper); }
.hemi .n { fill: none; stroke: var(--mist); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.hemi-center {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  text-align: center; line-height: 1; white-space: nowrap;
}
.hemi-center b {
  display: block; font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.2rem, 1.2rem + 3.6vw, 3.9rem); letter-spacing: -0.02em; color: var(--paper);
}
/* The label sits under the baseline, so it never collides with the inner row of seats. */
.hemi-center span { display: block; margin-top: 0.55rem; font-size: var(--t-xs); line-height: 1; color: var(--mist); }
.hemi-legend {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem 1.6rem;
  margin-top: 0.9rem; font-size: var(--t-s); color: var(--paper-dim);
}
.hemi-legend span { display: inline-flex; align-items: center; gap: 0.5rem; }
.hemi-legend i { width: 0.8rem; height: 0.8rem; border-radius: 50%; display: inline-block; }
.hemi-legend .k-yes { background: var(--paper); }
.hemi-legend .k-no { border: 1.5px solid var(--mist); }
.hemicycle figcaption {
  margin: 0.9rem auto 0; max-width: 32rem; text-align: center;
  font-size: var(--t-xs); line-height: 1.55; color: var(--mist);
}

/* One orchestrated moment: the seats fill in like a count, then the margin appears. */
.js .hemi .s, .js .hemi-center { opacity: 0; }
.js .is-ready .hemi .s { animation: es-seat 420ms var(--ease-out) forwards; animation-delay: calc(var(--i) * 3ms); }
.js .is-ready .hemi-center { animation: es-fade 700ms var(--ease-out) 1.15s forwards; }
@keyframes es-seat { from { opacity: 0; transform: scale(0.35); } to { opacity: 1; transform: scale(1); } }
@keyframes es-fade { to { opacity: 1; } }

/* ---------- Nota del autor ---------- */

.es-note .wrap { max-width: 50rem; }
.note-body {
  font-family: var(--serif); font-size: var(--t-l); line-height: 1.55; color: var(--paper);
}
.note-body p + p { margin-top: 0.9em; }
.note-body cite { font-style: italic; }
.signature { margin-top: 1.8rem; font-family: var(--serif); font-size: var(--t-l); color: var(--paper); }
.signature span { display: block; margin-top: 0.2rem; font-family: var(--sans); font-size: var(--t-s); color: var(--mist); }

/* ---------- Diagnóstico: el libro de cuentas ---------- */

.facts {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(2rem, 5vw, 4.5rem);
  border-top: 1px solid var(--line-strong);
}
.facts li {
  display: grid; grid-template-columns: 10.5rem minmax(0, 1fr); gap: 1.2rem; align-items: baseline;
  padding: 1.15rem 0 1.3rem; border-bottom: 1px solid var(--line);
}
.facts b {
  font-family: var(--serif); font-weight: 400; font-size: var(--t-2xl); line-height: 1;
  color: var(--paper); white-space: nowrap; font-variant-numeric: lining-nums;
}
.facts p { color: var(--paper-dim); font-size: var(--t-s); line-height: 1.5; }
.facts .src { display: block; margin-top: 0.35rem; font-size: var(--t-xs); color: var(--mist); }

/* ---------- Tablas: hoy frente a Artificracia ---------- */

.compare-wrap { max-width: 62rem; }
.compare { width: 100%; border-collapse: collapse; font-size: var(--t-m); }
.compare th, .compare td {
  text-align: left; vertical-align: top;
  padding: 1rem 1.4rem 1.05rem 0; border-bottom: 1px solid var(--line);
}
.compare thead th {
  padding-top: 0; font-family: var(--sans); font-weight: 500; font-size: var(--t-s);
  color: var(--mist); border-bottom-color: var(--line-strong);
}
.compare thead th:last-child { color: var(--earth); }
.compare tbody th {
  width: 20%; font-family: var(--serif); font-weight: 400; font-size: var(--t-l);
  line-height: 1.25; color: var(--paper);
}
.compare td { width: 40%; color: var(--paper-dim); line-height: 1.5; }
.compare td:last-child { color: var(--paper); }
.compare-note { margin-top: 1.8rem; max-width: var(--measure); color: var(--paper-dim); font-size: var(--t-m); }

/* ---------- El plan: tres horizontes ---------- */

.horizon-grid {
  display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(2rem, 5vw, 5rem); align-items: start;
}
.horizon-aside { position: sticky; top: calc(var(--nav-h) + 1.5rem); }
.horizon-year {
  font-family: var(--serif); font-weight: 300; line-height: 0.88; letter-spacing: -0.035em;
  font-size: clamp(3.6rem, 1.4rem + 6.4vw, 7.6rem); color: var(--paper);
  font-variant-numeric: lining-nums; margin-bottom: 1.2rem;
}
.horizon-year span { display: block; color: var(--mist); }
.horizon-aside h2 { font-size: var(--t-2xl); margin-bottom: 0.5rem; }
.horizon-book { font-size: var(--t-s); color: var(--earth); margin-bottom: 1rem; }
.horizon-intro { color: var(--paper-dim); font-size: var(--t-m); max-width: 26rem; }

.measures { border-top: 1px solid var(--line-strong); }
.measure { padding: clamp(1.6rem, 3vw, 2.4rem) 0; border-bottom: 1px solid var(--line); }
.measure h3 { font-size: var(--t-xl); margin-bottom: 0.9rem; }
.measure > p { max-width: var(--measure); font-size: var(--t-m); line-height: 1.6; }
.measure > p + p { margin-top: 0.75rem; }
.m-fact { color: var(--paper-dim); }
.m-prop { color: var(--paper); }
.measure b { font-weight: 600; }
.m-fact b { color: var(--mist); }
.m-prop b { color: var(--earth); }
.m-book {
  margin: 1.2rem 0 0; padding-left: 1rem; max-width: var(--measure);
  border-left: 1px solid var(--line-strong);
}
.m-book p { font-family: var(--serif); font-style: italic; font-size: var(--t-m); line-height: 1.45; color: var(--paper-dim); }
.m-book cite { display: block; margin-top: 0.3rem; font-style: normal; font-size: var(--t-xs); color: var(--mist); }

/* Dashed: outside the plan on purpose. */
.book-only {
  margin-top: clamp(1.6rem, 3vw, 2.4rem); padding: 1.3rem 1.4rem;
  border: 1px dashed var(--line-strong); border-radius: var(--radius); max-width: 44rem;
}
.book-only h3 { font-family: var(--sans); font-size: var(--t-m); font-weight: 600; margin-bottom: 0.45rem; }
.book-only p { color: var(--paper-dim); font-size: var(--t-s); line-height: 1.55; }

/* ---------- Garantías ---------- */

.guar-grid {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(2rem, 5vw, 5rem); align-items: start;
}
.guarantees { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-strong); }
.guarantees li { padding: 1rem 0 1.1rem; border-bottom: 1px solid var(--line); color: var(--paper-dim); font-size: var(--t-s); line-height: 1.55; }
.guarantees li b { display: block; margin-bottom: 0.25rem; font-family: var(--serif); font-weight: 400; font-size: var(--t-l); color: var(--paper); }
.lessons { border-left: 1px solid var(--earth); padding-left: clamp(1.2rem, 2.5vw, 2rem); }
.lessons h3 { font-size: var(--t-xl); margin-bottom: 1.1rem; }
.lessons ul { list-style: none; margin: 0; padding: 0; }
.lessons li { margin-bottom: 1rem; color: var(--paper-dim); font-size: var(--t-s); line-height: 1.55; }
.lessons li b { color: var(--paper); font-weight: 600; }
.lessons-close { margin-top: 1.4rem; color: var(--paper); font-size: var(--t-m); line-height: 1.5; }

/* ---------- Preguntas ---------- */

.questions {
  list-style: none; counter-reset: q; margin: 0; padding: 0; max-width: 58rem;
  border-top: 1px solid var(--line-strong);
}
.questions li {
  counter-increment: q; display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); gap: 0.8rem;
  padding: 1.1rem 0 1.15rem; border-bottom: 1px solid var(--line);
  font-family: var(--serif); font-size: var(--t-xl); line-height: 1.25; color: var(--paper);
}
.questions li::before { content: counter(q); color: var(--mist); font-variant-numeric: lining-nums tabular-nums; }
.q-actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: center; margin-top: 1.8rem; }
.q-status { font-size: var(--t-s); color: var(--mist); }

/* ---------- Cierre ---------- */

.es-ready blockquote { margin: 0 auto 2.4rem; max-width: 38rem; }
.es-ready blockquote p { font-family: var(--serif); font-style: italic; font-size: var(--t-xl); line-height: 1.3; color: var(--paper); margin: 0 auto; }
.es-ready blockquote cite { display: block; margin-top: 0.7rem; font-style: normal; font-size: var(--t-s); color: var(--mist); }

/* ---------- Fuentes ---------- */

.sources {
  margin: 0; padding-left: 1.7rem; columns: 2 24rem; column-gap: clamp(2rem, 5vw, 4rem);
  font-size: var(--t-xs); line-height: 1.5; color: var(--paper-dim);
}
.sources li { break-inside: avoid; margin-bottom: 0.65rem; padding-left: 0.25rem; }
.sources li::marker { color: var(--mist); font-variant-numeric: tabular-nums; }
.sources a { color: var(--paper); text-decoration-color: var(--line-strong); overflow-wrap: anywhere; }
.sources a:hover { text-decoration-color: var(--paper); }
.sources li:target { color: var(--paper); }
.sources li:target::marker { color: var(--earth); }
.sources-note { margin-top: 1.6rem; font-size: var(--t-s); color: var(--mist); max-width: var(--measure); }

.footer .footer-note { flex-basis: 100%; font-size: var(--t-xs); }

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  .horizon-grid, .guar-grid { grid-template-columns: 1fr; }
  .horizon-aside { position: static; }
  .horizon-intro { max-width: var(--measure); }
  .facts { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .es-hero .wrap { grid-template-columns: 1fr; gap: 2.5rem; }
  .es-hero { padding-top: 1.5rem; }
  .hemicycle { max-width: 480px; }
}

@media (max-width: 720px) {
  .compare thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .compare, .compare tbody, .compare tr, .compare th, .compare td { display: block; width: auto; }
  .compare tr { padding: 1rem 0 1.1rem; border-bottom: 1px solid var(--line); }
  .compare tbody th, .compare td { border: 0; padding: 0; }
  .compare tbody th { width: auto; margin-bottom: 0.6rem; }
  .compare td + td { margin-top: 0.6rem; }
  .compare td::before {
    content: attr(data-label); display: block; margin-bottom: 0.15rem;
    font-size: var(--t-xs); color: var(--mist);
  }
  .compare td:last-child::before { color: var(--earth); }
  .facts li { grid-template-columns: 1fr; gap: 0.5rem; }
  .questions li { grid-template-columns: 2rem minmax(0, 1fr); font-size: var(--t-l); }
}

@media (max-width: 480px) {
  .teaser { grid-template-columns: 1fr; }
  .teaser .arrow { display: none; }
  .q-actions .btn { width: 100%; justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  .js .hemi .s, .js .hemi-center { opacity: 1; animation: none !important; }
}

/* ==========================================================================
   Versión 2: el reloj de 48 meses, la carrera y las fábricas
   ========================================================================== */

/* Horizons are counted in months now */
.horizon-year small {
  display: block; margin-bottom: 0.55rem;
  font-family: var(--sans); font-size: var(--t-s); font-weight: 400; letter-spacing: 0; color: var(--mist);
}

/* ---------- El reloj ---------- */
.clock-quote { margin: 0 0 1.6rem; }
.clock-quote p { max-width: 15em; }
.clock-quote p { font-family: var(--serif); font-size: var(--t-3xl); line-height: 1.08; letter-spacing: -0.015em; color: var(--paper); }
.clock-quote cite { display: block; margin-top: 1rem; font-style: normal; font-size: var(--t-s); color: var(--mist); }
.clock-text { max-width: var(--measure); color: var(--paper-dim); font-size: var(--t-l); line-height: 1.45; }

/* 48 ticks: one per month. Year ends stand taller. */
.ruler { margin-top: clamp(2.2rem, 5vw, 3.5rem); }
.ticks { display: grid; grid-template-columns: repeat(48, minmax(0, 1fr)); gap: 3px; height: 3.4rem; align-items: end; }
.ticks i { display: block; height: 55%; border-radius: 1px; background: var(--mist); opacity: 0.5; }
.ticks i:nth-child(-n+3) { background: var(--earth); opacity: 1; height: 100%; }
.ticks i:nth-child(n+4):nth-child(-n+12) { background: var(--paper); opacity: 0.9; height: 78%; }
.ticks i:nth-child(12n) { height: 100%; opacity: 1; }
/* Segment labels step down like a schedule, each starting where its months start. */
.segments { margin-top: 0.4rem; }
.seg { position: relative; display: block; padding-top: 0.6rem; margin-top: 0.5rem; color: var(--paper); text-decoration: none; }
.seg::before { content: ""; position: absolute; top: 0; left: 0; height: 2px; width: var(--bar); background: var(--bar-c); }
.seg b { display: block; font-size: var(--t-s); font-weight: 500; }
.seg span { display: block; font-size: var(--t-xs); color: var(--mist); }
.seg:hover b { text-decoration: underline; text-underline-offset: 0.18em; }
.seg.s1 { margin-left: 0; --bar: 6.25%; --bar-c: var(--earth); }
.seg.s2 { margin-left: 6.25%; --bar: 20%; --bar-c: var(--paper); }
.seg.s3 { margin-left: 25%; --bar: 100%; --bar-c: var(--mist); }
.ruler-ends { display: flex; justify-content: space-between; margin-top: 1.2rem; font-size: var(--t-xs); color: var(--mist); }

/* ---------- La carrera: España frente a EE. UU. y China ---------- */
.race-wrap { max-width: none; }
.compare.race tbody th { width: 28%; font-family: var(--sans); font-weight: 500; font-size: var(--t-s); line-height: 1.4; color: var(--paper); }
.compare.race td { width: 24%; font-size: var(--t-s); line-height: 1.4; color: var(--paper-dim); }
.compare.race td b {
  display: block; margin-bottom: 0.25rem;
  font-family: var(--serif); font-weight: 400; font-size: var(--t-xl); line-height: 1.05;
  color: var(--paper); font-variant-numeric: lining-nums;
}
.compare.race td:last-child, .compare.race td:last-child b { color: var(--earth); }
.race-facts { margin-top: clamp(2rem, 4vw, 3rem); }

/* ---------- Fábricas ---------- */
.es-factory { position: relative; isolation: isolate; border-top: 1px solid var(--line); background: #000; }
.factory-media { position: relative; height: clamp(24rem, 58vw, 44rem); overflow: hidden; }
.factory-media video, .factory-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.factory-media::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.6) 0%, rgba(0,0,0,0) 28%, rgba(0,0,0,0.15) 50%, rgba(0,0,0,0.94) 100%);
}
.factory-copy { position: relative; z-index: 1; margin-top: -13rem; }
.factory-copy h2 { font-size: var(--t-3xl); max-width: 13em; margin-bottom: 1rem; }
.factory-copy p { max-width: 40rem; font-size: var(--t-l); line-height: 1.45; color: var(--paper); }
.factory-toggle { margin-top: 1.4rem; }
.factory-caption { padding-block: 0.8rem 2.6rem; font-size: var(--t-xs); color: var(--mist); }

/* ---------- Educación: la credencial ---------- */
.measure > .m-who {
  margin-top: 0.9rem; padding: 0.8rem 1rem;
  border-left: 2px solid var(--earth); background: rgba(201, 164, 107, 0.07);
  font-size: var(--t-s); line-height: 1.55; color: var(--paper);
}
.lessons-text { color: var(--paper-dim); font-size: var(--t-s); line-height: 1.6; }

@media (max-width: 720px) {
  .factory-copy { margin-top: -8rem; }
  .ticks { gap: 2px; height: 2.6rem; }
  .compare.race td b { font-size: var(--t-l); }
  .compare.race tbody th, .compare.race td { width: auto; }
}

/* ==========================================================================
   Versión 3: el error, figuras dentro de las medidas, tres preguntas
   ========================================================================== */
.es-error h2 { font-size: var(--t-4xl); line-height: 1.02; letter-spacing: -0.02em; max-width: 13em; margin-bottom: 1.6rem; }
.error-body { max-width: var(--measure); }
.error-body p { font-family: var(--serif); font-size: var(--t-l); line-height: 1.55; color: var(--paper); }
.error-body p + p { margin-top: 0.9em; }
.error-quote { margin-top: 1.8rem; }
.m-figure { margin: 1.1rem 0 1rem; max-width: 46rem; }
.m-figure img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 2px; }
.m-figure figcaption { margin-top: 0.45rem; font-size: var(--t-xs); color: var(--mist); }
.questions-3 li { font-size: var(--t-2xl); line-height: 1.15; padding: 1.4rem 0 1.5rem; grid-template-columns: 3.2rem minmax(0, 1fr); }
@media (max-width: 720px) {
  .questions-3 li { font-size: var(--t-xl); grid-template-columns: 2rem minmax(0, 1fr); }
  .es-error h2 { font-size: var(--t-3xl); }
}
