/* ==========================================================================
   OFERTA ACADÉMICA: pregrado, grado y posgrado
   Diseño del portal-oferta-academica aplicado a la plantilla de WordPress.
   Clases con prefijo "of-" para no chocar con el resto del tema.
   Se carga en todo el sitio porque los shortcodes [escuela_*] usan las
   mismas tarjetas (ver functions.php).
   ========================================================================== */

:root {
  --of-navy: #041147;
  --of-orange: #ff8300;
  --of-ink: #14182b;
  --of-muted: #5b6078;
  --of-line: #e4e6ee;
  --of-soft: #f6f7fb;
  --of-sidebar: 300px;
  --of-content: 1250px;
  --of-gap: 48px;
  --of-ease: cubic-bezier(.16, 1, .3, 1);
}

/* ── Estructura: sidebar 300px + contenido hasta 1250px ─────────────────── */
.of-shell {
  width: 100%;
  margin-inline: auto;
  padding-inline: 24px;
  max-width: calc(var(--of-sidebar) + var(--of-content) + var(--of-gap) + 48px);
}

.of-layout {
  display: grid;
  grid-template-columns: var(--of-sidebar) minmax(0, var(--of-content));
  gap: var(--of-gap);
  justify-content: center;
  align-items: start;
}

.of-main {
  min-width: 0;
}

/* ── Sidebar: fijo al hacer scroll, a 25px del borde superior ───────────── */
.of-sidebar {
  position: sticky;
  top: 25px;
}

.of-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--of-line);
}

.of-nav__link {
  display: block;
  margin-left: -1px;
  padding: 11px 20px;
  border-left: 2px solid transparent;
  color: var(--of-muted);
  font-size: 1.1rem;
  font-weight: 500;
  line-height: 1.3;
  text-decoration: none;
  transition: color .18s, border-color .18s, background-color .18s;
}

.of-nav__link:hover {
  color: var(--of-navy);
  border-left-color: rgba(255, 131, 0, .45);
}

.of-nav__link.is-active {
  color: var(--of-navy);
  font-weight: 700;
  border-left-color: var(--of-orange);
}

.of-nav__link:focus-visible {
  outline: 3px solid var(--of-orange);
  outline-offset: 2px;
}

/* ── Encabezado interno ─────────────────────────────────────────────────── */
.section-head {
  margin-bottom: 32px;
}

.section-head h1 {
  max-width: 22ch;
  margin: 0;
  color: var(--of-navy);
  font-size: clamp(1.8rem, 3.5vw, 2.5rem) !important;
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.1;
}

.section-head p {
  margin: 12px 0 0;
  color: var(--of-muted);
  font-size: 1rem;
  line-height: 1.65;
}

@media (min-width: 768px) {
  .section-head h1 { font-size: 2.4rem !important; }
  .section-head p { width: 50%; }
}

/* ── Buscador + botón Ver requisitos (el botón queda a la derecha) ──────── */
.of-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 4rem;
}

.of-search {
  position: relative;
  flex: 1 1 280px;
  max-width: 460px;
}

.of-search svg {
  position: absolute;
  top: 50%;
  left: 15px;
  transform: translateY(-50%);
  color: var(--of-muted);
  pointer-events: none;
}

.of-search input {
  width: 100%;
  padding: 13px 16px 13px 42px;
  border: 1.5px solid var(--of-line);
  border-radius: 10px;
  background: var(--of-soft);
  color: var(--of-ink);
  font: inherit;
  font-size: .93rem;
  transition: border-color .2s, background .2s, box-shadow .2s;
}

.of-search input::placeholder { color: #8a8fa6; }

.of-search input:focus {
  outline: none;
  border-color: var(--of-navy);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(4, 17, 71, .08);
}

.of-empty {
  margin: 32px 0 0;
  color: var(--of-muted);
}

/* ── Escuelas ───────────────────────────────────────────────────────────── */
.of-school__title {
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #ff83006b;
  color: var(--of-navy);
  font-size: 1.2rem !important;
  font-weight: 800;
  letter-spacing: -.01em;
  line-height: 1.3;
}

/* ── Cuadrícula de tarjetas ─────────────────────────────────────────────── */
.of-grid {
  display: grid;
  /* Máximo 3 columnas: cada columna mide al menos 1/3 del ancho (menos los espacios) */
  grid-template-columns: repeat(auto-fill, minmax(max(min(300px, 100%), calc((100% - 24px) / 3)), 1fr));
  gap: 12px;
  margin-top: 2rem;
  margin-bottom: 5rem;
}

.of-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 22px;
  border: 1.5px solid var(--of-line);
  border-radius: 10px;
  background: #dce9ff36;
  color: inherit;
  text-decoration: none;
  transition: border-color .22s var(--of-ease), box-shadow .22s var(--of-ease), transform .22s var(--of-ease), background .22s;
}

.of-card:hover {
  border-color: rgba(4, 17, 71, .28);
  background: #fafbff;
  box-shadow: 0 6px 24px rgba(4, 17, 71, .09);
  color: inherit;
  transform: translateY(-2px);
}

.of-card:active { transform: scale(.99); }

.of-card__title {
  flex: 1;
  margin: 0;
  color: var(--of-navy);
  font-size: 1.2rem !important;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.35;
}

.of-card__cta {
  display: inline-flex;
  align-items: center;
  align-self: flex-end;
  gap: 5px;
  padding: 3px 12px;
  border-radius: 999px;
  background: #ff830026;
  color: var(--of-orange);
  font-size: .78rem;
  font-weight: 500;
  line-height: 1.6;
  transition: gap .2s var(--of-ease);
}

.of-card:hover .of-card__cta { gap: 9px; }

/* ── Responsivo ─────────────────────────────────────────────────────────── */
/* Tablet y móvil: el sidebar pasa arriba como una fila de tres opciones */
@media (max-width: 991px) {
  .of-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .of-sidebar { position: static; }

  .of-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border-left: 0;
  }

  .of-nav__link {
    margin-left: 0;
    padding: 8px 18px;
    border: 1px solid var(--of-line);
    border-radius: 999px;
    font-size: 1rem;
  }

  .of-nav__link:hover { border-color: var(--of-navy); }

  .of-nav__link.is-active {
    border-color: var(--of-navy);
    background: var(--of-navy);
    color: #fff;
  }
}

/* Tablet: 2 columnas */
@media (min-width: 601px) and (max-width: 991px) {
  .of-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .of-shell { padding-inline: 16px; }
  .of-search { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .of-card, .of-card__cta, .of-nav__link { transition-duration: .01ms !important; }
}
