/* ==========================================================================
   Asier Lizarraga. Web personal
   Paleta «Bosque» de la skill de transición energética; contrastes verificados.
   ========================================================================== */

:root {
  --paper: #f4f6f1;
  --paper-2: #eaefe7;
  --surface: #ffffff;
  --ink: #16221b;
  --ink-2: #4a5a51;
  --ink-3: #5e6b63;
  --line: #d8ded3;
  --line-strong: #bfc8bb;
  --accent: #0e5138;
  --accent-hover: #0a3f2b;
  --accent-soft: #dce8e0;
  --on-accent: #ffffff;

  /* Colores de dato: verde para lo eléctrico, marrón para las emisiones */
  --data-bev: #2c7a4b;
  --data-co2: #7a4e28;

  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --wrap: 1160px;
  --wrap-wide: 1700px;
  --radius: 6px;
  --radius-lg: 8px;
  --header-h: 64px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #101713;
    --paper-2: #141c17;
    --surface: #18211b;
    --ink: #e7ede7;
    --ink-2: #a3b0a7;
    --ink-3: #8c9a91;
    --line: #26332b;
    --line-strong: #37463c;
    --accent: #5fbf8f;
    --accent-hover: #7fd0a6;
    --accent-soft: #173024;
    --on-accent: #08140e;
    --data-bev: #4fa374;
    --data-co2: #b8906a;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }
svg { width: 1em; height: 1em; flex: none; }
a { color: inherit; }
button { font: inherit; color: inherit; }
p { margin: 0; }
h1, h2, h3 { margin: 0; line-height: 1.2; }

[hidden] { display: none !important; }

::selection { background: var(--accent-soft); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  padding: .6rem 1rem; border-radius: var(--radius);
  background: var(--ink); color: var(--paper);
  text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 1rem; }

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap-wide {
  width: 100%;
  max-width: calc(var(--wrap-wide) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px;
  padding: .65rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: .95rem; font-weight: 600; line-height: 1.2;
  text-decoration: none;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn svg { width: 1.05em; height: 1.05em; }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-header.is-scrolled { border-bottom-color: var(--line); }
.site-header__inner {
  height: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}

.brand { font-size: 1.05rem; font-weight: 700; letter-spacing: -.01em; text-decoration: none; }

.site-nav { display: flex; align-items: center; gap: 1.5rem; }
.site-nav a {
  position: relative;
  padding: .35rem 0;
  font-size: .95rem; font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  transition: color .15s;
}
.site-nav a:hover,
.site-nav a[aria-current="true"] { color: var(--ink); }
.site-nav a[aria-current="true"]::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; background: var(--accent);
}
.site-nav .site-nav__cta {
  padding: .45rem .85rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--ink);
}
.site-nav .site-nav__cta::after { display: none; }
.site-nav .site-nav__cta:hover { border-color: var(--ink); }

.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: transparent;
  place-items: center; cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; }

@media (max-width: 1080px) {
  .nav-toggle { display: grid; }
  .site-nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: .25rem var(--gutter) 1.25rem;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    display: none;
  }
  /* Sin transición: así el menú no asoma al cruzar el punto de corte (al girar una tableta) */
  .site-header.is-open .site-nav { display: flex; }
  .site-nav a { padding: .8rem 0; border-bottom: 1px solid var(--line); }
  .site-nav a[aria-current="true"]::after { display: none; }
  .site-nav .site-nav__cta { margin-top: 1rem; text-align: center; border: 1px solid var(--line-strong); }
}

