/* =============================================================
   SINGLE ESTUDIO — mobile first
   ============================================================= */

html {
  scroll-behavior: smooth;
}

.estudio-single {
  padding-top: 2rem;
  padding-bottom: 4rem;
}

.talleres-mapa,
.talleres-grid,
.estudio-tablon,
.estudio-tablones-previos,
.estudio-becas,
.estudio-texto,
.estudio-tabla {
  scroll-margin-top: calc(var(--header-height, 46px) + 20px);
}

/* ── Hijos list ──────────────────────────────────────────────── */

.estudio-hijos {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

/* Contenido de cada hijo en 3 bloques: título (alto mínimo), descripción
   (separada del título) y enlace, siempre pegado abajo del todo. */
.estudio-hijos .estudio-box__title {
  min-height: 90px;
}

.estudio-hijos .estudio-box__text {
  margin-top: 16px;
  flex: none;
}

.estudio-hijos .estudio-box__enlace {
  margin-top: auto;
}

/* ── Logo (above the box) ────────────────────────────────────── */

.estudio-hijo__logo,
.estudio-section__logo {
  margin-bottom: 1rem;
}

.estudio-logo__img {
  max-height: 120px;
  max-width: 120px;
  object-fit: contain;
  margin-left: auto;
}

/* Hijos: altura fija (no max-height) para que todos los logos ocupen el
   mismo espacio y las cajas de debajo queden alineadas entre sí,
   independientemente del tamaño natural de cada logo. */
.estudio-hijo__logo .estudio-logo__img {
  height: 120px;
  max-height: none;
  width: auto;
  object-fit: contain;
}

/* ── Section wrap: left spacer + box + right indicator ───────── */

.estudio-section__wrap {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

/* ── Box ─────────────────────────────────────────────────────── */

.estudio-box {
  flex: 1;
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: start;
  min-height: 320px;
}

.estudio-box__aside {
  display: flex;
  align-items: flex-end;
  padding: 1.5rem 0.75rem;
}

.estudio-box__titulo-corto {
  display: block;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  white-space: nowrap;
}

.estudio-box__content {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.5rem 1.5rem 0;
}

.estudio-box__title {
  margin-bottom: 0;
}

.estudio-box__body {
  margin-top: auto;
  padding-top: 2rem;
}

.estudio-box__text p + p {
  margin-top: 0.75em;
}

.estudio-box__enlace {
  display: block;
  align-self: flex-start;
  text-decoration: none;
  padding-bottom: 0.25rem;
  transition: opacity 0.2s;
}

.estudio-box__enlace:hover {
  opacity: 0.6;
}

/* ── Secciones index (no-children estudio only) ──────────────── */

.estudio-box__indice {
  display: none;
}

.estudio-box__body-title {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid currentColor;
  margin-bottom: 0;
}

.estudio-box__indice-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.estudio-box__indice-item {
  border-bottom: 1px solid currentColor;
  padding: 0.625rem 0;
}

.estudio-box__indice-item a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.estudio-box__indice-item a:hover {
  opacity: 0.7;
}

/* ── Tablón / Becas sections ─────────────────────────────────── */

.estudio-tablon,
.estudio-tablones-previos,
.estudio-becas {
  margin-top: 3rem;
}

.estudio-section-title {
  margin-bottom: 1.5rem;
  text-align: right;
}

/* =============================================================
   TABLET  ≥ 640px
   ============================================================= */

@media (min-width: 640px) {
  .estudio-single {
    padding-top: 3rem;
    padding-bottom: 6rem;
  }

  .estudio-tablon,
  .estudio-tablones-previos,
  .estudio-becas {
    margin-top: 4rem;
  }

  .estudio-hijo__logo,
  .estudio-section__logo {
    margin-bottom: 2rem;
  }

  .estudio-box {
    grid-template-columns: 72px 1fr;
  }

  .estudio-box__content {
    width: 60%;
    margin-left: auto;
  }

  .estudio-box--with-indice .estudio-box__content {
    width: 80%;
    padding-right: 0;
  }

  .estudio-box--with-indice .estudio-box__title {
    padding-right: 1.5rem;
  }

  .estudio-box__body {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
  }

  .estudio-box__text {
    flex: 1;
  }

  .estudio-box__indice {
    display: block;
    flex-shrink: 0;
    width: 190px;
    margin-left: auto;
  }

  .estudio-logo__img {
    max-height: 100px;
  }

  .estudio-hijo__logo .estudio-logo__img {
    height: 100px;
  }
}

/* =============================================================
   DESKTOP  ≥ 1024px
   ============================================================= */

@media (min-width: 1024px) {
  .estudio-single {
    padding-top: 4rem;
    padding-bottom: 8rem;
  }

  .estudio-tablon,
  .estudio-tablones-previos,
  .estudio-becas {
    margin-top: 5rem;
  }

  .estudio-hijos {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 34px;
  }

  .estudio-box {
    grid-template-columns: 90px 1fr;
    min-height: 390px;
  }

  .estudio-hijos .estudio-box {
    min-height: 480px;
  }

  .estudio-box__aside {
    padding: 2rem 1.25rem;
  }

  .estudio-box__content {
    width: 75%;
    padding: 2rem 2rem 2rem 0;
  }

  .estudio-box--with-indice .estudio-box__content {
    width: 70%;
    padding-right: 0;
  }

  .estudio-box--with-indice .estudio-box__title {
    padding-right: 2rem;
  }

  .estudio-box__body {
    gap: 2rem;
  }

  .estudio-logo__img {
    max-height: 120px;
  }

  .estudio-hijo__logo .estudio-logo__img {
    height: 120px;
  }
}

/* =============================================================
   TALLERES MAPA — mobile first
   ============================================================= */

.talleres-mapa {
  margin-top: 3rem;
}

.talleres-mapa__titulo {
  margin-bottom: 1.5rem;
}

/* Header row: hidden on mobile, shown on tablet+ */
.talleres-mapa__header {
  display: none;
}

/* Each curso group */
.talleres-mapa__grupo-label {
  padding-top: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid #000000;
  text-transform: uppercase;
}

/* Turnos: stacked on mobile */
.talleres-mapa__grupo-turnos {
  display: flex;
  flex-direction: column;
}

/* Mobile-only turno labels */
.talleres-mapa__turno-label-mobile {
  padding-block: 0.5rem;
}

/* Boxes grid: container provides top + left outer edges */
.talleres-mapa__boxes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-items: start;
  gap: 10px;
}

/* Each taller box: provides right + bottom edges */
.talleres-mapa__taller {
  border: 1px solid #000000;
  padding: 0.5rem;
  min-height: 90px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.375rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

/* Solo taller spans full row width */
.talleres-mapa__taller--solo {
  grid-column: 1 / -1;
}

/* Unidad docente: caja más alta que el resto del mapa de docencia */
.talleres-mapa__taller--unidad {
  min-height: 110px;
}

/* Spacer invisible — oculto en móvil */
.talleres-mapa__spacer {
  display: none;
}

.talleres-mapa__taller-titulo {
  display: block;
}

.talleres-mapa__taller-subtitulo {
  display: block;
  margin-top: auto;
}

/* =============================================================
   TABLET  ≥ 640px
   ============================================================= */

@media (min-width: 640px) {
  .talleres-mapa {
    margin-top: 4rem;
  }

  .talleres-mapa__wrap {
    position: relative;
  }

  .talleres-mapa__wrap::after {
    content: "";
    position: absolute;
    top: 0px;
    left: calc(50% - 1.5px);
    width: 3px;
    height: 100%;
    background-color: #000000;
  }

  /* Show Mañana / Tarde header */
  .talleres-mapa__header {
    display: flex;
  }

  .talleres-mapa__header-cell {
    flex: 1;
  }

  .talleres-mapa__header-cell > div {
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #000000;
  }

  .talleres-mapa__header-manana {
    display: flex;
    padding-right: 10px;
  }

  .talleres-mapa__header-manana > div {
    padding-bottom: 0.5rem;
    border-bottom: 3px solid #000000;
    flex: 1;
  }

  .talleres-mapa__header-manana > div:last-child {
    text-align: right;
  }

  .talleres-mapa__header-tarde {
    padding-left: 10px;
  }

  /* Turnos side by side */
  .talleres-mapa__grupo-turnos {
    flex-direction: row;
  }

  .talleres-mapa__turno {
    flex: 1;
    min-width: 0;
  }

  .talleres-mapa__turno--manana {
    padding-right: 20px;
  }

  .talleres-mapa__turno--tarde {
    padding-left: 20px;
  }

  /* Mobile labels hidden */
  .talleres-mapa__turno-label-mobile {
    display: none;
  }

  /* 2 cols per turno on tablet */
  .talleres-mapa__boxes {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .talleres-mapa__grupo-label {
    border-bottom: none;
  }

  .talleres-mapa__taller {
    padding: 0.625rem;
    min-height: 100px;
  }

  .talleres-mapa__taller--unidad {
    min-height: 130px;
  }
}

/* =============================================================
   DESKTOP  ≥ 1024px
   ============================================================= */

@media (min-width: 1024px) {
  .talleres-mapa {
    margin-top: 5rem;
  }

  .talleres-mapa__wrap::after {
    left: calc(57% - 1.5px);
  }

  /* 4 mañana + 3 tarde = 7 equal columns total */
  .talleres-mapa__header-manana {
    flex: 4;
  }
  .talleres-mapa__header-tarde {
    flex: 3;
  }
  .talleres-mapa__turno--manana {
    flex: 4;
  }
  .talleres-mapa__turno--tarde {
    flex: 3;
  }

  /* Mañana: 4-col grid */
  .talleres-mapa__turno--manana .talleres-mapa__boxes {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Tarde: 3-col grid */
  .talleres-mapa__turno--tarde .talleres-mapa__boxes {
    grid-template-columns: repeat(3, 1fr);
  }

  .talleres-mapa__spacer {
    display: block;
  }
}

/* =============================================================
   DESKTOP  ≥ 1440px
   ============================================================= */

@media (min-width: 1440px) {
  .talleres-mapa__taller {
    min-height: 120px;
  }

  .talleres-mapa__taller--unidad {
    min-height: 150px;
  }
}

/* =============================================================
   DESKTOP  ≥ 1680px
   ============================================================= */

@media (min-width: 1680px) {
  .talleres-mapa__turno--manana {
    padding-right: 24px;
  }

  .talleres-mapa__turno--tarde {
    padding-left: 24px;
  }

  .talleres-mapa__boxes {
    gap: 24px;
  }

  .talleres-mapa__taller {
    min-height: 140px;
  }

  .talleres-mapa__taller--unidad {
    min-height: 170px;
  }
}

/* =============================================================
   TALLERES GRID (experimentales / aula TFG) — mobile first
   ============================================================= */

.talleres-grid {
  margin-top: 3rem;
}

.talleres-grid__titulo {
  margin-bottom: 1.5rem;
}

/* Misma línea horizontal que las tablas de tablones / estudio-tabla,
   pero como tabla real desde el móvil: solo dos columnas cortas
   (título / subtítulo), no necesita apilarse. */
.talleres-grid__tabla {
  width: 100%;
  border-collapse: collapse;
}

.talleres-grid__tabla tr {
  border-bottom: 1px solid var(--color-black);
}

.talleres-grid__tabla td {
  padding: 0.75rem 0;
  vertical-align: top;
}

.talleres-grid__tabla td:last-child {
  text-align: right;
  padding-left: 1rem;
}

.talleres-grid__tabla-enlace {
  display: block;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (min-width: 640px) {
  .talleres-grid {
    margin-top: 4rem;
  }

  .talleres-grid__tabla-enlace {
    text-decoration: none;
  }

  .talleres-grid__tabla-enlace:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
  }
}

@media (min-width: 1024px) {
  .talleres-grid {
    margin-top: 5rem;
  }
}

/* =============================================================
   SECCIÓN TEXTO — mobile first
   ============================================================= */

.estudio-texto {
  margin-top: 3rem;
}

.estudio-texto__titulo {
  margin-bottom: 1.5rem;
}

/* .estudio-texto__columnas envuelve el core/columns nativo renderizado
   por el bloque (wp-block-columns / wp-block-column); su layout base
   (apilado en móvil, en fila a partir de ~782px) ya lo aporta el CSS de
   WordPress (wp-block-library) — aquí solo se ajusta el espaciado. */
.estudio-texto__columnas .wp-block-columns {
  gap: 1.5rem;
}

.estudio-texto__columnas p + p {
  margin-top: 0.75em;
}

.estudio-texto__enlace-wrap {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

@media (min-width: 640px) {
  .estudio-texto {
    margin-top: 4rem;
  }

  .estudio-texto__columnas .wp-block-columns {
    gap: 2rem;
  }
}

@media (min-width: 1024px) {
  .estudio-texto {
    margin-top: 5rem;
  }
}

/* =============================================================
   SECCIÓN TABLA — mobile first
   ============================================================= */

.estudio-tabla {
  margin-top: 3rem;
}

.estudio-tabla__titulo {
  margin-bottom: 1.5rem;
}

/* Mismo patrón EXACTO que .tablon-registros (single-tablon.css):
   apilado en móvil, tabla real desde 640px, mismo padding/margen y
   color de línea. Antes tenía border:1px solid en las 4 celdas (caja
   cerrada por completo) — se sustituye por líneas horizontales. */
.estudio-tabla__contenido table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2.5rem;
}

.estudio-tabla__contenido tbody tr {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-black);
}

.estudio-tabla__contenido td,
.estudio-tabla__contenido th {
  padding: 0;
  border: none;
  text-align: left;
}

.estudio-tabla__contenido th {
  font-weight: 700;
  font-size: 16px;
}

@media (min-width: 640px) {
  .estudio-tabla {
    margin-top: 4rem;
  }

  .estudio-tabla__contenido tbody tr {
    display: table-row;
    padding: 0;
  }

  .estudio-tabla__contenido td,
  .estudio-tabla__contenido th {
    padding: 0.75rem 0;
    vertical-align: top;
  }

  .estudio-tabla__contenido td:first-child,
  .estudio-tabla__contenido th:first-child {
    width: 40%;
    padding-right: 2rem;
  }

  .estudio-tabla__contenido td:last-child,
  .estudio-tabla__contenido th:last-child {
    text-align: right;
  }
}

@media (min-width: 1024px) {
  .estudio-tabla {
    margin-top: 5rem;
  }
}