/* Mi Necocli: sistema visual escalable
   Benigna IA Tech - tokens, layout y componentes
   ISO 9241, WCAG 2.2 AA
*/

:root {
  --forest: #0b241c;
  --forest-mid: #14352a;
  --forest-deep: #071610;
  --gold: #c9a44a;
  --gold-bright: #e4c878;
  --gold-dim: #8a6f2e;
  --cream: #f6f0e4;
  --paper: #efe6d4;
  --ink: #1a1612;
  --ink-soft: #3d342c;
  --ocean: #1a5f6a;
  --ocean-deep: #0e3a42;
  --sand: #d7c4a3;
  --danger: #7a2e1f;
  --ok: #2d6a4f;
  --white: #fffdf8;
  --overlay: rgba(7, 22, 16, 0.72);
  --shadow: 0 18px 40px rgba(7, 22, 16, 0.18);
  --radius: 18px;
  --radius-sm: 10px;
  --max: 1180px;
  --header-h: 4.5rem;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --step-0: clamp(1.05rem, 0.95rem + 0.4vw, 1.2rem);
  --step-1: clamp(1.2rem, 1rem + 0.8vw, 1.5rem);
  --step-2: clamp(1.55rem, 1.15rem + 1.6vw, 2.15rem);
  --step-3: clamp(2.1rem, 1.4rem + 2.6vw, 3.4rem);
  --step-4: clamp(2.7rem, 1.7rem + 3.8vw, 4.6rem);
  --space: clamp(1rem, 0.7rem + 1.2vw, 2rem);
  --focus: 0 0 0 3px var(--cream), 0 0 0 6px var(--gold);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-contrast="high"] {
  --forest: #000;
  --forest-mid: #111;
  --cream: #fff;
  --paper: #fff;
  --ink: #000;
  --ink-soft: #000;
  --gold: #8a6a00;
  --gold-bright: #a07d00;
}

html[data-font="lg"] { font-size: 112%; }
html[data-font="xl"] { font-size: 124%; }
html[data-font="sm"] { font-size: 96%; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--ink);
  background: var(--cream);
  min-height: 100vh;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--ocean-deep); text-underline-offset: 0.18em; }
a:hover { color: var(--gold-dim); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
::selection { background: var(--gold); color: var(--forest-deep); }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 1000;
  background: var(--gold);
  color: var(--forest-deep);
  padding: 0.7rem 1rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 8px 8px;
}
.skip-link:focus { top: 0; }

.wrap {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 80;
  background: var(--forest);
  color: var(--cream);
  border-bottom: 3px solid var(--gold);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.brand img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  background: #050e0b;
  object-fit: cover;
  flex-shrink: 0;
}
.brand-text strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--gold-bright);
  line-height: 1.1;
}
.brand-text small {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sand);
}

.nav-toggle {
  display: none;
  background: transparent;
  color: var(--gold-bright);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.menu {
  display: flex;
  gap: 0.15rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.menu a {
  color: var(--cream);
  text-decoration: none;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  display: inline-block;
}
.menu a:hover,
.menu a[aria-current="page"] {
  background: rgba(201, 164, 74, 0.18);
  color: var(--gold-bright);
}

.a11y-bar {
  background: var(--forest-mid);
  color: var(--cream);
  font-size: 0.9rem;
  border-bottom: 1px solid rgba(201, 164, 74, 0.25);
}
.a11y-bar .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding-block: 0.35rem;
}
.a11y-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.a11y-tools button {
  font: inherit;
  font-weight: 700;
  background: transparent;
  color: var(--gold-bright);
  border: 1px solid rgba(201, 164, 74, 0.5);
  border-radius: 6px;
  padding: 0.25rem 0.55rem;
  cursor: pointer;
  min-height: 36px;
  min-width: 36px;
}
.a11y-tools button[aria-pressed="true"] {
  background: var(--gold);
  color: var(--forest-deep);
}

/* Hero */
.hero {
  position: relative;
  min-height: min(86vh, 760px);
  display: grid;
  align-items: end;
  color: var(--white);
  overflow: hidden;
  background: var(--forest-deep);
}
.hero img.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7, 22, 16, 0.25) 0%, rgba(7, 22, 16, 0.55) 45%, rgba(7, 22, 16, 0.92) 100%);
}
.hero-copy {
  position: relative;
  z-index: 1;
  padding: clamp(2rem, 6vw, 5rem) 0 3rem;
  max-width: 42rem;
}
.kicker {
  display: inline-block;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold-bright);
  margin-bottom: 0.6rem;
}
h1, h2, h3, .display {
  font-family: var(--font-display);
  line-height: 1.12;
  font-weight: 600;
  letter-spacing: 0.01em;
}
h1 {
  font-size: var(--step-4);
  margin: 0 0 0.6rem;
  color: var(--white);
  text-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
.hero h1 span { color: var(--gold-bright); display: block; }
.lede {
  font-size: var(--step-1);
  margin: 0 0 1.4rem;
  color: var(--paper);
  max-width: 38rem;
}
.actions { display: flex; flex-wrap: wrap; gap: 0.7rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 48px;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.2s var(--ease), background 0.2s, color 0.2s;
}
.btn:hover { transform: translateY(-1px); }
.btn-gold {
  background: var(--gold);
  color: var(--forest-deep);
}
.btn-gold:hover { background: var(--gold-bright); color: var(--forest-deep); }
.btn-ghost {
  background: transparent;
  color: var(--white);
  border-color: var(--gold);
}
.btn-ghost:hover { background: rgba(201, 164, 74, 0.15); color: var(--gold-bright); }
.btn-ink {
  background: var(--forest);
  color: var(--cream);
}
.btn-ink:hover { color: var(--gold-bright); }

/* Sections */
section { padding: clamp(2.5rem, 5vw, 5rem) 0; }
.section-head { max-width: 40rem; margin-bottom: 2rem; }
.section-head h2 {
  font-size: var(--step-3);
  margin: 0.2rem 0 0.6rem;
  color: var(--forest);
}
.section-head p { margin: 0; color: var(--ink-soft); }
.gold-rule {
  width: 4.5rem;
  height: 3px;
  background: var(--gold);
  border: 0;
  margin: 0 0 0.9rem;
}

.panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-pad { padding: clamp(1.1rem, 2vw, 1.8rem); }

.grid-2 { display: grid; gap: 1.4rem; grid-template-columns: 1fr 1fr; }
.grid-3 { display: grid; gap: 1.2rem; grid-template-columns: repeat(3, 1fr); }
.grid-4 { display: grid; gap: 1rem; grid-template-columns: repeat(4, 1fr); }
.grid-5 { display: grid; gap: 1rem; grid-template-columns: repeat(5, 1fr); }

.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}
.card img { aspect-ratio: 16/10; object-fit: cover; width: 100%; }
.card-body { padding: 1.15rem 1.2rem 1.3rem; }
.card h3 { margin: 0 0 0.4rem; font-size: var(--step-1); color: var(--forest); }
.card p { margin: 0; color: var(--ink-soft); }

