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

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

/* ── Parent header (for estudios with children) ──────────────── */

.estudio-parent__header {
  margin-bottom: 2rem;
}

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

.estudio-parent__text {
  max-width: 75ch;
  margin-left: auto;
}

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

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

.estudio-hijos .estudio-box__text {
  margin-top: auto;
  padding-top: 2rem;
  flex: none;
}

/* ── 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;
}

/* ── 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;
}

/* ── 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;
  }

  .estudio-logo__img {
    max-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 {
    gap: 6rem;
  }

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

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

  .estudio-box__content {
    width: 50%;
    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;
  }
}

/* =============================================================
   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);
  gap: 10px;
}

/* Each taller box: provides right + bottom edges */
.talleres-mapa__taller {
  border: 1px solid #000000;
  padding: 0.5rem;
  min-height: 80px;
  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;
}

/* Taller de proyecto: caja un poco menos alta */
.talleres-mapa__taller--proyecto {
  min-height: 68px; /* 85% of 80px */
}

/* 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;
}

/* Split tarde — mobile/tablet: side by side, dashed separator */
.talleres-mapa__turno-split-row {
  display: flex;
  flex-direction: row;
  column-gap: 0.25rem;
}

.talleres-mapa__turno-tarde-a,
.talleres-mapa__turno-tarde-b {
  flex: 1;
  min-width: 0;
}

.talleres-mapa__turno-tarde-b {
  border-left: 1px dashed #000000;
  padding-left: 0.25rem;
}

/* 1 col per sub-group on mobile/tablet */
.talleres-mapa__turno--tarde-split .talleres-mapa__boxes {
  grid-template-columns: 1fr;
}

/* =============================================================
   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: 10px;
  }

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

  /* 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);
  }

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

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

  .talleres-mapa__taller--proyecto {
    min-height: 85px; /* 85% of 100px */
  }
}

/* =============================================================
   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;
  }

  .talleres-mapa__boxes {
    align-items: start;
  }

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

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

  /* Tarde split: reset for sub-groups, then late-b gets 2 cols */
  .talleres-mapa__turno--tarde-split .talleres-mapa__boxes {
    grid-template-columns: 1fr;
  }

  .talleres-mapa__turno-tarde-a {
    flex: 1;
  }
  .talleres-mapa__turno-tarde-b {
    flex: 2;
  }

  .talleres-mapa__turno-tarde-b .talleres-mapa__boxes {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .talleres-mapa__taller--proyecto {
    min-height: 102px; /* 85% of 120px */
  }

  .talleres-mapa__spacer {
    display: block;
  }
}

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

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

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

.talleres-grid__items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.talleres-grid__items .talleres-mapa__taller {
  width: calc((100% - 10px) / 2);
}

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

  .talleres-grid__items .talleres-mapa__taller {
    width: calc((100% - 30px) / 4);
  }
}

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

  .talleres-grid__items .talleres-mapa__taller {
    width: calc((100% - 60px) / 7);
  }
}
