/* Diseño 2.0 — Santa Cruz WiFi (adaptado del export de Claude Design en diseno-2.0/) */

@font-face {
  font-family: 'Source Sans 3';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/source-sans-3-latin.woff2') format('woff2');
}

/* Tipografía del isologotipo (OFL, ver /fonts/OFL-montserrat.txt). Local
   porque antes de autenticarse el invitado no llega a Google Fonts. */
@font-face {
  font-family: 'Montserrat';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/montserrat-latin.woff2') format('woff2');
}

:root {
  /* Escala navy */
  --navy-900: #081420;
  --navy-800: #0a1b2e;
  --navy-700: #0e1f33;
  --navy-600: #0f263f;
  --navy-500: #1a3050;
  --navy-400: #1e3a5f;
  --navy-300: #1b3f62;
  --navy-500-tint-fallback: #7a879a; /* fallback sin color-mix() */

  --white: #ffffff;
  --off-white: #f5f7fa;
  --border: #ccd8e6;
  --disabled: #b0c0d0;

  --ink-900: #1a3050;
  --ink-600: #3d5472;
  --ink-400: #6b839a;

  --danger-500: #b23a3a;
  --danger-50: #f6e9e9;
  --success-500: #1f7a4d;
  --success-50: #e7f3ec;

  --font-sans: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --fs-display: 1.6rem;
  --fs-body: 0.95rem;
  --fs-sm: 0.85rem;
  --fs-xs: 0.78rem;
  --fs-2xs: 0.72rem;
  --fs-label: 0.72rem;

  --lh-tight: 1.25;
  --lh-snug: 1.5;
  --lh-body: 1.7;

  --ls-wide: 0.1em;
  --ls-wider: 0.12em;

  --radius-card: 22px;
  --radius-field: 6px;
  --radius-check: 4px;

  --shadow-card: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --shadow-button: 0 6px 20px rgba(14, 31, 51, 0.35);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --backdrop-gradient:
    radial-gradient(ellipse 85% 50% at 50% -10%, var(--navy-300) 0%, transparent 60%),
    linear-gradient(170deg, var(--navy-800) 0%, var(--navy-600) 50%, var(--navy-900) 100%);
  --backdrop-grid:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink-900);
  min-height: 100vh;
  background: var(--backdrop-gradient);
}

a { color: inherit; }

/* --- Portal (form del hotspot) --- */
.portal {
  position: relative;
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 40px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 16px;
}

.portal::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--backdrop-grid);
  background-size: 52px 52px;
  pointer-events: none;
  z-index: 0;
}

.portal-card {
  position: relative;
  z-index: 1;
  background: var(--navy-800);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  animation: scwifi-fade-up 0.6s var(--ease-out) both;
}

@keyframes scwifi-fade-up {
  from { transform: translateY(26px); }
  to { transform: translateY(0); }
}

.card-header {
  position: relative;
  padding: 30px 30px 26px;
  overflow: hidden;
}

/* fitzroy-watermark.png está recortado al contorno de la montaña: se centra
   y apoya en el borde inferior sin desplazamientos a ojo. */
