/* ============================================================
   CAP IV · ESTRUCTURA v2 — cadena causal · DD_018_B
   Apertura + Plano isométrico + Overlay ANTES/Ahora + Cierre editorial
   ============================================================ */

.estructura-section {
  position: relative;
  background:
    linear-gradient(180deg, rgba(4, 106, 56, 0.05), rgba(4, 106, 56, 0) 18%),
    var(--paper);
}

.estructura {
  position: relative;
  width: 100%;
  max-width: 1728px;
  margin: 0 auto;
  padding: clamp(48px, 7vh, 96px) clamp(28px, 5vw, 96px) clamp(64px, 9vh, 116px);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
}

.estructura__grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.52;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.78' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.045'/%3E%3C/svg%3E");
}

.estructura > *:not(.estructura__grain) {
  position: relative;
  z-index: 1;
}

.estructura__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 520px);
  gap: clamp(28px, 4vw, 72px);
  align-items: end;
}

.estructura__eyebrow {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.estructura__title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(2.5rem, 4.8vw, 5.35rem);
  line-height: 1.03;
  color: var(--ink);
}

.estructura__time {
  display: block;
}

.estructura__time--future {
  color: var(--brand-349c);
}

.estructura__lead {
  max-width: 42ch;
  font-size: clamp(1rem, 1.2vw, 1.25rem);
  line-height: 1.55;
  font-style: italic;
  color: var(--ink-soft);
}

.estructura__causal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: clamp(28px, 4vh, 48px);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand-349c);
}

.estructura__causal span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.estructura__causal span:not(:last-child)::after {
  content: "";
  width: 28px;
  height: 1px;
  background: linear-gradient(90deg, var(--brand-349c), var(--gold-olfato));
}

.estructura__body {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-top: clamp(28px, 5vh, 64px);
}

.estructura-plan {
  position: relative;
  min-height: clamp(320px, 44vh, 520px);
}

.estructura-plan__svg {
  display: block;
  width: min(100%, 1220px);
  height: auto;
  margin: 0 auto;
  overflow: visible;
}

.estructura-layer-shape {
  cursor: pointer;
  transition: transform 0.4s var(--ease-brand), opacity 0.35s ease;
}

