/* ============================================================
   Diego Restrepo-Tobón — academic site
   Beige paper, ink blacks, graphite grays, oxblood red.
   ============================================================ */

:root {
  --paper: #F1EBDF;
  --paper-alt: #E9E1D2;
  --card: #F7F3EA;
  --ink: #151413;
  --ink-2: #2F2D2A;
  --mute: #6B665D;
  --rule: #CBC1AE;
  --rule-soft: #DDD4C3;
  --red: #A3191F;
  --red-deep: #7C1217;

  --serif: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  --wrap: 1160px;
  --gutter: clamp(20px, 4vw, 40px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-2);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; }
::selection { background: var(--red); color: var(--paper); }

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

h1, h2, h3 { font-family: var(--serif); color: var(--ink); font-weight: 500; margin: 0; }

.mono-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 0 0 0.9rem;
}

/* ---------------- NAV ---------------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: rgba(241, 235, 223, 0.92);
  backdrop-filter: saturate(1.2) blur(8px);
  -webkit-backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--rule-soft);
  padding-top: env(safe-area-inset-top, 0px);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; flex-shrink: 0; }
.brand-mark {
  font-family: var(--mono); font-weight: 500; font-size: 0.78rem; letter-spacing: 0.08em;
  color: var(--paper); background: var(--ink); padding: 5px 7px 4px; border-radius: 2px;
  border-bottom: 3px solid var(--red);
}
.brand-name { font-family: var(--serif); font-size: 1.12rem; color: var(--ink); font-weight: 500; }
.nav-links { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  font-size: 0.86rem; text-decoration: none; color: var(--ink-2);
  padding: 7px 11px; border-radius: 2px; transition: color .15s, background .15s;
  white-space: nowrap;
}
.nav-links a:hover { color: var(--red); }
.nav-links .nav-cta { background: var(--ink); color: var(--paper); }
.nav-links .nav-cta:hover { background: var(--red); color: var(--paper); }

/* ---------------- HERO ---------------- */
.hero {
  position: relative;
  padding: clamp(48px, 8vw, 104px) 0 clamp(40px, 6vw, 72px);
  border-bottom: 1px solid var(--rule);
  background-image:
    linear-gradient(to right, rgba(21,20,19,0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(21,20,19,0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  background-position: -1px -1px;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 30% 40%, transparent 40%, var(--paper) 95%);
}
.hero > .wrap { position: relative; z-index: 1; }
.hero-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(32px, 5vw, 72px); align-items: center; }

.eyebrow {
  font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--mute); margin: 0 0 1.4rem; display: flex; align-items: center; gap: 10px;
}
.eyebrow .dot { width: 8px; height: 8px; background: var(--red); display: inline-block; flex-shrink: 0; }

.hero h1 {
  font-size: clamp(2.4rem, 5.6vw, 4.9rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
  font-weight: 500;
}
.nowrap { white-space: nowrap; }
.lead {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(1.3rem, 2.3vw, 1.7rem); line-height: 1.32;
  color: var(--ink); margin: 1.6rem 0 1rem; max-width: 30ch;
  padding-left: 18px; border-left: 3px solid var(--red);
}
.hero-body { color: var(--ink-2); max-width: 54ch; margin: 0 0 2rem; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.9rem; font-weight: 500; text-decoration: none;
  padding: 12px 20px; border-radius: 2px; transition: all .18s;
}
.btn-solid { background: var(--ink); color: var(--paper); border: 1px solid var(--ink); }
.btn-solid:hover { background: var(--red); border-color: var(--red); }
.btn-line { border: 1px solid var(--ink); color: var(--ink); }
.btn-line:hover { border-color: var(--red); color: var(--red); }

.hero-fig {
  margin: 0; background: var(--card); border: 1px solid var(--rule);
  padding: 18px 18px 14px; box-shadow: 10px 10px 0 -1px var(--paper-alt), 10px 10px 0 0 var(--rule);
}
.hero-fig svg { width: 100%; height: auto; }
.hero-fig .grid line { stroke: var(--rule-soft); stroke-width: 1; }
.hero-fig .axes line { stroke: var(--ink); stroke-width: 1.4; }
.hero-fig .axis-label, .hero-fig .frontier-label, .hero-fig .gap-label {
  font-family: var(--mono); font-size: 11.5px; fill: var(--mute); letter-spacing: 0.04em;
}
.hero-fig .frontier-label { fill: var(--ink); }
.hero-fig .gap-label { fill: var(--red); font-weight: 500; }
.hero-fig .obs circle { fill: var(--mute); opacity: 0.55; }
.hero-fig .frontier {
  fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 600; stroke-dashoffset: 600; animation: draw 1.8s ease-out .2s forwards;
}
.hero-fig .gap { stroke: var(--red); stroke-width: 1.6; stroke-dasharray: 4 4; opacity: 0; animation: fade .5s ease-out 1.8s forwards; }
.hero-fig .target { fill: var(--card); stroke: var(--red); stroke-width: 2; opacity: 0; animation: fade .5s ease-out 1.9s forwards; }
.hero-fig .focus { fill: var(--red); }
.hero-fig .gap-label { opacity: 0; animation: fade .5s ease-out 2s forwards; }
.hero-fig figcaption { font-size: 0.82rem; color: var(--mute); line-height: 1.5; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--rule-soft); }
.fig-no { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--red); margin-right: 6px; }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }

