/* Isaac Martínez Ríos — portafolio · "Informe de análisis" */

:root {
  --paper: #f5f4f0;
  --paper-deep: #ebe9e2;
  --ink: #1a1c22;
  --ink-2: #474b57;
  --ink-3: #626674;
  --rule: #d4d1c8;
  --rule-strong: #1a1c22;
  --indigo: #3d3a9e;
  --indigo-deep: #2c2a7a;
  --indigo-wash: #e4e3f2;
  --ochre: #b27a1e;
  --ochre-ink: #855a12;
  --series-ref: #a19f97;

  --serif: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --sans: "Source Sans 3", "Source Sans Pro", system-ui, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.625rem;
  --step-3: clamp(1.9rem, 1.4rem + 1.6vw, 2.6rem);
  --step-4: clamp(2.6rem, 1.6rem + 3.6vw, 4.75rem);

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6.5rem;

  --page: 1240px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --radius: 3px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
  scrollbar-color: var(--ink-3) var(--paper-deep);
}

html[lang="es"] [lang="en"],
html[lang="en"] [lang="es"] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--indigo); color: var(--paper); }

img { max-width: 100%; display: block; height: auto; }

a {
  color: var(--indigo);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color 160ms ease-out, text-decoration-color 160ms ease-out;
}
a:hover { color: var(--indigo-deep); text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--indigo);
  outline-offset: 3px;
  border-radius: 2px;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0;
}

p { margin: 0 0 var(--space-2); text-wrap: pretty; }

.skip {
  position: absolute; left: var(--gutter); top: -4rem;
  background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; z-index: 20;
}
.skip:focus { top: 0.5rem; }

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Masthead ---------- */

.masthead {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.masthead .wrap {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 3.75rem;
}
.masthead__name {
  font-family: var(--serif); font-weight: 600; font-size: 1.125rem;
  color: var(--ink); text-decoration: none; margin-right: auto; white-space: nowrap;
}
.masthead__name:hover { color: var(--indigo); }
.masthead nav ul { display: flex; gap: var(--space-3); list-style: none; margin: 0; padding: 0; }
.masthead nav a {
  color: var(--ink-2); text-decoration: none; font-size: 0.95rem; font-weight: 600;
  padding: 0.4rem 0; border-bottom: 2px solid transparent;
}
.masthead nav a:hover, .masthead nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--indigo); }

.lang {
  display: inline-flex; border: 1px solid var(--ink); border-radius: var(--radius);
  overflow: hidden; flex: none;
}
.lang button {
  font: 700 0.78rem/1 var(--sans); letter-spacing: 0.06em;
  background: transparent; color: var(--ink); border: 0; padding: 0.5rem 0.65rem; cursor: pointer;
  transition: background 160ms ease-out, color 160ms ease-out;
}
.lang button + button { border-left: 1px solid var(--ink); }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.lang button:not([aria-pressed="true"]):hover { background: var(--indigo-wash); }

@media (max-width: 760px) {
  .masthead .wrap { flex-wrap: wrap; row-gap: 0; padding-top: 0.5rem; }
  .masthead nav { order: 3; width: 100%; overflow-x: auto; }
  .masthead nav ul { gap: var(--space-3); padding: 0.35rem 0 0.6rem; }
}

