/* =========================================================
   Clon visual: Universidad del Cauca - PermaneSer
   ========================================================= */

/* ---------- Variables ---------- */
:root {
  --navy: #000066;
  --periwinkle: #696fc7;
  --lavender: #e8ecf9;
  --topbar: #ecf0ff;
  --red: #e30613;
  --text: #1f1f4d;
  --muted: #6b6b7b;
  --green: #4caf50;
  --fab: #b71c2b;
  --container: 1636px; /* 1596px de contenido + 20px de padding a cada lado */
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  font-size: calc(100% * var(--fs, 1)); /* lo modifican las herramientas de accesibilidad */
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Exo 2", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: #fff;
  letter-spacing: calc(var(--sp, 0) * 0.02em);
  word-spacing: calc(var(--sp, 0) * 0.08em);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex; flex-direction: column;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid #f5a300; outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 300;
  background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 6px;
}
.skip-link:focus { top: 8px; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}

.caret {
  display: inline-block;
  width: 0; height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 8px solid currentColor;
  transition: transform .2s ease;
}
[aria-expanded="true"] > .caret { transform: rotate(180deg); }

/* ---------- Encabezado ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  display: flex;
  background: var(--topbar);
}

.brand {
  flex: 0 0 198px;
  display: flex; align-items: center; justify-content: flex-start;
  padding: 0 0 0 20px;
  background: var(--navy);
}
.brand img { width: 150px; height: auto; max-height: 80px; object-fit: contain; }

.header-main { flex: 1; min-width: 0; }

/* Barra superior */
.topbar {
  height: 46px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(20px, 6.4vw, 120px) 0 42px;
  background: var(--topbar);
}
.topbar__links { display: flex; gap: 30px; }
.topbar__links a {
  color: var(--navy);
  font-size: 1rem; font-weight: 500;
  text-underline-offset: 6px; text-decoration-color: var(--red); text-decoration-thickness: 2px;
}
.topbar__links a:hover { text-decoration-line: underline; }

.topbar__tools { display: flex; align-items: center; gap: 30px; }
.icon-link { display: inline-flex; align-items: center; gap: 6px; color: var(--navy); }
.icon-link img { width: 30px; height: 30px; }
.topbar .caret { border-left-width: 4px; border-right-width: 4px; border-top-width: 5px; }

/* Barra principal */
.mainbar {
  height: 48px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: stretch;
  padding-left: 40px;
  background: var(--navy);
  color: #fff;
}

.menu-btn {
  display: flex; align-items: center; gap: 8px;
  justify-self: start;
  font-size: 1rem; font-weight: 600;
}
.burger {
  position: relative;
  width: 16px; height: 12px;
  border-top: 2.5px solid #fff; border-bottom: 2.5px solid #fff;
}
.burger::before {
  content: ""; position: absolute; left: 0; right: 0; top: 50%;
  height: 2.5px; margin-top: -1.25px; background: #fff;
}

.mainnav { display: flex; align-items: stretch; gap: 9px; }
.mainnav > li { position: relative; display: flex; }
.mainnav > li > a,
.mainnav > li > button {
  display: flex; align-items: center; gap: 8px;
  padding: 0 11px;
  color: #fff; font-size: 1rem; font-weight: 600;
  transition: background-color .2s ease;
}
.mainnav > li > a:hover,
.mainnav > li > button:hover,
.mainnav > li > button[aria-expanded="true"],
.mainnav > li > .is-active { background: var(--periwinkle); }

.search-btn {
  justify-self: start;
  margin-left: clamp(24px, 11.8vw, 222px);
  padding: 0 12px;
  display: flex; align-items: center;
}
.search-btn svg {
  width: 24px; height: 24px;
  fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round;
}

/* Menús desplegables pequeños */
.dropdown { position: relative; }
.dropdown__panel {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 210px;
  padding: 8px 0;
  background: #fff;
  border-top: 4px solid var(--red);
  box-shadow: 0 14px 30px rgba(0, 0, 102, .2);
  z-index: 20;
}
.dropdown__panel a {
  display: block; padding: 9px 18px;
  color: var(--navy); font-size: .95rem; font-weight: 500;
}
.dropdown__panel a:hover { background: var(--lavender); }

.has-dropdown { position: relative; }
.has-dropdown > .dropdown__panel { top: 100%; left: 0; right: auto; }

