/* =========================================================
   Carlos Jiménez Díaz, FRM, personal CV site
   Clean corporate style: white (light) / black (dark), Inter.
   ========================================================= */

:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --ink: #0A0A0A;
  --ink-2: #2E2E2E;
  --muted: #6B6B6B;
  --line: #E6E6E6;
  --accent: #0B3A75;
  --accent-soft: rgba(11, 58, 117, 0.06);
  --band: #0A0A0A;
  --band-ink: #FFFFFF;
  --band-muted: rgba(255, 255, 255, .68);
  --band-line: rgba(255, 255, 255, .14);

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --radius: 6px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px -12px rgba(0, 0, 0, .12);
  --maxw: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #0B0B0B;
    --ink: #F5F5F5;
    --ink-2: #CFCFCF;
    --muted: #8C8C8C;
    --line: #232323;
    --accent: #8DB4EA;
    --accent-soft: rgba(141, 180, 234, 0.08);
    --band: #0B0B0B;
    --band-ink: #F5F5F5;
    --band-muted: rgba(245, 245, 245, .66);
    --band-line: #232323;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 32px -16px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000;
  --surface: #0B0B0B;
  --ink: #F5F5F5;
  --ink-2: #CFCFCF;
  --muted: #8C8C8C;
  --line: #232323;
  --accent: #8DB4EA;
  --accent-soft: rgba(141, 180, 234, 0.08);
  --band: #0B0B0B;
  --band-ink: #F5F5F5;
  --band-muted: rgba(245, 245, 245, .66);
  --band-line: #232323;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 12px 32px -16px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.65 var(--sans);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--ink); color: var(--bg); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

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

.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: var(--radius);
}
.skip:focus { left: 8px; }

.eyebrow, .label {
  font: 600 12px/1 var(--sans);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent);
}
.label { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  height: 46px; padding: 0 22px;
  border-radius: var(--radius);
  background: var(--ink); color: var(--bg);
  font: 500 15px/1 var(--sans);
  border: 1px solid var(--ink);
  cursor: pointer;
  transition: background .2s ease, color .2s ease, border-color .2s ease, opacity .2s ease;
}
.btn:hover { opacity: .88; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn--small { height: 38px; padding: 0 16px; font-size: 14px; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink); opacity: 1; }
.btn--light { background: var(--band-ink); color: var(--band); border-color: var(--band-ink); }
.btn--outline-light { background: transparent; color: var(--band-ink); border-color: var(--band-line); }
.btn--outline-light:hover { border-color: var(--band-ink); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: var(--radius);
  background: transparent; color: var(--ink);
  border: 1px solid var(--line); cursor: pointer;
  transition: border-color .2s ease;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 24px; }

.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.brand__mark {
  display: grid; place-items: center; flex: none;
  width: 34px; height: 34px; border-radius: var(--radius);
  background: var(--ink); color: var(--bg);
  font: 700 13px/1 var(--sans); letter-spacing: .04em;
}
.brand__name { font: 600 15px/1.2 var(--sans); letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand__suffix { color: var(--muted); font-weight: 500; }

.nav__links { display: flex; gap: 28px; }
.nav__links a {
  font-size: 14px; font-weight: 500; color: var(--muted);
  position: relative; padding: 6px 0;
  transition: color .2s ease;
}
.nav__links a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform .3s ease;
}
.nav__links a:hover, .nav__links a.is-active { color: var(--ink); }
.nav__links a.is-active::after { transform: scaleX(1); }
.nav__actions { display: flex; align-items: center; gap: 10px; }
.nav__burger { display: none; }

