/* ==========================================================================
   Portal UGS-FICA / SIIG-FICA
   ========================================================================== */

/* Space Grotesk: si se agregan los archivos en /assets/fonts, descomentar.
@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/SpaceGrotesk-Variable.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
*/

:root {
  --c-navy: #0a1f3a;
  --c-navy-hover: #14335c;
  --c-steel: #3f5568;
  --c-teal: #0e9f8e;
  --c-teal-dark: #0a766a;
  --c-bg: #f4f6f9;
  --c-surface: #ffffff;
  --c-text: #1f2933;
  --c-muted: #566676;
  --c-border: #dfe5ec;
  --c-error: #b42318;
  --c-error-bg: #fef3f2;

  --font-title: "Space Grotesk", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgb(10 31 58 / 6%), 0 1px 3px rgb(10 31 58 / 5%);
  --shadow-md: 0 8px 24px rgb(10 31 58 / 8%), 0 2px 6px rgb(10 31 58 / 5%);
  --container: 1240px;
  --gutter: clamp(16px, 4vw, 32px);
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
}

main {
  flex: 1 0 auto;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-title);
  color: var(--c-navy);
  line-height: 1.2;
}

p {
  margin: 0;
}

a {
  color: var(--c-teal-dark);
}

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

:focus-visible {
  outline: 3px solid var(--c-teal);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -64px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--c-navy);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- Encabezado institucional ---------- */

.site-header {
  background: var(--c-navy);
  border-bottom: 1px solid var(--c-navy-hover);
  box-shadow: var(--shadow-sm);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 32px;
  padding-block: 14px;
}

.site-header__ugs img {
  height: 110px;
  width: auto;
  object-fit: contain;
}

.site-header__inst img {
  height: 60px;
  width: auto;
  object-fit: contain;
}

@media (max-width: 640px) {
  .site-header__inner {
    flex-direction: column;
    justify-content: center;
    padding-block: 12px;
  }

  .site-header__ugs img {
    height: 66px;
  }

  .site-header__inst img {
    height: 44px;
  }
}

/* ---------- Hero ---------- */

.hero {
  background:
    radial-gradient(60rem 28rem at 8% -10%, rgb(14 159 142 / 9%), transparent 70%),
    linear-gradient(180deg, #ffffff 0%, var(--c-bg) 100%);
  padding-block: clamp(28px, 5vw, 56px) clamp(16px, 2.5vw, 28px);
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  align-items: center;
  gap: clamp(32px, 6vw, 80px);
}

.hero__logo img {
  width: min(100%, 360px);
  height: auto;
  aspect-ratio: 311 / 100;
  object-fit: contain;
}

.hero__lema {
  margin-top: 20px;
  font-family: var(--font-title);
  font-size: clamp(1.05rem, 1.2vw + 0.8rem, 1.4rem);
  font-weight: 600;
  color: var(--c-navy);
}

.hero__texto {
  margin-top: 10px;
  max-width: 34rem;
  color: var(--c-muted);
  font-size: 1.05rem;
}

@media (max-width: 900px) {
  .hero__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }

  .hero__logo img {
    width: min(100%, 300px);
  }

  .acceso {
    max-width: 360px;
    width: 100%;
    margin-inline: auto;
  }
}

/* ---------- Tarjeta de acceso ---------- */

.acceso {
  justify-self: end;
  width: 100%;
  max-width: 340px;
  padding: clamp(18px, 3vw, 24px);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgb(10 31 58 / 4%);
}

.acceso__titulo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 1rem;
  font-weight: 600;
}

.acceso__titulo .icon {
  width: 1.1em;
  height: 1.1em;
  color: var(--c-teal-dark);
}

.acceso__sesion {
  margin-bottom: 16px;
}

.acceso__salir {
  margin-top: 10px;
}

.acceso__salir .btn,
.acceso > .btn {
  width: 100%;
}

.acceso__nota {
  margin-top: 14px;
  font-size: 0.75rem;
  color: var(--c-muted);
  text-align: center;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--c-steel);
}

.input {
  position: relative;
  display: flex;
  align-items: center;
}

.input > .icon {
  position: absolute;
  left: 12px;
  width: 1.1em;
  height: 1.1em;
  color: var(--c-muted);
  pointer-events: none;
}

.input input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--c-text);
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

/* Solo los campos con ícono a la izquierda (ingreso) reservan lugar para él y para el botón de mostrar clave. */
.input > .icon ~ input {
  padding: 0 42px 0 38px;
}

.input input:hover {
  border-color: #b7c2ce;
}