/* ---------- Buttons ---------- */

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem 1.25rem; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font: 700 0.95rem/1 var(--sans);
  padding: 0.85rem 1.2rem; border-radius: var(--radius);
  border: 1px solid var(--ink); color: var(--ink); background: transparent; text-decoration: none;
  transition: background 160ms ease-out, color 160ms ease-out, border-color 160ms ease-out;
}
.btn:hover { background: var(--ink); color: var(--paper); text-decoration: none; }
.btn--primary { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.btn--primary:hover { background: var(--indigo-deep); border-color: var(--indigo-deep); color: #fff; }
.btn svg { width: 1em; height: 1em; }
.link-arrow { font-weight: 700; text-decoration: none; }
.link-arrow::after { content: "→"; display: inline-block; margin-left: 0.35em; transition: transform 200ms cubic-bezier(.16,1,.3,1); }
.link-arrow:hover::after { transform: translateX(4px); }

/* ---------- Cover (home first viewport) ---------- */

.cover { padding: var(--space-5) 0 var(--space-5); border-bottom: 1px solid var(--rule-strong); }
.cover__grid {
  display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  gap: var(--space-5); align-items: center;
}
.cover h1 { font-size: var(--step-4); font-weight: 600; letter-spacing: -0.025em; max-width: 12ch; }
.cover__lede {
  font-family: var(--serif); font-size: clamp(1.15rem, 1rem + 0.5vw, 1.4rem); line-height: 1.5;
  color: var(--ink); margin: var(--space-3) 0 var(--space-3); max-width: 36ch;
}
.byline {
  display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 0 0 var(--space-4);
  padding: var(--space-2) 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  font-size: var(--step--1); color: var(--ink-2); list-style: none; padding-left: 0;
}
.byline strong { color: var(--ink); font-weight: 700; }

@media (max-width: 900px) {
  .cover { padding-top: var(--space-4); }
  .cover__grid { grid-template-columns: 1fr; gap: var(--space-4); }
}

/* ---------- Figures ---------- */

.fig { margin: 0; }
.fig__plate { position: relative; }
.fig svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--sans); }
.fig figcaption {
  margin-top: 0.85rem; padding-top: 0.75rem; border-top: 1px solid var(--rule);
  font-size: var(--step--1); color: var(--ink-2); line-height: 1.5;
}
.fig figcaption b { color: var(--ink); font-weight: 700; }
.fig__source { display: block; margin-top: 0.3rem; color: var(--ink-3); }
.fig__readout {
  min-height: 1.5em; margin-top: 0.5rem; font-size: var(--step--1); color: var(--ink);
  font-weight: 600;
}
.fig__readout:empty::before { content: attr(data-hint); color: var(--ink-3); font-weight: 400; }
.fig__shot { border: 1px solid var(--rule); background: #fff; }

.legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1.1rem; list-style: none; padding: 0; margin: 0 0 0.6rem; font-size: var(--step--1); color: var(--ink-2); }
.legend li { display: inline-flex; align-items: center; gap: 0.45rem; }
.legend i { width: 0.75rem; height: 0.75rem; border-radius: 50%; display: inline-block; }
.legend i.line { width: 1.1rem; height: 3px; border-radius: 0; }

.ax text { fill: var(--ink-3); font-size: 11px; }
.ax line, .ax path { stroke: var(--rule); }
.ax .zero { stroke: var(--ink-3); }
.lbl { fill: var(--ink); font-size: 12px; font-weight: 700; }
.lbl--muted { fill: var(--ink-3); font-weight: 600; }

.fig .draw { stroke-dasharray: var(--len); stroke-dashoffset: 0; transition: stroke-dashoffset 1400ms cubic-bezier(.16,1,.3,1); }
.fig .dot-in { transition: opacity 700ms cubic-bezier(.16,1,.3,1); transition-delay: var(--d, 0ms); }
.fig.is-pending .draw { stroke-dashoffset: var(--len); transition: none; }
.fig.is-pending .dot-in { opacity: 0.12; transition: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fig .draw, .fig .dot-in { transition: none; }
}

/* ---------- Sections ---------- */

.section { padding: var(--space-6) 0 var(--space-5); }
.section + .section { border-top: 1px solid var(--rule); }
.section__head { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 8fr); gap: var(--space-4); margin-bottom: var(--space-5); }
.section__head h2 { font-size: var(--step-3); }
.section__head p { color: var(--ink-2); max-width: 60ch; margin: 0.35rem 0 0; font-size: var(--step-1); line-height: 1.5; }

@media (max-width: 900px) {
  .section { padding: var(--space-5) 0 var(--space-4); }
  .section__head { grid-template-columns: 1fr; gap: var(--space-2); margin-bottom: var(--space-4); }
}

/* Case entries on the home page */

.case {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 8fr);
  gap: var(--space-4); padding: var(--space-5) 0;
  border-top: 1px solid var(--rule-strong);
}
.case:first-of-type { padding-top: var(--space-4); }
.case__meta { font-size: var(--step--1); color: var(--ink-2); }
.case__meta dl { margin: 0; display: grid; gap: 0.75rem; }
.case__meta dt { font-weight: 700; color: var(--ink); }
.case__meta dd { margin: 0; }
.case__fig-n { font-family: var(--serif); font-size: 1.05rem; color: var(--ink); font-weight: 600; display: block; margin-bottom: var(--space-2); }
.case__body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: var(--space-4); align-items: start; }
.case h3 { font-size: var(--step-2); line-height: 1.18; margin-bottom: var(--space-2); }
.case h3 a { color: inherit; text-decoration: none; }
.case h3 a:hover { color: var(--indigo); }
.case__q { font-family: var(--serif); font-style: italic; color: var(--ink-2); font-size: 1.1rem; line-height: 1.45; }
.case__links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-top: var(--space-3); font-size: 0.98rem; }