.mobile-menu {
  display: none;
  flex-direction: column;
  padding: 8px var(--gutter) 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.mobile-menu a { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 16px; font-weight: 500; }
.mobile-menu a:last-child { border-bottom: 0; }
.nav.is-open .mobile-menu { display: flex; }

/* ---------- Hero ---------- */
.hero { padding: clamp(48px, 8vw, 104px) 0 clamp(48px, 7vw, 80px); }
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}
.hero__title {
  margin-top: 20px;
  font: 700 clamp(40px, 6.2vw, 76px)/1.02 var(--sans);
  letter-spacing: -0.035em;
}
.hero__suffix { color: var(--muted); font-weight: 500; }
.hero__lead {
  margin-top: 26px; max-width: 34em;
  font-size: clamp(17px, 1.5vw, 19px); line-height: 1.65; color: var(--ink-2);
}
.hero__lead strong { color: var(--ink); font-weight: 600; }
.hero__meta { margin-top: 26px; display: grid; gap: 10px; }
.hero__meta li { display: flex; align-items: flex-start; gap: 12px; font-size: 15px; color: var(--muted); }
.dot { width: 5px; height: 5px; margin-top: .65em; border-radius: 50%; background: var(--ink); flex: none; }
.hero__cta { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 12px; }

.hero__portrait { margin: 0; position: relative; justify-self: end; width: 100%; max-width: 400px; }
.portrait {
  border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 4 / 5;
  background: var(--line);
  border: 1px solid var(--line);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.portrait__card {
  position: absolute; left: -24px; bottom: 24px;
  display: grid; gap: 4px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.portrait__role { font: 600 16px/1.25 var(--sans); letter-spacing: -0.01em; }
.portrait__org { font-size: 13px; color: var(--muted); }

/* ---------- Stats ---------- */
.stats {
  margin: clamp(56px, 8vw, 88px) 0 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat { padding: 28px 24px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat dt { font: 600 11px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stat dd { margin: 14px 0 0; font: 700 clamp(34px, 3.8vw, 46px)/1 var(--sans); letter-spacing: -0.035em; }
.stat dd > span:not(.stat__note) { color: var(--accent); }
.stat__note { display: block; margin-top: 10px; font: 400 13px/1.3 var(--sans); letter-spacing: 0; color: var(--muted); }

/* ---------- Sections ---------- */
.section { padding: clamp(72px, 9vw, 112px) 0; border-top: 1px solid var(--line); }
.section__head { margin-bottom: clamp(36px, 5vw, 56px); max-width: 760px; }
.section__title {
  margin-top: 16px;
  font: 700 clamp(28px, 3.4vw, 42px)/1.12 var(--sans);
  letter-spacing: -0.03em;
}

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 96px); }
.split .section__head { margin-bottom: 0; }
.prose { display: grid; gap: 20px; color: var(--ink-2); font-size: 17px; }
.prose__lead { font: 500 clamp(19px, 1.8vw, 22px)/1.5 var(--sans); letter-spacing: -0.015em; color: var(--ink); }

/* ---------- Expertise ---------- */
.cards {
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line); border-left: 1px solid var(--line);
}
.card {
  padding: 28px 28px 32px;
  border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--surface);
  transition: background .2s ease;
}
.card:hover { background: var(--accent-soft); }
.card__num { font: 600 12px/1 var(--sans); letter-spacing: .1em; color: var(--accent); }
.card h3 { margin-top: 18px; font: 600 18px/1.3 var(--sans); letter-spacing: -0.015em; }
.card p { margin-top: 10px; font-size: 15px; color: var(--muted); }

.toolkit { margin-top: 48px; }
.toolkit__groups { margin-top: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 48px; }
.toolkit__group h3 { font: 600 15px/1.3 var(--sans); letter-spacing: -0.01em; margin-bottom: 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  padding: 6px 12px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 13px; font-weight: 500; color: var(--ink-2);
}

/* ---------- Timeline ---------- */
.timeline { display: grid; }
.job {
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(20px, 4vw, 56px);
  padding: 40px 0;
  border-top: 1px solid var(--line);
}
.job:last-child { border-bottom: 1px solid var(--line); }
.job__meta { display: grid; gap: 6px; align-content: start; }
.job__date { font: 600 14px/1.4 var(--sans); color: var(--ink); font-variant-numeric: tabular-nums; }
.job__place { font-size: 14px; color: var(--muted); }
.job__body { max-width: 760px; }
.job__role { font: 600 clamp(19px, 1.9vw, 22px)/1.3 var(--sans); letter-spacing: -0.02em; }
.job__org { margin-top: 6px; font-weight: 600; font-size: 15px; color: var(--accent); }
.job__org span { font-weight: 400; color: var(--muted); }
.job__org--lg { margin-top: 0; font: 700 clamp(22px, 2.2vw, 28px)/1.15 var(--sans); letter-spacing: -0.025em; color: var(--ink); }
.job__body > p:not(.job__org) { margin-top: 16px; color: var(--ink-2); }
.job__body ul, .subrole ul { margin-top: 16px; display: grid; gap: 10px; }
.job__body li {
  position: relative; padding-left: 20px;
  color: var(--ink-2); font-size: 15.5px;
}
.job__body li::before {
  content: ""; position: absolute; left: 0; top: .72em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--muted);
}
.job__body li strong { color: var(--ink); font-weight: 600; }