.pillar {
  background: var(--forest);
  color: var(--cream);
  border-radius: var(--radius);
  padding: 1.3rem 1.2rem 1.4rem;
  border-top: 4px solid var(--gold);
  height: 100%;
}
.pillar .ico {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(201, 164, 74, 0.15);
  color: var(--gold-bright);
  font-size: 1.2rem;
  margin-bottom: 0.7rem;
}
.pillar h3 { margin: 0 0 0.4rem; color: var(--gold-bright); font-size: 1.25rem; }
.pillar p { margin: 0; color: var(--paper); }

/* Stats */
.stats {
  background: var(--forest);
  color: var(--cream);
}
.stat {
  text-align: center;
  padding: 0.6rem;
}
.stat b {
  display: block;
  font-family: var(--font-display);
  font-size: var(--step-3);
  color: var(--gold-bright);
  line-height: 1;
}
.stat span { display: block; margin-top: 0.4rem; font-size: 0.95rem; }

/* Timeline */
.timeline {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 6.2rem;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(var(--gold), var(--forest));
}
.timeline li {
  display: grid;
  grid-template-columns: 5.4rem 1fr;
  gap: 2.2rem;
  padding: 0 0 1.6rem;
  position: relative;
}
.timeline li::after {
  content: "";
  position: absolute;
  left: 5.75rem;
  top: 0.45rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid var(--cream);
  box-shadow: 0 0 0 3px var(--gold);
}
.year {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--gold-dim);
  font-size: 1.2rem;
}
.t-card {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow);
}
.t-card h3 { margin: 0 0 0.35rem; font-size: 1.25rem; color: var(--forest); }
.t-card p { margin: 0 0 0.4rem; }
.source {
  font-size: 0.85rem;
  color: var(--gold-dim);
  font-weight: 700;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  font-size: 0.98rem;
}
th, td {
  padding: 0.75rem 0.9rem;
  text-align: left;
  border-bottom: 1px solid var(--paper);
  vertical-align: top;
}
th {
  background: var(--forest);
  color: var(--gold-bright);
  font-weight: 700;
  position: sticky;
  top: 0;
}
tr:nth-child(even) td { background: #fbf7ee; }
caption {
  text-align: left;
  font-weight: 700;
  padding: 0.8rem 0.4rem;
  color: var(--forest);
}

details.dato {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1.1rem;
  box-shadow: var(--shadow);
  margin-bottom: 0.8rem;
}
details.dato summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--forest);
  font-family: var(--font-display);
  font-size: 1.25rem;
  list-style: none;
}
details.dato summary::-webkit-details-marker { display: none; }
details.dato summary::after {
  content: " +";
  color: var(--gold-dim);
  float: right;
}
details.dato[open] summary::after { content: " ?"; }
details.dato p { margin: 0.7rem 0 0; }

.figure {
  margin: 0;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  background: var(--forest-deep);
}
.figure img { width: 100%; }
.figure figcaption {
  padding: 0.8rem 1rem 1rem;
  color: var(--paper);
  font-size: 0.95rem;
}

