/* Portada y ficha pública de Posgrados */
:root {
  --pos-gutter: clamp(1.125rem, 5.3vw, 6rem);
  --content: min(84rem, calc(100% - var(--pos-gutter) - var(--pos-gutter)));
  --header-height: 4.5rem;
  --pos-band: #103626;
  --pos-rule: rgb(255 255 255 / .22);
  --pos-mint: #bee7cf;
  --pos-heading: clamp(2rem, 1.45rem + 2.9vw, 4.35rem);
}

.shell { width: var(--content); }
.header-inner {
  width: min(94rem, calc(100% - 2.25rem));
  column-gap: clamp(.75rem, 1.5vw, 1.75rem);
}
.pos-ficha .site-header, .pos-ficha .header-inner { min-height: var(--header-height); }
.pos-ficha .header-inner { min-height: calc(var(--header-height) - 1px); grid-template-columns: minmax(0, 1fr) auto; }
.site-header, .site-header.scrolled { background: var(--ui-surface-1); }
.top-brand picture { display: block; }
.top-brand img, .site-header.scrolled .top-brand img {
  display: block;
  width: clamp(110px, 10vw, 140px);
  max-height: 38px;
  object-fit: contain;
}
.top-brand, .site-header.scrolled .top-brand {
  border-radius: .375rem;
  padding: .25rem .375rem;
}
.top-brand, .header-brand { display: flex; align-items: center; min-height: 44px; }
.pos-portada .header-link.primary, .pos-portada .site-header.scrolled .header-link.primary, .pos-portada .hero-search button {
  background: #145730;
  border-color: #145730;
  color: #fff;
}
.pos-portada .header-link.primary:hover, .pos-portada .site-header.scrolled .header-link.primary:hover, .pos-portada .hero-search button:hover { background: #0c341d; }

/* La fotografía ocupa el ancho completo. La banda conserva su lugar aunque crezca el texto. */
.hero {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: clamp(40rem, 84svh, 57rem);
}
.hero-scene { position: relative; isolation: isolate; flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.pos-portada .hero::before, .pos-portada .hero::after { content: none; }
.pos-portada .hero-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
}
.pos-portada .hero-scene::before, .pos-ficha .hero-media::after {
  background: linear-gradient(90deg, rgb(5 24 17 / .93), rgb(5 24 17 / .78) 34%, rgb(5 24 17 / .39) 61%, rgb(5 24 17 / .10) 85%);
}
.pos-portada .hero-inner, .pos-ficha .hero-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
}
.pos-portada .hero-inner {
  padding: calc(var(--header-height) + clamp(2rem, 5vh, 4rem)) 0 clamp(2.5rem, 6vh, 5rem);
}
.pos-portada .hero-copy { width: min(100%, 41rem); }
.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  margin: 0;
  color: #e0f3e7;
  font-size: .75rem;
  letter-spacing: .10em;
  line-height: 1.5;
}
.hero .eyebrow::before {
  content: "";
  width: 1.8rem;
  height: 2px;
  flex-shrink: 0;
  background: var(--pos-300);
}
.hero-code { white-space: nowrap; }
.hero h1 {
  margin: .85rem 0 1.25rem;
  font-size: clamp(3rem, 1.85rem + 4.65vw, 6.35rem);
  font-weight: 650;
  letter-spacing: -.055em;
  line-height: 1.035;
}
.pos-portada .hero h1 .soft { display: block; color: var(--pos-mint); }
.pos-portada .hero-lead {
  max-width: 47ch;
  color: #f1f6f2;
  font: 400 clamp(1rem, .94rem + .35vw, 1.25rem)/1.55 var(--font-body, Rubik), sans-serif;
}
.hero-search {
  max-width: 37.5rem;
  margin-top: clamp(1.375rem, 3.5vh, 2.25rem);
  border-radius: .8rem;
  box-shadow: 0 5px 18px rgb(4 20 12 / .15);
}
.hero-search:focus-within { outline: 3px solid var(--pos-mint); outline-offset: 3px; }
.hero-search button, .calendar-action a, .hero-actions .action { border-radius: .55rem; }
.hero-chips { flex-wrap: wrap; gap: .45rem; margin: .75rem 0 0; padding: 0; overflow: visible; }
.hero-chip {
  min-height: 44px;
  padding: .45rem .9rem;
  border: 1px solid rgb(255 255 255 / .48);
  background: rgb(6 27 18 / .68);
  color: #fff;
  font-size: .875rem;
}
.hero-chip:hover { background: var(--pos-900); border-color: var(--pos-mint); }
.hero a:focus-visible, .hero button:focus-visible, .hero input:focus-visible {
  outline: 3px solid #f2c94c;
  outline-offset: 2px;
}