.card-header .watermark {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 92%;
  opacity: 0.09;
  pointer-events: none;
  mask-image: linear-gradient(to bottom, transparent 0%, #000 55%, #000 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 55%, #000 100%);
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand img {
  width: 320px;
  max-width: 100%;
  height: auto;
  filter: brightness(0) invert(1);
}

/* Se muestra solo si el logo institucional todavía no cargó (ver img/README.md) */
.brand-fallback {
  display: none;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--white);
  text-align: center;
  letter-spacing: 0.02em;
}

h1 {
  position: relative;
  margin: 24px 0 4px;
  text-align: center;
  font-size: var(--fs-display);
  font-weight: 700;
  color: var(--white);
  letter-spacing: 0.01em;
  line-height: var(--lh-tight);
}

.eyebrow {
  position: relative;
  margin: 0;
  text-align: center;
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  font-weight: 300;
}

.card-body {
  position: relative;
  margin: 0 10px 10px;
  padding: 26px 22px 22px;
  border-radius: 56px 0 56px 0;
  background: var(--navy-500-tint-fallback);
  background: color-mix(in oklab, var(--navy-500) 58%, var(--white));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.network-badge {
  padding: 11px 16px;
  border-radius: var(--radius-field);
  background: var(--navy-500);
  color: rgba(255, 255, 255, 0.82);
  font-size: var(--fs-body);
  text-align: center;
}
.network-badge strong { color: var(--white); font-weight: 700; }

.subtitle {
  margin: 0;
  text-align: center;
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.8);
  line-height: var(--lh-body);
}

.info-box {
  padding: 16px 18px;
  border-radius: var(--radius-field);
  background: var(--navy-500);
  font-size: var(--fs-sm);
  line-height: var(--lh-body);
  color: rgba(255, 255, 255, 0.78);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.info-box p { margin: 0; }
.info-box strong { color: var(--white); }

/* Que el atributo hidden gane sobre los display: flex de abajo. */
[hidden] { display: none !important; }

form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }

label.field-label {
  font-size: var(--fs-label);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
  text-transform: uppercase;
  letter-spacing: var(--ls-wider);
}

input[type="email"], input[type="text"], input[type="password"], select {
  width: 100%;
  padding: 13px 15px;
  border-radius: var(--radius-field);
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: var(--navy-500);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  outline: none;
}
input[type="email"]::placeholder, input[type="text"]::placeholder, input[type="password"]::placeholder {
  color: rgba(255, 255, 255, 0.45);
}
input[type="email"]:focus, input[type="text"]:focus, input[type="password"]:focus, select:focus {
  border-color: var(--white);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.15);
}

