/* ==========================================================================
   RADAX STUDIO · Base
   Reset, tipografía, iconografía, foco y capas de estado táctiles.
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--appbar-h) + 16px);
  /* El color del área de rebote coincide con el tema */
  background: var(--bg);
}

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--on-surface);
  font-family: var(--font-sans);
  font-size: var(--t-body);
  font-weight: 400;
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  /* Sin resaltado azul al tocar: el feedback lo da la capa de estado */
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

/* El cambio de tema se anima sólo en las superficies, no en todo */
body,
.app-bar,
.nav-bar,
.nav-rail,
.surface,
.card,
.sheet,
.dialog {
  transition: background-color var(--dur-3) var(--ease-standard),
              border-color var(--dur-3) var(--ease-standard),
              color var(--dur-3) var(--ease-standard);
}

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

input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; }

ul, ol { padding: 0; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
code, .break-any { overflow-wrap: anywhere; }

/* ── Tipografía ────────────────────────────────────────────────────────── */

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: -.015em;
  color: var(--on-surface);
}

h1 { font-size: var(--t-headline); }
h2 { font-size: var(--t-title-lg); }
h3 { font-size: var(--t-title); }
h4 { font-size: var(--t-body-lg); }

@media (min-width: 900px) {
  h1 { font-size: var(--t-display); }
}

strong, b { font-weight: 600; color: var(--on-surface); }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--dur-2) var(--ease-standard);
}

code, kbd, pre, samp { font-family: var(--font-mono); font-size: .9em; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* Etiqueta de sección: versalitas compactas, como los encabezados de lista
   de una app de ajustes */
.label-overline {
  display: block;
  font-size: var(--t-label-sm);
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--on-surface-dim);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.section-head h2 { font-size: var(--t-title); font-weight: 700; }

/* ── Iconografía ───────────────────────────────────────────────────────── */

/* Una sola familia variable. El eje FILL distingue activo de inactivo, que es
   justo el patrón de Android: relleno = seleccionado, contorno = disponible. */
.material-symbols-rounded,
.material-icons {
  font-family: 'Material Symbols Rounded', 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  flex-shrink: 0;
  user-select: none;
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  transition: font-variation-settings var(--dur-3) var(--ease-standard);
}

.icon-filled,
.is-active > .material-symbols-rounded,
.is-active > .material-icons {
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

.icon-sm { font-size: 20px !important; }
.icon-xs { font-size: 16px !important; }

/* ── Capa de estado ────────────────────────────────────────────────────────
   Todo lo pulsable recibe un velo del color de su contenido al pasar por
   encima, al enfocar y al presionar. Es lo que da sensación de material. */

.state {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.state::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: currentColor;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-2) var(--ease-standard);
}

@media (hover: hover) {
  .state:hover::before { opacity: var(--state-hover); }
}

.state:focus-visible::before { opacity: var(--state-focus); }
.state:active::before { opacity: var(--state-press); }
.state[disabled]::before,
.state:disabled::before { opacity: 0; }

/* Ripple (lo dispara ripple.js) */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: currentColor;
  opacity: .22;
  transform: scale(0);
  pointer-events: none;
  z-index: -1;
  animation: ripple-out 520ms var(--ease-decel) forwards;
}

@keyframes ripple-out {
  to { transform: scale(2.4); opacity: 0; }
}

/* ── Foco ──────────────────────────────────────────────────────────────── */

:focus { outline: none; }

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--shape-xs);
}

/* ── Accesibilidad ─────────────────────────────────────────────────────── */

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

.skip-link {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 8px);
  left: 8px;
  z-index: 200;
  transform: translateY(-180%);
  padding: 12px 20px;
  background: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
  font-size: var(--t-label-lg);
  border-radius: var(--shape-full);
  box-shadow: var(--elev-3);
  transition: transform var(--dur-3) var(--ease-spring);
}

.skip-link:focus-visible { transform: translateY(0); color: var(--on-primary); }

/* ── Scroll ────────────────────────────────────────────────────────────── */

* { scrollbar-width: thin; scrollbar-color: var(--outline-var) transparent; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--outline-var);
  border: 4px solid transparent;
  background-clip: content-box;
  border-radius: var(--shape-full);
}
::-webkit-scrollbar-thumb:hover { background-color: var(--outline); background-clip: content-box; }

::selection { background: var(--primary-container); color: var(--on-primary-container); }

/* ── Contenedores ──────────────────────────────────────────────────────── */

.container { width: 100%; max-width: var(--content-max); margin-inline: auto; }
.container-wide { width: 100%; max-width: var(--content-max-wide); margin-inline: auto; }
.container-read { width: 100%; max-width: var(--read-max); margin-inline: auto; }

.hide { display: none !important; }

@media (max-width: 599px) { .hide-compact { display: none !important; } }
@media (min-width: 600px) { .only-compact { display: none !important; } }
@media (max-width: 899px) { .hide-medium-down { display: none !important; } }
@media (min-width: 900px) { .only-medium-down { display: none !important; } }

/* ── Entrada de contenido ──────────────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--dur-4) var(--ease-decel), transform var(--dur-4) var(--ease-decel);
}

.reveal.is-in { opacity: 1; transform: none; }

/* Entrada escalonada de listas, como al abrir una pantalla en Android */
@keyframes list-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ── Transición entre páginas ──────────────────────────────────────────────
   Navegación entre documentos: el contenido entra deslizándose y la carcasa
   permanece. Se ignora en navegadores que no lo soportan. */

@view-transition { navigation: auto; }

::view-transition-old(page-content) {
  animation: vt-out var(--dur-2) var(--ease-accel) both;
}

::view-transition-new(page-content) {
  animation: vt-in var(--dur-4) var(--ease-decel) both;
}

@keyframes vt-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(12px); } }

::view-transition-group(app-bar),
::view-transition-group(nav-bar) { animation-duration: var(--dur-2); }

/* ── Movimiento reducido ───────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }

  .reveal { opacity: 1; transform: none; }
  @view-transition { navigation: none; }
}

/* ── Utilidades ────────────────────────────────────────────────────────── */

/* Texto que sobra en pantallas estrechas y se recupera al haber sitio */
.hide-sm { display: none; }
@media (min-width: 600px) { .hide-sm { display: inline; } }

/* Entradilla corta bajo la barra superior */
.page-intro {
  max-width: 62ch;
  margin-bottom: var(--sp-5);
  color: var(--on-surface-var);
  font-size: var(--t-body-sm);
  line-height: var(--lh-normal);
}

/* Logo según el tema */
.brand-logo--light { display: none; }
[data-theme="light"] .brand-logo--light { display: block; }
[data-theme="light"] .brand-logo--dark { display: none; }