.subrole {
  position: relative;
  margin-top: 28px; padding-left: 24px;
  border-left: 1px solid var(--line);
}
.subrole::before {
  content: ""; position: absolute; left: -5px; top: 9px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--ink);
}
.subrole__date { margin-top: 6px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }

.kpis { margin-top: 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.kpi {
  display: grid; gap: 6px;
  padding: 16px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.kpi__val { font: 700 22px/1 var(--sans); color: var(--ink); letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.kpi__lbl { font-size: 13px; color: var(--muted); line-height: 1.35; }

/* ---------- Education ---------- */
.edu { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.edu__item {
  padding: 26px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  display: grid; gap: 10px; align-content: start;
}
.edu__year { font: 600 13px/1 var(--sans); color: var(--accent); font-variant-numeric: tabular-nums; }
.edu__item h3 { font: 600 17px/1.35 var(--sans); letter-spacing: -0.015em; }
.edu__item p { font-size: 14px; color: var(--muted); }

/* ---------- Credentials ---------- */
.creds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.creds-progress { margin-top: 40px; display: grid; gap: 16px; }
.creds-progress .cred { max-width: calc(50% - 8px); }
.cred--progress { border-style: dashed; }
.cred--progress .cred__badge { background: transparent; color: var(--ink); border: 1px solid var(--ink); }
.cred {
  display: flex; align-items: center; gap: 18px;
  padding: 22px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.cred__badge {
  flex: none; display: grid; place-items: center;
  width: 58px; height: 58px; border-radius: var(--radius);
  background: var(--ink); color: var(--bg);
  font: 700 13px/1 var(--sans); letter-spacing: .04em;
}
.cred h3 { font: 600 16px/1.35 var(--sans); letter-spacing: -0.01em; }
.cred p { margin-top: 4px; font-size: 14px; color: var(--muted); }

/* ---------- Contact ---------- */
.contact {
  background: var(--band); color: var(--band-ink);
  padding: clamp(80px, 10vw, 128px) 0;
  border-top: 1px solid var(--band-line);
}
.eyebrow--light { color: var(--band-muted); }
.contact__title {
  margin-top: 18px; max-width: 18em;
  font: 700 clamp(32px, 4.6vw, 56px)/1.08 var(--sans);
  letter-spacing: -0.035em;
}
.contact__text { margin-top: 22px; max-width: 34em; font-size: 18px; color: var(--band-muted); }
.contact__cta { margin-top: 38px; display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Footer ---------- */
.footer { background: var(--band); color: var(--band-muted); border-top: 1px solid var(--band-line); }
.footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding-top: 26px; padding-bottom: 26px; font-size: 13px; }
.footer a:hover { color: var(--band-ink); }

/* ---------- Reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(10px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .card, .btn { transition: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .nav__links { gap: 20px; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .creds { grid-template-columns: 1fr; }
  .creds-progress .cred { max-width: none; }
  .toolkit__groups { grid-template-columns: 1fr; }
}
@media (max-width: 880px) {
  .nav__links { display: none; }
  .nav__burger { display: inline-grid; }
  .nav__actions .btn--small { display: none; }
  .hero__grid { grid-template-columns: 1fr; }
  .hero__portrait { justify-self: start; max-width: 340px; order: -1; }
  .portrait__card { left: auto; right: -12px; bottom: 20px; }
  .split { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(odd) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .job { grid-template-columns: 1fr; gap: 14px; }
  .job__meta { grid-auto-flow: column; justify-content: start; gap: 16px; align-items: baseline; }
}
@media (max-width: 560px) {
  body { font-size: 15.5px; }
  .brand__name { font-size: 14px; }
  .cards { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: 1fr; }
  .hero__portrait { max-width: 100%; }
  .portrait { aspect-ratio: 1 / 1; }
  .portrait__card { right: 12px; bottom: 12px; padding: 12px 16px; }
  .stat { padding: 22px 16px; }
  .job__meta { grid-auto-flow: row; gap: 4px; }
}

/* ---------- Print: clean one-column CV ---------- */
@media print {
  @page { margin: 14mm 14mm; }
  :root, :root[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --ink: #000; --ink-2: #222; --muted: #555;
    --line: #ddd; --accent: #0B3A75; --accent-soft: transparent;
    --band: #fff; --band-ink: #000; --band-muted: #333; --band-line: #ddd;
    color-scheme: light;
  }
  body { font-size: 10.5pt; line-height: 1.45; background: #fff; }
  .nav, .hero__cta, .toolkit .label, .contact__cta, .footer, .skip, .portrait__card { display: none !important; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
  .wrap { max-width: none; padding: 0; }
  .hero { padding: 0 0 10pt; }
  .hero__grid { grid-template-columns: 1fr 110px; gap: 20pt; }
  .hero__portrait { max-width: 110px; order: 0; }
  .portrait { aspect-ratio: 1; }
  .hero__title { font-size: 26pt; margin-top: 6pt; }
  .hero__lead { font-size: 11pt; margin-top: 10pt; }
  .hero__meta { margin-top: 10pt; gap: 3pt; }
  .stats { margin-top: 14pt; grid-template-columns: repeat(4, 1fr); }
  .stat, .stat:nth-child(odd) { border-left: 1px solid var(--line); padding-left: 12pt; }
  .stat:first-child { border-left: 0; padding-left: 0; }
  .stat:nth-child(n+3) { border-top: 0; }
  .stat { padding: 10pt 12pt; }
  .stat dd { font-size: 20pt; margin-top: 6pt; }
  .section, .contact { padding: 16pt 0; background: #fff; color: #000; }
  .section__head { margin-bottom: 12pt; }
  .section__title { font-size: 15pt; margin-top: 6pt; }
  .split { grid-template-columns: 1fr; gap: 8pt; }
  .prose { font-size: 10.5pt; gap: 6pt; }
  .prose__lead { font-size: 12pt; }
  .cards { grid-template-columns: repeat(3, 1fr); }
  .card { padding: 10pt; break-inside: avoid; }
  .card h3 { margin-top: 0; font-size: 11.5pt; }
  .card p { font-size: 9.5pt; margin-top: 4pt; }
  .card__num { display: none; }
  .tags li { padding: 2pt 7pt; font-size: 8.5pt; }
  .toolkit { margin-top: 10pt; }
  .toolkit__groups { gap: 8pt 20pt; margin-top: 0; }
  .toolkit__group h3 { font-size: 10pt; margin-bottom: 4pt; }
  .job { grid-template-columns: 120px 1fr; gap: 14pt; padding: 12pt 0; break-inside: avoid; }
  .job--group { break-inside: auto; }
  .subrole { break-inside: avoid; margin-top: 10pt; }
  .job__role { font-size: 12.5pt; }
  .job__org--lg { font-size: 14pt; }
  .job__body li { font-size: 10pt; }
  .job__body ul, .subrole ul { gap: 3pt; margin-top: 6pt; }
  .kpi { padding: 6pt 8pt; }
  .kpi__val { font-size: 13pt; }
  .edu { grid-template-columns: repeat(2, 1fr); gap: 8pt; }
  .edu__item { padding: 10pt; break-inside: avoid; }
  .edu__item h3 { font-size: 11pt; }
  .creds { grid-template-columns: repeat(2, 1fr); gap: 8pt; }
  .creds-progress { margin-top: 8pt; gap: 4pt; }
  .cred { padding: 10pt; gap: 10pt; }
  .cred__badge { width: 36px; height: 36px; font-size: 8.5pt; }
  .cred h3 { font-size: 10.5pt; }
  .contact__title { font-size: 14pt; max-width: none; }
  .contact__text { font-size: 10pt; margin-top: 6pt; }
  a { color: inherit; }
}
