/* =============================================================
   base.css — Reset minimo, tipografia, fondo negro + blobs blancos
   Sprint 35 fix-3
   ============================================================= */

/* ── Viewport height + safe-area variables (Sprint 61.10) ── */
:root {
  --vh-full: 100vh; /* fallback navegadores antiguos */
  --vh-full: 100svh; /* Sprint 61.66: svh = small viewport height = estable con barra Safari iPhone visible. Resuelve scroll inaccesible en iPhone */
  --vh-small: 100vh;
  --vh-small: 100svh;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --bottomnav-h: 64px;
  --mobileheader-h: 56px;
}

/* ── Mobile: scroll natural documento para TODAS las páginas (Sprint 61.70) ── */
@media (max-width: 768px) {
  /* Sprint 61.70: TODAS las páginas (incluido chat) usan scroll natural del documento */
  html.page-chat body, html.page-dashboard body, html.page-comunidad body,
  html.page-campus body, html.page-canjea body, html.page-perfil body,
  html.page-mas body, html.page-lesson body {
    margin: 0;
    min-height: 100svh;
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    overscroll-behavior-y: contain;
  }
  /* #app: flex column sin altura fija para todas las páginas */
  html.page-chat #app, html.page-dashboard #app, html.page-comunidad #app,
  html.page-campus #app, html.page-canjea #app, html.page-perfil #app,
  html.page-mas #app, html.page-lesson #app {
    display: flex;
    flex-direction: column;
    min-height: 100svh;
  }

  /* .page-content: flujo natural, sin overflow interno (documento scrollea) */
  html.page-dashboard .page-content,
  html.page-comunidad .page-content,
  html.page-campus .page-content,
  html.page-canjea .page-content,
  html.page-perfil .page-content,
  html.page-mas .page-content,
  html.page-lesson .page-content {
    flex: 1 1 auto;
    min-height: 0;
  }

  /* Sprint 61.70: chat-wrap deja de ser overflow:hidden — el documento scrollea, chat-messages también scrollea internamente como antes */
  html.page-chat .chat-wrap {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    /* Garantiza altura suficiente para que el chat ocupe la pantalla menos header y bottomnav */
    min-height: calc(100svh - var(--header-h-mobile, 56px) - 96px);
  }
  html.page-chat #messages, html.page-chat .chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }
  html.page-chat .chat-input-wrap, html.page-chat .composer {
    flex: 0 0 auto;
    /* Sprint 61.58.1: background gestionado por layout-v2.css con glass */
  }
}

/* ── Reset minimo ── */
*, *::before, *::after { box-sizing: border-box; }

body, h1, h2, h3, h4, h5, h6, p, ul, ol, figure, blockquote, dl, dd {
  margin: 0;
  padding: 0;
}

ul, ol { list-style: none; }

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

input, button, textarea, select {
  font: inherit;
}

button { cursor: pointer; }

/* ── HTML base ── */
html {
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── Body ── */
body {
  font-family: var(--ff);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--text);
  background: var(--bg);
  min-height: var(--vh-full);
  overflow-x: hidden;
}

/* ── Fondo — gran halo blanco difuso desde arriba (glow principal) ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse 90% 55% at 50% 0%, rgba(255,255,255,0.055) 0%, transparent 65%);
}

/* ── Tres blobs blancos difusos distribuidos — dan material al glass ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 50% 35% at 15% 20%, rgba(255,255,255,0.10) 0%, transparent 65%),
    radial-gradient(ellipse 45% 32% at 85% 25%, rgba(255,255,255,0.08) 0%, transparent 65%),
    radial-gradient(ellipse 50% 40% at 60% 85%, rgba(255,255,255,0.07) 0%, transparent 65%);
}

/* ── Scrollbar custom ── */
::-webkit-scrollbar              { width: 10px; height: 10px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: rgba(255,255,255,0.10); border-radius: 9999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover  { background: rgba(255,255,255,0.16); background-clip: content-box; }
::-webkit-scrollbar-corner       { background: transparent; }

@media (max-width: 767px) {
  ::-webkit-scrollbar { width: 0; height: 0; }
}

/* Firefox */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.10) transparent; }

/* ── Focus visible ── */
:focus-visible {
  outline: 2px solid var(--ac);
  outline-offset: 2px;
  border-radius: var(--r-2);
}

/* ── Selection ── */
::selection {
  background: var(--ac);
  color: #fff;
}

/* ── Tipografia base ── */
h1 {
  font-size: var(--fs-3xl);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
}
h2 {
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
}
h3 { font-size: var(--fs-xl);   font-weight: 700; line-height: var(--lh-tight); }
h4 { font-size: var(--fs-lg);   font-weight: 600; line-height: var(--lh-tight); }
h5 { font-size: var(--fs-md);   font-weight: 600; line-height: var(--lh-tight); }
h6 { font-size: var(--fs-base); font-weight: 600; line-height: var(--lh-tight); }
p  { font-size: var(--fs-base); }

a { color: var(--ac-on-dark); text-decoration: none; }
a:hover { text-decoration: none; opacity: 0.85; }

/* ── Helper eyebrow ── */
.uio-eyebrow {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-3);
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