@media (max-width: 1000px) { .case__body { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .case { grid-template-columns: 1fr; gap: var(--space-3); } .case__meta dl { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); } }

/* Method */

.method { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--rule-strong); }
.method > div { padding: var(--space-3) var(--space-3) var(--space-3) 0; }
.method > div + div { padding-left: var(--space-3); border-left: 1px solid var(--rule); }
.method h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.method p { color: var(--ink-2); font-size: 0.98rem; margin: 0; }
@media (max-width: 900px) {
  .method { grid-template-columns: 1fr 1fr; }
  .method > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .method > div:nth-child(n+3) { border-top: 1px solid var(--rule); }
}
@media (max-width: 560px) {
  .method { grid-template-columns: 1fr; }
  .method > div + div { padding-left: 0; border-left: 0; border-top: 1px solid var(--rule); }
}

/* Archive table */

.archive { width: 100%; border-collapse: collapse; }
.archive th { text-align: left; font-size: var(--step--1); color: var(--ink-3); font-weight: 600; padding: 0 0 0.6rem; border-bottom: 1px solid var(--rule-strong); }
.archive td { padding: 1rem 1rem 1rem 0; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.archive td:last-child { padding-right: 0; text-align: right; white-space: nowrap; }
.archive__thumb { width: 7.5rem; }
.archive__thumb img { width: 7.5rem; aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; border: 1px solid var(--rule); }
.archive__name { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; display: block; }
.archive__desc { color: var(--ink-2); font-size: 0.95rem; }
.archive__tool { color: var(--ink-2); font-size: 0.95rem; white-space: nowrap; }
@media (max-width: 700px) {
  .archive thead { display: none; }
  .archive tr { display: grid; grid-template-columns: 6rem 1fr; gap: 0.25rem 1rem; padding: 1rem 0; border-bottom: 1px solid var(--rule); }
  .archive td { padding: 0; border: 0; }
  .archive__thumb { grid-row: span 3; width: 6rem; }
  .archive__thumb img { width: 6rem; }
  .archive td:last-child { text-align: left; }
}

/* About + education */

.about { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 8fr); gap: var(--space-4); }
.about__photo figcaption { font-size: var(--step--1); color: var(--ink-3); margin-top: 0.6rem; }
.about__photo img { width: 100%; max-width: 18rem; aspect-ratio: 4 / 5; object-fit: cover; }
.about__text { max-width: 68ch; }
.about__text > p:first-child { font-family: var(--serif); font-size: var(--step-1); line-height: 1.55; }
.edu { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin-top: var(--space-4); }
.edu h3 { font-size: 1.25rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--rule-strong); margin-bottom: 0.25rem; }
.edu ul { list-style: none; margin: 0; padding: 0; }
.edu li { padding: 0.7rem 0; border-bottom: 1px solid var(--rule); display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.edu li span:last-child { color: var(--ink-3); font-size: var(--step--1); white-space: nowrap; }
.edu .edu__name { font-weight: 600; }
.edu .edu__sub { display: block; color: var(--ink-2); font-size: 0.95rem; font-weight: 400; }
.edu__more { margin-top: var(--space-2); font-size: 0.98rem; }
@media (max-width: 900px) {
  .about { grid-template-columns: 1fr; }
  .about__photo img { max-width: 14rem; }
  .edu { grid-template-columns: 1fr; }
}

/* Contact */

.contact { padding: var(--space-6) 0; border-top: 1px solid var(--rule-strong); }
.contact h2 { font-size: var(--step-3); max-width: 22ch; }
.contact__mail {
  display: inline-block; margin: var(--space-3) 0 var(--space-4);
  font-family: var(--serif); font-size: clamp(1.4rem, 1rem + 2vw, 2.4rem); font-weight: 600;
  word-break: break-word;
}
.contact__list { display: flex; flex-wrap: wrap; gap: 0.75rem 2rem; list-style: none; margin: 0; padding: 0; font-weight: 600; }

.footer { border-top: 1px solid var(--rule); padding: var(--space-3) 0 var(--space-4); font-size: var(--step--1); color: var(--ink-3); }
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; }

