/* Inicio (index.html). Reuses tokens, .frame-grid, .cols and the bleed
   utilities from layout.css. Breakpoints: <720 / 720–1023 / ≥1024. */

.inicio {
  --seccion: var(--space-7); /* vertical rhythm between sections */
}

@media (min-width: 1024px) {
  .inicio {
    --seccion: var(--space-8);
  }
}

.inicio h2 {
  margin-bottom: var(--space-5);
}

/* ---------- 1. Hero "La mesa" (D-20 to D-20c) ---------- */

.hero {
  padding-top: var(--space-6);
}

.hero__intro {
  row-gap: var(--space-4);
}

.hero__acciones {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  margin-top: var(--space-4);
}

.hero__acciones .enlace {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-h);
  font-size: var(--fs-ui);
  font-weight: 600;
}

@media (min-width: 1024px) {
  .hero__intro {
    align-items: start;
  }

  .hero__intro > h1 {
    grid-column: 1 / span 8;
  }

  .hero__aside {
    grid-column: 9 / span 4;
  }
}

/* The mesa is a nested .frame-grid. Its rows are shared, through subgrid,
   by the column grid and the figures, so the bar (a .bleed-both sibling)
   can sit on exactly the image row. */

.mesa {
  margin-top: calc(var(--space-5) + var(--space-2));
  grid-template-rows: repeat(5, auto); /* <720: pie, img, bar, pie, img */
}

.mesa > .mesa__cols {
  grid-column: bleed-start / bleed-end; /* <720: images full-bleed (D-19) */
  grid-row: 1 / -1;
  grid-template-rows: subgrid;
  z-index: 1;
}

.mesa__fig {
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 2;
}

.mesa__fig--proveedor {
  grid-row: 1 / span 2;
}

.mesa__fig--comprador {
  grid-row: 4 / span 2;
}

.mesa__pie {
  align-self: end;
  padding-inline: var(--bleed-w); /* back on the margin while images bleed */
  padding-bottom: var(--space-2);
  color: var(--gris);
  font-size: var(--fs-ui);
  font-weight: 600;
  line-height: var(--lh-ui);
}

.mesa__rol {
  grid-row: 3;
  align-self: center;
  max-width: none;
  padding: var(--space-4) var(--bleed-w);
  color: var(--blanco);
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: 1.3;
  text-wrap: balance;
  hyphens: manual;
}

.mesa > .mesa__barra {
  grid-row: 3;
  z-index: 0;
  background: var(--azul);
}

/* 720–1023: images side by side, bar becomes a band under them */
@media (min-width: 720px) {
  .mesa {
    grid-template-rows: repeat(3, auto);
  }

  .mesa > .mesa__cols {
    grid-column: frame-start / frame-end;
  }

  .mesa__fig--proveedor {
    grid-column: 1 / span 4;
    grid-row: 1 / span 2;
  }

  .mesa__fig--comprador {
    grid-column: 5 / span 4;
    grid-row: 1 / span 2;
  }

  .mesa__pie {
    padding-inline: 0;
  }

  .mesa__rol {
    grid-column: 1 / -1;
    padding-inline: 0;
  }
}

/* ≥1024: bar behind both images at their vertical middle, 45% tall */
@media (min-width: 1024px) {
  .mesa {
    grid-template-rows: repeat(2, auto);
  }

  .mesa__fig--comprador {
    grid-column: 9 / span 4;
  }

  .mesa__rol {
    grid-column: 5 / span 4;
    grid-row: 2;
    padding: 0 var(--space-2);
    text-align: center; /* the one centered element (D-18) */
  }

  .mesa > .mesa__barra {
    grid-row: 2;
    align-self: center;
    height: 45%;
  }
}

/* ---------- 2. Qué hacemos (D-21) ---------- */

.que-hacemos {
  margin-top: var(--seccion);
}

.servicio-fila {
  row-gap: var(--space-3);
  padding-block: var(--space-5);
}

.servicio-fila + .servicio-fila {
  border-top: 2px solid var(--gris);
}

.servicio-fila__texto .enlace {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: var(--space-2);
}

@media (min-width: 1024px) {
  .servicio-fila > h3 {
    grid-column: 1 / span 4;
  }

  .servicio-fila__texto {
    grid-column: 5 / span 6;
  }
}

/* ---------- 3. Cómo trabajamos (D-22) ---------- */

.como {
  margin-top: var(--seccion);
  padding-block: var(--seccion);
  background: var(--niebla);
}

.como__cols {
  row-gap: var(--space-5);
}

/* Below 1024 the image goes above the text, full width */
.como__fig {
  grid-row: 1;
}

.como__texto {
  grid-row: 2;
}

.practicas {
  display: grid;
  gap: var(--space-4);
}

.practicas h3 {
  margin-bottom: var(--space-1);
}

@media (min-width: 1024px) {
  .como__texto {
    grid-column: 1 / span 6;
    grid-row: 1;
  }

  .como__fig {
    grid-column: 7 / span 6;
    grid-row: 1;
    align-self: start;
  }
}

/* ---------- 4. Para quién (D-23) ---------- */

.para-quien {
  margin-top: var(--seccion);
}

.para-quien__cols {
  row-gap: var(--space-5);
}

.para-quien__col h3 {
  margin-bottom: var(--space-2);
}

/* <720: horizontal 48×4 bar between the stacked columns */
.para-quien__col--b::before {
  content: "";
  display: block;
  width: 48px;
  height: 4px;
  margin-bottom: var(--space-5);
  background: var(--naranja);
}

/* ≥720: vertical 4px bar centered in the gap between the columns */
@media (min-width: 720px) {
  .para-quien__col--a {
    grid-column: 1 / span 4;
  }

  .para-quien__col--b {
    grid-column: 5 / span 4;
    position: relative;
  }

  .para-quien__col--b::before {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(var(--gap) / -2 - 2px);
    width: 4px;
    height: auto;
    margin: 0;
  }
}

@media (min-width: 1024px) {
  .para-quien__col--a {
    grid-column: 1 / span 6;
  }

  .para-quien__col--b {
    grid-column: 7 / span 6;
  }
}

/* ==========================================================================
   APERTURA DE LA MESA - delete this block to remove
   §9 motion moment 1. Bar fades in with an 8px shift from the left, once, on
   load. The role line fades in 120ms later. The shift is negative so the
   full-bleed bar never pushes past the right edge. `backwards` fill: the
   resting styles are the final state, so nothing stays hidden if this never runs.
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
  .mesa > .mesa__barra {
    animation: apertura-barra 320ms ease-out backwards;
  }

  .mesa__rol {
    animation: apertura-rol 320ms ease-out 120ms backwards;
  }
}

@keyframes apertura-barra {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
}

@keyframes apertura-rol {
  from {
    opacity: 0;
  }
}

/* ======================= /APERTURA DE LA MESA ============================ */