.facts {
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin: clamp(40px, 6vw, 72px) 0 0; border-top: 1px solid var(--ink);
}
.facts > div { padding: 18px 20px 4px 0; border-right: 1px solid var(--rule); }
.facts > div + div { padding-left: 20px; }
.facts > div:last-child { border-right: 0; }
.facts dt { font-family: var(--serif); font-size: clamp(1.4rem, 2.4vw, 1.9rem); color: var(--ink); line-height: 1.1; }
.facts dd { margin: 6px 0 0; font-size: 0.86rem; color: var(--mute); line-height: 1.45; }

/* ---------------- SECTIONS ---------------- */
.section { padding: clamp(64px, 9vw, 112px) 0; border-bottom: 1px solid var(--rule); }
.section-alt { background: var(--paper-alt); }

.sec-head {
  display: grid; grid-template-columns: auto 1fr; column-gap: 20px; align-items: baseline;
  margin-bottom: clamp(32px, 5vw, 56px); padding-bottom: 18px; border-bottom: 1px solid var(--ink);
}
.sec-no { font-family: var(--mono); font-size: 0.85rem; color: var(--red); font-weight: 500; letter-spacing: 0.06em; }
.sec-head h2 { font-size: clamp(2rem, 4.2vw, 3rem); letter-spacing: -0.015em; line-height: 1.05; }
.sec-intro { grid-column: 2; margin: 10px 0 0; color: var(--mute); max-width: 62ch; font-size: 1rem; }

/* About */
.about-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: clamp(32px, 5vw, 72px); align-items: start; }
.prose p { margin: 0 0 1.15rem; max-width: 64ch; }
.prose-lead { font-family: var(--serif); font-size: clamp(1.3rem, 2vw, 1.55rem); line-height: 1.38; color: var(--ink); }
.about-side { display: grid; gap: 28px; align-content: start; }
.portrait {
  margin: 0; position: relative; background: var(--card); border: 1px solid var(--rule); padding: 10px;
  box-shadow: 10px 10px 0 -1px var(--paper-alt), 10px 10px 0 0 var(--rule);
}
.portrait img { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; filter: saturate(0.88) contrast(1.02); }
.portrait::after { content: ""; position: absolute; left: 10px; bottom: 10px; width: 56px; height: 4px; background: var(--red); }
.side-card { background: var(--card); border: 1px solid var(--rule); border-top: 3px solid var(--ink); padding: 24px 24px 8px; }
.side-card .mono-label { margin-top: 0; }
.side-card .mono-label:not(:first-child) { margin-top: 22px; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 10px 0; border-bottom: 1px solid var(--rule-soft); display: flex; flex-direction: column; }
.plain li:first-child { padding-top: 0; }
.plain strong { color: var(--ink); font-weight: 500; font-size: 0.97rem; }
.plain span { font-size: 0.86rem; color: var(--mute); }
.tools { font-size: 0.9rem; color: var(--ink-2); margin: 0 0 16px; line-height: 1.55; }

