/* Base v2: reset mínimo + tipografía. Solo se carga en templates v2. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--xg-nav-height) + 20px);
  -webkit-text-size-adjust: 100%;
}

body.xg {
  margin: 0;
  background: var(--xg-surface);
  color: var(--xg-on-surface);
  font-family: var(--xg-font-body);
  font-size: var(--xg-fs-body1);
  line-height: 1.5;
  letter-spacing: 0.15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

:where(.xg) img,
:where(.xg) svg,
:where(.xg) video,
:where(.xg) canvas {
  display: block;
  max-width: 100%;
}

:where(.xg) a {
  color: inherit;
  text-decoration: none;
}

:where(.xg) button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

:where(.xg) h1,
:where(.xg) h2,
:where(.xg) h3,
:where(.xg) h4,
:where(.xg) h5,
:where(.xg) h6,
:where(.xg) p,
:where(.xg) ul,
:where(.xg) ol,
:where(.xg) figure {
  margin: 0;
}

:where(.xg) ul,
:where(.xg) ol {
  padding: 0;
  list-style: none;
}

:where(.xg) :focus-visible {
  outline: 2px solid var(--xg-primary);
  outline-offset: 3px;
  border-radius: 4px;
}

:where(.xg) ::selection {
  background: var(--xg-primary-container);
  color: var(--xg-on-surface);
}

/* Tipografía (estilos de texto del Figma) */
.xg-h2,
.xg-h3,
.xg-h4,
.xg-h5,
.xg-h6,
.xg-subtitle {
  font-family: var(--xg-font-display);
  font-weight: 500;
  color: var(--xg-on-surface);
}

.xg-h2 { font-size: var(--xg-fs-h2); line-height: 1.2; letter-spacing: -0.5px; }
.xg-h3 { font-size: var(--xg-fs-h3); line-height: 1.2; }
.xg-h4 { font-size: var(--xg-fs-h4); line-height: 1.2; letter-spacing: 0.25px; }
.xg-h5 { font-size: var(--xg-fs-h5); line-height: 1.25; }
.xg-h6 { font-size: var(--xg-fs-h6); line-height: 1.2; letter-spacing: 0.15px; }
.xg-subtitle { font-size: var(--xg-fs-subtitle); line-height: 1.25; letter-spacing: 0.15px; }

.xg-body1 {
  font-size: var(--xg-fs-body1);
  line-height: 1.5;
  letter-spacing: 0.15px;
  color: var(--xg-on-surface-variant);
}

.xg-body2 {
  font-size: var(--xg-fs-body2);
  line-height: 1.43;
  letter-spacing: 0.17px;
  color: var(--xg-outline);
}

.xg-overline {
  font-family: var(--xg-font-body);
  font-weight: 500;
  font-size: var(--xg-fs-overline);
  line-height: 1;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--xg-outline);
}

/* Layout */
.xg-main {
  padding-top: var(--xg-nav-height);
}

.xg-container {
  width: 100%;
  max-width: var(--xg-page-max);
  margin-inline: auto;
  padding-inline: var(--xg-gutter);
}

.xg-section {
  padding-block: var(--xg-space-6);
}

.xg-skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 1000;
  padding: 10px 16px;
  background: var(--xg-primary);
  color: var(--xg-surface);
  border-radius: var(--xg-radius-sm);
  font-family: var(--xg-font-display);
  font-weight: 500;
  transition: top var(--xg-dur) var(--xg-ease-out);
}

.xg-skip-link:focus {
  top: 12px;
}

.xg-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/*
 * Reveal on scroll. Solo se oculta si JS está activo (.xg-js), así el contenido
 * nunca queda invisible si el script falla.
 */
.xg-js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition:
    opacity var(--xg-dur-slow) var(--xg-ease-out),
    transform var(--xg-dur-slow) var(--xg-ease-out);
  transition-delay: var(--xg-delay, 0ms);
}

.xg-js [data-reveal="fade"] {
  transform: none;
}

.xg-js [data-reveal="scale"] {
  transform: scale(0.94);
}

.xg-js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

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

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

  .xg-js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
