/* ========================= RESET ========================= */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}


/* ========================= BASE ========================= */
body {
  font-family: var(--font-base);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-relaxed);
  letter-spacing: var(--tracking-normal);

  color: var(--text-primary);
  background-color: var(--surface-primary);

  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/* ========================= LINKS ========================= */
a {
  color: inherit;
  text-decoration: none;
}


/* ========================= HEADINGS (TOKEN-DRIVEN) ========================= */
h1 {
  font-size: var(--heading-1-size);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
}

h2 {
  font-size: var(--heading-2-size);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-snug);
}

h3 {
  font-size: var(--heading-3-size);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
}

h4 {
  font-size: var(--heading-4-size);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  line-height: var(--leading-normal);
}

/* Heading rhythm mejorado */
h1,
h2,
h3,
h4 {
  margin-bottom: clamp(0.6em, 1vw, 0.8em);
}


/* ========================= TEXT ELEMENTS ========================= */
p {
  line-height: var(--leading-relaxed);
}

small {
  font-size: var(--text-xs);
  letter-spacing: 0.04em;
  font-weight: var(--weight-regular);
}


/* ========================= ELEMENT NORMALIZATION ========================= */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul,
ol {
  list-style: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* Tablas corporativas */
table {
  border-collapse: collapse;
  width: 100%;
}

/* Fieldset normalization */
fieldset {
  border: none;
  padding: 0;
}


/* ========================= ACCESSIBILITY ========================= */
.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;
}

:focus-visible {
  outline: 2px solid var(--action-primary);
  outline-offset: 2px;
}


/* ========================= MOTION (CONTROLADO) ========================= */
/* Only color transitions globally — transform/opacity are handled per-component */
a,
button {
  transition:
    color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard);
}

@media (prefers-reduced-motion: reduce) {

  a,
  button {
    transition: none;
  }
}


/* ========================= WHATSAPP FLOATING BUTTON ========================= */
.whatsapp-float {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;

  width: 4rem;
  /* 64px */
  height: 4rem;
  /* 64px */
  border-radius: 50%;

  background-color: #25d366;
  color: #ffffff;

  box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
  transition:
    background-color var(--duration-base) var(--ease-standard),
    transform var(--duration-base) var(--ease-standard),
    box-shadow var(--duration-base) var(--ease-standard);

  animation: whatsapp-pulse 2s infinite;
}

.whatsapp-float svg {
  width: 2rem;
  /* 32px */
  height: 2rem;
  flex-shrink: 0;
}

.whatsapp-float:hover {
  background-color: #1ebe5d;
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(37, 211, 102, 0.55);
}

@keyframes whatsapp-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
  }

  50% {
    box-shadow: 0 0 0 14px rgba(37, 211, 102, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .whatsapp-float {
    animation: none;
  }
}

@media (max-width: 48rem) {
  .whatsapp-float {
    width: 3.5rem;
    height: 3.5rem;
    bottom: 1.25rem;
    right: 1.25rem;
  }
  .whatsapp-float svg {
    width: 1.8rem;
    height: 1.8rem;
  }
}


/* ========================= PAGE LOADER ========================= */
#page-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;

  background-color: #012138; /* --primary hardcoded: variables.css loads after this */

  transition: opacity 0.5s ease, visibility 0.5s ease;
  opacity: 1;
  visibility: visible;
}

#page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#page-loader__logo {
  width: clamp(9rem, 18vw, 14rem);
  height: auto;
  animation: loader-breathe 2s ease-in-out infinite;
}

#page-loader__spinner {
  width: 2.75rem;
  height: 2.75rem;
  border: 3px solid rgba(222, 168, 122, 0.2); /* --accent translucent */
  border-top-color: #DEA87A;                   /* --accent solid */
  border-radius: 50%;
  animation: loader-spin 0.8s linear infinite;
}

@keyframes loader-spin {
  to { transform: rotate(360deg); }
}

@keyframes loader-breathe {
  0%, 100% { opacity: 1;    transform: scale(1); }
  50%       { opacity: 0.75; transform: scale(0.97); }
}

@media (prefers-reduced-motion: reduce) {
  #page-loader__logo    { animation: none; }
  #page-loader__spinner { animation: none; border-top-color: #DEA87A; }
}