/* =====================================================================
   PetCare · Base: tema «Cuidado Animal», reinicio y tipografía
   ---------------------------------------------------------------------
   Tema vibrante con modo claro y oscuro. Todos los colores, espacios y
   radios se definen como variables: para cambiar la identidad visual
   basta con modificar estos valores.

   El modo se adapta solo a la preferencia del sistema, o se fuerza con
   <html data-theme="light"> o <html data-theme="dark"> (ver js/theme.js).
   ===================================================================== */

/* Fuente Nunito alojada en el proyecto (licencia OFL). Variable: pesos 200 a 1000. */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/assets/fonts/nunito-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito";
  font-style: italic;
  font-weight: 200 1000;
  font-display: swap;
  src: url("/assets/fonts/nunito-latin-italic.woff2") format("woff2");
}

/* ---------- MODO CLARO (por defecto) ---------- */
:root {
  --bg: #fff8ee;               /* crema cálido */
  --surface: #ffffff;
  --surface-alt: #ffeccf;
  --ink: #2a2438;
  --ink-soft: #4d4466;
  --muted: #6b6280;
  --line: #f3d9b1;
  --line-strong: #e6c48f;

  --primary: #ff7a1a;          /* naranja mandarina */
  --primary-hover: #e86500;
  --on-primary: #ffffff;
  --secondary: #00b8a9;        /* turquesa */
  --secondary-hover: #009c8f;
  --on-secondary: #10222a;
  --accent: #ff4f8b;           /* rosa coral */
  --accent-hover: #e8397a;
  --on-accent: #ffffff;
  --accent-2: #ffc233;         /* amarillo sol */
  --accent-2-hover: #f0b11a;
  --on-accent-2: #3a2a00;
  --success: #3ccf6e;          /* verde hoja */
  --on-success: #0b2a16;

  --shadow-sm: 0 2px 8px rgba(255, 122, 26, 0.12);
  --shadow: 0 8px 24px rgba(255, 122, 26, 0.18);
  --shadow-lg: 0 18px 40px rgba(255, 122, 26, 0.24);
  --backdrop: rgba(42, 36, 56, 0.55);

  color-scheme: light;
}

/* ---------- MODO OSCURO (automático por sistema) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14121f;             /* azul noche */
    --surface: #1f1b2e;
    --surface-alt: #2a2540;
    --ink: #f5f1ff;
    --ink-soft: #d9d2ec;
    --muted: #b8b0d0;
    --line: #3a3358;
    --line-strong: #4b4370;

    --primary: #ff9140;        /* naranja luminoso */
    --primary-hover: #ffa860;
    --on-primary: #1d1206;
    --secondary: #2de2d0;      /* turquesa neón */
    --secondary-hover: #5aebdc;
    --on-secondary: #07312d;
    --accent: #ff6fa3;
    --accent-hover: #ff8ab6;
    --on-accent: #2a0a18;
    --accent-2: #ffd75e;
    --accent-2-hover: #ffe17f;
    --on-accent-2: #3a2a00;
    --success: #5ef08e;
    --on-success: #0b2a16;

    --shadow-sm: 0 2px 8px rgba(45, 226, 208, 0.12);
    --shadow: 0 8px 28px rgba(45, 226, 208, 0.18);
    --shadow-lg: 0 18px 40px rgba(45, 226, 208, 0.22);
    --backdrop: rgba(5, 3, 12, 0.7);

    color-scheme: dark;
  }
}