/* Mega menús */
.mega {
  position: absolute; left: 0; right: 0; top: 100%;
  max-height: calc(100vh - 94px); overflow: auto;
  background: #fff;
  border-top: 4px solid var(--red);
  box-shadow: 0 22px 40px rgba(0, 0, 102, .22);
}
.mega__inner {
  max-width: 1400px; margin: 0 auto;
  padding: 28px 40px 40px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 32px;
}
.mega h3 {
  margin: 0 0 10px; padding-bottom: 8px;
  color: var(--navy); font-size: 1.05rem; font-weight: 700;
  border-bottom: 2px solid var(--lavender);
}
.mega__gap { margin-top: 26px !important; }
.mega li a,
.mega__label { display: block; padding: 5px 0; font-size: .95rem; }
.mega__label { color: var(--navy); font-weight: 600; }
.mega li a:hover { color: var(--navy); text-decoration: underline; text-underline-offset: 3px; }
.mega .sub { margin: 2px 0 8px; padding-left: 14px; border-left: 2px solid var(--lavender); }
.only-mobile { display: none; }

/* ---------- Contenido ---------- */
main { flex: 1; }

/* ---------- Portada: banner + QR ---------- */
/* Alto del encabezado fijo; se usa para que todo quepa en la primera pantalla */
:root { --header-h: 94px; --banner-ratio: 2.2935; /* 1899 / 828 */ }

.hero {
  display: flex; align-items: center; justify-content: center;
  gap: clamp(16px, 1.6vw, 28px);
  padding: clamp(12px, 1.4vw, 22px) 2%;
  /* deja libre la columna de botones flotantes para que no tapen el QR */
  padding-right: max(2%, 116px);
}

.slider {
  position: relative;
  flex: 1 1 auto; min-width: 0;
  width: 100%;
  /* El banner nunca es más alto que la pantalla disponible */
  max-width: min(2200px, calc((100vh - var(--header-h) - 40px) * var(--banner-ratio)));
  max-width: min(2200px, calc((100svh - var(--header-h) - 40px) * var(--banner-ratio)));
}

.slider__viewport {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1899 / 828;
  background: #ebeff7;
  border-radius: 6px;
  touch-action: pan-y;
}

.slider__track {
  display: flex; height: 100%;
  transition: transform .6s ease;
}
.slide { position: relative; flex: 0 0 100%; height: 100%; margin: 0; }
.slide img { width: 100%; height: 100%; object-fit: contain; }
.slide__btn {
  position: absolute; left: 6%; bottom: 14%;
  padding: 0 19px; line-height: 30px;
  color: #fff; background: #5056ac;
  font-size: .78rem; font-weight: 600;
  border-radius: 999px;
  transition: background-color .2s ease;
}
.slide__btn:hover { background: var(--navy); }

/* Estado vacío */
.slider__empty {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: #6a7391; text-align: center;
}
.slider__empty svg {
  width: 44px; height: 44px; margin-bottom: 6px;
  fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}
.slider__empty p { margin: 0; font-size: 1.15rem; font-weight: 600; }
.slider__empty small { font-size: .9rem; }
.slider[data-state="empty"] .slider__empty { display: flex; }

/* Flechas */
.slider__arrow {
  position: absolute; top: 50%; z-index: 2;
  width: 28px; height: 28px; margin-top: -14px;
  display: grid; place-items: center;
  color: var(--navy);
  background: rgba(235, 240, 248, .82);
  border-radius: 50%;
  transition: background-color .2s ease, opacity .2s ease;
}
.slider__arrow svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.slider__arrow--prev { left: 7px; }
.slider__arrow--next { right: 7px; }
.slider__arrow:not(:disabled):hover { background: #fff; }
.slider__arrow:disabled { cursor: default; opacity: .7; }
.slider[data-state="single"] .slider__arrow { display: none; }

/* Puntos */
.slider__dots { display: flex; justify-content: center; gap: 10px; padding: 16px 0 4px; }
.slider__dots:empty { display: none; }
.slider__dots button {
  width: 10px; height: 10px;
  background: #c3cce6; border-radius: 6px;
  transition: width .25s ease, background-color .25s ease;
}
.slider__dots button[aria-current="true"] { width: 26px; background: var(--navy); }

/* ---------- Accesibilidad (botón verde) ---------- */
.a11y { position: fixed; top: 157px; right: 0; z-index: 110; }
.a11y__toggle {
  width: 42px; height: 46px;
  display: grid; place-items: center;
  color: #fff; background: var(--green);
  border-radius: 8px 0 0 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}
.a11y__toggle svg { width: 30px; height: 30px; fill: currentColor; }
.a11y__panel {
  position: absolute; top: 0; right: 50px;
  width: 250px; padding: 10px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 102, .25);
}
.a11y__panel button {
  display: block; width: 100%;
  padding: 10px 12px; border-radius: 6px;
  color: var(--navy); font-weight: 600; text-align: left;
}
.a11y__panel button:hover { background: var(--lavender); }
.a11y__panel button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.a11y__reset { margin-top: 6px; border-top: 1px solid var(--lavender) !important; border-radius: 0 0 6px 6px !important; }

