/* ---------- Tokens ---------- */
@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,700&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --ink: #14213d;        /* midnight: hero, navbar, headings */
  --ink-2: #1e2f52;      /* raised surface on ink */
  --paper: #f6f7f9;      /* page background */
  --slate: #536179;      /* secondary text */
  --rule: #dde2ea;       /* hairlines */
  --teal: #1f7a6d;       /* links, actions */
  --gold: #c9a24a;       /* ledger accent: hashes, highlights */
  --serif: "Fraunces", Georgia, serif;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
}
h1, h2, h3, .title { font-family: var(--serif); color: var(--ink); letter-spacing: -0.015em; }
a { color: var(--teal); text-underline-offset: 3px; }
a:hover { color: var(--ink); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.navbar { border-bottom: 1px solid var(--ink-2); }
.navbar-brand .navbar-title { font-family: var(--serif); font-weight: 700; }

/* ---------- Buttons ---------- */
.btn-solid, .btn-line {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  border-radius: 6px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.btn-solid { background: var(--gold); color: var(--ink) !important; }
.btn-solid:hover { background: #e0bc66; }
.btn-line { border: 1px solid rgba(246, 247, 249, 0.5); color: var(--paper) !important; }
.btn-line:hover { background: rgba(246, 247, 249, 0.1); }
.btn-dark { background: var(--teal); color: #fff !important; }
.btn-dark:hover { background: var(--ink); }

/* ---------- Home: hero ---------- */
.hero {
  background-color: var(--ink);
  /* faint ledger grid */
  background-image:
    linear-gradient(rgba(246,247,249,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(246,247,249,0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--paper);
  margin: 0 calc(50% - 50vw);
  padding: 4.5rem 1.5rem 3.5rem;
}
.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
}
.hero h1 {
  color: var(--paper);
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  line-height: 1.02;
  margin: 0 0 1.25rem;
}
.hero-role { font-size: 1.15rem; color: var(--gold); margin-bottom: 0.75rem; }
.hero-lede { font-size: 1.15rem; max-width: 34em; color: #d6dce7; }
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.75rem; }
.hero-photo {
  width: 100%;
  max-width: 320px;
  justify-self: end;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  border: 6px solid var(--ink-2);
  box-shadow: 0 0 0 1px var(--gold);
}

/* ---------- Home: career chain ---------- */
.chain-section {
  background-color: var(--ink);
  background-image:
    linear-gradient(rgba(246,247,249,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(246,247,249,0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: 0 -16px;
  margin: 0 calc(50% - 50vw);
  padding: 0 1.5rem 3.5rem;
  color: var(--paper);
}
.chain-head { max-width: 1100px; margin: 0 auto 1.25rem; }
.chain-head h2 { color: var(--paper); font-size: 1.6rem; margin: 0; border: 0; }
.chain-head p { color: #b8c1d1; margin: 0.25rem 0 0; }

.chain {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  gap: 2.25rem;
  overflow-x: auto;
  padding: 0.5rem 0.25rem 1.25rem;
  scroll-snap-type: x proximity;
  scrollbar-color: var(--gold) transparent;
}
.block {
  position: relative;
  flex: 0 0 210px;
  scroll-snap-align: start;
  background: var(--ink-2);
  border: 1px solid #2e4470;
  border-radius: 8px;
  padding: 0.9rem 1rem 1rem;
}
/* link to the previous block */
.block + .block::before {
  content: "";
  position: absolute;
  left: -2.25rem;
  top: 2.1rem;
  width: 2.25rem;
  height: 2px;
  background: var(--gold);
  transform-origin: left;
}
.block .year { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; color: var(--paper); }
.block .name { font-weight: 600; margin: 0.15rem 0 0.35rem; color: var(--paper); }
.block .what { font-size: 0.9rem; color: #c3cad7; line-height: 1.45; }
.block .hash {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--gold);
  margin-top: 0.75rem;
  white-space: nowrap;
}
.block.current { border-color: var(--gold); }

/* build animation: only when JS adds .is-building */
.chain.is-building .block { animation: block-in 0.45s ease-out both; }
.chain.is-building .block + .block::before { animation: link-in 0.3s ease-out both; animation-delay: inherit; }
@keyframes block-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes link-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) {
  .chain.is-building .block, .chain.is-building .block + .block::before { animation: none; }
}

/* ---------- Home: body ---------- */
.home-body { max-width: 760px; margin: 3rem auto 1rem; }
.home-body h2 { font-size: 1.7rem; margin-top: 2.5rem; }
.focus {
  max-width: 1100px;
  margin: 2.5rem auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
}
.focus > div { border-top: 3px solid var(--ink); padding-top: 0.9rem; }
.focus h3 { font-size: 1.2rem; margin: 0 0 0.4rem; }
.focus p { color: var(--slate); margin: 0; }

/* ---------- Projects ---------- */
.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 1rem 0 2rem; }
.filters button {
  font: inherit;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.filters button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.pgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.pcard {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
}
.pcard.wide { grid-column: 1 / -1; }
.pcard img { width: 100%; border-radius: 6px; margin-bottom: 0.9rem; border: 1px solid var(--rule); }
.pcard h3 { font-size: 1.3rem; margin: 0 0 0.25rem; }
.pcard .where { color: var(--slate); font-size: 0.9rem; margin-bottom: 0.6rem; }
.pcard .metric {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 700;
  color: var(--teal);
  line-height: 1.1;
}
.pcard .metric-label { color: var(--slate); font-size: 0.9rem; margin-bottom: 0.6rem; }
.pcard .tools { margin-top: auto; padding-top: 0.6rem; font-size: 0.85rem; color: var(--slate); }
.pcard[hidden] { display: none; }

/* ---------- CV and contact ---------- */
.cv-frame { width: 100%; height: 900px; border: 1px solid var(--rule); border-radius: 6px; }
.contact-big { font-family: var(--serif); font-size: clamp(1.6rem, 4vw, 2.4rem); margin: 1.5rem 0; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero-photo { justify-self: start; max-width: 200px; order: -1; }
  .focus, .pgrid { grid-template-columns: 1fr; }
}

/* Home: hero sits flush under the navbar */
main.content:has(> .hero) { margin-top: 0 !important; padding-top: 0 !important; }
main.content > .hero:first-child { margin-top: 0; }

/* Projects page: wider grid on a full-width layout */
.projects-page .filters,
.projects-page .pgrid,
.projects-page #title-block-header { max-width: 1100px; margin-left: auto; margin-right: auto; }
main.content:has(> .hero) > #title-block-header { display: none; }