/* ---------- MODO OSCURO (forzado manualmente) ---------- */
:root[data-theme="dark"] {
  --bg: #14121f;
  --surface: #1f1b2e;
  --surface-alt: #2a2540;
  --ink: #f5f1ff;
  --ink-soft: #d9d2ec;
  --muted: #b8b0d0;
  --line: #3a3358;
  --line-strong: #4b4370;

  --primary: #ff9140;
  --primary-hover: #ffa860;
  --on-primary: #1d1206;
  --secondary: #2de2d0;
  --secondary-hover: #5aebdc;
  --on-secondary: #07312d;
  --accent: #ff6fa3;
  --accent-hover: #ff8ab6;
  --on-accent: #2a0a18;
  --accent-2: #ffd75e;
  --accent-2-hover: #ffe17f;
  --on-accent-2: #3a2a00;
  --success: #5ef08e;
  --on-success: #0b2a16;

  --shadow-sm: 0 2px 8px rgba(45, 226, 208, 0.12);
  --shadow: 0 8px 28px rgba(45, 226, 208, 0.18);
  --shadow-lg: 0 18px 40px rgba(45, 226, 208, 0.22);
  --backdrop: rgba(5, 3, 12, 0.7);

  color-scheme: dark;
}

/* ---------- Tokens comunes a ambos modos ---------- */
:root {
  /* Tintes suaves derivados de la paleta (funcionan en claro y oscuro) */
  --primary-soft: color-mix(in srgb, var(--primary) 16%, var(--surface));
  --secondary-soft: color-mix(in srgb, var(--secondary) 16%, var(--surface));
  --accent-soft: color-mix(in srgb, var(--accent) 16%, var(--surface));
  --accent-2-soft: color-mix(in srgb, var(--accent-2) 22%, var(--surface));
  --success-soft: color-mix(in srgb, var(--success) 20%, var(--surface));

  /* Estados de vacunas y mensajes */
  --ok-bg: var(--success);        --ok-fg: var(--on-success);
  --warn-bg: var(--accent-2);     --warn-fg: var(--on-accent-2);
  --danger-bg: var(--accent);     --danger-fg: var(--on-accent);
  --info-bg: var(--secondary);    --info-fg: var(--on-secondary);
  --neutral-bg: var(--surface-alt); --neutral-fg: var(--ink-soft);

  /* Tipografía */
  --font: "Nunito", "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --text-xs: 0.8rem;
  --text-sm: 0.9rem;
  --text-md: 1rem;
  --text-lg: 1.15rem;
  --text-xl: 1.4rem;
  --text-2xl: 1.8rem;
  --text-3xl: 2.3rem;

  /* Espacios, radios y transiciones */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --radius-full: 999px;
  --focus: 0 0 0 4px color-mix(in srgb, var(--secondary) 30%, transparent);
  --transition: 200ms ease;

  --sidebar-width: 256px;
  --topbar-height: 64px;
  --bottom-nav-height: 64px;
}

/* ---------- Reinicio mínimo ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--text-md);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); font-weight: 700; text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.2; color: var(--ink); letter-spacing: -0.01em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.6rem); font-weight: 900; }
h2 { font-size: clamp(1.35rem, 3vw, 1.9rem); font-weight: 800; color: var(--primary); }
h3 { font-size: 1.2rem; font-weight: 700; color: var(--secondary); }
p { margin: 0 0 var(--space-3); }
ul, ol { margin: 0; padding-left: 1.2rem; }
hr { border: 0; border-top: 2px solid var(--line); margin: var(--space-5) 0; }

/* Enfoque visible para quienes navegan con teclado */
:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 3px; border-radius: 6px; }

/* Texto solo para lectores de pantalla */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--space-4); top: -60px; z-index: 1000;
  background: var(--primary); color: var(--on-primary); padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full); text-decoration: none; transition: top var(--transition);
}
.skip-link:focus { top: var(--space-4); color: var(--on-primary); }

.icon { width: 20px; height: 20px; flex-shrink: 0; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 28px; height: 28px; }

.muted { color: var(--muted); }
.small { font-size: var(--text-sm); }
.nowrap { white-space: nowrap; }
.hidden, [hidden] { display: none !important; }

/* Respeta a quienes prefieren menos movimiento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* Utilidades de espaciado (no se usan estilos en línea por la política de seguridad CSP) */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mb-0 { margin-bottom: 0; }
.block { display: block; }
.stack-tight { gap: var(--space-2) !important; }
.text-center { text-align: center; }