/* ---------- Botones flotantes (accesos rápidos + WhatsApp) ---------- */
.floating {
  position: fixed; right: 40px; bottom: 40px; z-index: 110;
  display: flex; flex-direction: column; align-items: flex-end; gap: 16px;
}

/* Accesos rápidos (botón rojo) */
.fab { position: relative; }
.fab__btn {
  width: 60px; height: 60px;
  display: grid; place-items: center;
  background: var(--fab);
  border-radius: 50%;
  box-shadow: 0 5px 16px rgba(0, 0, 0, .3);
  transition: transform .2s ease;
}
.fab__btn:hover { transform: scale(1.06); }
.fab__btn svg { width: 28px; height: 28px; fill: none; stroke: #fff; stroke-width: 3.2; }
.fab__panel {
  position: absolute; right: 0; bottom: calc(100% + 14px);
  width: 240px; padding: 10px;
  display: grid; gap: 4px;
  background: var(--navy);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .3);
}
.fab__panel a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  color: #fff; font-weight: 600;
}
.fab__panel a:hover { background: rgba(255, 255, 255, .14); }
.fab__panel img { width: 28px; height: 28px; object-fit: contain; }

/* WhatsApp */
.floating.qr-visible .whatsapp { display: none; }
.whatsapp { position: relative; display: block; width: 60px; height: 60px; }
.whatsapp__btn {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  color: #fff; background: #25d366;
  border-radius: 50%;
  box-shadow: 0 5px 16px rgba(0, 0, 0, .3);
}
.whatsapp__btn svg { width: 34px; height: 34px; fill: currentColor; }