.estructura-layer-shape__top {
  fill: url(#estructuraTop);
  stroke: rgba(4, 59, 34, 0.58);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
  transition: fill 0.25s ease, stroke 0.25s ease;
}

.estructura-layer-shape__side {
  fill: url(#estructuraSide);
  opacity: 0.62;
}

.estructura-layer-shape__side--right {
  opacity: 0.48;
}

.estructura-layer-shape__rule {
  fill: none;
  stroke: var(--gold-olfato);
  stroke-width: 1;
  opacity: 0.5;
  vector-effect: non-scaling-stroke;
}

.estructura-layer-shape__order {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  fill: var(--brand-349c);
}

.estructura-layer-shape__label {
  font-family: var(--font-body);
  font-size: 19px;
  font-weight: 600;
  fill: var(--ink);
}

.estructura-link {
  fill: none;
  stroke: var(--brand-349c);
  stroke-width: 2;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  opacity: 0.55;
  vector-effect: non-scaling-stroke;
}

.estructura-hotspots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.estructura-hotspot {
  position: absolute;
  width: clamp(170px, 15vw, 232px);
  min-height: 112px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
  background: rgba(255, 253, 247, 0.88);
  border: 1px solid rgba(4, 106, 56, 0.18);
  border-radius: 3px;
  color: var(--ink);
  box-shadow: 0 18px 36px rgba(3, 27, 16, 0.08);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.28s var(--ease-brand), border-color 0.2s ease, opacity 0.25s ease, background 0.2s ease;
}

.estructura-hotspot--1 { left: 4%; top: 7%; }
.estructura-hotspot--2 { left: 13%; top: 22%; }
.estructura-hotspot--3 { left: 23%; top: 37%; }
.estructura-hotspot--4 { left: 35%; top: 52%; }
.estructura-hotspot--5 { right: 28%; top: 61%; }
.estructura-hotspot--6 { right: 14%; top: 69%; }
.estructura-hotspot--7 { right: 0%; top: 76%; }

.estructura-hotspot__num {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--brand-349c);
}

.estructura-hotspot__resource {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(1.12rem, 1.35vw, 1.5rem);
  line-height: 1.08;
}

.estructura-hotspot__anchor {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  font-size: 0.78rem;
  line-height: 1.38;
  color: var(--ink-soft);
}

.estructura-hotspot:hover,
.estructura-hotspot:focus-visible,
.estructura-hotspot.is-active {
  transform: translateY(-8px);
  border-color: var(--brand-349c);
  background: rgba(255, 253, 247, 0.98);
  outline: none;
}

.estructura-plan:has(.estructura-hotspot:hover) .estructura-layer-shape,
.estructura-plan:has(.estructura-hotspot.is-active) .estructura-layer-shape {
  opacity: 0.34;
}

.estructura-plan:has(.estructura-hotspot--1:hover) [data-layer-shape="1"],
.estructura-plan:has(.estructura-hotspot--2:hover) [data-layer-shape="2"],
.estructura-plan:has(.estructura-hotspot--3:hover) [data-layer-shape="3"],
.estructura-plan:has(.estructura-hotspot--4:hover) [data-layer-shape="4"],
.estructura-plan:has(.estructura-hotspot--5:hover) [data-layer-shape="5"],
.estructura-plan:has(.estructura-hotspot--6:hover) [data-layer-shape="6"],
.estructura-plan:has(.estructura-hotspot--7:hover) [data-layer-shape="7"],
.estructura-plan:has(.estructura-hotspot--1.is-active) [data-layer-shape="1"],
.estructura-plan:has(.estructura-hotspot--2.is-active) [data-layer-shape="2"],
.estructura-plan:has(.estructura-hotspot--3.is-active) [data-layer-shape="3"],
.estructura-plan:has(.estructura-hotspot--4.is-active) [data-layer-shape="4"],
.estructura-plan:has(.estructura-hotspot--5.is-active) [data-layer-shape="5"],
.estructura-plan:has(.estructura-hotspot--6.is-active) [data-layer-shape="6"],
.estructura-plan:has(.estructura-hotspot--7.is-active) [data-layer-shape="7"] {
  opacity: 1;
  transform: translateY(-12px);
}

.estructura-plan:has(.estructura-hotspot--1:hover) [data-layer-shape="1"] .estructura-layer-shape__top,
.estructura-plan:has(.estructura-hotspot--2:hover) [data-layer-shape="2"] .estructura-layer-shape__top,
.estructura-plan:has(.estructura-hotspot--3:hover) [data-layer-shape="3"] .estructura-layer-shape__top,
.estructura-plan:has(.estructura-hotspot--4:hover) [data-layer-shape="4"] .estructura-layer-shape__top,
.estructura-plan:has(.estructura-hotspot--5:hover) [data-layer-shape="5"] .estructura-layer-shape__top,
.estructura-plan:has(.estructura-hotspot--6:hover) [data-layer-shape="6"] .estructura-layer-shape__top,
.estructura-plan:has(.estructura-hotspot--7:hover) [data-layer-shape="7"] .estructura-layer-shape__top,
.estructura-plan:has(.estructura-hotspot--1.is-active) [data-layer-shape="1"] .estructura-layer-shape__top,
.estructura-plan:has(.estructura-hotspot--2.is-active) [data-layer-shape="2"] .estructura-layer-shape__top,
.estructura-plan:has(.estructura-hotspot--3.is-active) [data-layer-shape="3"] .estructura-layer-shape__top,
.estructura-plan:has(.estructura-hotspot--4.is-active) [data-layer-shape="4"] .estructura-layer-shape__top,
.estructura-plan:has(.estructura-hotspot--5.is-active) [data-layer-shape="5"] .estructura-layer-shape__top,
.estructura-plan:has(.estructura-hotspot--6.is-active) [data-layer-shape="6"] .estructura-layer-shape__top,
.estructura-plan:has(.estructura-hotspot--7.is-active) [data-layer-shape="7"] .estructura-layer-shape__top {
  fill: #f9f3df;
  stroke: var(--brand-349c);
}

.estructura-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(1120px, 94%);
  max-height: 86vh;
  overflow-y: auto;
  padding: clamp(22px, 3vw, 42px);
  background: linear-gradient(180deg, var(--brand-349c-dark), #032f1c);
  color: var(--paper);
  border: 1px solid rgba(245, 241, 232, 0.18);
  box-shadow: 0 30px 70px rgba(3, 27, 16, 0.28);
  z-index: 20;
}

.estructura-panel[hidden] {
  display: none;
}

.estructura-panel__close {
  position: absolute;
  top: 16px;
  right: 18px;
  background: none;
  border: none;
  color: rgba(245, 241, 232, 0.78);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.estructura-panel__close:hover,
.estructura-panel__close:focus-visible {
  color: var(--gold-olfato);
}

.estructura-panel__meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-olfato);
  margin-bottom: 12px;
  padding-right: 86px;
}

