/* ============================================================
   estilos.css · Escuela Gustavo Domínguez
   Estética inspirada en las Human Interface Guidelines de Apple:
   mucho aire, tipografía del sistema, vidrio translúcido y un solo
   color de acento.
   ============================================================ */

:root {
  --fondo: #f5f5f7;
  --superficie: #ffffff;
  --texto: #1d1d1f;
  --texto-sec: #6e6e73;
  --borde: #d2d2d7;
  --azul: #0071e3;
  --azul-hover: #0077ed;
  --azul-suave: #e8f1fc;
  --rojo: #d70015;
  --verde: #248a3d;
  --radio: 18px;
  --radio-sm: 12px;
  --sombra: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --fuente: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--fuente);
  font-size: 17px;
  line-height: 1.47;
  color: var(--texto);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1 { font-size: 32px; line-height: 1.125; font-weight: 700; letter-spacing: -.02em; margin: 0 0 6px; }
h2 { font-size: 22px; line-height: 1.2; font-weight: 600; letter-spacing: -.01em; margin: 0 0 8px; }
h3 { font-size: 15px; font-weight: 600; margin: 0 0 10px; color: var(--texto-sec); }
p { margin: 0 0 12px; }
a { color: var(--azul); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid rgba(0,113,227,.45); outline-offset: 2px; border-radius: 6px; }
small, .ayuda { font-size: 13px; color: var(--texto-sec); }
.sub { color: var(--texto-sec); font-size: 19px; margin: 0; }

/* ---------- Loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 1000;
  display: grid; place-items: center;
  background: rgba(255,255,255,.88);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  transition: opacity .35s ease, visibility .35s ease;
}
#loader.oculto { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-logo { width: 76px; height: 76px; animation: latido 1.8s ease-in-out infinite; }
.loader-logo svg { width: 100%; height: 100%; display: block; animation: balanceo 3.6s ease-in-out infinite; }
@keyframes latido { 0%,100% { opacity: .35; transform: scale(.92); } 50% { opacity: 1; transform: scale(1.04); } }
@keyframes balanceo { 0%,100% { transform: rotate(-9deg); } 50% { transform: rotate(9deg); } }

/* ---------- Barra superior ---------- */
.barra {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251,251,253,.8);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0,0,0,.08);
}
.barra-interior { max-width: 980px; margin: 0 auto; padding: 8px 20px; display: flex; align-items: center; gap: 20px; }
.marca { display: flex; align-items: center; gap: 10px; color: var(--texto); font-weight: 600; font-size: 15px; }
.marca:hover { text-decoration: none; }
.marca-logo { width: 30px; height: 30px; display: block; }
.marca-logo svg { width: 100%; height: 100%; display: block; }
.barra-nav { display: flex; gap: 4px; margin-left: 8px; flex: 1; }
.barra-nav a { color: var(--texto-sec); font-size: 14px; padding: 6px 12px; border-radius: 980px; }
.barra-nav a:hover { color: var(--texto); text-decoration: none; background: rgba(0,0,0,.05); }
.barra-nav a.activo { color: var(--texto); background: rgba(0,0,0,.07); }
.barra-usuario { display: flex; align-items: center; gap: 8px; }
.barra-usuario form { margin: 0; }

/* ---------- Estructura ---------- */
.contenedor { width: 100%; max-width: 760px; margin: 0 auto; padding: 36px 20px 56px; flex: 1; }
.acceso { width: 100%; max-width: 440px; margin: 0 auto; padding: 48px 20px; flex: 1; display: flex; flex-direction: column; justify-content: center; }
.pie { text-align: center; color: var(--texto-sec); font-size: 12px; padding: 20px; }
.encabezado-pagina { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }

.tarjeta { background: var(--superficie); border-radius: var(--radio); box-shadow: var(--sombra); padding: 28px; margin-bottom: 20px; }
.tarjeta-acceso { text-align: center; padding: 36px 32px; }
.tarjeta-acceso .formulario { text-align: left; }
.acceso-logo { width: 64px; height: 64px; margin: 0 auto 16px; }
.acceso-logo svg { width: 100%; height: 100%; display: block; }
.tarjeta-acceso h1 { font-size: 26px; }
.tarjeta-acceso .sub { font-size: 16px; margin-bottom: 22px; }
.pie-tarjeta { margin: 22px 0 0; font-size: 14px; color: var(--texto-sec); }

/* ---------- Segmentos (selector de rol) ---------- */
.segmentos { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #e8e8ed; border-radius: 10px; padding: 2px; margin-bottom: 20px; }
.segmentos button { border: 0; background: transparent; font: inherit; font-size: 14px; font-weight: 500; padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--texto); transition: background .2s ease, box-shadow .2s ease; }
.segmentos button.activo { background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18); font-weight: 600; }