label.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.92);
  line-height: var(--lh-snug);
}
label.checkbox input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
label.checkbox .box {
  width: 20px;
  height: 20px;
  min-width: 20px;
  margin-top: 1px;
  border-radius: var(--radius-check);
  border: 2px solid var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
}
label.checkbox input:checked + .box { background: var(--white); }
label.checkbox input:checked + .box::after {
  content: '';
  width: 5px;
  height: 9px;
  border: 2px solid var(--navy-500);
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translateY(-1px);
}
label.checkbox input:focus-visible + .box { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35); }
label.checkbox a { color: var(--white); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
label.checkbox a:hover { color: rgba(255, 255, 255, 0.72); }

button {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 6px 6px 40px 6px;
  background: var(--navy-500);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
button:hover:not(:disabled) { box-shadow: var(--shadow-button); }
button:disabled { background: rgba(26, 48, 80, 0.45); cursor: not-allowed; }

.error, .success {
  font-size: var(--fs-sm);
  padding: 10px 12px;
  border-radius: var(--radius-field);
  margin: 0;
}
.error { color: var(--danger-500); background: var(--danger-50); }
.success { color: var(--success-500); background: var(--success-50); }

.footer-note {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.45);
  margin: 0;
}

/* --- Páginas legales (términos / privacidad) --- */
.portal.legal-page {
  max-width: 640px;
  justify-content: flex-start;
  padding-top: 40px;
  padding-bottom: 40px;
}

.legal-body { color: rgba(255, 255, 255, 0.82); }
.legal-body h1 {
  margin: 0 0 14px;
  text-align: left;
  font-size: 1.15rem;
  color: var(--white);
  line-height: var(--lh-tight);
}
.legal-body h2 {
  margin: 20px 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--white);
}
.legal-body h2:first-of-type { margin-top: 0; }
.legal-body p, .legal-body ul { margin: 0 0 14px; font-size: var(--fs-sm); line-height: var(--lh-body); }
.legal-body ul { padding-left: 20px; }
.legal-body li + li { margin-top: 6px; }
.legal-body strong { color: var(--white); }
.legal-body a { color: var(--white); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.legal-body a:hover { color: rgba(255, 255, 255, 0.72); }

.back-link {
  display: inline-block;
  margin-top: 4px;
  padding: 13px;
  width: 100%;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: var(--radius-field);
  background: transparent;
  color: var(--white);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 700;
  text-decoration: none;
  box-sizing: border-box;
}
.back-link:hover { background: rgba(255, 255, 255, 0.08); }

.draft-notice {
  background: #fef9c3;
  border: 1px solid #fde047;
  color: #713f12;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin: 0 0 20px;
}
.legal-body .draft-notice strong { color: #713f12; }

/* ==========================================================================
   Tema institucional — lo que ve el invitado (portal + términos y privacidad).
   Tarjeta con encabezado azul (logo en blanco, Fitz Roy sobre la franja
   celeste de la bandera) montada sobre una banda azul, con un cuerpo sobrio:
   texto corrido, controles nativos, sin adornos. Acotado a .guest-page /
   .legal-page para no tocar el login del dashboard ni /admin/.
   ========================================================================== */

:root {
  --sc-navy: #232b61;        /* azul exacto del isologotipo */
  --sc-navy-dark: #1a2150;
  --sc-navy-deep: #161c45;
  --sc-celeste: #6cb4e4;     /* celeste de la bandera provincial */
  --sc-bg: #eef1f6;
  --sc-ink: #222633;
  --sc-ink-2: #4d5363;
  --sc-line: #dcdfe6;
}

body:has(> .guest-page), body:has(> .legal-page) { background: var(--sc-bg); }

.portal:is(.guest-page, .legal-page) {
  max-width: none;
  margin: 0;
  min-height: 100vh;
  padding: clamp(16px, 5vh, 48px) 12px 24px;
  justify-content: flex-start;
  align-items: center;
  gap: 16px;
  color: var(--sc-ink);
  background:
    linear-gradient(var(--sc-navy-deep), var(--sc-navy-deep)) top / 100% 200px no-repeat,
    var(--sc-bg);
}
.portal:is(.guest-page, .legal-page)::before { display: none; }

.portal:is(.guest-page, .legal-page) .portal-card {
  width: 100%;
  max-width: 460px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(22, 28, 69, 0.12);
  animation: none;
}
.portal.legal-page .portal-card { max-width: 680px; }

/* --- Encabezado --- */
.portal:is(.guest-page, .legal-page) .card-header {
  padding: 22px 24px 24px;
  text-align: left;
  background: var(--sc-navy);
  border-bottom: 4px solid var(--sc-celeste);
}

/* Fitz Roy a la derecha, apoyado sobre la franja celeste. bottom negativo:
   la base del PNG es irregular y queda tapada por el borde. */
.portal:is(.guest-page, .legal-page) .card-header .watermark {
  left: auto;
  right: -6px;
  bottom: -8px;
  transform: none;
  width: auto;
  height: 132px;
  opacity: 0.15;
  mask-image: none;
  -webkit-mask-image: none;
}

.portal:is(.guest-page, .legal-page) .header-icon {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 26px;
  height: 26px;
  fill: none;
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 2.2;
  stroke-linecap: round;
}
.portal:is(.guest-page, .legal-page) .header-icon circle { fill: rgba(255, 255, 255, 0.85); stroke: none; }

.portal:is(.guest-page, .legal-page) .brand { justify-content: flex-start; }
.portal:is(.guest-page, .legal-page) .brand img { width: 168px; }
.portal:is(.guest-page, .legal-page) .brand-fallback { text-align: left; }

.portal:is(.guest-page, .legal-page) h1 {
  margin: 26px 0 4px;
  text-align: left;
  font-family: 'Montserrat', var(--font-sans);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  color: #fff;
}

.portal:is(.guest-page, .legal-page) .eyebrow {
  text-align: left;
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: rgba(255, 255, 255, 0.8);
}

/* --- Cuerpo --- */
.portal:is(.guest-page, .legal-page) .card-body {
  margin: 0;
  padding: 22px 24px 26px;
  border-radius: 0;
  background: #fff;
  gap: 18px;
}

.guest-page .lead { margin: 0; font-size: 1.02rem; line-height: 1.6; color: var(--sc-ink); }

.guest-page .data-note {
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--sc-line);
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--sc-ink-2);
}
.guest-page .data-note strong { color: var(--sc-ink); font-weight: 600; }

.guest-page form { gap: 18px; }

