/* ---------- Tokens (paleta tomada del logo) ---------- */
:root {
  --bg: #f0eee8;
  --surface: #ffffff;
  --ink: #0e2347;      /* azul noche */
  --muted: #4a5b78;
  --line: #d8e0ec;
  --blue: #1f66d1;
  --green: #2e9e6b;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --wrap: 72rem;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 6rem; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 1.0625rem/1.65 var(--font); display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
h1, h2, h3 { line-height: 1.12; margin: 0 0 .6em; letter-spacing: -.02em; }
h1 { font-size: clamp(2.2rem, 5.4vw, 3.8rem); font-weight: 750; }
h2 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; margin-top: 2rem; letter-spacing: -.01em; }
p { max-width: 64ch; margin: 0 0 1rem; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--blue); text-underline-offset: .2em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.lead { font-size: 1.2rem; color: var(--muted); }
.note { font-size: .9rem; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 20; }
.skip:focus { left: 0; }

/* ---------- Estructura ---------- */
main > section, footer { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
main { flex: 1 0 auto; display: flex; flex-direction: column; width: 100%; }
main > section { flex: none; padding-block: clamp(3rem, 7vw, 5.5rem); border-top: 1px solid var(--line); }
/* Contacto: siempre visible, pegado abajo aunque el apartado activo sea corto */
#contacto { margin-top: auto; padding-block: clamp(2rem, 5vw, 3.5rem); }
@keyframes view-in { from { opacity: 0; } }
@media (prefers-reduced-motion: no-preference) { main > section[data-view]:not([hidden]) { animation: view-in .3s ease both; } }
main > .hero, main > .funciones { border-top: 0; }
/* Menú fijo: ocupa todo el ancho y el contenido se alinea con el resto de la web */
.top { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem 2rem;
  padding: .7rem max(1.25rem, calc((100% - var(--wrap)) / 2)); background: rgba(240, 238, 232, .92); border-bottom: 1px solid var(--line); }
@supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
  .top { background: rgba(240, 238, 232, .8); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
}
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; letter-spacing: .02em; color: var(--ink); text-decoration: none; font-size: 1.2rem; }
.top ul { display: flex; flex-wrap: wrap; gap: .25rem 1.4rem; list-style: none; margin: 0; padding: 0; }
.top nav a { color: var(--ink); text-decoration: none; font-weight: 500; padding-block: .3rem; border-bottom: 2px solid transparent; }
.top nav a:hover { border-bottom-color: var(--green); }
.top nav a[aria-current="page"] { border-bottom-color: var(--blue); color: var(--blue); }
@media (max-width: 44rem) {
  .top nav { flex-basis: 100%; overflow-x: auto; }
  .top ul { flex-wrap: nowrap; white-space: nowrap; }
}