.input input:focus {
  outline: none;
  border-color: var(--c-teal-dark);
  box-shadow: 0 0 0 3px rgb(14 159 142 / 18%);
}

.input input[aria-invalid="true"] {
  border-color: var(--c-error);
}

.input__toggle {
  position: absolute;
  right: 3px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--c-muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.input__toggle[hidden] {
  display: none;
}

.input__toggle:hover {
  color: var(--c-navy);
  background: var(--c-bg);
}

.input__toggle .icon {
  position: static;
}

.input__toggle .icon--eye-off,
.input__toggle[aria-pressed="true"] .icon--eye {
  display: none;
}

.input__toggle[aria-pressed="true"] .icon--eye-off {
  display: block;
}

.form-msg:empty {
  display: none;
}

.form-msg {
  margin-bottom: 16px;
}

.form-msg__error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  color: var(--c-error);
  background: var(--c-error-bg);
  border: 1px solid #fecdca;
  border-radius: var(--radius-sm);
}

.form-msg__error .icon {
  margin-top: 2px;
}

/* ---------- Botones ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.btn--primary {
  color: #fff;
  background: var(--c-navy);
}

.btn--primary:hover {
  background: var(--c-navy-hover);
}

.btn--secondary {
  color: var(--c-navy);
  background: #fff;
  border-color: #b7c2ce;
}

.btn--secondary:hover {
  background: var(--c-bg);
}

.btn--block {
  width: 100%;
}

.acceso .btn {
  min-height: 42px;
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: 8px;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.7;
  cursor: progress;
}

/* ---------- Sistemas ---------- */

.sistemas {
  padding-block: clamp(16px, 2.5vw, 28px) clamp(40px, 6vw, 80px);
}

.sistemas__titulo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: clamp(1.4rem, 1.2vw + 1.1rem, 1.9rem);
}

.sistemas__titulo .icon {
  color: var(--c-teal-dark);
  width: 1.1em;
  height: 1.1em;
}

.sistemas__lead {
  margin-top: 6px;
  color: var(--c-muted);
}

.sistemas__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 16px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

/* 4 columnas en PC grande, 3 en notebook, 2 en tablet, 1 o 2 en celular */
@media (max-width: 1399px) {
  .sistemas__grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  }
}

@media (max-width: 1099px) {
  .sistemas__grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

@media (max-width: 640px) {
  .sistemas__grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
  }
}

.sistema-card {
  --accent: var(--c-teal);
  --logo-h: 70px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.sistema-card:hover,
.sistema-card:focus-within {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
}

.sistema-card__inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 108px;
  padding: 12px;
  color: inherit;
  border-radius: inherit;
}

/* Misma altura en todos: comparten escala, así el símbolo y el texto quedan del mismo tamaño. */
.sistema-card__inner img {
  height: var(--logo-h);
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.sistema-card--enlace .sistema-card__inner {
  cursor: pointer;
}

.sistema-card--sin-acceso {
  background: var(--c-bg);
  box-shadow: none;
}

.sistema-card--sin-acceso:hover,
.sistema-card--sin-acceso:focus-within {
  transform: none;
  border-color: var(--c-border);
  box-shadow: none;
}

.sistema-card--sin-acceso .sistema-card__inner {
  cursor: not-allowed;
}

.sistema-card--sin-acceso img {
  filter: grayscale(1);
  opacity: 0.45;
}

@media (max-width: 640px) {
  .sistema-card__inner {
    --logo-h: 64px;
    height: 92px;
    padding: 12px;
  }
}

/* ---------- Páginas simples (dashboard, errores) ---------- */

.page-simple {
  padding-block: clamp(32px, 6vw, 72px);
}

.page-simple .container > * + * {
  margin-top: 16px;
}

.page-simple h1 {
  font-size: clamp(1.6rem, 2vw + 1rem, 2.2rem);
}

.page-simple__estado {
  display: inline-block;
  padding: 4px 12px;
  font-weight: 600;
  color: var(--c-teal-dark);
  background: rgb(14 159 142 / 10%);
  border-radius: 999px;
}

/* ---------- Pie ---------- */

.site-footer {
  flex-shrink: 0;
  color: #d5dee8;
  background: var(--c-navy);
  font-size: 0.875rem;
  text-align: center;
}

.site-footer__inner {
  padding-block: 28px;
}

.site-footer__inner > * + * {
  margin-top: 4px;
}

.site-footer__titulo {
  font-family: var(--font-title);
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
}

.site-footer__copy {
  margin-top: 12px !important;
  color: #a9bbcc;
}

/* ---------- Accesibilidad ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }

  .sistema-card:hover,
  .sistema-card:focus-within {
    transform: none;
  }
}