.guest-page .consent-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 1rem;
  line-height: 1.5;
  cursor: pointer;
}
.guest-page .consent-check input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--sc-navy);
  cursor: pointer;
}
.guest-page .consent-check a { color: var(--sc-navy); font-weight: 600; text-underline-offset: 2px; }

.guest-page button {
  padding: 14px 24px;
  border-radius: 6px;
  background: var(--sc-navy);
  font-size: 1.05rem;
  font-weight: 600;
  transition: background 0.15s;
}
.guest-page button:hover:not(:disabled) { background: var(--sc-navy-dark); box-shadow: none; }
.guest-page button:focus-visible { outline: 3px solid var(--sc-celeste); outline-offset: 2px; }
.guest-page button:disabled { background: #9da2b6; }

.portal:is(.guest-page, .legal-page) .error,
.portal:is(.guest-page, .legal-page) .success {
  padding: 10px 14px;
  border-radius: 0;
  border-left: 4px solid currentColor;
}

.guest-page .success-panel { display: flex; flex-direction: column; gap: 14px; }
.guest-page .success-panel .success { font-size: 1.05rem; font-weight: 600; }
.guest-page .success-hint { margin: 0; font-size: 1rem; line-height: 1.5; color: var(--sc-ink); }
.guest-page .button-link {
  display: block;
  padding: 14px 24px;
  border-radius: 6px;
  background: var(--sc-navy);
  color: var(--white);
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}
.guest-page .button-link:hover { background: var(--sc-navy-dark); }
.guest-page .button-link:focus-visible { outline: 3px solid var(--sc-celeste); outline-offset: 2px; }

/* --- Logos de las subsecretarías (al pie de la tarjeta) --- */
.guest-page .card-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 24px 18px;
  border-top: 1px solid var(--sc-line);
  background: #fff;
}
.guest-page .card-footer img { display: block; width: auto; min-width: 0; object-fit: contain; }
/* Alturas distintas a propósito: igualan el peso visual de los dos logos
   (el de Telecomunicaciones tiene el texto más chico). */
.guest-page .logo-telecom { height: 46px; }
.guest-page .logo-informatica { height: 23px; padding-left: 16px; border-left: 1px solid var(--sc-line); box-sizing: content-box; }
@media (max-width: 360px) {
  .guest-page .card-footer { gap: 12px; padding-inline: 16px; }
  .guest-page .logo-telecom { height: 38px; }
  .guest-page .logo-informatica { height: 19px; padding-left: 12px; }
}

/* --- Pie --- */
.guest-page .site-footer {
  max-width: 460px;
  text-align: center;
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: #6a7084;
}
.guest-page .site-footer p { margin: 0; }
.guest-page .site-footer strong { font-weight: 600; color: var(--sc-ink-2); }

/* --- Términos y privacidad --- */
.portal.legal-page .legal-body { display: block; color: var(--sc-ink); }
.legal-page .legal-body h2 { margin: 24px 0 6px; font-size: 1.05rem; color: var(--sc-navy); }
.legal-page .legal-body h2:first-of-type { margin-top: 0; }
.legal-page .legal-body p, .legal-page .legal-body ul { font-size: 0.98rem; line-height: 1.6; }
.legal-page .legal-body strong { color: var(--sc-ink); }
.legal-page .legal-body a { color: var(--sc-navy); }
.portal.legal-page .back-link {
  width: auto;
  margin-top: 12px;
  padding: 0;
  border: none;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.portal.legal-page .back-link:hover { background: none; color: var(--sc-navy-dark); }

@media (min-width: 520px) {
  .portal:is(.guest-page, .legal-page) .card-header { padding: 26px 30px 28px; }
  .portal:is(.guest-page, .legal-page) .card-body { padding: 26px 30px 30px; }
  .portal:is(.guest-page, .legal-page) .header-icon { top: 28px; right: 30px; }
  .guest-page .card-footer { gap: 28px; padding: 18px 30px 20px; }
  .guest-page .logo-telecom { height: 56px; }
  .guest-page .logo-informatica { height: 28px; padding-left: 28px; }
}
