/* ==========================================================================
   jose_diaz.dev — site styles
   Colors live in tokens on :root; dark theme redefines them below.
   ========================================================================== */

@font-face {
  font-family: 'Public Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/public-sans-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Public Sans';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url('../fonts/public-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url('../fonts/jetbrains-mono-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --grid: #ececE6;
  --surface: #fff;
  --nav-bg: rgba(247, 247, 244, .88);
  --ink: #14171c;
  --text: #42454c;
  --text-2: #5a5d64;
  --muted: #686b72;
  --faint: #767880;
  --line: #d9d9d1;
  --line-soft: #e4e4dd;
  --accent: #2b64d6;
  --accent-mark: #2f6fed;
  --accent-bg: #eef3fd;
  --accent-line: #b9cdf6;
  --amber: #84613a;
  --amber-bg: #f6efe3;
  --amber-line: #e1cfae;
  --green: #2e6b41;
  --green-bg: #e8f4ec;
  --green-line: #b5d9c0;
  --footer-bg: #14171c;
  --footer-text: #9a9da4;
  --footer-link: #c4c6cc;
  --footer-accent: #6f9bff;
  --img-filter: none;

  --sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --gutter: 56px;
  --nav-h: 66px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1216;
  --grid: #191d23;
  --surface: #151920;
  --nav-bg: rgba(15, 18, 22, .86);
  --ink: #e8e9ec;
  --text: #b4b7be;
  --text-2: #9a9da4;
  --muted: #8b8f98;
  --faint: #7d818a;
  --line: #2a2f37;
  --line-soft: #232830;
  --accent: #6f9bff;
  --accent-mark: #6f9bff;
  --accent-bg: rgba(111, 155, 255, .1);
  --accent-line: #34508a;
  --amber: #d9b27c;
  --amber-bg: rgba(217, 178, 124, .08);
  --amber-line: #5a4a33;
  --green: #7fcf97;
  --green-bg: rgba(127, 207, 151, .08);
  --green-line: #2f5a3c;
  --footer-bg: #0a0c0f;
  --img-filter: brightness(.92);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1216;
    --grid: #191d23;
    --surface: #151920;
    --nav-bg: rgba(15, 18, 22, .86);
    --ink: #e8e9ec;
    --text: #b4b7be;
    --text-2: #9a9da4;
    --muted: #8b8f98;
    --faint: #7d818a;
    --line: #2a2f37;
    --line-soft: #232830;
    --accent: #6f9bff;
    --accent-mark: #6f9bff;
    --accent-bg: rgba(111, 155, 255, .1);
    --accent-line: #34508a;
    --amber: #d9b27c;
    --amber-bg: rgba(217, 178, 124, .08);
    --amber-line: #5a4a33;
    --green: #7fcf97;
    --green-bg: rgba(127, 207, 151, .08);
    --green-line: #2f5a3c;
    --footer-bg: #0a0c0f;
    --img-filter: brightness(.92);
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, p, figure { margin: 0; }
section { scroll-margin-top: var(--nav-h); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.mono { font-family: var(--mono); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  font: 500 13px var(--mono); background: var(--ink); color: var(--bg);
  padding: 10px 14px; border-radius: 3px;
}
.skip-link:focus { top: 12px; text-decoration: none; }
.wrap { max-width: 1180px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
/* Controls that need JS stay hidden until the inline head script swaps no-js → js. */
:root:not(.js) .js-only { display: none; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center; gap: 10px 24px;
  padding: 20px var(--gutter);
  border-bottom: 1px solid var(--line);
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.brand { font: 600 16px var(--mono); color: var(--ink); letter-spacing: -.01em; }
.brand span, .footer-brand span { color: var(--accent-mark); }
.brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 30px; font: 400 13px var(--mono); letter-spacing: .02em; }
.nav-links a { color: var(--text-2); }
.nav-links a[aria-current="true"] { color: var(--accent); }
.theme-toggle {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; margin: -6px -6px -6px -8px; padding: 0;
  background: none; border: 1px solid transparent; border-radius: 3px;
  color: var(--text-2); cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--line); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}

/* ---------- shared bits ---------- */
.eyebrow { font: 400 12.5px var(--mono); letter-spacing: .12em; color: var(--text-2); }
.eyebrow.accent { color: var(--accent); }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tag {
  font: 600 11px var(--mono); padding: 5px 10px; border-radius: 3px;
  border: 1px solid var(--line); color: var(--text-2);
}
.tag--accent { color: var(--accent); background: var(--accent-bg); border-color: var(--accent-line); }
.tag--outline { color: var(--accent); border-color: var(--accent-line); font-weight: 500; }
.tag--amber { color: var(--amber); background: var(--amber-bg); border-color: var(--amber-line); }
.tag--plain { font-weight: 500; }
.tag--green { color: var(--green); background: var(--green-bg); border-color: var(--green-line); }
.links { display: flex; flex-wrap: wrap; gap: 10px; font: 500 12.5px var(--mono); }
.links a, .linklike {
  color: var(--accent); font: inherit; background: none; border: 0; padding: 0; cursor: pointer;
}
.links a:hover, .linklike:hover { text-decoration: underline; text-underline-offset: 3px; }
.authors { font: 400 12.5px/1.7 var(--mono); color: var(--muted); }
.authors strong { color: var(--ink); font-weight: 600; }
.authors .note { color: var(--faint); }

/* ---------- hero ---------- */
.hero { padding-top: 80px; padding-bottom: 64px; }
.hero .eyebrow { margin-bottom: 26px; }
.hero-grid { display: grid; grid-template-columns: 1fr 270px; gap: 64px; align-items: center; }
.hero h1 { font-weight: 700; font-size: 58px; line-height: 1.04; letter-spacing: -.03em; margin-bottom: 24px; }
.lede { font-size: 17.5px; line-height: 1.62; color: var(--text); max-width: 620px; margin-bottom: 18px; }
.lede + .lede { margin-bottom: 30px; }
.lede a { font-weight: 600; }
.btn-row { display: flex; border: 1px solid var(--ink); border-radius: 3px; overflow: hidden; width: max-content; max-width: 100%; }
.btn-row a {
  font: 500 13px var(--mono); color: var(--accent); background: var(--surface);
  padding: 12px 20px; transition: background-color .15s;
}
.btn-row a + a { border-left: 1px solid var(--ink); }
.btn-row a:hover { background: var(--accent-bg); text-decoration: none; }
.btn-row a:focus-visible { outline-offset: -3px; }
.portrait img {
  width: 270px; height: 300px; object-fit: cover;
  border: 1px solid var(--ink); background: var(--line-soft); filter: var(--img-filter);
}
.portrait figcaption { font: 400 11px/1.7 var(--mono); color: var(--muted); margin-top: 10px; }
.focus {
  display: flex; margin: 54px 0 0; padding: 0; list-style: none;
  border: 1px solid var(--line); background: var(--surface);
}
.focus li { flex: 1; padding: 22px 26px; }
.focus li + li { border-left: 1px solid var(--line); }
.focus .eyebrow { font-size: 11px; letter-spacing: .1em; margin-bottom: 9px; }
.focus strong { font-size: 15.5px; font-weight: 600; }

/* ---------- publications ---------- */
.band { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.band > .wrap { padding-top: 64px; padding-bottom: 64px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 34px; }
.section-head .count { font: 400 12px var(--mono); color: var(--faint); }
.pub-feature { display: grid; grid-template-columns: 1fr 540px; gap: 48px; align-items: start; }
.pub-feature h3 { font-weight: 700; font-size: 34px; line-height: 1.12; letter-spacing: -.025em; margin-bottom: 16px; }
.pub-feature .abstract { font-size: 16.5px; line-height: 1.64; color: var(--text); margin-bottom: 16px; }
.pub-feature .authors { margin-bottom: 22px; }
.figure-zoom { position: relative; display: block; border: 1px solid var(--line-soft); cursor: zoom-in; }
.figure-zoom img { width: 100%; height: auto; aspect-ratio: 1065 / 1080; object-fit: cover; filter: var(--img-filter); }
.figure-zoom .zoom-hint {
  position: absolute; right: 10px; bottom: 10px;
  font: 500 11px var(--mono); color: #fff; background: rgba(20, 23, 28, .78);
  padding: 5px 9px; border-radius: 3px; opacity: 0; transition: opacity .15s;
}
.figure-zoom:hover .zoom-hint, .figure-zoom:focus-visible .zoom-hint { opacity: 1; }
.figure-zoom:hover { text-decoration: none; }
@media (hover: none) { .figure-zoom .zoom-hint { opacity: 1; } }
.pillars { display: flex; margin: 0; border: 1px solid var(--line); border-top: none; background: var(--surface); }
.pillars > div { flex: 1; padding: 14px; }
.pillars > div + div { border-left: 1px solid var(--line); }
.pillars dt { font: 600 14px var(--mono); letter-spacing: .04em; color: var(--accent); margin-bottom: 6px; }
.pillars dd { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--text); }

.pub-compact {
  display: grid; grid-template-columns: 320px 1fr; gap: 32px; align-items: start;
  margin-top: 48px; padding-top: 40px; border-top: 1px solid var(--line-soft);
}
.pub-compact > img {
  width: 320px; height: 205px; object-fit: cover;
  border: 1px solid var(--line-soft); filter: var(--img-filter);
}
.pub-compact .tags { margin-bottom: 12px; }
.pub-compact .tag { padding: 4px 9px; }
.pub-compact h3 { font-weight: 700; font-size: 22px; line-height: 1.2; letter-spacing: -.02em; margin-bottom: 10px; }
.pub-compact .abstract { font-size: 15px; line-height: 1.6; color: var(--text); margin-bottom: 12px; max-width: 720px; }
.pub-compact .authors { font-size: 12px; margin-bottom: 14px; }

.bibtex { margin-top: 14px; border: 1px solid var(--line); background: var(--bg); position: relative; }
.bibtex pre {
  margin: 0; padding: 14px 16px; overflow-x: auto;
  font: 400 12px/1.6 var(--mono); color: var(--text);
}
.bibtex .copy {
  position: absolute; top: 8px; right: 8px;
  font: 500 11px var(--mono); color: var(--accent); background: var(--surface);
  border: 1px solid var(--accent-line); border-radius: 3px; padding: 4px 9px; cursor: pointer;
}
.bibtex .copy:hover { background: var(--accent-bg); }

/* ---------- projects ---------- */
.projects { padding-top: 64px; padding-bottom: 72px; }
.projects .eyebrow { margin-bottom: 34px; }
.project-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); margin: 0; padding: 0; list-style: none;
  border: 1px solid var(--line); background: var(--surface);
}
.project { padding: 24px; }
.project + .project { border-left: 1px solid var(--line); }
.project img {
  width: 100%; height: 175px; object-fit: cover;
  border: 1px solid var(--line); filter: var(--img-filter);
}
.project .eyebrow { font-size: 11px; letter-spacing: .08em; margin: 16px 0 8px; }
.project h3 { font-weight: 700; font-size: 18px; margin-bottom: 7px; }
.project p { font-size: 14px; line-height: 1.55; color: var(--muted); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); background: var(--footer-bg); }
.footer > .wrap {
  padding-top: 44px; padding-bottom: 44px;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px;
}
.footer-brand { font: 600 15px var(--mono); color: #fff; }
.footer-brand span { color: var(--footer-accent); }
.footer-tagline { font-size: 13.5px; color: var(--footer-text); margin-top: 8px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 12px 24px; font: 400 12.5px var(--mono); }
.footer-links a { color: var(--footer-link); }
.footer-links a:focus-visible { outline-color: var(--footer-accent); }

/* ---------- lightbox ---------- */
.lightbox {
  width: fit-content; max-width: 96vw; max-height: 96vh; padding: 0; overflow: hidden;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.lightbox::backdrop { background: rgba(10, 12, 15, .82); }
.lightbox img { width: auto; height: auto; max-width: calc(96vw - 2px); max-height: calc(96vh - 50px); }
.lightbox-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 14px; font: 400 12px var(--mono); color: var(--text-2); border-top: 1px solid var(--line);
}
.lightbox-bar button {
  font: 500 12px var(--mono); color: var(--accent); background: none;
  border: 1px solid var(--accent-line); border-radius: 3px; padding: 4px 10px; cursor: pointer;
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .pub-feature { grid-template-columns: 1fr 440px; }
  .project-grid { grid-template-columns: repeat(2, 1fr); }
  .project:nth-child(3) { border-left: none; }
  .project:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 820px) {
  :root { --gutter: 20px; --nav-h: 84px; }
  .nav { padding: 14px var(--gutter); flex-wrap: wrap; }
  .nav-links { gap: 18px; }
  .hero { padding-top: 48px; padding-bottom: 40px; }
  .hero-grid, .pub-feature, .pub-compact { grid-template-columns: 1fr; gap: 32px; }
  .hero h1 { font-size: 36px; line-height: 1.08; overflow-wrap: break-word; }
  .portrait img { width: 100%; max-width: 300px; height: auto; aspect-ratio: 270 / 300; }
  .focus { flex-direction: column; margin-top: 36px; }
  .focus li + li { border-left: none; border-top: 1px solid var(--line); }
  .band > .wrap, .projects { padding-top: 48px; padding-bottom: 48px; }
  .pub-feature h3 { font-size: 26px; overflow-wrap: break-word; }
  .pub-compact > img { width: 100%; height: auto; aspect-ratio: 320 / 205; }
  .footer > .wrap { padding-top: 36px; padding-bottom: 36px; }
}
@media (max-width: 480px) {
  .hero h1 { font-size: 30px; }
  .btn-row { width: 100%; }
  .btn-row a { flex: 1; text-align: center; white-space: nowrap; font-size: 12px; padding: 12px 6px; }
  .pillars > div { padding: 12px 10px; }
  .pillars dt { font-size: 12px; }
  .project-grid { grid-template-columns: 1fr; }
  .project + .project { border-left: none; border-top: 1px solid var(--line); }
}

/* ---------- print ---------- */
@media print {
  :root, :root[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --ink: #000; --text: #222; --accent: #1a4fb8; --footer-bg: #fff;
    --footer-link: #222; --footer-text: #444; --img-filter: none;
  }
  body { background: #fff; }
  .nav, .skip-link, .theme-toggle, .zoom-hint, .bibtex, .js-only { display: none !important; }
  .footer-brand { color: #000; }
  section { break-inside: avoid-page; }
  .links a[href^="http"]::after { content: " <" attr(href) ">"; font-size: 10px; color: #444; }
}
