/* ==========================================================================
   UMEC — Tokens cromáticos, tipográficos y base semántica (design-system.md)
   4 presets de temática × 2 modos (light / dark) · Mobile-First
   ========================================================================== */

:root,
html[data-preset="calma-editorial"][data-theme="light"] {
  color-scheme: light;
  --bg: #F6F7F5;
  --surface: #FFFFFF;
  --surface-2: #ECEFE9;
  --ink: #181C19;
  --ink-muted: #525C54;
  --border: #D8DFD9;
  --accent: #2E5A4C;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3EDE9;
  --danger: #A63A3A;
  --ok: #2A6B4F;

  --font-display: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --font-sans: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --step-hero: clamp(2.25rem, 1.65rem + 3.2vw, 4.5rem);
  --step-h2: clamp(1.625rem, 1.3rem + 1.6vw, 2.625rem);
  --step-lead: clamp(1.125rem, 1rem + 0.45vw, 1.375rem);
  --step-body: clamp(1rem, 0.96rem + 0.18vw, 1.125rem);
  --step-small: clamp(0.8125rem, 0.8rem + 0.08vw, 0.875rem);

  --radius-control: 4px;
  --radius-panel: 6px;
  --radius-modal: 8px;

  --float-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  --ease-out-expo: cubic-bezier(0.22, 1, 0.36, 1);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

html[data-preset="calma-editorial"][data-theme="dark"] {
  color-scheme: dark;
  --bg: #121614;
  --surface: #191F1C;
  --surface-2: #222A26;
  --ink: #EBF0EC;
  --ink-muted: #9EABA1;
  --border: #2C3631;
  --accent: #7FB5A2;
  --accent-ink: #101714;
  --accent-soft: #1F2F29;
  --danger: #DF7B7B;
  --ok: #74B998;
  --float-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

html[data-preset="alba-serena"][data-theme="light"] {
  color-scheme: light;
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --surface-2: #E9EEF5;
  --ink: #141D26;
  --ink-muted: #4E5D6C;
  --border: #D5DEE8;
  --accent: #25537A;
  --accent-ink: #FFFFFF;
  --accent-soft: #E1ECF5;
  --danger: #A83B3B;
  --ok: #276A58;
  --float-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
}

html[data-preset="alba-serena"][data-theme="dark"] {
  color-scheme: dark;
  --bg: #10151B;
  --surface: #171F27;
  --surface-2: #202B36;
  --ink: #EAF0F6;
  --ink-muted: #99A9B9;
  --border: #2A3745;
  --accent: #7AA8CF;
  --accent-ink: #0E161E;
  --accent-soft: #1C2C3B;
  --danger: #E07D7D;
  --ok: #6FB8A3;
  --float-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

html[data-preset="bosque-silente"][data-theme="light"] {
  color-scheme: light;
  --bg: #F4F5F0;
  --surface: #FCFCF9;
  --surface-2: #E9ECE2;
  --ink: #1B2118;
  --ink-muted: #515C4B;
  --border: #D6DDD0;
  --accent: #3D5A36;
  --accent-ink: #FFFFFF;
  --accent-soft: #E4ECE0;
  --danger: #A33D35;
  --ok: #2F6B43;
  --float-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
}

html[data-preset="bosque-silente"][data-theme="dark"] {
  color-scheme: dark;
  --bg: #131611;
  --surface: #1B2018;
  --surface-2: #252C21;
  --ink: #EDF1E8;
  --ink-muted: #A2AD9B;
  --border: #303A2B;
  --accent: #8DB383;
  --accent-ink: #121810;
  --accent-soft: #222E1E;
  --danger: #DF7E75;
  --ok: #79BA8E;
  --float-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

html[data-preset="estudio-creativo"][data-theme="light"] {
  color-scheme: light;
  --bg: #F7F7F7;
  --surface: #FFFFFF;
  --surface-2: #ECECEC;
  --ink: #141414;
  --ink-muted: #555555;
  --border: #DCDCDC;
  --accent: #0F5C6E;
  --accent-ink: #FFFFFF;
  --accent-soft: #E0EFF2;
  --danger: #B03636;
  --ok: #1F6E4A;
  --float-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
}

html[data-preset="estudio-creativo"][data-theme="dark"] {
  color-scheme: dark;
  --bg: #121212;
  --surface: #1A1A1A;
  --surface-2: #242424;
  --ink: #F0F0F0;
  --ink-muted: #A3A3A3;
  --border: #303030;
  --accent: #6DB4C4;
  --accent-ink: #0E1618;
  --accent-soft: #1B2D32;
  --danger: #E27A7A;
  --ok: #6BB892;
  --float-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

/* ======================== Reset y Base ======================== */

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

html {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  overflow-x: clip;
  accent-color: var(--accent);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
  overflow-x: clip;
  caret-color: var(--accent);
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

a {
  color: inherit;
}

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

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ======================== Utilidades accesibles ======================== */

.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;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

[hidden],
.is-hidden {
  display: none !important;
}

/* ======================== Identidad de marca UMEC ======================== */

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  line-height: 1;
}

.brand-svg {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: block;
}

.brand-ring-outer {
  stroke: currentColor;
}

.brand-ring-inner {
  stroke: var(--accent);
}

.brand-dot-core {
  fill: var(--accent);
}

.brand-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.brand-wordmark {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--ink);
}

/* ======================== Iconos Lucide ======================== */

.lucide {
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
  flex-shrink: 0;
  vertical-align: middle;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.icon-md {
  width: 20px;
  height: 20px;
}

.icon-lg {
  width: 24px;
  height: 24px;
}

/* ======================== SweetAlert2 tematizado ======================== */

.swal2-popup {
  background: var(--surface) !important;
  color: var(--ink) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-modal) !important;
  box-shadow: var(--float-shadow) !important;
  font-family: var(--font-sans) !important;
}

.swal2-title {
  color: var(--ink) !important;
  font-family: var(--font-sans) !important;
  font-weight: 600 !important;
  font-size: 1.125rem !important;
}

.swal2-html-container {
  color: var(--ink-muted) !important;
  font-size: 0.9375rem !important;
}

.swal2-confirm {
  background: var(--accent) !important;
  color: var(--accent-ink) !important;
  border-radius: var(--radius-control) !important;
  min-height: 44px !important;
  font-weight: 500 !important;
  box-shadow: none !important;
}

.swal2-cancel {
  background: transparent !important;
  color: var(--ink) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-control) !important;
  min-height: 44px !important;
  font-weight: 500 !important;
  box-shadow: none !important;
}

.swal2-confirm.swal2-umec-danger {
  background: var(--danger) !important;
  color: #FFFFFF !important;
}

.swal2-timer-progress-bar {
  background: var(--accent) !important;
}

.swal2-popup.swal2-toast {
  padding: 12px 16px !important;
}

/* ======================== Preferencia de movimiento reducido ======================== */

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
