/* ============================================================
   Alejandro Pelaez — portfolio styles
   Colors live in :root. Change --accent to re-theme the site.
   ============================================================ */

:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --text: #1c2321;
  --muted: #5f6b67;
  --border: #e3e1db;
  --accent: #1f4d3f;        /* deep green */
  --accent-soft: #e6eeea;
  --accent-text: #ffffff;
  --radius: 10px;
  --max: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111513;
    --surface: #181d1b;
    --text: #e8ecea;
    --muted: #9aa6a1;
    --border: #2a312e;
    --accent: #7fc4a8;
    --accent-soft: #1d2a25;
    --accent-text: #0f1412;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 16px;
}
.brand {
  font-weight: 700;
  color: var(--text);
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 22px; align-items: center; }
.nav a {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 500;
}
.nav a:hover, .nav a.active { color: var(--text); text-decoration: none; }
.nav a.active { border-bottom: 2px solid var(--accent); padding-bottom: 2px; }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 56px;
  align-items: center;
  padding: 72px 0 56px;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 12px;
}
.eyebrow::before { content: "● "; font-size: 0.6rem; vertical-align: 2px; }
.hero h1 {
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
  color: var(--accent);
}
.tagline {
  font-size: 1.2rem;
  color: var(--text);
  margin: 0 0 22px;
}
.hero p { color: var(--muted); }
.hero p strong { color: var(--text); font-weight: 600; }
.hero-photo img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--border);
}

/* ---------- Buttons ---------- */
.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface);
}
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.small { padding: 5px 11px; font-size: 0.82rem; }

.icon-links { display: flex; gap: 14px; margin-top: 18px; }
.icon-links a { color: var(--muted); }
.icon-links a:hover { color: var(--text); }
.icon-links svg { width: 22px; height: 22px; fill: currentColor; }

/* ---------- Sections ---------- */
section { padding: 48px 0; border-top: 1px solid var(--border); }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
  gap: 12px;
}
h2 { font-size: 1.6rem; letter-spacing: -0.02em; margin: 0; }
h3 { font-size: 1.15rem; margin: 0 0 4px; letter-spacing: -0.01em; }

/* ---------- Cards (Selected work) ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 22px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); text-decoration: none; }
.card .body { padding: 16px 18px 18px; }
.org {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}
.keywords { font-size: 0.82rem; color: var(--muted); margin-top: 6px; }

/* Thumbnails: an <img>, or a .placeholder div until you have a photo */
.thumb, .placeholder {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--accent-soft);
}
.placeholder {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ---------- Tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Two-column info (education / skills) ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.two-col ul { padding-left: 18px; margin: 8px 0 0; color: var(--muted); }
.label { font-weight: 600; color: var(--text); }
.muted { color: var(--muted); }

/* ---------- Stats strip ---------- */
.stats.stats-3 { grid-template-columns: repeat(3, 1fr); }
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 28px 0 44px;
}
.stat { border-left: 3px solid var(--accent); padding: 2px 0 2px 14px; }
.stat .num { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.02em; color: var(--accent); line-height: 1.1; }
.stat .what { font-size: 0.85rem; color: var(--muted); line-height: 1.4; margin-top: 4px; }

/* ---------- Publications ---------- */
.pubs { padding-left: 20px; margin: 0; }
.pubs li { margin-bottom: 14px; padding-left: 4px; }
.pubs .title { font-weight: 600; color: var(--text); }
.pubs .venue { font-style: italic; color: var(--muted); }
/* the site owner's name in author lists: accent colour on a soft highlight so it stands out in both themes */
.pubs strong { color: var(--accent); background: var(--accent-soft); padding: 1px 4px; margin: 0 -3px 0 -1px; border-radius: 4px; white-space: nowrap; }
.pubs .status { font-size: 0.82rem; color: var(--muted); }
.pubs .pub-links { margin-top: 8px; }
.award {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 1px 9px;
  margin-left: 4px;
}

