@font-face {
  font-family: 'Geist'; font-style: normal; font-weight: 300 600; font-display: swap;
  src: url('fonts/Geist-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist Mono'; font-style: normal; font-weight: 400 500; font-display: swap;
  src: url('fonts/GeistMono-latin.woff2') format('woff2');
}

:root {
  --bg: #f4f4f1;
  --ink: #151815;
  --body: #2b2f2a;
  --muted: #5d625c;
  --faint: #8a8f88;
  --line: #d9dad4;
  --hover: #e6e7e1;
  --green: #1c7f3a;
  --green-dark: #145e2b;
  --gutter: clamp(20px, 5vw, 64px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --mono: 'Geist Mono', ui-monospace, monospace;
  --controls: background-color .2s ease, border-color .2s ease, color .2s ease, transform .2s var(--ease);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
body { font-family: 'Geist', system-ui, sans-serif; font-size: 16px; line-height: 1.55; }
p { margin: 0; }
a { color: var(--green); text-underline-offset: .18em; }
a:hover { color: var(--green-dark); }
::selection { background: var(--green); color: #fff; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.eyebrow {
  font-family: var(--mono); font-weight: 400; font-size: 12px;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}

/* Estructura */
.page { min-height: 100vh; display: flex; flex-direction: column; }
.site-header {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 16px; padding: 28px var(--gutter);
}
.logo-link { display: block; line-height: 0; transition: opacity .2s; }
.logo-link:hover { opacity: .7; }
.logo { display: block; width: 200px; height: auto; mix-blend-mode: multiply; }
.site-nav { display: flex; flex-wrap: wrap; gap: 6px; font-size: 14px; }
.site-nav a {
  flex: none; white-space: nowrap; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: var(--controls);
}
.site-nav a:hover { border-color: var(--ink); background: #fff; color: var(--ink); transform: translateY(-1px); }
.site-nav a:active { transform: scale(.96); }
.site-nav a[aria-current="page"], .site-nav a[aria-current="page"]:hover {
  border-color: var(--ink); background: var(--ink); color: var(--bg); transform: none;
}
main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 var(--gutter); }
.site-footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  padding: 24px var(--gutter); border-top: 1px solid var(--line); font-size: 13px; color: var(--muted);
}
.site-footer div { display: flex; flex-wrap: wrap; gap: 20px; }
.site-footer a { color: var(--muted); transition: color .2s; }
.site-footer a:hover { color: var(--green); }

/* Cabecera de página */
.hero {
  padding: clamp(48px, 10vw, 120px) 0 clamp(40px, 6vw, 72px); display: flex; flex-wrap: wrap;
  justify-content: space-between; gap: 32px; align-items: flex-end;
}
.hero h1 {
  flex: none; max-width: 100%; margin: 0; font-weight: 400; font-size: clamp(min(44px, 11.5vw), 7.2vw, 96px);
  line-height: .98; letter-spacing: -.035em; text-wrap: balance;
}
.hero h1 span { color: var(--green); }
.hero p { flex: 1 1 300px; max-width: 380px; margin-left: auto; color: var(--muted); text-wrap: pretty; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--line); color: var(--ink);
  text-decoration: none; font-size: 14px; transition: var(--controls);
}
.btn:hover { border-color: var(--ink); background: #fff; color: var(--ink); transform: translateY(-2px); }
.btn:active { transform: scale(.96); }
.btn-primary { padding: 0 18px 0 20px; border-color: var(--green); background: var(--green); color: #fff; }
.btn-primary:hover { border-color: var(--green-dark); background: var(--green-dark); color: #fff; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hero .btn { margin-left: auto; flex: none; white-space: nowrap; padding: 0 18px 0 20px; }
.hero .btn span { color: var(--green); }

/* Documentos */
.docs-head {
  display: flex; justify-content: space-between; gap: 16px; padding: 0 0 12px;
  border-bottom: 1px solid var(--ink);
}
.docs { list-style: none; margin: 0; padding: 0; }
.doc { border-bottom: 1px solid var(--line); }
.doc-row {
  display: grid; grid-template-columns: minmax(0, 1fr);
  gap: 20px 32px; align-items: center; padding: 28px 0;
}
.doc-when { display: flex; align-items: baseline; gap: 20px; }
.doc-num { font-family: var(--mono); font-size: 13px; color: var(--faint); }
.doc-year {
  font-size: clamp(40px, 5vw, 64px); font-weight: 300; letter-spacing: -.04em;
  line-height: 1; font-variant-numeric: tabular-nums;
}
.doc-link {
  display: flex; flex-direction: column; gap: 4px; min-width: 0; color: var(--ink);
  text-decoration: none; transition: color .2s ease, transform .3s var(--ease);
}
.doc-link:hover { color: var(--green); transform: translateX(6px); }
.doc-kind {
  font-family: var(--mono); font-size: 12px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--green);
}
.doc-title { font-size: 22px; font-weight: 500; letter-spacing: -.01em; line-height: 1.25; }
.doc-date { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; }
.doc-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; }
.size { font-family: var(--mono); font-size: 13px; }

/* Contacto */
.contact {
  margin: clamp(80px, 12vw, 160px) 0 clamp(56px, 8vw, 96px); display: grid;
  grid-template-columns: minmax(0, 1fr); gap: 32px;
  padding-top: 24px; border-top: 1px solid var(--ink);
}
.contact h2 { margin: 0; }
.contact address { font-style: normal; font-size: 20px; line-height: 1.45; letter-spacing: -.01em; }
.contact strong { display: block; font-weight: 500; text-wrap: balance; }
.contact strong + br { display: none; }
.contact-email { display: flex; flex-direction: column; gap: 6px; font-size: 20px; letter-spacing: -.01em; }
.contact-email a { color: var(--ink); text-decoration-color: var(--green); text-decoration-thickness: 1.5px; transition: color .2s; }
.contact-email a:hover { color: var(--green); }

/* Documentos y contacto comparten rejilla: una columna, luego año + detalle, luego tres. */
@media (min-width: 640px) {
  .doc-row, .contact { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
  .doc-actions { grid-column: 2; justify-content: flex-start; }
  .contact-email { grid-column: 2; }
}
@media (min-width: 960px) {
  .doc-row, .contact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .doc-actions { grid-column: auto; justify-content: flex-end; }
  .contact-email { grid-column: auto; }
}

/* Visor de PDF */
.viewer {
  width: min(1000px, calc(100% - 48px)); height: calc(100% - 48px); max-width: none; max-height: none;
  padding: 0; border: 0; border-radius: 20px; overflow: hidden; background: var(--bg); color: var(--ink);
}
.viewer[open] { display: flex; flex-direction: column; animation: viewer-in .3s var(--ease); }
.viewer::backdrop { background: rgba(21, 24, 21, .55); backdrop-filter: blur(6px); animation: fade-in .2s ease-out; }
.viewer-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 12px 12px 24px; border-bottom: 1px solid var(--line);
}
.viewer-heading { display: flex; flex-direction: column; min-width: 0; }
.viewer-heading strong { font-weight: 500; }
.viewer-heading span { font-size: 13px; color: var(--muted); }
.viewer-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.viewer-actions .btn { min-height: 40px; }
.viewer-actions .btn:hover { transform: none; }
.viewer-close {
  display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 999px;
  background: transparent; color: var(--ink); cursor: pointer; transition: var(--controls);
}
.viewer-close:hover { background: var(--hover); transform: rotate(90deg); }
.viewer-close:active { transform: scale(.9); }
.viewer-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.viewer iframe { flex: 1; width: 100%; border: 0; background: #fff; }

/* Páginas legales */
.legal-layout {
  display: flex; flex-wrap: wrap; gap: 48px clamp(32px, 6vw, 96px); align-items: flex-start;
  padding-bottom: clamp(56px, 8vw, 96px);
}
.toc { flex: 1 1 240px; max-width: 320px; border-top: 1px solid var(--ink); padding-top: 16px; }
.toc .eyebrow { display: block; margin-bottom: 12px; }
.toc nav { display: flex; flex-direction: column; font-size: 14px; line-height: 1.35; }
.toc a { display: flex; align-items: baseline; gap: 12px; padding: 7px 0; color: var(--ink); text-decoration: none; transition: color .2s; }
.toc a:hover, .toc a.is-active { color: var(--green); }
.toc-n { font-family: var(--mono); font-size: 12px; color: var(--faint); padding-top: 1px; transition: color .2s; }
.toc a.is-active .toc-n { color: var(--green); }
.toc-label { display: flex; align-items: center; gap: 10px; }
.toc-label::before { content: ""; flex: none; width: 0; height: 1px; margin-right: -10px; background: var(--green); transition: width .3s var(--ease), margin-right .3s var(--ease); }
.toc a.is-active .toc-label::before { width: 16px; margin-right: 0; }
/* El índice solo se fija cuando va al lado del texto; apilado taparía el artículo. */
@media (min-width: 960px) { .toc { position: sticky; top: 24px; } }

.legal {
  flex: 3 1 520px; max-width: 720px; min-width: 0; font-size: 16px; line-height: 1.72;
  color: var(--body); overflow-wrap: anywhere;
}
.legal section {
  display: flex; flex-direction: column; gap: 16px; padding: 16px 0 48px;
  border-top: 1px solid var(--line); scroll-margin-top: 24px;
}
.legal section:first-child { border-top-color: var(--ink); }
.legal section:last-child { padding-bottom: 0; }
.legal h2 { margin: 0 0 8px; display: flex; gap: 16px; font-weight: 500; font-size: 13px; letter-spacing: .06em; color: var(--ink); }
.legal h2 span { flex: none; font-family: var(--mono); color: var(--green); }
.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; background: var(--green);
  transform: scaleX(0); transform-origin: 0 50%; z-index: 40;
}

/* Movimiento */
@keyframes rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes viewer-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

@media print {
  .site-nav, .toc, .progress, .viewer, .doc-actions, .hero .btn { display: none !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; animation: none !important; }
}