/* ---------- Botones ---------- */
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }
.btn { display: inline-block; padding: .8rem 1.4rem; background: var(--blue); color: #fff; border: 2px solid var(--blue); border-radius: 999px; text-decoration: none; font-weight: 600; }
.btn:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-quiet { background: transparent; color: var(--blue); }

/* ---------- Hero: foto con la silueta del cristal del logo ---------- */
.hero { display: grid; gap: 2.5rem; align-items: center; padding-block: clamp(1.5rem, 4vw, 3rem); }
.hero h1 { font-size: clamp(1.9rem, 3.6vw, 2.9rem); }
.hero .lead { font-size: 1.05rem; line-height: 1.6; }
.hero .actions { margin-top: 1.25rem; }

.gem { margin: 0; aspect-ratio: 4 / 5; max-height: 36rem; justify-self: center; width: min(100%, 28rem);
  clip-path: polygon(50% 0, 100% 28%, 94% 68%, 50% 100%, 6% 68%, 0 28%); background: var(--blue); }
.gem img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%; }
/* En pantallas anchas la portada (texto, botones y foto) cabe entera en la primera pantalla, bajo el menú */
@media (min-width: 56rem) {
  .hero { grid-template-columns: 1.15fr 1fr; min-height: calc(100vh - 4.5rem); min-height: calc(100svh - 4.5rem); padding-block: 1rem 2rem; }
  .gem { height: min(34rem, calc(100vh - 9rem)); height: min(34rem, calc(100svh - 9rem)); width: auto; max-width: 100%; max-height: none; }
}
/* ---------- Funciones del material ---------- */
.funciones ul { list-style: none; margin: 0 auto; padding: 0; display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.funciones li { border-top: 4px solid var(--blue); padding-top: .9rem; display: grid; gap: .25rem; }
.funciones li:nth-child(even) { border-top-color: var(--green); }
.funciones span { color: var(--muted); }
.funciones { padding-block: 1rem 3rem; }

/* ---------- Proyecto ---------- */
.cols { display: grid; gap: 2.5rem; }
@media (min-width: 52rem) { .cols { grid-template-columns: 1fr 1fr; } }
.plain { padding-left: 1.2rem; margin: 0 0 1rem; max-width: 62ch; }
.plain li { margin-bottom: .6rem; }
.lab { display: grid; gap: 2rem; margin-top: 3rem; align-items: center; }
@media (min-width: 52rem) { .lab { grid-template-columns: 20rem 1fr; } }
figure { margin: 0; }
figcaption { font-size: .9rem; color: var(--muted); margin-top: .5rem; }
.lab img { border-radius: 4px; aspect-ratio: 3 / 4; object-fit: cover; width: 100%; }
.lab h3 { margin-top: 0; }

/* ---------- Paquetes de trabajo ---------- */
/* ---------- Equipo ---------- */
.people { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem 2rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.people li { display: grid; gap: .2rem; align-content: start; padding-top: .9rem; border-top: 1px solid var(--line); }
.people em { color: var(--green); font-style: normal; font-weight: 600; font-size: .95rem; }
.people span { color: var(--muted); }

/* ---------- Resultados ---------- */
.pubs { list-style: none; margin: 0; padding: 0; max-width: 50rem; }
.pubs li { display: grid; gap: .15rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
.pubs span { color: var(--muted); font-size: .95rem; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 32px -18px rgba(14, 35, 71, .35); }
table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 46rem; font-size: .95rem; }
th, td { text-align: right; padding: .75rem 1.1rem; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; vertical-align: middle; }
th:first-child, td:first-child { text-align: left; }
thead th { background: var(--ink); color: #fff; font-weight: 600; line-height: 1.25; padding-block: .95rem; vertical-align: bottom; border-bottom: 3px solid var(--blue); }
thead th:nth-child(even) { border-bottom-color: var(--green); }
thead th:first-child { position: sticky; left: 0; z-index: 1; }
thead th small { display: block; margin-top: .15rem; font-size: .8rem; font-weight: 400; opacity: .72; }
tbody th { font-weight: 600; text-align: left; background: var(--surface); position: sticky; left: 0; white-space: nowrap; }
tbody tr:hover > * { background: #f3f7fd; }
tbody tr.group > * { background: #eaf0f9; color: var(--muted); font-size: .9rem; font-weight: 600; padding-block: .5rem; }
tbody:last-of-type tr:last-child > * { border-bottom: 0; }
.tag { display: inline-block; margin-right: .6rem; padding: .05rem .45rem; border-radius: 6px; background: var(--ink); color: #fff; font-size: .78rem; font-weight: 700; }
.flow { display: flex; align-items: center; justify-content: flex-end; gap: .8rem; }
.flow i { position: relative; flex: 0 0 6rem; height: .5rem; border-radius: 99px; background: #e6edf7; overflow: hidden; }
.flow i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: calc(var(--v) * 1%); min-width: .3rem; border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green)); background-size: 6rem 100%; }
.flow span { min-width: 4.6ch; text-align: right; }
.pill { display: inline-block; min-width: 3.8rem; padding: .15rem .65rem; border-radius: 999px; font-size: .9rem; font-weight: 600; text-align: center; }
.pill.lo { background: #e0f3ea; color: #17623f; }
.pill.mid { background: #fdefd0; color: #7d5200; }
.pill.hi { background: #fde4e0; color: #9f2519; }

/* Tabla de paquetes de trabajo */
.crono { min-width: 54rem; }
.crono td.desc, .crono th.desc { text-align: left; min-width: 22rem; }
.crono td.desc { display: table-cell; }
.crono td.desc strong { display: block; line-height: 1.3; }
.crono td.desc span { display: block; color: var(--muted); font-size: .9rem; line-height: 1.45; margin-top: .15rem; max-width: 40ch; }
.crono .t { position: relative; text-align: center; width: 3.4rem; padding-inline: .3rem; border-left: 1px solid var(--line); }
.crono thead th.t { border-left-color: rgba(255, 255, 255, .15); }
.crono td.on::before { content: ""; display: inline-block; width: .9rem; height: .9rem; border-radius: 50%; background: var(--blue); vertical-align: middle; }
.crono tbody th .tag { margin: 0; }

/* Documentos */
.docs { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); max-width: 50rem; }
.doc { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: start; height: 100%; padding: 1rem 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; color: var(--ink); text-decoration: none; }
.doc:hover { border-color: var(--blue); color: var(--ink); }
.doc strong { display: block; line-height: 1.3; }
.doc span span { display: block; margin-top: .25rem; color: var(--muted); font-size: .92rem; line-height: 1.5; }
.doc-type { display: grid; place-items: center; width: 2.6rem; height: 3.2rem; border-radius: 6px; background: var(--ink); color: #fff; font-size: .8rem; font-weight: 700; }

/* Galería */
.gallery { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); margin-top: 2rem; }
.gallery figure { display: grid; gap: .5rem; align-content: start; }
.thumb { display: block; width: 100%; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); cursor: zoom-in; }
.thumb img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .3s ease; }
.thumb:hover img { transform: scale(1.03); }
.gallery .paper .thumb img { object-fit: contain; background: #fff; }
.gallery figcaption { margin: 0; }
#lightbox { width: min(94vw, 72rem); max-height: 94vh; padding: 0; border: 0; border-radius: 14px; background: var(--surface); color: var(--ink); overflow: hidden; }
#lightbox::backdrop { background: rgba(14, 35, 71, .75); }
#lightbox[open] { display: grid; }
#lightbox img { width: 100%; max-height: calc(94vh - 5rem); object-fit: contain; background: #fff; }
#lightbox p { margin: 0; padding: .8rem 1.2rem; max-width: none; color: var(--muted); }
.lb-close { position: absolute; top: .75rem; right: .75rem; padding: .45rem 1rem; border: 0; border-radius: 999px; background: var(--ink); color: #fff; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; }
.lb-close:hover { background: var(--blue); }

/* ---------- Noticias ---------- */
.log { list-style: none; padding: 0; margin: 0 0 1.5rem; max-width: 44rem; }
.log li { display: grid; grid-template-columns: 7rem 1fr; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.log time { color: var(--muted); }

/* ---------- Pie ---------- */
footer { padding-block: 2rem 3rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .92rem; }
footer p { max-width: 70ch; }

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