/**
 * diseno.css — Sección "Diseño de producto" de la portada (template-parts/product-design-section.php).
 *
 * Un plano de ensamble claro en medio de la portada oscura: texto que avanza a
 * la izquierda y el producto fijo a la derecha, con pestañas por rubro arriba
 * del plano. Naranja solo para las piezas en foco y los acentos.
 *
 * Sin JS o sin WebGL la sección queda en .is-static: los cuatro rubros se
 * muestran uno debajo de otro, sin plano.
 *
 * Requiere que ningún ancestro tenga overflow hidden/auto (rompe position: sticky);
 * la portada usa overflow-x: clip en impresion.css.
 *
 * @package Astra Child - Xeta 3D Studio
 */

.xeta-design {
  --xd-bg: #e3e8ea;
  --xd-ink: #0d191e;
  --xd-muted: #4f5e66;
  --xd-hair: #c1cacf;
  --xd-grid: rgba(13, 25, 30, 0.055);
  --xd-hot: #ff6a1a;
  --xd-hot-text: #b23f00;
  --xd-head: 104px; /* bajo el header fijo; diseno.js lo ajusta al alto real */

  position: relative;
  width: 100%;
  background: var(--xd-bg);
  color: var(--xd-ink);
  font-family: var(--font-text, "Plus Jakarta Sans", system-ui, sans-serif);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.xeta-design *,
.xeta-design *::before,
.xeta-design *::after {
  box-sizing: border-box;
}
.xeta-design p,
.xeta-design h2,
.xeta-design h3,
.xeta-design dl,
.xeta-design dd,
.xeta-design ol {
  margin: 0;
}
.xeta-design :focus-visible {
  outline: 1px solid var(--xd-hot);
  outline-offset: 3px;
}

.xd-in {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
}

/* ==========================================================================
   Plano fijo
   ========================================================================== */
.xd-stage {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background-color: var(--xd-bg);
  background-image:
    linear-gradient(var(--xd-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--xd-grid) 1px, transparent 1px);
  background-size: 28px 28px;
  border-left: 1px solid var(--xd-hair);
}
.xd-canvas,
.xd-leaders {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.xd-leaders {
  pointer-events: none;
}
.xd-leaders polyline {
  stroke: var(--xd-ink);
  stroke-width: 1;
  fill: none;
}
.xd-leaders circle {
  fill: var(--xd-ink);
}

/* Pestañas: las hojas del juego de planos */
.xd-tabs {
  position: absolute;
  top: var(--xd-head);
  left: 16px;
  z-index: 3;
  display: flex;
  max-width: calc(100% - 32px);
  overflow-x: auto;
  scrollbar-width: none;
  border: 1px solid var(--xd-ink);
  background: var(--xd-bg);
}
.xd-tabs::-webkit-scrollbar {
  display: none;
}
.xeta-design .xd-tab {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  margin: 0;
  padding: 8px 16px 9px;
  border: 0;
  border-right: 1px solid var(--xd-hair);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--xd-ink);
  font: 500 0.88rem/1.3 var(--font-text, "Plus Jakarta Sans", sans-serif);
  letter-spacing: 0;
  text-transform: none;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.xeta-design .xd-tab:last-child {
  border-right: 0;
}
.xeta-design .xd-tab small {
  font: 400 0.58rem/1.3 var(--font-mono, "Roboto Mono", monospace);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--xd-muted);
}
.xeta-design .xd-tab:hover,
.xeta-design .xd-tab:focus {
  background: rgba(13, 25, 30, 0.07);
  color: var(--xd-ink);
}
.xeta-design .xd-tab[aria-selected="true"] {
  background: var(--xd-ink);
  color: var(--xd-bg);
}
.xeta-design .xd-tab[aria-selected="true"] small {
  color: var(--xd-hot);
}

/* Globos numerados; los posiciona diseno.js */
.xd-balloons {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.xd-balloon {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  cursor: default;
  opacity: 0;
  visibility: hidden;
  will-change: transform, opacity;
}
.xd-balloon b {
  flex: none;
  width: 26px;
  height: 26px;
  margin-top: -13px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 500 0.72rem var(--font-mono, "Roboto Mono", monospace);
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--xd-ink);
  background: var(--xd-bg);
  color: var(--xd-ink);
  transition: background-color 0.25s, color 0.25s, border-color 0.25s;
}
.xd-balloon span {
  margin-top: -13px;
  font-size: 0.8rem;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--xd-ink);
}
.xd-balloon span i {
  font-style: normal;
  color: var(--xd-muted);
}
.xd-balloon.is-hot b {
  background: var(--xd-hot);
  border-color: var(--xd-hot);
  color: #1a0800;
}