.estructura-panel__title {
  max-width: 18ch;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(1.8rem, 3vw, 3.2rem);
  line-height: 1.06;
  color: var(--paper);
}

.estructura-panel__anchor {
  max-width: 66ch;
  margin-top: 12px;
  color: rgba(245, 241, 232, 0.82);
  font-size: clamp(1rem, 1.1vw, 1.2rem);
  line-height: 1.48;
}

.estructura-panel__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(18px, 2.4vw, 34px);
  margin-top: 24px;
}

.estructura-panel__label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-olfato);
  margin-bottom: 8px;
}

.estructura-panel__grid p:not(.estructura-panel__label) {
  font-size: 0.9rem;
  line-height: 1.55;
  color: rgba(245, 241, 232, 0.82);
}

.estructura-transversales {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(20px, 3vw, 36px);
  margin-top: clamp(32px, 6vh, 76px);
}

.estructura-transversal {
  border-top: 1px solid rgba(4, 106, 56, 0.28);
  padding-top: 22px;
}

.estructura-transversal__roman,
.estructura-ledger__meta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--brand-349c);
}

.estructura-transversal h3,
.estructura-ledger__item h3 {
  margin-top: 8px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(1.55rem, 2.1vw, 2.35rem);
  line-height: 1.12;
}

.estructura-transversal__anchor,
.estructura-ledger__anchor {
  margin-top: 10px;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.estructura-transversal__cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.estructura-transversal__cols p {
  font-size: 0.86rem;
  line-height: 1.48;
  color: var(--ink-soft);
}

.estructura-transversal__cols span {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--brand-349c);
}

.estructura-ledger {
  display: grid;
  grid-template-columns: repeat(7, minmax(220px, 1fr));
  gap: 18px;
  margin-top: clamp(36px, 6vh, 80px);
  overflow-x: auto;
  padding-bottom: 12px;
}

.estructura-ledger__item {
  min-width: 220px;
  border-top: 1px solid var(--rule);
  padding-top: 16px;
}

.estructura-ledger details {
  margin-top: 14px;
  color: var(--ink-soft);
}

.estructura-ledger summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-349c);
}

.estructura-ledger details p {
  margin-top: 12px;
  font-size: 0.86rem;
  line-height: 1.5;
}

.estructura__overlay {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: clamp(56px, 8vh, 112px);
  background: var(--brand-349c-dark);
  color: var(--paper);
}

.estructura__closing {
  margin: clamp(48px, 7vh, 96px) auto 0;
  max-width: 26ch;
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(1.75rem, 2.8vw, 3rem);
  line-height: 1.16;
  color: var(--ink);
}

.estructura__signature {
  margin-top: 24px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.estructura__signature span {
  color: var(--ink);
  font-weight: 700;
}

@media (max-width: 980px) {
  .estructura__head,
  .estructura-transversales,
  .estructura-panel__grid,
  .estructura__overlay {
    grid-template-columns: 1fr;
  }

  .estructura-plan {
    min-height: auto;
    padding-bottom: 18px;
  }

  .estructura-plan__svg {
    width: 1060px;
    max-width: none;
    transform: translateX(-18%);
  }

  .estructura-hotspots {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 12px;
  }

  .estructura-hotspot {
    position: relative;
    inset: auto;
    width: 100%;
    min-height: 0;
  }

  .estructura-panel {
    left: 50%;
    top: auto;
    bottom: 14px;
    transform: translateX(-50%);
    max-height: 82vh;
  }

  .estructura-transversal__cols {
    grid-template-columns: 1fr;
  }

  .estructura-ledger {
    grid-template-columns: 1fr;
    overflow-x: visible;
  }

  .capa + .capa::before {
    display: none;
  }
}

@media (max-width: 560px) {
  .estructura {
    padding-left: 20px;
    padding-right: 20px;
  }

  .estructura__causal span:not(:last-child)::after {
    width: 16px;
  }

  .estructura-plan__svg {
    width: 920px;
    transform: translateX(-25%);
  }

  .estructura-panel {
    width: calc(100% - 24px);
    padding: 22px 18px;
  }
}

/* ── Apertura editorial ─────────────────────────────────────── */

.estructura__apertura {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 480px);
  gap: clamp(24px, 3.5vw, 56px);
  align-items: start;
  padding-top: clamp(32px, 5vh, 64px);
}