/* Research pillars */
.pillars { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.pillar { background: var(--card); padding: clamp(24px, 3vw, 36px); position: relative; display: flex; flex-direction: column; }
.pillar-no {
  font-family: var(--mono); font-size: 0.78rem; color: var(--paper); background: var(--ink);
  width: 28px; height: 28px; display: inline-grid; place-items: center; margin-bottom: 18px; border-radius: 2px;
}
.pillar h3 { font-size: 1.5rem; line-height: 1.2; margin-bottom: 12px; }
.pillar p { margin: 0 0 16px; font-size: 0.97rem; }
.pillar-tags { margin-top: auto !important; font-family: var(--mono); font-size: 0.72rem !important; letter-spacing: 0.04em; color: var(--mute); padding-top: 14px; border-top: 1px solid var(--rule-soft); }
.pillar-accent { background: var(--ink); color: #D8D1C4; }
.pillar-accent h3 { color: var(--paper); }
.pillar-accent .pillar-no { background: var(--red); }
.pillar-accent .pillar-tags { color: #A49D90; border-top-color: #3A3733; }

/* Publications */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.chip {
  font-family: var(--sans); font-size: 0.84rem; cursor: pointer;
  background: transparent; color: var(--ink-2); border: 1px solid var(--rule);
  padding: 7px 14px; border-radius: 999px; transition: all .15s;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.is-on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip:focus-visible, .btn:focus-visible, .nav-links a:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.pubs { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.pub {
  display: grid; grid-template-columns: 84px 1fr; gap: 20px;
  padding: 18px 0; border-bottom: 1px solid var(--rule-soft);
}
.pub[hidden] { display: none; }
.pub-year { font-family: var(--mono); font-size: 0.85rem; color: var(--red); padding-top: 4px; }
.pub.same-year .pub-year { visibility: hidden; }
.pub h3 { font-size: 1.18rem; line-height: 1.35; font-weight: 500; }
.pub h3 a { text-decoration: none; background-image: linear-gradient(var(--red), var(--red)); background-size: 0 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .25s, color .15s; }
.pub h3 a::after { content: " ↗"; font-family: var(--sans); font-size: 0.8em; color: var(--mute); }
.pub h3 a:hover { color: var(--red); background-size: 100% 1px; }
.pub-meta { margin: 4px 0 0; font-size: 0.9rem; color: var(--mute); }
.pub-meta em { color: var(--ink-2); }

.wip-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(28px, 4vw, 56px); margin-top: clamp(48px, 6vw, 72px); }
.wip-list { list-style: none; margin: 0; padding: 0; counter-reset: wp; }
.wip-list li { counter-increment: wp; position: relative; padding: 10px 0 10px 40px; border-bottom: 1px solid var(--rule-soft); font-family: var(--serif); font-size: 1.05rem; color: var(--ink); line-height: 1.4; }
.wip-list li::before { content: "WP" counter(wp, decimal-leading-zero); position: absolute; left: 0; top: 14px; font-family: var(--mono); font-size: 0.68rem; color: var(--mute); }
.wip-list li span { display: block; font-family: var(--sans); font-size: 0.85rem; color: var(--mute); margin-top: 2px; }
.book-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.book-list li {
  display: flex; align-items: stretch; gap: 14px; background: var(--card); border: 1px solid var(--rule);
  padding: 14px 16px 14px 0; font-family: var(--serif); font-size: 1.05rem; color: var(--ink); line-height: 1.35;
}
.book-spine { width: 6px; background: var(--red); flex-shrink: 0; }
.book-list li:nth-child(even) .book-spine { background: var(--ink); }

/* Applied work ledger */
.ledger { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); }
.ledger li { display: grid; grid-template-columns: 110px 1fr 220px; gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--rule); align-items: baseline; }
.ledger-year { font-family: var(--mono); font-size: 0.85rem; color: var(--red); }
.ledger-body h3 { font-size: 1.28rem; line-height: 1.3; }
.ledger-body p { margin: 6px 0 0; font-size: 0.94rem; color: var(--ink-2); max-width: 62ch; }
.ledger-client { font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); text-align: right; }

/* Teaching */
.teach-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.teach { border-top: 2px solid var(--ink); padding-top: 16px; }
.teach h3 { font-size: 1.3rem; margin-bottom: 8px; }
.teach p { margin: 0 0 10px; font-size: 0.96rem; }
.teach .courses { font-size: 0.9rem; color: var(--mute); }
.teach-feature { grid-column: 1 / -1; background: var(--card); border: 1px solid var(--rule); border-top: 3px solid var(--red); padding: 24px 28px; }
.teach-feature h3 { font-size: 1.6rem; }
.teach-feature p { max-width: 70ch; font-size: 1.02rem; }

/* Career */
.career-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(32px, 5vw, 72px); }
.career-grid .mono-label:not(:first-child) { margin-top: 36px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.timeline li:first-child { border-top: 1px solid var(--ink); }
.t-date { font-family: var(--mono); font-size: 0.8rem; color: var(--red); padding-top: 3px; }
.timeline strong { display: block; font-family: var(--serif); font-weight: 500; font-size: 1.1rem; color: var(--ink); line-height: 1.3; }
.timeline span:not(.t-date) { display: block; font-size: 0.87rem; color: var(--mute); }
.timeline em { display: block; font-family: var(--serif); font-size: 0.95rem; color: var(--ink-2); margin-top: 4px; }

.talks { margin-top: clamp(40px, 6vw, 64px); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule); }
.talks summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 16px 0; }
.talks summary::-webkit-details-marker { display: none; }
.talks summary .mono-label { margin: 0; color: var(--ink); }
.plus { width: 14px; height: 14px; position: relative; }
.plus::before, .plus::after { content: ""; position: absolute; background: var(--red); left: 0; top: 6px; width: 14px; height: 2px; transition: transform .2s; }
.plus::after { transform: rotate(90deg); }
.talks[open] .plus::after { transform: rotate(0); }
.talks ul { list-style: none; margin: 0; padding: 0 0 12px; }
.talks li { position: relative; padding: 10px 0 10px 80px; border-top: 1px solid var(--rule-soft); font-size: 0.92rem; line-height: 1.55; }
.talks li span { position: absolute; left: 0; top: 12px; font-family: var(--mono); font-size: 0.8rem; color: var(--red); }
.talks li em { font-family: var(--serif); font-size: 1rem; color: var(--ink); }