.whatsapp__tip {
  position: absolute; right: calc(100% + 14px); top: 50%;
  padding: 10px 16px;
  color: #000; background: #fff;
  font-size: .95rem; font-weight: 600; white-space: nowrap;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translate(10px, -50%);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.whatsapp__tip::after { /* flecha del globo */
  content: ""; position: absolute; left: 100%; top: 50%; margin-top: -7px;
  border: 7px solid transparent; border-left-color: #fff;
}
.whatsapp:hover .whatsapp__tip,
.whatsapp:focus-visible .whatsapp__tip {
  opacity: 1; visibility: visible; transform: translate(0, -50%);
}

/* Vibración al pasar el mouse */
.whatsapp:hover .whatsapp__btn,
.whatsapp:focus-visible .whatsapp__btn { animation: whatsapp-shake .7s ease-in-out infinite; }

@keyframes whatsapp-shake {
  0%, 100% { transform: translateX(0) rotate(0); }
  15% { transform: translateX(-3px) rotate(-8deg); }
  30% { transform: translateX(3px) rotate(8deg); }
  45% { transform: translateX(-3px) rotate(-6deg); }
  60% { transform: translateX(3px) rotate(6deg); }
  75% { transform: translateX(-2px) rotate(-3deg); }
  90% { transform: translateX(2px) rotate(3deg); }
}

/* ---------- Tarjeta QR de WhatsApp ---------- */
.qr-card {
  /* Tamaño del QR: crece con la pantalla pero siempre cabe sin hacer scroll */
  --qr: clamp(150px, min(18vw, calc(100vh - var(--header-h) - 300px)), 300px);
  --qr: clamp(150px, min(18vw, calc(100svh - var(--header-h) - 300px)), 300px);
  flex: 0 0 auto;
  width: calc(var(--qr) + 52px);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 22px 26px 24px;
  color: #fff; text-align: center;
  background: linear-gradient(160deg, #0a0a8a 0%, var(--navy) 60%);
  border: 3px solid #25d366;
  border-radius: 20px;
  box-shadow: 0 14px 34px rgba(0, 0, 102, .28), 0 0 0 6px rgba(37, 211, 102, .15);
}

.qr-card__title {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 0;
  font-size: clamp(1rem, 1.1vw, 1.2rem); font-weight: 700; line-height: 1.2;
}
.qr-card__title svg { flex: 0 0 auto; width: 24px; height: 24px; fill: #25d366; }

.qr-card__code {
  display: block;
  width: var(--qr); height: var(--qr);
  padding: 8px;
  background: #fff;
  border-radius: 14px;
  animation: qr-pulse 2.4s ease-out infinite;
}
.qr-card__code img { width: 100%; height: 100%; image-rendering: pixelated; }

.qr-card__text {
  margin: 0;
  font-size: clamp(.95rem, 1vw, 1.1rem); font-weight: 600; line-height: 1.35;
}

.qr-card__btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 22px;
  color: #fff; background: #1fa855;
  font-weight: 700;
  border-radius: 999px;
  transition: background-color .2s ease;
}
.qr-card__btn:hover { background: #178a45; }

@keyframes qr-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(37, 211, 102, .75); }
  70%  { box-shadow: 0 0 0 16px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

/* ---------- Pie de página ---------- */
.site-footer {
  padding: 14px 20px;
  color: #fff; background: var(--navy);
  text-align: center;
}
.site-footer p { margin: 0; font-size: .9rem; opacity: .85; }

/* ---------- Buscador ---------- */
.search-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; text-align: center;
  color: #fff; background: rgba(0, 0, 80, .96);
}
.search-overlay__close { position: absolute; top: 18px; right: 26px; font-size: 3rem; line-height: 1; color: #fff; }
.search-overlay > p { max-width: 520px; margin: 0 0 26px; font-size: 1.3rem; line-height: 1.4; }
.search-form {
  display: flex; width: min(680px, 100%);
  overflow: hidden; background: #fff; border-radius: 999px;
}
.search-form input {
  flex: 1; min-width: 0; padding: 16px 26px;
  font: inherit; font-size: 1.15rem; color: var(--text);
  border: 0; outline: 0;
}
.search-form button { padding: 0 30px; color: #fff; font-weight: 700; background: var(--red); }
.quick-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 28px; margin-top: 40px; }
.quick-links a { display: grid; justify-items: center; gap: 10px; font-weight: 600; }
.quick-links img { width: 64px; height: 64px; object-fit: contain; }
.quick-links a:hover { text-decoration: underline; }

/* ---------- Herramientas de accesibilidad (efectos) ---------- */
html.a11y-gray { filter: grayscale(1); }

body.a11y-dyslexia,
body.a11y-dyslexia * {
  font-family: "OpenDyslexic", "Comic Sans MS", "Comic Neue", Verdana, sans-serif !important;
}

body.a11y-links a {
  text-decoration: underline !important;
  background: #fff59d !important;
  color: #000 !important;
  outline: 2px solid #000;
}

body.a11y-contrast,
body.a11y-contrast *:not(img):not(svg):not(path):not(rect):not(circle) {
  background-color: #000 !important;
  background-image: none !important;
  color: #fff !important;
  border-color: #fff !important;
  box-shadow: none !important;
}
body.a11y-contrast a,
body.a11y-contrast a * { color: #ffeb3b !important; }
body.a11y-contrast .service svg,
body.a11y-contrast .fab__btn svg,
body.a11y-contrast .search-btn svg { stroke: #fff !important; }
body.a11y-contrast .a11y__toggle svg { fill: #fff !important; }
body.a11y-contrast .whatsapp__btn { background-color: #25d366 !important; }
body.a11y-links .whatsapp { background: none !important; outline: none; text-decoration: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .topbar__links, .topbar__tools { gap: 22px; }
  .mainnav { gap: 4px; }
  .mainnav > li > a,
  .mainnav > li > button { padding: 0 9px; font-size: .95rem; }
  .search-btn { margin-left: 24px; }
}

@media (max-width: 992px) {
  .brand { flex-basis: 140px; padding-left: 14px; }
  .brand img { width: 112px; }
  .topbar { justify-content: flex-end; padding: 0 20px; }
  .topbar__links { display: none; }
  .mainbar { display: flex; justify-content: space-between; padding: 0 12px 0 20px; }
  .mainnav { display: none; }
  .search-btn { margin-left: 0; }
  .only-mobile { display: block; }
}

@media (max-width: 600px) {
  .brand { flex-basis: 104px; padding-left: 10px; }
  .brand img { width: 88px; }
  .topbar__tools { gap: 16px; }
  .icon-link img { width: 26px; height: 26px; }
  .mega { max-height: calc(100vh - 92px); }
  .mega__inner { padding: 22px 20px 34px; }

  .slider__empty p { font-size: 1rem; }
  .slider__empty svg { width: 34px; height: 34px; }
  .slide__btn { line-height: 26px; padding: 0 14px; font-size: .72rem; }

  .a11y { top: 110px; }
  .a11y__toggle { width: 38px; height: 42px; }
  .a11y__toggle svg { width: 26px; height: 26px; }
  .a11y__panel { right: 46px; width: min(250px, calc(100vw - 72px)); }
  .floating { right: 16px; bottom: 16px; gap: 12px; }
  .fab__btn { width: 52px; height: 52px; }
  .fab__btn svg { width: 24px; height: 24px; }
  .whatsapp { width: 52px; height: 52px; }
  .whatsapp__btn svg { width: 30px; height: 30px; }
  .whatsapp__tip { width: min(220px, calc(100vw - 110px)); white-space: normal; }
}

/* Pantallas verticales (tablets y celulares): QR debajo del banner */
@media (max-width: 899px) and (orientation: portrait), (max-width: 640px) {
  .hero { flex-direction: column; align-items: stretch; padding: 12px 12px 84px; gap: 14px; }
  .slider { max-width: none; }
  .qr-card {
    /* espacio que queda debajo del banner */
    --qr: clamp(160px, calc(100vh - var(--header-h) - (100vw - 24px) / var(--banner-ratio) - 250px), 300px);
    --qr: clamp(160px, calc(100svh - var(--header-h) - (100vw - 24px) / var(--banner-ratio) - 250px), 300px);
    width: auto; align-self: center;
    max-width: 100%;
  }
}

/* Celulares: tarjeta horizontal (QR a la izquierda, texto y botón a la derecha) */
@media (max-width: 560px) {
  .qr-card {
    --qr: clamp(136px, 44vw, 210px);
    align-self: stretch;
    display: grid;
    grid-template-columns: var(--qr) 1fr;
    grid-template-areas: "code title" "code text" "code btn";
    align-items: center; justify-items: start;
    column-gap: 14px; row-gap: 8px;
    padding: 14px;
    text-align: left;
    border-radius: 16px;
  }
  .qr-card__code  { grid-area: code; padding: 6px; border-radius: 10px; }
  .qr-card__title { grid-area: title; justify-content: flex-start; font-size: .95rem; align-self: end; }
  .qr-card__title svg { width: 20px; height: 20px; }
  .qr-card__text  { grid-area: text; font-size: .9rem; }
  .qr-card__btn   { grid-area: btn; align-self: start; min-height: 40px; padding: 0 16px; font-size: .9rem; }
}

/* Celulares muy pequeños: los flotantes se esconden mientras se ve el QR */
@media (max-width: 560px) and (max-height: 600px) {
  .floating.qr-visible { display: none; }
}

/* Pantallas bajas (celular acostado, laptops pequeñas con zoom) */
@media (max-height: 520px) and (orientation: landscape) {
  .hero { padding-block: 10px; padding-right: 84px; }
  .floating { right: 12px; bottom: 12px; }
  .qr-card {
    --qr: clamp(110px, calc(100vh - var(--header-h) - 150px), 220px);
    --qr: clamp(110px, calc(100svh - var(--header-h) - 150px), 220px);
    gap: 8px; padding: 12px 16px;
  }
  .qr-card__title, .qr-card__btn { display: none; }
  .qr-card__text { font-size: .85rem; }
}

@media (prefers-reduced-motion: reduce) {
  .qr-card__code { animation: none; }
  * { transition: none !important; scroll-behavior: auto !important; }
  .slider__track { transition: none; }
  .whatsapp:hover .whatsapp__btn,
  .whatsapp:focus-visible .whatsapp__btn { animation: none; }
}