.hero-calendar, .hero-facts-band {
  position: relative;
  inset: auto;
  min-height: 0;
  background: var(--pos-band);
  border-top: 1px solid var(--pos-rule);
  backdrop-filter: none;
}
.hero-calendar-inner, .hero-facts {
  display: grid;
  align-items: stretch;
  padding-block: 1.25rem;
  margin-block: 0;
  min-height: 0;
  gap: 0;
  border: 0;
}
.hero-calendar-inner { grid-template-columns: 1.22fr repeat(3, minmax(0, 1fr)) auto; }
.calendar-label, .calendar-date, .calendar-action, .hero-fact {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: .2rem clamp(.75rem, 1.8vw, 1.75rem);
  border: 0;
  border-inline-start: 1px solid var(--pos-rule);
}
.calendar-label, .hero-fact:first-child { padding-inline-start: 0; border-inline-start: 0; }
.calendar-action, .hero-fact:last-child { padding-inline-end: 0; }
.calendar-label span, .calendar-date span, .hero-fact > span {
  color: var(--pos-mint);
  font: 500 .72rem/1.5 var(--font-code);
  text-transform: uppercase;
  letter-spacing: .055em;
}
.calendar-label strong, .calendar-date strong, .hero-fact strong {
  color: #fff;
  font: 500 clamp(.95rem, .88rem + .35vw, 1.18rem)/1.35 var(--font-display);
  margin-top: .35rem;
  overflow-wrap: anywhere;
}
.calendar-date strong { font-family: var(--font-code); }
.calendar-action a {
  min-height: 44px;
  min-width: 0;
  padding-inline: 1rem;
  border: 1px solid var(--pos-300);
  color: #fff;
  background: transparent;
}
.calendar-action a:hover { background: var(--pos-800); color: #fff; }
.pos-ficha .hero { min-height: clamp(32rem, 72svh, 52rem); }
.pos-ficha .hero-content { padding-block: clamp(3rem, 8vh, 7rem); }
.pos-ficha .hero-grid { display: block; max-width: min(76%, 55rem); }
.pos-ficha .hero h1 {
  font-size: clamp(2.375rem, 1.6rem + 3.6vw, 5.25rem);
  margin-bottom: 1.6rem;
}
.hero-review-notice {
  width: fit-content;
  max-width: 54ch;
  padding: .7rem 1rem;
  line-height: 1.5;
  background: rgb(6 24 17 / .88);
}
.hero-actions .action { min-height: 48px; }
.hero-actions .action.primary { background: var(--pos-mint); border-color: var(--pos-mint); color: #0c341d; }
.hero-actions .action.primary:hover { background: #e2f4e9; }
.hero-actions .action.secondary { color: #fff; background: rgb(6 27 18 / .66); border-color: rgb(255 255 255 / .56); }
.hero-actions .action.secondary:hover { background: var(--pos-900); border-color: var(--pos-mint); }
.hero-facts { grid-template-columns: 1.45fr repeat(5, minmax(0, 1fr)); }
.hero-fact .status { display: flex; text-transform: none; letter-spacing: normal; gap: .55rem; }
.fact-status small { margin-top: .35rem; color: #e0f3e7; font: .82rem/1.4 var(--font-code); }

/* Títulos, superficies y accesos del recorrido. */
.section { padding-block: clamp(3rem, 6.5vw, 7rem); }
.section-heading, .section-head, .ops-heading { gap: clamp(1rem, 4vw, 4.25rem); margin-bottom: clamp(1.75rem, 3.4vw, 3.5rem); }
.section-heading h2, .planner-title h2, .process-copy h2, .ops-heading h2,
.support h2, .editorial h2, .pos-ficha .section-head h2 {
  margin: 0;
  font: 650 var(--pos-heading)/1.06 var(--font-display);
  letter-spacing: -.045em;
  text-wrap: balance;
}
.program-grid { gap: clamp(.95rem, 1.6vw, 1.6rem); }
.filter-count[hidden], .applied-filters[hidden] { display: none; }
.program-card, .program-card.is-inactive {
  min-height: 0;
  border: 1px solid var(--ui-border);
  border-radius: 1rem;
}
.program-card.is-inactive .program-art-image { filter: none; }
.program-card:hover, .program-card.is-inactive:hover, .program-card:focus-within {
  border-color: var(--ui-border-strong);
  box-shadow: var(--ui-shadow-card);
}
.program-art { height: auto; aspect-ratio: 2.5; }
.program-art.has-image::before {
  background: linear-gradient(150deg, rgb(4 22 14 / .24), transparent 55%);
}
.program-card .program-body { padding: 1.15rem clamp(1rem, 1.4vw, 1.4rem) .6rem; }
.program-faculty { font-size: .72rem; line-height: 1.5; }
.program-card h3 { margin: .45rem 0 .8rem; font-size: clamp(1.22rem, 1.07rem + .55vw, 1.6rem); line-height: 1.22; letter-spacing: -.025em; }
.program-meta span { font-size: .73rem; padding: .25rem .5rem; }
.program-date-range span, .program-deadline span { font-size: .69rem; line-height: 1.45; }
.program-card-actions { padding-top: .8rem; margin-top: 0; }
.program-review-notice { font-size: .875rem; padding: .55rem .75rem; }
.editorial { min-height: clamp(20rem, 58svh, 43rem); }
.editorial-inner { display: block; padding-block: clamp(2.25rem, 6vw, 6rem); }
.editorial p { margin-top: .85rem; max-width: 53ch; color: #fff; }
.prep-body { padding-block: clamp(2rem, 5vw, 5rem); }
.prep-card, .ops-card { min-height: 0; }
.prep-card h3, .ops-card h3 { margin-top: 0; }
.prep-card a, .prep-card .prep-action, .ops-card a { min-height: 44px; }
.ops-card p, .prep-card p { margin-bottom: 1.5rem; }
.mobile-menu { overflow-y: auto; }
.mobile-menu-actions { margin-top: 1.25rem; }
.mobile-menu[aria-hidden="true"] { display: none; }

.compare-choice {
  position: absolute; inset: .6rem auto auto .6rem; z-index: 2;
  display: inline-flex; align-items: center; gap: .45rem; min-height: 44px;
  padding: .35rem .8rem; border: 1px solid rgb(255 255 255 / .48); border-radius: .55rem;
  color: #fff; background: #103626; font: 500 .85rem/1.25 var(--font-ui); cursor: pointer;
}
.compare-choice input { width: 1rem; height: 1rem; accent-color: #26834a; margin: 0; }
.compare-choice:focus-within { outline: 3px solid white; outline-offset: 2px; }
.compare-choice:has(:disabled) { background: #38453e; color: #e0e5e2; cursor: default; }
.program-card:has(.compare-choice :checked) { border-color: var(--ui-accent); box-shadow: inset 0 0 0 1px var(--ui-accent); }
.compare-tray {
  position: sticky; top: var(--header-height); z-index: 60;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  gap: .5rem 1rem; padding: .6rem .9rem; margin-bottom: 1rem;
  color: var(--ui-text); background: var(--ui-surface-1); border: 1px solid var(--ui-border);
  border-inline-start: 3px solid var(--ui-accent); border-radius: .65rem; box-shadow: var(--ui-shadow-card);
}
.compare-tray[hidden] { display: none; }
.compare-tray-info strong, .compare-tray-info span { display: block; }
.compare-tray-info strong { font-size: .92rem; }
.compare-tray-info span { color: var(--ui-muted); font-size: .78rem; }
.compare-tray ul { display: flex; gap: .35rem; margin: 0; padding: .15rem; overflow-x: auto; list-style: none; }
.compare-chip, .compare-submit {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; border: 1px solid var(--ui-border); border-radius: .5rem; cursor: pointer;
}
.compare-chip { padding: .35rem .6rem; white-space: nowrap; background: var(--ui-surface-2); color: var(--ui-text); font: 500 .77rem/1.25 var(--font-code); }
.compare-chip-name { max-width: 12rem; overflow: hidden; text-overflow: ellipsis; font: 500 .85rem/1.35 var(--font-ui); }
.compare-chip [aria-hidden] { font-size: 1.1rem; }
.compare-chip:hover { border-color: var(--ui-accent); }
.compare-submit { padding: .5rem .9rem; background: #145730; border-color: transparent; color: #fff; font: 600 .9rem/1.25 var(--font-ui); }
.compare-submit:hover:enabled { background: #0c341d; }
.compare-submit:disabled { background: var(--ui-surface-2); color: var(--ui-muted); border-color: var(--ui-border); cursor: default; }
.compare-tray :focus-visible { outline: 2px solid var(--ui-accent-strong); outline-offset: -2px; }
@media (max-width: 55rem) {
  .compare-tray { grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .45rem; padding: .45rem .6rem; }
  .compare-tray ul { grid-column: 1 / -1; grid-row: 2; }
  .compare-tray .compare-submit { grid-column: 2; grid-row: 1; }
}

@media (min-width: 821px) {
  .section-dots { right: max(.25rem, calc((100% - 84rem) / 2 - 3.5rem)); }
}
@media (min-width: 821px) and (max-width: 1100px) {
  :root { --pos-gutter: 3.25rem; }
  .calendar-action { padding-inline-start: .65rem; }
  .hero-facts { grid-template-columns: 1.3fr 1fr 1fr; row-gap: 1rem; }
  .hero-fact:nth-child(4) { border: 0; padding-inline-start: 0; }
}
@media (max-width: 820px) {
  :root { --header-height: 4rem; }
  .header-inner { width: calc(100% - 1.5rem); }
  .pos-ficha .hero-grid { max-width: 100%; }
  .hero { min-height: 0; }
  .pos-portada .hero-inner { padding-block: calc(var(--header-height) + 3rem) 2.5rem; }
  .pos-portada .hero-scene::before, .pos-ficha .hero-media::after {
    background: linear-gradient(90deg, rgb(4 22 15 / .79), rgb(4 22 15 / .24)), linear-gradient(0deg, rgb(4 22 15 / .78), transparent 88%);
  }
  .hero-calendar-inner, .hero-facts {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, max(8rem, 36%)), 1fr));
    padding-block: .25rem;
  }
  .calendar-label, .calendar-date, .calendar-action, .hero-fact {
    grid-column: auto;
    border: 0;
    border-bottom: 1px solid var(--pos-rule);
    padding: .85rem .5rem .85rem 0;
  }
  .hero-calendar-inner > :nth-child(even), .hero-facts > :nth-child(even) { padding-inline-start: .75rem; }
  .calendar-action { grid-column: 1 / -1; align-items: start; border: 0; padding-block: .55rem; }
  .calendar-action a { padding-inline: 0; border: 0; text-decoration: underline; text-underline-offset: .22em; }
  .hero-fact:last-child { grid-column: auto; }
  .hero-fact:nth-last-child(-n+2) { border-bottom: 0; }
  .pos-ficha .hero { min-height: 0; }
  .pos-ficha .hero-content { padding-block: clamp(4rem, 14vw, 7rem) 2.5rem; }
  .pos-ficha .hero-media img { object-position: 77% center; }
  .pos-ficha .hero h1 { max-width: 21ch; }
  .section-heading, .section-head, .ops-heading { grid-template-columns: 1fr; }
  .section-dots, .section-dots.visible {
    left: 0;
    right: 0;
    width: 100%;
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding: 0 max(.125rem, env(safe-area-inset-left));
    gap: 0;
    border: 0;
    border-bottom: 1px solid var(--ui-border);
    border-radius: 0;
    transform: none;
    background: var(--ui-surface-1);
  }
  .pos-portada .section-dots { top: 0; }
  .section-dots .section-dot { flex: 1 0 auto; display: grid; place-items: center; width: auto; min-width: 44px; min-height: 44px; padding: .1rem; border-radius: 0; }
  .section-dot::before { display: none; }
  .section-dots .section-dot .dot-label {
    display: block;
    position: static;
    padding: .2rem 0;
    border: 0;
    border-radius: 0;
    font: 500 clamp(.7rem, .66rem + .2vw, .82rem)/1.2 var(--font-body, Rubik), sans-serif;
    text-transform: none;
    letter-spacing: normal;
    color: var(--ui-text);
    background: transparent;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
  }
  .section-dot[aria-current="location"] { box-shadow: inset 0 -3px var(--ui-accent); }
}
@media (max-width: 700px) {
  .hero-search { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0; padding: .4rem; }
  .hero-search > svg { position: static; margin-left: .75rem; transform: none; }
  .hero-search input { width: 100%; height: 44px; padding: 0 .65rem; }
  .hero-search button { grid-column: 1 / -1; width: 100%; height: 46px; }
  .hero-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 8rem), 1fr)); max-width: 24rem; }
  .hero-chip { padding-inline: .5rem; }
  .program-art { aspect-ratio: 2.6; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-media, .has-reveal .reveal, .pos-ficha .reveal { animation: none; transition: none; }
}

/* Navegación por las características de la ficha. */
.program-layout {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: start;
  --index-width: 16.5rem;
  --index-toggle-height: 3.5rem;
}
.program-content { min-width: 0; }
.program-index {
  position: sticky;
  top: var(--program-header-height, var(--header-height));
  z-index: 75;
  height: calc(100vh - var(--program-header-height, var(--header-height)));
  height: calc(100dvh - var(--program-header-height, var(--header-height)));
  border-inline-end: 1px solid var(--ui-border);
  color: var(--ui-text);
  background: var(--ui-surface-1);
}
.program-index-toggle { display: none; }
.js .program-index-toggle {
  position: relative;
  display: flex;
  width: 100%;
  min-height: var(--index-toggle-height);
  align-items: center;
  gap: .6rem;
  padding: .6rem .85rem;
  border: 0;
  border-bottom: 1px solid var(--ui-border);
  color: var(--ui-text);
  background: transparent;
  font: 550 .88rem/1.25 var(--font-body);
  text-align: start;
  cursor: pointer;
}
.program-index-toggle:hover, .index-entry[href]:hover { color: var(--ui-accent-strong); background: var(--ui-surface-2); }
.program-index :focus-visible { outline: 2px solid var(--ui-accent-strong); outline-offset: -3px; }
.index-icon { flex: none; width: 1.35rem; height: 1.35rem; color: var(--ui-accent-strong); }
.index-chevron { flex: none; width: 1rem; height: 1rem; margin-inline-start: auto; transform: rotate(90deg); }
.index-current { display: none; }
.program-index-panel {
  width: var(--index-width);
  max-height: calc(100% - var(--index-toggle-height));
  padding: .85rem .65rem 1.25rem;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scroll-target-group: auto;
}
.js .program-index-toggle[aria-expanded="false"] + .program-index-panel { display: none; }
.index-caption { display: block; padding: .5rem; }
.index-group + .index-group { margin-top: .85rem; padding-top: .85rem; border-top: 1px solid var(--ui-border); }
.index-group p { margin: 0 0 .35rem; padding-inline: .55rem; color: var(--ui-muted); font: 550 .72rem/1.5 var(--font-code); letter-spacing: .045em; text-transform: uppercase; }
.index-group ul { padding: 0; margin: 0; list-style: none; }
.index-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  min-height: 44px;
  padding: .45rem .55rem;
  border-inline-start: 3px solid transparent;
  border-radius: .35rem;
  font: 440 .9rem/1.35 var(--font-body);
  overflow-wrap: anywhere;
}
.index-entry[aria-current="location"] {
  border-inline-start-color: var(--ui-accent);
  background: var(--ui-surface-2);
  color: var(--ui-accent-strong);
  font-weight: 650;
}
.index-entry[aria-disabled="true"] { color: var(--ui-muted); }
.index-entry small { flex: none; font: 400 .7rem/1.4 var(--font-code); }
.index-entry[aria-disabled="true"] small { padding-inline-start: .35rem; border-inline-start: 1px solid var(--ui-border-strong); }
@supports selector(a:target-current) {
  html:not(.js) .index-entry:target-current { border-inline-start-color: var(--ui-accent); font-weight: 650; }
}
@media (min-width: 60.001rem) {
  .program-content .hero-facts-band .shell { container: program-facts / inline-size; }
  @container program-facts (max-width: 65rem) {
    .hero-facts { grid-template-columns: 1.3fr 1fr 1fr; row-gap: 1rem; }
    .hero-fact:nth-child(4) { border-inline-start: 0; padding-inline-start: 0; }
  }
  .js .program-index-toggle[aria-expanded="false"] {
    width: 4.5rem;
    min-height: 4.6rem;
    flex-direction: column;
    justify-content: center;
    gap: .4rem;
    padding: .55rem .2rem;
    font-size: .72rem;
  }
  .program-index-toggle[aria-expanded="false"] .index-title span,
  .program-index-toggle[aria-expanded="false"] .index-chevron { display: none; }
  .program-index-toggle[aria-expanded="false"] .index-current {
    display: block;
    position: absolute;
    top: calc(100% + 1.25rem);
    writing-mode: vertical-rl;
    color: var(--ui-muted);
    font: 400 .75rem/1.4 var(--font-body);
    white-space: nowrap;
    pointer-events: none;
  }
}
@media (max-width: 60rem) {
  html.js { --program-menu-height: 3.25rem; }
  .program-layout { display: block; }
  .program-index { position: static; width: 100%; height: auto; border: 0; }
  .js .program-index { position: sticky; }
  .js .program-index-toggle {
    height: var(--program-menu-height);
    min-height: 44px;
    padding: .4rem max(.9rem, env(safe-area-inset-right)) .4rem max(.9rem, env(safe-area-inset-left));
  }
  .index-title { flex-shrink: 0; }
  .index-current { display: block; margin-inline-start: auto; color: var(--ui-muted); font-size: .77rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .index-chevron { margin-inline-start: 0; transform: none; }
  .program-index-toggle[aria-expanded="true"] .index-chevron { transform: rotate(180deg); }
  .program-index-panel { width: 100%; }
  .js .program-index-panel {
    position: absolute;
    inset: 100% 0 auto;
    max-height: calc(100vh - var(--program-header-height, var(--header-height)) - var(--program-menu-height));
    max-height: calc(100dvh - var(--program-header-height, var(--header-height)) - var(--program-menu-height));
    padding-inline: var(--pos-gutter);
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
    background: var(--ui-surface-1);
    border-bottom: 1px solid var(--ui-border-strong);
    box-shadow: var(--ui-shadow-sticky);
  }
}
@media (forced-colors: active) {
  .index-entry[aria-current="location"] { border-inline-start-color: Highlight; }
  .index-entry[aria-disabled="true"] { color: GrayText; }
}