/* Cajetín del plano */
.xd-block {
  position: absolute;
  left: 16px;
  bottom: 16px;
  display: grid;
  grid-template-columns: auto auto auto;
  border: 1px solid var(--xd-ink);
  font-family: var(--font-mono, "Roboto Mono", monospace);
  font-size: 0.66rem;
  line-height: 1.3;
  background: var(--xd-bg);
}
.xd-block > div {
  padding: 6px 10px;
  border-right: 1px solid var(--xd-hair);
  border-bottom: 1px solid var(--xd-hair);
}
.xd-block > div:nth-child(3n) {
  border-right: 0;
}
.xd-block > div:nth-last-child(-n + 3) {
  border-bottom: 0;
}
.xd-block small {
  display: block;
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--xd-muted);
}
.xd-block #xd-view {
  color: var(--xd-hot-text);
}

/* ==========================================================================
   Columna de texto
   ========================================================================== */
.xd-copy {
  grid-column: 1;
  grid-row: 1;
  padding-left: clamp(20px, 5vw, 72px);
  padding-right: clamp(20px, 4vw, 56px);
}
.xd-panel {
  max-width: 30rem;
  margin-left: auto;
  transition: opacity 0.22s ease;
}
.xd-panel[hidden] {
  display: none !important;
}
.xd-copy.is-swapping .xd-panel {
  opacity: 0;
}
.xd-step {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: 72px 0;
  opacity: 0.4;
  transition: opacity 0.4s ease;
}
.xd-step.is-active {
  opacity: 1;
}
.xd-eyebrow {
  font-family: var(--font-mono, "Roboto Mono", monospace);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--xd-muted);
}
.xd-eyebrow b {
  font-weight: 400;
  color: var(--xd-hot-text);
}
.xeta-design .xd-h2 {
  font-family: var(--font-heading, "Space Grotesk", sans-serif);
  font-weight: 300;
  font-size: clamp(2.2rem, 4.2vw, 3.5rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--xd-ink);
  text-wrap: balance;
}
.xeta-design h3 {
  font-family: var(--font-heading, "Space Grotesk", sans-serif);
  font-weight: 400;
  font-size: clamp(1.55rem, 2.6vw, 2.1rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--xd-ink);
  text-wrap: balance;
}
.xeta-design .xd-h2 em,
.xeta-design h3 em {
  font-style: normal;
  color: var(--xd-hot-text);
}
.xd-step > p {
  color: var(--xd-muted);
  max-width: 32em;
}

.xd-rubros {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.xeta-design .xd-rubros button {
  margin: 0;
  padding: 6px 14px;
  border: 1px solid var(--xd-hair);
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: var(--xd-ink);
  font: 500 0.82rem/1.4 var(--font-text, "Plus Jakarta Sans", sans-serif);
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}
.xeta-design .xd-rubros button[aria-current="true"] {
  border-color: var(--xd-ink);
}
.xeta-design .xd-rubros button:hover,
.xeta-design .xd-rubros button:focus {
  background: transparent;
  color: var(--xd-ink);
  border-color: var(--xd-hot);
}

.xd-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono, "Roboto Mono", monospace);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--xd-muted);
}
.xd-tag b {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 11px;
  border: 1px solid var(--xd-ink);
  color: var(--xd-ink);
  font-weight: 500;
  letter-spacing: 0;
}

.xd-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  border-top: 1px solid var(--xd-hair);
  padding-top: 14px;
}
.xd-specs div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.xd-specs dt {
  font-family: var(--font-mono, "Roboto Mono", monospace);
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--xd-muted);
}
.xd-specs dd {
  font-family: var(--font-heading, "Space Grotesk", sans-serif);
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  color: var(--xd-ink);
}

/* Tabla de piezas (Astra pone bordes a todas las tablas) */
.xd-bom-wrap {
  overflow-x: auto;
}
.xeta-design .xd-bom {
  width: 100%;
  margin: 0 !important;
  border: 0 !important;
  border-collapse: collapse;
  color: var(--xd-ink);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}