/* ---------- Clickable project thumbnails ---------- */
.thumb-link { display: block; }
.thumb-link img, .thumb-link .placeholder { transition: border-color .15s ease, opacity .15s ease; }
.thumb-link:hover img, .thumb-link:hover .placeholder { border-color: var(--accent); opacity: .9; }
.project h3 a { color: var(--text); }
.project h3 a:hover { color: var(--accent); }
.card img.thumb { border-bottom: 1px solid var(--border); background: #fff; }

/* ---------- Code snippets (collapsible) ---------- */
details.code { margin: 12px 0 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
details.code summary {
  cursor: pointer;
  padding: 9px 14px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
}
details.code summary::-webkit-details-marker { display: none; }
details.code summary::before { content: "▸ "; display: inline-block; transition: transform .15s ease; }
details.code[open] summary::before { transform: rotate(90deg); }
details.code summary .file { font-weight: 400; color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 0.8rem; margin-left: 6px; }
details.code pre {
  margin: 0;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.55;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}
details.code .c { color: var(--muted); font-style: italic; }
.thumb.contain { object-fit: contain; background: #fff; }
.project .figs { margin: 14px 0; }
.project figure { margin: 0; }
.project figure img { border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.project figcaption { font-size: 0.8rem; color: var(--muted); margin-top: 4px; }

/* ---------- Build progression + video ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 20px 0; counter-reset: step; }
.steps figure { margin: 0; }
.steps img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; margin: 0 0 8px; }
.steps figcaption::before {
  counter-increment: step;
  content: counter(step);
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; margin-right: 8px;
  border-radius: 50%; background: var(--accent); color: var(--accent-text);
  font-size: 0.72rem; font-weight: 700; font-style: normal;
}
.steps figcaption { font-style: normal; text-align: left; }
.steps figcaption b { color: var(--text); }
video.clip { width: 100%; display: block; border-radius: var(--radius); border: 1px solid var(--border); background: #000; margin: 0 0 8px; }
.portrait-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; margin: 24px 0; }
.portrait-pair figure { margin: 0; }
.portrait-pair img, .portrait-pair video { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); margin: 0 0 8px; }
.vids3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 20px 0; }
.vids3 figure { margin: 0; }
@media (max-width: 760px) {
  .steps, .vids3 { grid-template-columns: 1fr; }
}

/* ---------- Detail pages ---------- */
.article.wide { max-width: 860px; }
.article .lede { font-size: 1.1rem; color: var(--muted); margin: 0 0 18px; }
.article ul { padding-left: 20px; }
.article figure { margin: 24px 0; }
.article figure img { margin: 0 0 8px; border: 1px solid var(--border); background: #fff; width: 100%; }
.video { position: relative; width: 100%; aspect-ratio: 16 / 9; margin-bottom: 8px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.figs { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 24px 0; }
.figs figure { margin: 0; }
.back { display: inline-block; margin-bottom: 18px; font-size: 0.9rem; }

.table-wrap { overflow-x: auto; margin: 20px 0 6px; border: 1px solid var(--border); border-radius: var(--radius); }
table.results { border-collapse: collapse; width: 100%; font-size: 0.9rem; background: var(--surface); }
table.results th, table.results td { padding: 9px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.results th:first-child, table.results td:first-child { text-align: left; }
table.results thead th { font-weight: 600; color: var(--muted); font-size: 0.8rem; }
table.results tbody tr:last-child td { border-bottom: 0; }

.flow { display: flex; align-items: stretch; gap: 8px; margin: 20px 0; flex-wrap: wrap; }
.flow .step {
  flex: 1 1 0;
  min-width: 120px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.86rem;
  color: var(--muted);
}
.flow .step b { display: block; color: var(--text); font-size: 0.92rem; margin-bottom: 4px; }
.flow .arrow { align-self: center; color: var(--accent); font-weight: 700; }

/* ---------- Experience timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--muted); font-size: 0.9rem; }

/* ---------- Research page project blocks ---------- */
.page-head { padding: 64px 0 32px; }
.page-head h1 { font-size: clamp(2.2rem, 5vw, 3rem); letter-spacing: -0.03em; margin: 0 0 8px; color: var(--accent); }
.page-head p { color: var(--muted); margin: 0; max-width: 680px; }

.project {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 28px;
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
}
.project:last-child { border-bottom: 0; }
.project > * { min-width: 0; } /* lets wide code blocks scroll instead of stretching the column */
.project .thumb, .project .placeholder { border-radius: var(--radius); border: 1px solid var(--border); }
.project .lab { font-style: italic; color: var(--muted); margin: 0 0 4px; }
.project .meta { font-size: 0.85rem; color: var(--muted); margin: 0 0 10px; }
.project ul { margin: 8px 0 14px; padding-left: 18px; }
.project p { margin: 0 0 8px; }

/* ---------- Blog ---------- */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { padding: 20px 0; border-bottom: 1px solid var(--border); }
.post-list .date { font-size: 0.85rem; color: var(--muted); }
.post-list h3 a { color: var(--text); }

.article { max-width: 720px; margin: 0 auto; padding: 56px 24px 80px; }
.article h1 { font-size: clamp(2rem, 5vw, 2.6rem); letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 8px; }
.article h2 { margin-top: 36px; }
.article img { border-radius: var(--radius); margin: 20px 0 6px; }
.article figcaption { font-size: 0.85rem; color: var(--muted); font-style: italic; text-align: center; }
.article pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 0.88rem;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.site-footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .container { padding: 0 16px; }
  .hero { grid-template-columns: 1fr; gap: 28px; padding: 40px 0 36px; }
  .hero-photo { order: -1; max-width: 220px; }
  .two-col { grid-template-columns: 1fr; gap: 24px; }
  .project { grid-template-columns: 1fr; gap: 14px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .project .thumb, .project .placeholder { max-height: 220px; }
  .stats, .stats.stats-3 { grid-template-columns: 1fr 1fr; gap: 20px; }
  .figs { grid-template-columns: 1fr; }
  .flow .arrow { display: none; }
  .flow .step { flex-basis: 100%; }
  .nav { gap: 14px; }
  .nav a { font-size: 0.85rem; }
  .brand { font-size: 0.95rem; }
}
@media (max-width: 420px) {
  .brand span { display: none; } /* hides last name on tiny screens */
}

/* ---------- Grad school goals (About page) ---------- */
.goals-lede { max-width: 820px; margin: 0 0 22px; }
.goals { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.goal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.goal h3 { margin-bottom: 8px; }
.goal p { margin: 0; color: var(--muted); }
@media (max-width: 760px) { .goals { grid-template-columns: 1fr; } }
.goal .kicker {
  margin: 0 0 6px; font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent);
}
.goal { display: flex; flex-direction: column; }
.goal .applies { margin-top: auto; padding-top: 12px; font-size: 0.92rem; }
.goals-tail { max-width: 820px; margin: 18px 0 0; }

/* ---------- Hero band with 3D wireframe scene (About and Research pages) ---------- */
/* Always dark, in both themes, so the glowing mesh reads like a CAD render. */
.hero-band {
  --bg: #0b1210;
  --surface: #121b18;
  --text: #eef3f1;
  --muted: #a3b1ab;
  --border: #26332e;
  --accent: #7fc4a8;
  --accent-text: #0b1210;
  --scene-bg: #0b1210;
  --scene-terrain: #2c6652;
  --scene-main: #7fc4a8;
  --scene-bright: #c9f5e2;
  --scene-seg: #f0b860;
  --scene-sfc: #8fa8ff;
  --scene-wp: #ff8fa3;
  position: relative;
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(120% 90% at 78% 40%, #143128 0%, rgba(11,18,16,0) 60%),
    linear-gradient(180deg, #0b1210 0%, #0e1714 100%);
  border-bottom: 1px solid var(--border);
}
canvas.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 1.2s ease;
  /* keep the text side clean */
  -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000 58%);
          mask-image: linear-gradient(90deg, transparent 30%, #000 58%);
}
canvas.scene.ready { opacity: 1; }
.hero-band .hero {
  position: relative;
  display: block;
  padding: 64px 24px 76px;
}
.hero-band .hero > div { max-width: 560px; }
.hero-band .hero h1 { color: var(--text); }
.hero-band .tagline { color: var(--accent); }
.hero-band .btn { background: rgba(18,27,24,0.7); }
.hero-band .btn.primary { background: var(--accent); }
.hero-id { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.hero-id .eyebrow { margin: 0; }
.avatar {
  width: 64px; height: 64px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--accent);
}
@media (max-width: 760px) {
  /* phones: the scene gets its own strip under the text instead of sitting behind it */
  .hero-band { display: flex; flex-direction: column; }
  canvas.scene {
    position: relative;
    order: 2;
    height: 300px;
    margin-top: -24px;
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 85%, transparent 100%);
            mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 85%, transparent 100%);
  }
  .hero-band .hero { padding: 40px 16px 8px; }
  .scene-inset, .scene-legend { display: none; }
}

/* Research & Projects pages: shorter band; Research adds a downward-camera inset and legend */
.hero-band--page { min-height: 560px; }
.hero-band--page .hero { padding-top: 72px; }
.hero-band--page h1 { font-size: clamp(2.4rem, 5vw, 3.4rem); letter-spacing: -0.03em; margin: 0 0 12px; }
.hero-band--page .hero p { color: var(--muted); }
.scene-inset {
  position: absolute; right: 28px; bottom: 28px;
  width: 280px; height: 196px;
  border: 1px solid rgba(240,184,96,0.55);
  border-radius: 6px;
  pointer-events: none;
}
.scene-inset span {
  position: absolute; right: 0; top: -22px;
  font-size: 0.66rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase;
  color: #f0b860;
  white-space: nowrap;
}
.scene-legend {
  display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 22px;
  font-size: 0.8rem; color: var(--muted);
}
.scene-legend i { display: inline-block; width: 18px; height: 0; vertical-align: middle; margin-right: 6px; border-top: 2px solid; }
.scene-legend .k-sfc { height: 8px; border: 1px solid #8fa8ff; background: rgba(143,168,255,0.12); }
.scene-legend .k-traj { border-color: #c9f5e2; }
.scene-legend .k-wp { width: 9px; height: 9px; border: 1.5px solid #ff8fa3; transform: rotate(45deg); margin-right: 9px; }
.scene-legend .k-seg { border-color: #f0b860; border-top-width: 4px; }
.scene-caption { margin-top: 18px; font-size: 0.85rem; }

/* ---------- Static mesh band on write-up pages (texture = still frame from the matching scene) ---------- */
.hero-band.article-band { background: linear-gradient(180deg, #0b1210 0%, #0e1714 100%); }
.article-band::before {
  content: "";
  position: absolute; inset: 0;
  background: var(--band-img) right center / cover no-repeat;
  opacity: 0.6;
  -webkit-mask-image: linear-gradient(90deg, transparent 22%, #000 72%);
          mask-image: linear-gradient(90deg, transparent 22%, #000 72%);
  pointer-events: none;
}
.article-band .article { position: relative; padding: 44px 24px 48px; }
.article-band .article h1 { color: var(--text); }
.article-band .lede { color: #c5d1cc; }
.article-band .btn { background: rgba(18,27,24,0.75); }
.article-band + .article { padding-top: 40px; }
@media (max-width: 760px) {
  .article-band::before {
    opacity: 0.35;
    -webkit-mask-image: linear-gradient(180deg, transparent 10%, #000 100%);
            mask-image: linear-gradient(180deg, transparent 10%, #000 100%);
  }
  .article-band .article { padding: 32px 16px 36px; }
}