/* ---------- Formularios ---------- */
.formulario { display: flex; flex-direction: column; gap: 16px; }
.campo { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; border: 0; padding: 0; margin: 0; }
.campo .ayuda { font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=search], textarea, input[type=file] {
  font: inherit; font-size: 17px; color: var(--texto); background: #fff;
  border: 1px solid var(--borde); border-radius: var(--radio-sm);
  padding: 11px 14px; width: 100%;
}
input[type=file] { font-size: 15px; padding: 10px 12px; background: #fafafc; }
textarea { resize: vertical; min-height: 96px; }
input:focus, textarea:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 4px rgba(0,113,227,.18); }
.opciones { flex-direction: row; flex-wrap: wrap; gap: 8px 20px; }
.opciones legend { padding: 0; margin-bottom: 8px; font-size: 14px; font-weight: 500; }
.opcion { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 400; }

/* ---------- Botones ---------- */
.boton { font: inherit; font-size: 15px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; border: 0; cursor: pointer; padding: 10px 20px; border-radius: 980px; transition: background .2s ease, transform .1s ease; text-decoration: none !important; }
.boton:active { transform: scale(.98); }
.boton.primario { background: var(--azul); color: #fff; }
.boton.primario:hover { background: var(--azul-hover); }
.boton.secundario { background: var(--azul-suave); color: var(--azul); }
.boton.secundario:hover { background: #d9e8fa; }
.boton.texto { background: transparent; color: var(--azul); padding: 6px 10px; font-size: 14px; }
.boton.texto:hover { background: rgba(0,0,0,.05); }
.boton.peligro { color: var(--rojo); }
.boton.ancho { width: 100%; padding: 13px 20px; font-size: 17px; }

/* ---------- Avisos ---------- */
.aviso { border-radius: var(--radio-sm); padding: 12px 16px; font-size: 15px; margin-bottom: 16px; text-align: left; }
.aviso-error { background: #fff0f1; color: #a1001a; }
.aviso-ok { background: #e9f7ee; color: #17622b; }

/* ---------- Foro ---------- */
.buscador { position: sticky; top: 56px; z-index: 20; padding: 8px 0 16px; background: linear-gradient(var(--fondo) 75%, rgba(245,245,247,0)); }
.buscador input { border-radius: 980px; padding-left: 20px; background: #fff; }

.post-cabecera { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.post-cabecera form { margin: 0; }
.post-autor { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.post-titulo { font-size: 24px; }
.post-texto { color: #3a3a3c; }
.post-recurso { margin: 16px 0 8px; }

.avatar { border-radius: 50%; object-fit: cover; flex: none; display: block; }
.avatar-ini { display: inline-flex; align-items: center; justify-content: center; background: var(--azul-suave); color: var(--azul); font-weight: 600; }

.visor { width: 100%; height: 520px; border: 1px solid var(--borde); border-radius: var(--radio-sm); background: #f0f0f2; display: block; }
.visor-imagen { max-width: 100%; max-height: 560px; border-radius: var(--radio-sm); display: block; margin: 0 auto; }
.acciones-archivo { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; font-size: 14px; color: var(--texto-sec); flex-wrap: wrap; }
.acciones-archivo span { overflow-wrap: anywhere; }
.audio-caja { background: var(--fondo); border-radius: var(--radio-sm); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--texto-sec); }
.audio-caja audio { width: 100%; }
.enlace-tarjeta { display: flex; align-items: center; gap: 14px; background: var(--fondo); border-radius: var(--radio-sm); padding: 14px 16px; color: var(--texto); }
.enlace-tarjeta:hover { text-decoration: none; background: #ededf0; }
.enlace-tarjeta img { border-radius: 8px; flex: none; }
.enlace-datos { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.enlace-datos small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.comentarios { border-top: 1px solid #ececf0; margin-top: 16px; padding-top: 16px; }
.comentario { display: flex; gap: 10px; margin-bottom: 14px; align-items: flex-start; }
.comentario form { margin: 0; }
.comentario-cuerpo { flex: 1; min-width: 0; background: var(--fondo); border-radius: 14px; padding: 8px 14px; }
.comentario-cuerpo p { margin: 2px 0 0; font-size: 15px; overflow-wrap: anywhere; }
.comentario-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.insignia { background: var(--azul-suave); color: var(--azul); font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 980px; }
.comentar { display: flex; gap: 8px; margin-top: 6px; }
.comentar input { border-radius: 980px; padding: 9px 16px; font-size: 15px; }
.comentar .boton { padding: 9px 18px; }

.vacio { text-align: center; padding: 48px 28px; }
.vacio p { color: var(--texto-sec); }

/* ---------- Perfil ---------- */
.perfil-foto { display: flex; align-items: center; gap: 20px; }
.perfil-foto-campos { display: flex; flex-direction: column; gap: 6px; flex: 1; font-size: 14px; font-weight: 500; }

/* ---------- Adaptación a móvil ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  h1 { font-size: 27px; }
  .marca-texto { display: none; }
  .barra-interior { gap: 8px; padding: 8px 12px; }
  .contenedor { padding: 24px 14px 40px; }
  .tarjeta { padding: 20px 16px; }
  .visor { height: 400px; }
  .buscador { top: 52px; }
  .perfil-foto { flex-direction: column; align-items: flex-start; }
}

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  .loader-logo svg { animation: none; }
  .loader-logo { animation: none; opacity: 1; }
  * { transition-duration: .01ms !important; }
}
