/* ==========================================================================
   GPE Network — Base: reset, tipografía y utilidades
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem; /* deja aire bajo el header fijo al saltar a un ancla */
}

body {
  margin: 0;
  background: var(--gpe-bg);
  color: var(--gpe-text);
  font-family: var(--gpe-font-sans);
  font-size: var(--gpe-fs-base);
  line-height: var(--gpe-lh-body);
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* --- Títulos ------------------------------------------------------------ */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--gpe-s4);
  font-family: var(--gpe-font-serif);
  font-weight: 600;
  line-height: var(--gpe-lh-tight);
  letter-spacing: var(--gpe-track-tight);
  color: var(--gpe-carbon);
  text-wrap: balance;
}
h1 { font-size: var(--gpe-fs-3xl); }
h2 { font-size: var(--gpe-fs-2xl); }
h3 { font-size: var(--gpe-fs-xl); }
h4 { font-size: var(--gpe-fs-lg); }
h5, h6 { font-size: var(--gpe-fs-md); }

p { margin: 0 0 var(--gpe-s5); color: var(--gpe-text-2); text-wrap: pretty; }
p:last-child { margin-bottom: 0; }

strong, b { font-weight: 600; color: var(--gpe-carbon); }
em, i { font-style: italic; }
small { font-size: var(--gpe-fs-sm); }

/* --- Enlaces ------------------------------------------------------------ */
a {
  color: var(--gpe-wine);
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: color var(--gpe-dur-fast) var(--gpe-ease);
}
a:hover { color: var(--gpe-wine-dark); text-decoration: underline; }

/* Enlaces dentro de bloques de texto largo: subrayado permanente y discreto */
.gpe-prose a { text-decoration: underline; text-decoration-color: rgba(122, 27, 46, .32); }
.gpe-prose a:hover { text-decoration-color: currentColor; }

/* --- Foco accesible ------------------------------------------------------ */
:focus-visible {
  outline: 2px solid var(--gpe-focus);
  outline-offset: 3px;
  border-radius: 2px;
}
:focus:not(:focus-visible) { outline: none; }

/* --- Medios -------------------------------------------------------------- */
img, svg, video, canvas { display: block; max-width: 100%; height: auto; }
img { border-radius: var(--gpe-radius-sm); }
figure { margin: 0; }
figcaption { margin-top: var(--gpe-s3); font-size: var(--gpe-fs-sm); color: var(--gpe-muted); }

/* --- Listas -------------------------------------------------------------- */
ul, ol { margin: 0 0 var(--gpe-s5); padding-left: 1.25em; color: var(--gpe-text-2); }
li { margin-bottom: var(--gpe-s2); }
li::marker { color: var(--gpe-muted); }

/* --- Formularios --------------------------------------------------------- */
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; }

/* --- Tablas -------------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; margin-bottom: var(--gpe-s5); font-size: var(--gpe-fs-sm); }
th, td { padding: var(--gpe-s3) var(--gpe-s4); text-align: left; border-bottom: 1px solid var(--gpe-line); }
th { font-weight: 600; color: var(--gpe-carbon); }

/* --- Citas y código ------------------------------------------------------ */
blockquote {
  margin: var(--gpe-s6) 0;
  padding-left: var(--gpe-s5);
  border-left: 2px solid var(--gpe-wine);
  font-family: var(--gpe-font-serif);
  font-size: var(--gpe-fs-lg);
  line-height: var(--gpe-lh-snug);
  color: var(--gpe-carbon);
}
code, pre { font-family: var(--gpe-font-mono); font-size: 0.875em; }
code { background: var(--gpe-line-soft); padding: 0.15em 0.4em; border-radius: var(--gpe-radius-sm); }
pre { overflow-x: auto; padding: var(--gpe-s5); background: var(--gpe-carbon); color: #F4F4F2; border-radius: var(--gpe-radius); }
pre code { background: none; padding: 0; }

hr { border: none; border-top: 1px solid var(--gpe-line); margin: var(--gpe-s7) 0; }

/* --- Prosa: bloques de texto editorial ----------------------------------- */
.gpe-prose { max-width: var(--gpe-maxw-text); font-size: var(--gpe-fs-md); }
.gpe-prose > * + * { margin-top: var(--gpe-s5); }
.gpe-prose h2 { margin-top: var(--gpe-s7); }
.gpe-prose h3 { margin-top: var(--gpe-s6); }
.gpe-prose :first-child { margin-top: 0; }

/* Capitular opcional: añade la clase .gpe-prose--lead al primer párrafo */
.gpe-prose--lead > p:first-of-type {
  font-size: var(--gpe-fs-lg);
  line-height: 1.5;
  color: var(--gpe-carbon);
}

/* --- Utilidades ---------------------------------------------------------- */
.gpe-visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.gpe-skip-link {
  position: absolute; top: -100px; left: var(--gpe-s4);
  z-index: var(--gpe-z-skip);
  background: var(--gpe-carbon); color: #fff;
  padding: var(--gpe-s3) var(--gpe-s5); border-radius: 0 0 var(--gpe-radius) var(--gpe-radius);
  transition: top var(--gpe-dur) var(--gpe-ease);
}
.gpe-skip-link:focus { top: 0; color: #fff; text-decoration: none; }

.gpe-text-center { text-align: center; }
.gpe-nowrap { white-space: nowrap; }
.gpe-mt-0 { margin-top: 0 !important; }
.gpe-mb-0 { margin-bottom: 0 !important; }

/* El atributo hidden tiene que ganar SIEMPRE.
   El navegador trae [hidden] { display: none }, pero es una regla débil:
   cualquier componente que declare su propio display la pisa. Las tarjetas
   de proyecto usan display:flex, así que el filtrado las marcaba como
   ocultas y seguían viéndose igual. Con esto queda resuelto para todo el
   sitio, no solo para las tarjetas. */
[hidden] { display: none !important; }

/* Respeta la preferencia del sistema: sin movimiento, sin animaciones */
@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;
  }
}

/* --- Impresión ----------------------------------------------------------- */
@media print {
  .gpe-header, .gpe-footer, .gpe-hero__canvas, .gpe-filters { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  a::after { content: " (" attr(href) ")"; font-size: 9pt; color: #666; }
}