/* ---------- Portada ---------- */
.hero {
  padding: clamp(2.5rem, 6vw, 5rem) 0 clamp(3rem, 6vw, 5rem);
  border-bottom: 1px solid var(--line);
}
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
}
.hero__name {
  font-size: clamp(2.75rem, 6vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.05;
}
.hero__role {
  margin-top: .75rem;
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  font-weight: 500;
  line-height: 1.35;
  max-width: 22em;
}
.hero__lead { margin-top: 1.5rem; font-size: 1.125rem; color: var(--ink-2); max-width: 34em; }
.hero__cred { margin-top: 1rem; font-size: .95rem; color: var(--ink-3); max-width: 36em; }
.hero__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

.social { list-style: none; padding: 0; margin: 1.5rem 0 0 -.6rem; display: flex; gap: .15rem; }
.social a {
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: var(--radius);
  color: var(--ink-2);
  transition: color .15s, background-color .15s;
}
.social a:hover { color: var(--accent); background: var(--accent-soft); }
.social svg { width: 20px; height: 20px; }

.hero__work { margin: 0; }
.hero__shot {
  width: 100%; height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
}
.hero__work figcaption { margin-top: .9rem; font-size: .9rem; line-height: 1.55; color: var(--ink-3); max-width: 46em; }
.hero__work figcaption strong { display: block; margin-bottom: .15rem; font-size: .95rem; font-weight: 600; color: var(--ink); }
.hero__work figcaption a { color: var(--accent); font-weight: 600; text-underline-offset: 3px; text-decoration-thickness: 1px; }

@media (max-width: 900px) {
  .hero__grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Sections ---------- */
.section { padding: clamp(3.5rem, 8vw, 6rem) 0; }
.section--tinted { background: var(--paper-2); }
.section__head { max-width: 44rem; margin-bottom: clamp(2rem, 4vw, 3rem); }
.section__title {
  font-size: clamp(1.9rem, 3.4vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -.015em;
  line-height: 1.15;
}
.section__lead { margin-top: 1rem; font-size: 1.0625rem; color: var(--ink-2); }
.subhead { font-size: 1.05rem; font-weight: 600; margin-bottom: 1rem; }

/* ---------- Sobre mí ---------- */
.about {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(2.5rem, 6vw, 5rem);
  align-items: start;
}
.about__head { display: flex; align-items: center; gap: 1.25rem; margin-bottom: 1.75rem; }
.portrait {
  position: relative;
  flex: none;
  width: 76px; height: 76px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent-soft);
}
.portrait img {
  position: absolute;
  width: 210%; height: 210%; max-width: none;
  left: -62.5%; top: -80%;
  object-fit: cover;
}

.prose p { color: var(--ink-2); max-width: 38em; }
.prose p + p { margin-top: 1rem; }
.prose strong { color: var(--ink); font-weight: 600; }
.prose a { color: var(--accent); font-weight: 500; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.prose a:hover { text-decoration-thickness: 2px; }

.about__intro .subhead { margin-top: 2.5rem; }
.skills {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem 1.5rem;
  font-size: .95rem;
}
.skills li { position: relative; padding-left: 1rem; }
.skills li::before {
  content: "";
  position: absolute; left: 0; top: .62em;
  width: 5px; height: 5px;
  background: var(--accent);
}

.cv { list-style: none; padding: 0; margin: 0; }
.cv li {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: .9rem 0;
  border-top: 1px solid var(--line);
}
.cv li:last-child { border-bottom: 1px solid var(--line); }
.cv__when { padding-top: .1rem; font-size: .875rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.cv__what { display: flex; flex-direction: column; min-width: 0; }
.cv__what strong { font-weight: 600; line-height: 1.35; }
.cv__what span { margin-top: .15rem; font-size: .9rem; line-height: 1.45; color: var(--ink-2); }
.cv__link {
  align-self: flex-start;
  margin-top: .4rem;
  font-size: .875rem; font-weight: 600;
  color: var(--accent);
  text-underline-offset: 3px; text-decoration-thickness: 1px;
}
.about__cv .cv + .subhead { margin-top: 2.5rem; }

@media (max-width: 900px) {
  .about { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .skills { grid-template-columns: minmax(0, 1fr); }
  .cv li { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
}

/* ---------- Proyecto ---------- */
.projects {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1.25rem;
}
.project { display: flex; flex-direction: column; height: 100%; text-decoration: none; }
.project__img {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  transition: border-color .15s;
}
.project__img img { width: 100%; height: 100%; object-fit: cover; object-position: left top; }
.project__title { margin-top: .85rem; font-size: .98rem; font-weight: 600; line-height: 1.3; }
.project__meta { margin-top: .3rem; font-size: .85rem; color: var(--ink-3); }
.project:hover .project__img { border-color: var(--ink-3); }
.project:hover .project__title { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

@media (max-width: 1080px) { .projects { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 680px)  { .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px)  { .projects { grid-template-columns: minmax(0, 1fr); } }

.sources { margin-top: clamp(3rem, 6vw, 4rem); }
.sources__title { font-size: 1.3rem; font-weight: 600; margin-bottom: 1rem; }
.table-scroll { overflow-x: auto; }
.sources__table { width: 100%; min-width: 680px; border-collapse: collapse; font-size: .95rem; }
.sources__table th,
.sources__table td { text-align: left; padding: .8rem 1.25rem .8rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.sources__table thead th { font-size: .85rem; font-weight: 600; color: var(--ink-2); border-bottom-color: var(--line-strong); }
.sources__table td:first-child { font-weight: 600; }
.sources__table a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.sources__table a:hover { text-decoration-thickness: 2px; }
.sources__note { margin-top: 1rem; font-size: .875rem; color: var(--ink-3); }

/* ---------- Caso Navarra ---------- */
.case { border-bottom: 1px solid var(--line); }
.case .section__head { max-width: 48rem; }

.charts {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(1.25rem, 3vw, 2rem);
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}
.chart {
  display: flex; flex-direction: column;
  margin: 0;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.chart__title { font-size: 1.15rem; font-weight: 600; line-height: 1.3; }
.chart__sub { margin-top: .35rem; font-size: .9rem; line-height: 1.5; color: var(--ink-2); }
.chart__legend { display: flex; align-items: flex-start; gap: .6rem; margin-top: 1.25rem; font-size: .875rem; line-height: 1.5; color: var(--ink-2); }
.chart__key { flex: none; width: 1.5rem; margin-top: .7em; border-top: 2px dashed var(--ink); }
.chart__source { margin-top: .75rem; font-size: .8rem; color: var(--ink-3); }
.chart > .chart__source:last-child { margin-top: auto; padding-top: .75rem; }
.chart__source a { color: inherit; text-underline-offset: 2px; }
.chart__source a:hover { color: var(--ink); }

/* Columnas: cuota mensual de eléctricos (escala de 0 a 35 %) */
.cols {
  --plot: 13rem;
  --bars: 11rem;
  position: relative;
  list-style: none; padding: 0; margin: 1.5rem 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .75rem;
}
.cols li { display: grid; grid-template-rows: var(--plot) auto; }
.cols__plot { grid-row: 1; display: flex; flex-direction: column; justify-content: flex-end; }
.cols__value { position: relative; z-index: 1; align-self: center; margin-bottom: .3rem; padding-inline: .25rem; background: var(--surface); text-align: center; font-size: .9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.cols__bar { height: calc(var(--v) / 35 * var(--bars)); background: var(--data-bev); border-radius: 2px 2px 0 0; }
.cols__label { grid-row: 2; padding-top: .5rem; text-align: center; font-size: .875rem; line-height: 1.35; }
.cols__label small { display: block; font-size: .8rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
/* Línea base y media del periodo (25,58 %) */
.cols::before,
.cols::after { content: ""; position: absolute; left: 0; right: 0; pointer-events: none; }
.cols::before { top: calc(var(--plot) - 25.58 / 35 * var(--bars)); border-top: 2px dashed var(--ink); }
.cols::after { top: var(--plot); border-top: 1px solid var(--ink-3); }

/* Línea: CO₂ medio anual (escala de 0 a 150 g/km). Las etiquetas son HTML para que no se deformen al escalar. */
.line {
  position: relative;
  height: 15rem;
  margin: 1.75rem .75rem 2.25rem 2.25rem;
  font-size: .8rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.line__grid span {
  position: absolute; left: 0; right: 0;
  bottom: calc(var(--v) / 150 * 100%);
  border-top: 1px solid var(--line);
}
.line__grid span:first-child { border-top-color: var(--ink-3); }
.line__grid b { position: absolute; right: calc(100% + .5rem); top: -.75em; font-weight: 400; line-height: 1.5; }
.line__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.line__svg polyline {
  fill: none;
  stroke: var(--data-co2); stroke-width: 2.5;
  stroke-linejoin: round; stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.line__svg .line__partial { stroke-dasharray: 4 4; stroke-linecap: butt; }
.line__dot,
.line__label,
.line__x li { position: absolute; left: calc(var(--i) / 11 * 100%); }
.line__dot,
.line__label { bottom: calc(var(--v) / 150 * 100%); }
.line__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--data-co2);
  transform: translate(-50%, 50%);
}
.line__dot--partial { background: var(--surface); border: 2px solid var(--data-co2); }
.line__label {
  transform: translate(-50%, -.6rem);
  font-size: .875rem; font-weight: 600; color: var(--ink);
  white-space: nowrap;
}
.line__label--start { transform: translate(-.25rem, -.6rem); }
.line__label--end { transform: translate(-100%, calc(100% + .6rem)); }
.line__x { list-style: none; padding: 0; margin: 0; }
.line__x li { top: calc(100% + .5rem); transform: translateX(-50%); }

.chart__data { margin-top: .25rem; font-size: .875rem; }
.chart__data summary { cursor: pointer; font-weight: 600; color: var(--accent); }
.chart__data .table-scroll { margin-top: .75rem; }
.data-table { border-collapse: collapse; font-size: .85rem; font-variant-numeric: tabular-nums; }
.data-table th,
.data-table td { padding: .35rem .6rem; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.data-table th[scope="row"] { text-align: left; font-weight: 600; }
.data-table thead th { font-weight: 600; color: var(--ink-2); }

.findings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5rem clamp(2rem, 5vw, 4rem);
  align-items: start;
  margin-top: clamp(3rem, 6vw, 4rem);
}
.finding { padding-top: 1rem; border-top: 2px solid var(--ink); }
.finding__title { margin-bottom: .6rem; font-size: 1.15rem; font-weight: 600; line-height: 1.3; }
.finding p { color: var(--ink-2); }
.finding p + p { margin-top: .75rem; }

/* Barras horizontales: CO₂ medio por motorización (escala de 0 a 153 g/km) */
.hbars { list-style: none; padding: 0; margin: .25rem 0 0; font-size: .875rem; }
.hbars li {
  display: grid;
  grid-template-columns: 9.5rem minmax(0, 1fr) 2.75rem;
  align-items: center;
  gap: .75rem;
  padding: .3rem 0;
}
.hbars__track { height: 12px; }
.hbars__bar { display: block; height: 100%; width: calc(var(--v) / 153 * 100%); background: var(--data-co2); border-radius: 0 2px 2px 0; }
.hbars__value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.finding .hbars__caption { margin: .4rem 0 1rem; font-size: .8rem; color: var(--ink-3); }

.case__policy,
.case__more {
  margin-top: clamp(3rem, 6vw, 4.5rem);
  padding-top: clamp(3rem, 6vw, 4.5rem);
  border-top: 1px solid var(--line);
}
.case__policy {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 2rem clamp(2rem, 5vw, 4.5rem);
  align-items: start;
}
.policy__text .video-block__text + .video-block__text { margin-top: 1rem; }
.policy__subhead { margin: .35rem 0 1rem; font-size: 1.05rem; font-weight: 600; line-height: 1.3; }
.policy__timeline .cv li { grid-template-columns: 8.5rem minmax(0, 1fr); }
.policy__timeline .cv__what strong a { color: var(--ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.policy__timeline .cv__what strong a:hover { color: var(--accent); text-decoration-thickness: 2px; }
@media (max-width: 900px) {
  .case__policy { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .policy__timeline .cv li { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
}

.case__policy .video-block__text a,
.case__more .video-block__text a,
.case__links a { color: var(--accent); font-weight: 600; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.case__links { display: flex; flex-direction: column; gap: .4rem; margin-top: 1.25rem; font-size: .9rem; }
.case__links a:hover { text-decoration-thickness: 2px; }

@media (max-width: 900px) {
  .charts { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 800px) {
  .findings { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .cols { gap: .5rem; }
  .cols__unit { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .line { height: 12rem; }
  .line__x li.is-minor { display: none; }
  .hbars li { grid-template-columns: 8rem minmax(0, 1fr) 2.5rem; gap: .5rem; }
}

/* ---------- Cuadros de mando ---------- */
.mobile-hint {
  display: none;
  margin-top: 1rem;
  padding: .8rem 1rem;
  border-radius: var(--radius);
  background: var(--accent-soft);
  font-size: .9rem;
}
@media (max-width: 720px) { .mobile-hint { display: block; } }

.dash { padding-top: clamp(2.5rem, 5vw, 3.5rem); }
.dash + .dash { margin-top: clamp(3rem, 6vw, 4.5rem); border-top: 1px solid var(--line); }

.dash__intro {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 1.25rem clamp(2rem, 5vw, 4.5rem);
  margin-bottom: 2rem;
}
.dash__title {
  font-size: clamp(1.45rem, 2.6vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.2;
}
.dash__lead { color: var(--ink-2); }

/* Ficha del conjunto de datos, como en un catálogo de datos abiertos */
.record {
  display: flex; flex-wrap: wrap;
  gap: .75rem 2.25rem;
  margin: 1.25rem 0 0;
  font-size: .9rem;
}
.record dt { font-size: .8rem; color: var(--ink-3); }
.record dd { margin: 0; color: var(--ink); }
.record a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.record a:hover { text-decoration-thickness: 2px; }

.video-links { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; margin-top: 1rem; }
.video-link {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .9rem; font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.video-link svg { width: 13px; height: 13px; }
.video-link:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

.stats { grid-column: 1 / -1; }
.stats__label { margin: .5rem 0 .85rem; font-size: .875rem; font-weight: 600; color: var(--ink-2); }
.stats__grid {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem 2rem;
}
.stats--two .stats__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 50%; }
.stat {
  display: flex; flex-direction: column; gap: .3rem;
  padding-top: .85rem;
  border-top: 2px solid var(--ink);
}
.stat__value {
  font-size: clamp(1.6rem, 2.6vw, 2rem);
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat__value small { margin-left: .1em; font-size: .55em; font-weight: 500; color: var(--ink-2); }
.stat__text { font-size: .875rem; line-height: 1.45; color: var(--ink-2); }

@media (max-width: 960px) {
  .dash__intro { grid-template-columns: minmax(0, 1fr); }
  .stats__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 1.5rem; }
  .stats--two .stats__grid { max-width: none; }
}

/* Pestañas */
.tabs {
  display: flex; flex-wrap: wrap;
  gap: 0 1.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.tabs [role="tab"] {
  position: relative;
  padding: .7rem 0;
  border: 0; background: none;
  font-size: .93rem; font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s;
}
.tabs [role="tab"]:hover { color: var(--ink); }
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); font-weight: 600; }
.tabs [role="tab"][aria-selected="true"]::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--accent);
}

@media (max-width: 720px) {
  .tabs {
    flex-wrap: nowrap; overflow-x: auto;
    margin-inline: calc(-1 * var(--gutter));
    padding-inline: var(--gutter);
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
}

/* Marco del cuadro de mando */
.viz__bar {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.viz__desc { flex: 1 1 26rem; font-size: .93rem; color: var(--ink-2); }
.viz__tools { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }

.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.seg button {
  border: 0; background: transparent;
  padding: .4rem .8rem;
  font-size: .85rem; font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.tool {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .4rem .8rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: transparent;
  font-size: .85rem; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s;
}
.tool svg { width: 15px; height: 15px; }
.tool:hover { border-color: var(--ink); }

.viz__screen {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}
.viz[data-zoom="real"] .viz__screen { overflow: auto; max-height: 82vh; overscroll-behavior: contain; }

.viz__stage { position: relative; margin-inline: auto; overflow: hidden; }
.viz__stage iframe {
  position: absolute; top: 0; left: 0;
  border: 0;
  transform-origin: 0 0;
  background: #fff;
}

.viz__loading {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: .75rem;
  background: var(--surface);
  color: var(--ink-2);
  font-size: .9rem;
  pointer-events: none;
  transition: opacity .3s, visibility .3s;
}
.viz.is-loaded .viz__loading { opacity: 0; visibility: hidden; }
.spinner {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.viz__screen:fullscreen { display: flex; align-items: center; justify-content: center; border: 0; border-radius: 0; max-height: none; overflow: hidden; }
.viz__screen:-webkit-full-screen { display: flex; align-items: center; justify-content: center; border: 0; border-radius: 0; max-height: none; overflow: hidden; }
.viz__exit {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .85rem;
  border: 0; border-radius: var(--radius);
  background: #16221b; color: #fff;
  font-size: .85rem; font-weight: 600;
  cursor: pointer;
}
.viz__exit svg { width: 14px; height: 14px; }

/* Otros trabajos */
.more {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem 3rem;
  flex-wrap: wrap;
  margin-top: clamp(3.5rem, 7vw, 5rem);
  padding: clamp(1.5rem, 3vw, 2rem) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.more__text { flex: 1 1 24rem; }
.more__title { margin-bottom: .4rem; font-size: 1.3rem; font-weight: 600; }
.more__text p { max-width: 40em; color: var(--ink-2); }
.more__actions { display: flex; flex-wrap: wrap; gap: .6rem; }

/* ---------- Informes ---------- */
.docs {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.25rem, 3vw, 2rem);
}
.doc {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: clamp(1.5rem, 3vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.doc__title { font-size: clamp(1.25rem, 2vw, 1.4rem); font-weight: 700; letter-spacing: -.01em; line-height: 1.25; }
.doc__meta { margin-top: .35rem; font-size: .875rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.doc__text { margin-top: 1rem; color: var(--ink-2); }
.doc__video { margin-top: 1rem; }
.doc__stats { list-style: none; padding: 0; margin: 1.25rem 0 0; width: 100%; }
.doc__stats li {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  align-items: baseline;
  gap: 1rem;
  padding: .6rem 0;
  border-top: 1px solid var(--line);
  font-size: .9rem;
  color: var(--ink-2);
}
.doc__stats b { font-size: 1.3rem; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.doc__actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: auto; padding-top: 1.5rem; }

@media (max-width: 800px) { .docs { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Vídeos ---------- */
.videos {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem 1.5rem;
}
.video-card { display: flex; flex-direction: column; gap: .35rem; text-decoration: none; }
.video-card__thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  margin-bottom: .5rem;
  border-radius: var(--radius);
  background: #1b252c;
}
.video-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.video-card__play { position: absolute; inset: 0; display: grid; place-items: center; }
.video-card__play svg {
  width: 48px; height: 48px;
  padding: 14px 12px 14px 16px;
  border-radius: 50%;
  background: rgb(255 255 255 / .92); color: #16221b;
  box-shadow: 0 0 0 1px rgb(22 34 27 / .25);
}
.video-card strong { font-weight: 600; line-height: 1.35; }
.video-card:hover strong { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.video-card__duration {
  position: absolute; right: 8px; bottom: 8px;
  padding: .1rem .4rem;
  border-radius: 3px;
  background: rgb(0 0 0 / .8); color: #fff;
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
}
.video-card__desc { font-size: .93rem; line-height: 1.5; color: var(--ink-2); }
.video-card__related { margin-top: .6rem; font-size: .875rem; color: var(--ink-3); }
.video-card__related a { color: var(--accent); font-weight: 600; text-underline-offset: 3px; text-decoration-thickness: 1px; }

/* Los tutoriales sí son una secuencia: se numeran */
ol.videos { counter-reset: tutorial; }
ol.videos .video-card strong::before {
  counter-increment: tutorial;
  content: counter(tutorial) ". ";
  font-weight: 500;
  color: var(--ink-3);
}

@media (max-width: 900px) { .videos { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .videos { grid-template-columns: minmax(0, 1fr); } }

.video-block + .video-block {
  margin-top: clamp(3rem, 6vw, 4.5rem);
  padding-top: clamp(3rem, 6vw, 4.5rem);
  border-top: 1px solid var(--line);
}
.video-block__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem 2rem; flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.video-block__head > div { flex: 1 1 28rem; max-width: 44rem; }
.video-block__title {
  margin-bottom: .5rem;
  font-size: clamp(1.35rem, 2.4vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.25;
}
.video-block__text { color: var(--ink-2); }

.videos--featured { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.videos--featured .video-card strong { font-size: 1.1rem; }
@media (max-width: 700px) { .videos--featured { grid-template-columns: minmax(0, 1fr); } }

.feature {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
}
.feature .video-card__thumb { margin-bottom: 0; }
.feature__actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }

@media (max-width: 860px) {
  .feature { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Referidos ---------- */
.referrals {
  list-style: none; padding: 0; margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.25rem, 3vw, 2rem);
}
.referral {
  display: flex; flex-direction: column; align-items: flex-start;
  padding: clamp(1.5rem, 3vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.referral__title { font-size: clamp(1.25rem, 2vw, 1.4rem); font-weight: 700; line-height: 1.25; }
.referral__kind { margin-top: .25rem; font-size: .875rem; color: var(--ink-3); }
.referral__text { margin: 1rem 0 1.5rem; color: var(--ink-2); }
.referral__code {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  flex-wrap: wrap;
  width: 100%;
  margin: 0 0 1.5rem;
  padding: .5rem .5rem .5rem .9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  font-size: .9rem;
  color: var(--ink-2);
}
.referral__code b { margin-left: .35rem; font-weight: 600; letter-spacing: .02em; color: var(--ink); }
.referral__cta { margin-top: auto; }
.referrals__note { max-width: 44rem; margin-top: 1.25rem; font-size: .875rem; color: var(--ink-3); }

@media (max-width: 760px) { .referrals { grid-template-columns: minmax(0, 1fr); } }

/* Botón de copiar */
.copy-btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .35rem .7rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: .85rem; font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.copy-btn svg { width: 15px; height: 15px; }
.copy-btn:hover { border-color: var(--ink); }
.copy-btn.is-copied { border-color: var(--accent); color: var(--accent); }

/* ---------- Contacto ---------- */
.contact__grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}
.contact .section__lead { max-width: 30rem; }
.contact__links { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.contact__links > li { border-bottom: 1px solid var(--line); }
.contact-card { display: flex; align-items: center; gap: 1rem; padding: 1rem 0; text-decoration: none; }
.contact-card > svg:first-child { width: 22px; height: 22px; color: var(--ink-2); }
.contact-card > span { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.contact-card strong { font-weight: 600; }
.contact-card > span > span { font-size: .9rem; color: var(--ink-3); overflow-wrap: anywhere; }
.contact-card:hover strong { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

.contact-item--copy { position: relative; }
.contact-item--copy .contact-card { padding-right: 7rem; }
.contact-item--copy .copy-btn { position: absolute; right: 0; top: 50%; transform: translateY(-50%); }

@media (max-width: 480px) {
  .contact-item--copy .contact-card { padding-right: 3.5rem; }
  .contact-item--copy .copy-btn { padding: .5rem; }
  .contact-item--copy [data-copy-label] {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
}

@media (max-width: 860px) { .contact__grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Footer ---------- */
.site-footer { padding: 1.75rem 0; border-top: 1px solid var(--line); font-size: .875rem; color: var(--ink-3); }
.site-footer__inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem 2rem; }

/* ---------- Modal de vídeo ---------- */
.modal {
  width: min(1040px, calc(100vw - 2rem));
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  background: #101713;
  color: #fff;
}
.modal::backdrop { background: rgb(10 15 12 / .8); }
.modal__head { display: flex; align-items: center; gap: 1rem; padding: .75rem .75rem .75rem 1.25rem; }
.modal__title { margin-right: auto; font-weight: 600; }
.modal__yt {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .45rem .85rem;
  border-radius: var(--radius);
  background: rgb(255 255 255 / .1); color: #fff;
  font-size: .85rem; font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.modal__yt:hover { background: rgb(255 255 255 / .2); }
.modal__close {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border: 0; border-radius: var(--radius);
  background: rgb(255 255 255 / .1); color: #fff;
  cursor: pointer;
}
.modal__close:hover { background: rgb(255 255 255 / .2); }
.modal__close svg { width: 18px; height: 18px; }
.modal__video { aspect-ratio: 16 / 9; background: #000; }
.modal__video iframe { display: block; width: 100%; height: 100%; border: 0; }

/* ---------- Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