.estructura__eyebrow {
  grid-column: 1 / -1;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.estructura__apertura-titulo {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: clamp(2.2rem, 4vw, 4.6rem);
  line-height: 1.05;
  color: var(--ink);
}

.estructura__apertura-subtitulo {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-349c);
  margin-top: 8px;
  grid-column: 1 / -1;
}

.estructura__apertura-cuerpo {
  grid-column: 1 / -1;
  max-width: 72ch;
  font-size: clamp(1rem, 1.15vw, 1.22rem);
  line-height: 1.62;
  color: var(--ink-soft);
  margin-top: clamp(16px, 2vh, 28px);
}

.estructura__apertura-pie {
  grid-column: 1 / -1;
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--brand-349c);
  padding-left: 14px;
  border-left: 2px solid var(--brand-349c);
}

@media (max-width: 768px) {
  .estructura__apertura {
    grid-template-columns: 1fr;
  }
}

/* ── Overlay datos hidden (fuente para el panel) ────────────── */

.estructura-overlay-data {
  display: none;
}

/* ── Panel v2 — ANTES / Ahora con AI First ─────────────────── */

.estructura-panel__cifra {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-olfato);
  margin-bottom: 10px;
  padding-right: 86px;
}

.estructura-panel__cara {
  max-width: 62ch;
  margin-top: 10px;
  font-size: clamp(0.95rem, 1vw, 1.08rem);
  line-height: 1.5;
  color: rgba(245, 241, 232, 0.72);
  font-style: italic;
}

.estructura-panel__bloque {
  margin-top: clamp(18px, 2.5vh, 30px);
  padding-top: 18px;
}

.estructura-panel__bloque--antes {
  border-top: 1px solid rgba(245, 241, 232, 0.14);
}

.estructura-panel__bloque--ahora {
  border-top: 1px solid rgba(4, 106, 56, 0.38);
}

.estructura-panel__label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.estructura-panel__label {
  color: var(--gold-olfato);
}

.estructura-panel__bloque--ahora .estructura-panel__label {
  color: #6fcc8a;
}

.estructura-panel__bloque p {
  font-size: 0.9rem;
  line-height: 1.62;
  color: rgba(245, 241, 232, 0.82);
}

.estructura-panel__entregables {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.estructura-panel__entregables li {
  position: relative;
  padding-left: 20px;
  font-size: 0.9rem;
  line-height: 1.58;
  color: rgba(245, 241, 232, 0.82);
}

.estructura-panel__entregables li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 8px;
  height: 1px;
  background: #6fcc8a;
}

.estructura-panel__ahora-cierre {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: #6fcc8a;
  border-top: 1px solid rgba(111, 204, 138, 0.22);
  padding-top: 10px;
}

/* ── Cierre editorial ───────────────────────────────────────── */

.estructura__cierre {
  margin-top: clamp(64px, 10vh, 128px);
  padding: clamp(36px, 6vw, 72px) clamp(28px, 5vw, 96px);
  background: var(--brand-349c-dark);
  color: var(--paper);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 380px);
  gap: clamp(24px, 4vw, 56px);
}

.estructura__cierre-p {
  font-size: clamp(1rem, 1.18vw, 1.2rem);
  line-height: 1.68;
  color: rgba(245, 241, 232, 0.84);
}

.estructura__cierre-p + .estructura__cierre-p {
  margin-top: 18px;
}

.estructura__cierre-pie {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-olfato);
  grid-column: 1 / -1;
  margin-top: clamp(24px, 4vh, 42px);
  padding-top: 18px;
  border-top: 1px solid rgba(245, 241, 232, 0.14);
}

@media (max-width: 768px) {
  .estructura__cierre {
    grid-template-columns: 1fr;
  }
}