/* ---------- Case study pages ---------- */

.report-head { padding: var(--space-5) 0 var(--space-4); border-bottom: 1px solid var(--rule-strong); }
.crumbs { font-size: var(--step--1); margin-bottom: var(--space-3); }
.crumbs a { color: var(--ink-2); }
.report-head h1 { font-size: clamp(2.3rem, 1.5rem + 3vw, 4rem); letter-spacing: -0.025em; max-width: 20ch; }
.report-head__dek { font-family: var(--serif); font-style: italic; font-size: var(--step-1); color: var(--ink-2); max-width: 52ch; margin: var(--space-3) 0 0; line-height: 1.5; }

.report { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 8fr); gap: var(--space-4); padding-top: var(--space-4); padding-bottom: var(--space-5); }
.report__aside { font-size: var(--step--1); color: var(--ink-2); }
.report__aside > div { position: sticky; top: 5.5rem; }
.report__aside dl { margin: 0 0 var(--space-3); display: grid; gap: 0.85rem; }
.report__aside dt { font-weight: 700; color: var(--ink); }
.report__aside dd { margin: 0; }
.report__aside .btn { width: 100%; justify-content: center; margin-bottom: 0.6rem; }
.report__main { min-width: 0; }
.report__main > section { padding-bottom: var(--space-4); }
.report__main > section + section { padding-top: var(--space-4); border-top: 1px solid var(--rule); }
.report__main h2 { font-size: var(--step-2); margin-bottom: var(--space-2); }
.report__main p, .report__main li { max-width: 68ch; }
.answer { font-family: var(--serif); font-size: var(--step-1); line-height: 1.55; }
.findings { padding-left: 1.4rem; margin: 0; }
.findings li { padding: 0.35rem 0 0.35rem 0.25rem; }
.findings li::marker { font-family: var(--serif); font-weight: 700; color: var(--indigo); }
.findings strong { color: var(--ink); }
.report__main .fig { margin: var(--space-4) 0; }

.metrics { width: 100%; border-collapse: collapse; margin: var(--space-3) 0; font-size: 0.98rem; }
.metrics th, .metrics td { text-align: left; padding: 0.6rem 1rem 0.6rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.metrics thead th { font-size: var(--step--1); color: var(--ink-3); font-weight: 600; border-bottom-color: var(--rule-strong); }
.metrics td.num, .metrics th.num { text-align: right; padding-right: 0; white-space: nowrap; }
.metrics td strong { color: var(--indigo); }

.pipeline { list-style: none; padding: 0; margin: var(--space-3) 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); border-top: 1px solid var(--rule-strong); }
.pipeline li { padding: var(--space-2) var(--space-2) var(--space-2) 0; font-size: 0.95rem; color: var(--ink-2); }
.pipeline li b { display: block; color: var(--ink); font-family: var(--serif); font-size: 1.05rem; margin-bottom: 0.2rem; }
.pipeline li + li { padding-left: var(--space-2); border-left: 1px solid var(--rule); }

.limits li { color: var(--ink-2); padding: 0.25rem 0; }

.next { border-top: 1px solid var(--rule-strong); padding-top: var(--space-4); padding-bottom: var(--space-5); display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.next a { text-decoration: none; display: block; }
.next span { display: block; font-size: var(--step--1); color: var(--ink-3); margin-bottom: 0.3rem; }
.next b { font-family: var(--serif); font-size: 1.3rem; color: var(--ink); font-weight: 600; line-height: 1.25; }
.next a:hover b { color: var(--indigo); }
.next a:last-child { text-align: right; }

@media (max-width: 900px) {
  .report { grid-template-columns: 1fr; gap: var(--space-3); }
  .report__aside > div { position: static; }
  .report__aside dl { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); }
  .report__aside .btn { width: auto; }
  .next { grid-template-columns: 1fr; }
  .next a:last-child { text-align: left; }
}

@media print {
  .masthead, .lang, .report__aside .btn { display: none; }
  body { background: #fff; }
}

.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;
}

.cover .fig { width: 100%; max-width: 420px; justify-self: end; }
@media (max-width: 900px) { .cover .fig { justify-self: stretch; max-width: 560px; } }
.report__main [data-chart="stations"] { max-width: 520px; }