.xeta-design .xd-bom th,
.xeta-design .xd-bom td {
  border: 0 !important;
  background: transparent;
  text-align: left;
  color: var(--xd-ink);
}
.xeta-design .xd-bom th {
  font: 400 0.62rem var(--font-mono, "Roboto Mono", monospace);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--xd-muted);
  padding: 0 8px 8px 0 !important;
  border-bottom: 1px solid var(--xd-ink) !important;
}
.xeta-design .xd-bom td {
  padding: 7px 8px 7px 0 !important;
  border-bottom: 1px solid var(--xd-hair) !important;
  white-space: nowrap;
}
.xeta-design .xd-bom td:first-child {
  font-family: var(--font-mono, "Roboto Mono", monospace);
  font-size: 0.72rem;
  width: 2.2em;
}
.xeta-design .xd-bom td:nth-child(3) {
  color: var(--xd-muted);
}
.xeta-design .xd-bom td:last-child,
.xeta-design .xd-bom th:last-child {
  text-align: right;
  padding-right: 0 !important;
}
.xd-bom tbody tr {
  cursor: default;
  transition: background-color 0.2s;
}
.xd-bom tbody tr:hover,
.xd-bom tbody tr:focus-visible,
.xd-bom tbody tr.is-hot {
  background: rgba(255, 106, 26, 0.14);
  outline: none;
}

.xd-revs {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--xd-hair);
}
.xd-revs li {
  margin: 0;
  padding: 12px 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--xd-muted);
}
.xd-revs li b {
  font: 500 0.72rem var(--font-mono, "Roboto Mono", monospace);
  letter-spacing: 0.1em;
  color: var(--xd-ink);
}
.xd-revs li:last-child b {
  color: var(--xd-hot-text);
}

.xd-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: center;
  padding-top: 6px;
}
.xd-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 999px;
  background: var(--xd-hot);
  color: #1a0800 !important;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none !important;
  transition: background-color 0.2s ease;
}
.xd-btn:hover {
  background: #ff8240;
}
.xd-link {
  font-weight: 500;
  color: var(--xd-ink) !important;
  text-decoration: none !important;
  border-bottom: 1px solid var(--xd-hair);
  padding-bottom: 3px;
  transition: border-color 0.2s ease;
}
.xd-link:hover {
  border-bottom-color: var(--xd-hot);
}

/* ==========================================================================
   Sin plano: los rubros uno debajo de otro
   ========================================================================== */
.xeta-design.is-static .xd-in {
  display: block;
}
.xeta-design.is-static .xd-stage,
.xeta-design.is-static .xd-rubros {
  display: none;
}
.xeta-design.is-static .xd-copy {
  padding-top: 96px;
  padding-bottom: 96px;
}
.xeta-design.is-static .xd-panel {
  max-width: 44rem;
  margin: 0 auto;
}
.xeta-design.is-static .xd-panel + .xd-panel {
  margin-top: 72px;
  padding-top: 72px;
  border-top: 1px solid var(--xd-hair);
}
.xeta-design.is-static .xd-step {
  min-height: 0;
  padding: 0 0 48px;
  opacity: 1;
}

/* ==========================================================================
   Móvil y tablet vertical: el plano arriba, el texto pasa por debajo
   ========================================================================== */
@media (max-width: 860px) {
  .xeta-design {
    --xd-head: 84px;
  }
  .xd-in {
    display: block;
  }
  .xd-stage {
    height: 62vh;
    height: 62svh;
    z-index: 2;
    border-left: 0;
    border-bottom: 1px solid var(--xd-hair);
  }
  .xd-tabs {
    left: 10px;
    max-width: calc(100% - 20px);
  }
  .xeta-design .xd-tab {
    padding: 7px 12px 8px;
    font-size: 0.8rem;
  }
  .xd-copy {
    padding-left: 20px;
    padding-right: 20px;
  }
  .xd-panel {
    margin: 0;
    max-width: none;
  }
  .xd-step {
    min-height: 66vh;
    min-height: 66svh;
    justify-content: flex-start;
    padding: 40px 0 56px;
  }
  .xd-balloon span {
    display: none;
  }
  .xd-block {
    grid-template-columns: auto auto;
    font-size: 0.6rem;
    left: 10px;
    bottom: 10px;
  }
  .xd-block > div:nth-child(n) {
    border-right: 1px solid var(--xd-hair);
    border-bottom: 1px solid var(--xd-hair);
  }
  .xd-block > div:nth-child(2n) {
    border-right: 0;
  }
  .xd-block > div:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
  .xd-hide-sm {
    display: none;
  }
  .xd-revs {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .xd-step,
  .xd-panel,
  .xd-balloon b,
  .xeta-design .xd-tab,
  .xd-btn,
  .xd-link {
    transition: none;
  }
}