/* Contact */
.contact { background: var(--ink); color: #CFC8BA; padding: clamp(64px, 9vw, 112px) 0 0; border-top: 4px solid var(--red); }
.contact-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: clamp(32px, 5vw, 72px); align-items: end; padding-bottom: clamp(56px, 8vw, 96px); }
.sec-no-light { display: block; margin-bottom: 16px; color: #E0525A; }
.contact h2 { color: var(--paper); font-size: clamp(2rem, 4.6vw, 3.4rem); line-height: 1.08; letter-spacing: -0.015em; max-width: 16ch; }
.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { display: flex; flex-direction: column; padding: 14px 0; border-bottom: 1px solid #36332F; }
.contact-list .mono-label { color: #8E877B; margin-bottom: 4px; }
.contact-list a { color: var(--paper); text-decoration: none; font-family: var(--serif); font-size: 1.3rem; overflow-wrap: anywhere; }
.contact-list a:hover { color: #E0525A; }
.contact-list li > span:last-child { font-size: 0.95rem; }
.foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-top: 20px; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #36332F; font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.06em; color: #8E877B;
}
.foot a { text-decoration: none; }
.foot a:hover { color: var(--paper); }

/* ---------------- RESPONSIVE ---------------- */
@media (max-width: 1020px) {
  .brand-name { display: none; }
}
@media (max-width: 900px) {
  .hero-grid, .about-grid, .wip-grid, .career-grid, .contact-grid { grid-template-columns: 1fr; }
  .hero-fig { max-width: 560px; }
  .portrait { max-width: 340px; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .facts > div:nth-child(2) { border-right: 0; }
  .facts > div:nth-child(3) { padding-left: 0; }
  .facts > div:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .ledger li { grid-template-columns: 90px 1fr; }
  .ledger-client { grid-column: 2; text-align: left; }
}
@media (max-width: 760px) {
  .nav-inner { height: auto; padding-block: 10px; flex-direction: column; align-items: stretch; gap: 8px; }
  .brand-name { display: inline; }
  .nav nav { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter); }
  .nav nav::-webkit-scrollbar { display: none; }
  .nav-links a { padding: 6px 10px; }
  html { scroll-padding-top: 110px; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .pillars, .teach-grid { grid-template-columns: 1fr; }
  .pub { grid-template-columns: 1fr; gap: 4px; }
  .pub.same-year .pub-year { display: none; }
  .ledger li { grid-template-columns: 1fr; gap: 6px; }
  .ledger-client { grid-column: auto; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .talks li { padding-left: 0; }
  .talks li span { position: static; display: block; margin-bottom: 2px; }
  .sec-intro { grid-column: 1 / -1; }
  .hero-fig, .portrait { box-shadow: none; }
}
@media (max-width: 420px) {
  .facts { grid-template-columns: 1fr; }
  .facts > div { border-right: 0; padding-left: 0 !important; }
  .facts > div + div { border-top: 1px solid var(--rule); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-fig .frontier { animation: none; stroke-dashoffset: 0; }
  .hero-fig .gap, .hero-fig .target, .hero-fig .gap-label { animation: none; opacity: 1; }
}