.quote {
  border-left: 4px solid var(--gold);
  margin: 1.2rem 0;
  padding: 0.2rem 0 0.2rem 1.1rem;
  font-family: var(--font-display);
  font-size: var(--step-1);
  color: var(--forest);
}

.badge {
  display: inline-block;
  background: rgba(201, 164, 74, 0.18);
  color: var(--gold-dim);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.breadcrumbs {
  padding: 0.9rem 0 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.breadcrumbs a { color: inherit; }
.page-hero {
  background:
    linear-gradient(120deg, rgba(11, 36, 28, 0.88), rgba(14, 58, 66, 0.7)),
    var(--forest);
  color: var(--cream);
  padding: 2.4rem 0 2.6rem;
}
.page-hero h1 { font-size: var(--step-3); margin: 0.3rem 0 0.5rem; }
.page-hero p { margin: 0; max-width: 40rem; color: var(--paper); }

.split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.6rem;
  align-items: center;
}

.chart-box {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.2rem;
}
.chart-box canvas { width: 100%; height: auto; display: block; }
.legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.8rem;
  font-size: 0.92rem;
}
.legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 0.35rem;
}

.notice {
  background: var(--paper);
  border: 1px solid var(--sand);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  margin: 1rem 0;
}
.notice strong { color: var(--forest); }

.footer {
  background: var(--forest-deep);
  color: var(--paper);
  padding: 2.5rem 0 1.4rem;
  margin-top: 2rem;
}
.footer a { color: var(--gold-bright); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.8rem;
}
.footer h2 {
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.7rem;
}
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin: 0.35rem 0; }
.footer-brand {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  margin-bottom: 0.7rem;
}
.footer-brand img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--gold);
}
.legal-line {
  border-top: 1px solid rgba(201, 164, 74, 0.25);
  padding-top: 1rem;
  font-size: 0.88rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  justify-content: space-between;
}

/* Cookie banner - Ley 1581 / ISO 27701 */
.cookie-banner {
  position: fixed;
  z-index: 120;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--forest);
  color: var(--cream);
  border-top: 3px solid var(--gold);
  padding: 1rem 0 1.15rem;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.28);
}
.cookie-banner[hidden] { display: none !important; }
.cookie-grid {
  display: grid;
  grid-template-columns: 1.6fr auto;
  gap: 1rem;
  align-items: center;
}
.cookie-banner h2 { margin: 0 0 0.35rem; font-size: 1.35rem; color: var(--gold-bright); }
.cookie-banner p { margin: 0; font-size: 0.95rem; }
.cookie-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; }
.prefs-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  background: rgba(7, 22, 16, 0.6);
  display: grid;
  place-items: center;
  padding: 1rem;
}
.prefs-modal[hidden] { display: none !important; }
.prefs-card {
  background: var(--cream);
  color: var(--ink);
  width: min(100%, 560px);
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: var(--shadow);
}
.prefs-card h2 { margin-top: 0; color: var(--forest); }
.pref-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--sand);
}
.pref-row label { font-weight: 700; }

.mosaic {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.mosaic a {
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}
.mosaic img { width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.mosaic span {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0.7rem 0.9rem;
  background: linear-gradient(transparent, rgba(7, 22, 16, 0.88));
  color: var(--cream);
  font-weight: 700;
}

.areas {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
}
.area {
  background: var(--white);
  border-radius: var(--radius-sm);
  padding: 1rem;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--gold);
}
.area h3 { margin: 0 0 0.3rem; font-size: 1.1rem; color: var(--forest); }
.area p { margin: 0; font-size: 0.95rem; }

.legal-prose h2 { color: var(--forest); font-size: var(--step-2); }
.legal-prose h3 { color: var(--forest-mid); }
.legal-prose ul { padding-left: 1.2rem; }

#chart-legend-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@media (max-width: 980px) {
  .grid-5, .grid-4, .areas { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-2, .split, .footer-grid, .cookie-grid { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; }
  .site-header { position: sticky; }
  .menu {
    display: none;
    position: absolute;
    left: 0; right: 0;
    top: 100%;
    background: var(--forest-mid);
    flex-direction: column;
    padding: 0.6rem;
    border-bottom: 2px solid var(--gold);
  }
  .menu.is-open { display: flex; }
  .menu a { padding: 0.85rem 1rem; }
  .timeline::before { left: 0.55rem; }
  .timeline li { grid-template-columns: 1fr; padding-left: 1.8rem; gap: 0.4rem; }
  .timeline li::after { left: 0.28rem; }
}

@media (max-width: 640px) {
  .grid-5, .grid-4, .grid-3, .mosaic, .areas { grid-template-columns: 1fr; }
  .brand-text small { display: none; }
  h1 { font-size: clamp(2rem, 10vw, 2.8rem); }
  .cookie-actions { width: 100%; }
  .cookie-actions .btn { flex: 1 1 140px; }
}

@media print {
  .site-header, .a11y-bar, .cookie-banner, .nav-toggle, .btn, .footer, .prefs-modal { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; }
  .hero { min-height: auto; }
}
