/* ---------- fonts (self-hosted, latin subsets) ---------- */
@font-face { font-family: "Fraunces"; src: url("assets/fonts/Fraunces-normal-latin.woff2") format("woff2"); font-weight: 300 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("assets/fonts/Fraunces-italic-latin.woff2") format("woff2"); font-weight: 300 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter Tight"; src: url("assets/fonts/InterTight-normal-latin.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }

/* ---------- tokens ---------- */
:root {
  color-scheme: light dark;
  --paper: #f6f4ee;
  --surface: #fffdf8;
  --ink: #10131a;
  --ink-soft: #4b5361;
  --ink-faint: #8c93a0;
  --rule: #dcd8ce;
  --accent: #1e40af;
  --accent-ink: #f6f4ee;
  --accent-soft: rgba(30, 64, 175, 0.08);
  --shadow: 0 1px 0 rgba(16, 19, 26, 0.04), 0 12px 32px -20px rgba(30, 64, 175, 0.35);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --max: 66rem;
  --rail: 11rem;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  font-optical-sizing: auto;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0c0d0f;
    --surface: #121418;
    --ink: #eae5dc;
    --ink-soft: rgba(234, 229, 220, 0.72);
    --ink-faint: rgba(234, 229, 220, 0.44);
    --rule: #22262d;
    --accent: #7da4ff;
    --accent-ink: #0c0d0f;
    --accent-soft: rgba(125, 164, 255, 0.12);
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 16px 40px -24px rgba(62, 123, 255, 0.45);
  }
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { scroll-padding-top: 1.5rem; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body { margin: 0; background: var(--paper); color: var(--ink); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.14em; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); transition: text-decoration-color 160ms ease; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
h2 { font-family: var(--serif); font-weight: 500; font-size: 2rem; line-height: 1.1; letter-spacing: -0.015em; margin: 0 0 1.5rem; }
h3 { font-size: 1.08rem; font-weight: 600; line-height: 1.3; }
p { margin: 0 0 0.8rem; text-wrap: pretty; }
ul { margin: 0.35rem 0 0.9rem; padding-left: 1.15rem; }
li { margin: 0.28rem 0; }
li::marker { color: var(--ink-faint); }
section { padding: 3.25rem 0 1rem; border-top: 1px solid var(--rule); }
section:first-of-type { border-top: 0; padding-top: 1rem; }

/* ---------- hero ---------- */
.hero { border-bottom: 1px solid var(--rule); background: linear-gradient(180deg, var(--surface) 0%, var(--paper) 100%); }
.hero-inner { max-width: var(--max); margin: 0 auto; padding: clamp(2.5rem, 7vw, 5.5rem) 1.25rem 2.5rem; display: grid; grid-template-columns: 1fr; gap: 2rem; align-items: end; }
h1 { font-family: var(--serif); font-weight: 600; font-size: clamp(2.75rem, 7.5vw, 5rem); line-height: 0.98; letter-spacing: -0.03em; color: var(--ink); }
.title { font-size: 1.05rem; font-weight: 500; color: var(--ink-soft); margin: 1.1rem 0 1.5rem; }
.title .location { font-weight: 400; color: var(--ink-faint); }
.tagline { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: clamp(1.3rem, 2.4vw, 1.75rem); line-height: 1.3; max-width: 30ch; color: var(--ink); margin: 0 0 1.75rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 0; }
.btn { display: inline-block; padding: 0.55rem 1rem; border: 1px solid var(--rule); border-radius: 8px; text-decoration: none; color: var(--ink); background: var(--surface); font-size: 0.95rem; font-weight: 500; transition: border-color 160ms ease, background-color 160ms ease, transform 120ms ease; }
.btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.btn:active { transform: translateY(1px); }
.btn-pdf { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-pdf:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.photo { width: 112px; height: auto; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 15%; border-radius: 14px; display: block; box-shadow: var(--shadow); outline: 1px solid var(--rule); outline-offset: -1px; justify-self: start; order: -1; }
.print-contact { display: none; }
@media (min-width: 760px) {
  .hero-inner { grid-template-columns: 1fr auto; gap: 3rem; align-items: center; }
  .photo { width: 208px; justify-self: end; order: 0; }
}

/* one page-load moment, nothing else moves on its own */
@media (prefers-reduced-motion: no-preference) {
  .hero h1, .hero .title, .hero .tagline, .hero .actions, .hero .photo { animation: rise 700ms cubic-bezier(0.22, 1, 0.36, 1) both; }
  .hero .title { animation-delay: 80ms; }
  .hero .tagline { animation-delay: 160ms; }
  .hero .actions { animation-delay: 240ms; }
  .hero .photo { animation-delay: 120ms; }
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- layout: rail + content ---------- */
.layout { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem 4rem; }
main { max-width: 44rem; }
.rail { position: sticky; top: 0; z-index: 2; display: flex; gap: 0.25rem 1.1rem; flex-wrap: wrap; padding: 0.75rem 0; margin: 0 -1.25rem 0.5rem; padding-inline: 1.25rem; background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); font-size: 0.92rem; }
.rail a { color: var(--ink-soft); text-decoration: none; padding: 0.15rem 0; border-bottom: 1px solid transparent; transition: color 160ms ease, border-color 160ms ease; }
.rail a:hover, .rail a[aria-current] { color: var(--ink); border-color: var(--accent); }
.rail a[aria-current] { font-weight: 600; }
@media (min-width: 960px) {
  .layout { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); gap: 4rem; align-items: start; }
  .rail { position: sticky; top: 2rem; display: flex; flex-direction: column; gap: 0.55rem; margin: 3.25rem 0 0; padding: 0; background: none; backdrop-filter: none; border: 0; }
  .rail a { border-bottom: 0; border-left: 2px solid transparent; padding-left: 0.85rem; margin-left: -0.85rem; }
  .rail a:hover, .rail a[aria-current] { border-left-color: var(--accent); }
  main { max-width: none; }
}

/* ---------- about ---------- */
#about p { font-size: 1.05rem; max-width: 62ch; }

/* ---------- experience: dates in a left gutter ---------- */
.job { padding: 1.5rem 0; border-top: 1px solid var(--rule); }
.job:first-of-type { border-top: 0; padding-top: 0; }
.job-head { display: grid; grid-template-columns: 1fr; gap: 0.15rem 1.5rem; }
.job-head h3 { font-size: 1.15rem; }
.org { color: var(--ink-soft); margin: 0; }
.dates { color: var(--ink-faint); font-variant-numeric: tabular-nums; margin: 0; font-size: 0.92rem; }
.summary { margin-top: 0.75rem; color: var(--ink-soft); }
.job.compact .summary { font-size: 0.95rem; }
.links { font-size: 0.92rem; color: var(--ink-soft); margin-top: 0.5rem; }
@media (min-width: 640px) {
  .job { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); column-gap: 1.5rem; }
  .job-head { grid-column: 1 / -1; grid-template-columns: subgrid; }
  .job-head .dates { grid-column: 1; grid-row: 1 / span 2; padding-top: 0.2rem; }
  .job-head h3, .job-head .org { grid-column: 2; }
  .job > .summary, .job > ul, .job > .links { grid-column: 2; }
}

/* ---------- projects: featured rows, then a compact list ---------- */
.lede { color: var(--ink-soft); max-width: 60ch; margin-bottom: 1.75rem; }
.projects-featured { display: grid; grid-template-columns: 1fr; gap: 0; border-top: 1px solid var(--rule); }
.card { display: grid; grid-template-columns: 1fr; gap: 0.3rem 1.5rem; padding: 1.25rem 0; border-bottom: 1px solid var(--rule); color: inherit; text-decoration: none; transition: background-color 160ms ease; }
.card:hover { background: var(--accent-soft); box-shadow: 0 0 0 0.75rem var(--accent-soft); border-radius: 6px; }
.card h3 { font-family: var(--serif); font-weight: 600; font-size: 1.35rem; letter-spacing: -0.01em; color: var(--accent); }
.card p { margin: 0; color: var(--ink); }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem 0.75rem; margin: 0.15rem 0 0; padding: 0; font-size: 0.86rem; color: var(--ink-soft); }
.chips li { margin: 0; }
.chips li:not(:last-child)::after { content: ","; }
.status { font-size: 0.86rem; color: var(--ink-faint); }
@media (min-width: 640px) {
  .card.featured { grid-template-columns: 13rem minmax(0, 1fr); }
  .card.featured h3 { grid-row: 1 / span 3; }
}
.more-title { margin: 2.5rem 0 0.75rem; font-size: 0.95rem; color: var(--ink-soft); }
.projects-more .card { padding: 0.7rem 0; gap: 0.15rem 1rem; }
.projects-more .card h3 { font-family: var(--sans); font-size: 1rem; font-weight: 600; }
.projects-more .card p { font-size: 0.95rem; color: var(--ink-soft); }
.projects-more .chips { display: none; }
@media (min-width: 640px) {
  .projects-more .card { grid-template-columns: 13rem minmax(0, 1fr); }
  .projects-more .card h3 { grid-row: 1 / span 2; }
}

/* ---------- skills ---------- */
#skills h3 { margin: 1.5rem 0 0.6rem; font-size: 0.95rem; color: var(--ink-soft); }
dl { display: grid; grid-template-columns: 1fr; gap: 0.35rem 1.5rem; margin: 0; }
dt { font-weight: 600; }
dd { margin: 0 0 0.6rem; color: var(--ink-soft); }
@media (min-width: 640px) { dl { grid-template-columns: 11rem minmax(0, 1fr); } dd { margin-bottom: 0.2rem; } }
.soft dd { color: var(--ink-soft); }

/* ---------- education ---------- */
#education h3 { margin: 1.5rem 0 0.5rem; font-size: 0.95rem; color: var(--ink-soft); }
.edu { list-style: none; padding: 0; margin: 0; }
.edu li { margin: 0.35rem 0; }

/* ---------- footer ---------- */
footer { border-top: 1px solid var(--rule); padding: 1.75rem 1.25rem 3.5rem; text-align: center; color: var(--ink-soft); font-size: 0.92rem; }
.updated { margin: 0; color: var(--ink-faint); }

/* ---------- print: two Letter pages ---------- */
@media print {
  /* page and base */
  @page { size: Letter; margin: 0.5in 0.6in; }
  :root { --paper: #fff; --surface: #fff; --ink: #111; --ink-soft: #444; --ink-faint: #666; --rule: #ccc; --accent: #0b4f8a; font-size: 9.5pt; line-height: 1.28; }
  body { background: #fff; }
  main, .layout { max-width: none; padding: 0; display: block; }
  a { color: inherit; text-decoration: none; }
  .rail, footer, .actions, .lede, .links, .chips, .soft-block, .photo, .more-title, .projects-more { display: none !important; }

  /* spacing */
  p { margin: 0 0 0.05in; orphans: 3; widows: 3; }
  ul { margin: 0.02in 0 0.05in; padding-left: 0.16in; }
  li { margin: 0; orphans: 3; widows: 3; }
  h1 { font-size: 18pt; letter-spacing: -0.02em; line-height: 1; }
  h2 { font-size: 13pt; padding-top: 0; margin: 0 0 0.06in; break-after: avoid; }
  h3 { font-size: 10.5pt; margin: 0; }
  section { padding: 0.1in 0 0; border-top: 0; }
  dl { margin: 0.04in 0 0.08in; gap: 0.02in 0.2in; }

  /* header */
  .hero { background: none; border-bottom: 1px solid var(--rule); }
  .hero-inner { display: block; max-width: none; padding: 0 0 0.1in; }
  .hero h1, .hero .title, .hero .tagline, .hero .actions, .hero .photo { animation: none; }
  .title { margin: 0.04in 0 0.06in; font-size: 10.5pt; }
  .tagline { font-size: 10.5pt; max-width: none; margin: 0 0 0.05in; }
  .print-contact { display: block; font-size: 9pt; color: var(--accent); }

  /* experience: long roles may split across pages, headings stay with their first lines */
  .job { display: block; padding: 0.04in 0; break-inside: auto; border-top: 1px solid var(--rule); }
  .job:first-of-type { border-top: 0; }
  .job-head { display: grid; grid-template-columns: 1fr auto; gap: 0 0.2in; break-inside: avoid; break-after: avoid; }
  .job-head h3 { grid-column: 1; }
  .job-head .org { grid-column: 1; }
  .job-head .dates { grid-column: 2; grid-row: 1 / span 2; }
  .summary { margin-top: 0.03in; }
  #about p { max-width: none; font-size: inherit; }

  /* projects: featured only, one line each */
  .projects-featured { display: block; border: 0; }
  .card, .card.featured { display: block; margin: 0 0 0.04in; padding: 0; border: 0; break-inside: avoid; }
  .card h3 { display: inline; font-family: var(--sans); font-weight: 600; font-size: 9.5pt; color: var(--ink); } /* accent on screen, plain ink on paper */
  .card h3::after { content: " — "; }
  .card p, .card .status { display: inline; }
  .card .status::before { content: " · "; }

  /* technical skills as plain lines */
  dl.hard { display: block; }
  dl.hard dt { display: inline; font-weight: 650; }
  dl.hard dt::after { content: ": "; }
  dl.hard dd { display: inline; margin: 0; }
  dl.hard dd::after { content: "\A"; white-space: pre; }
  #skills h3, #education h3 { color: var(--ink); font-size: 10pt; margin: 0.06in 0 0.03in; }

  /* keep these blocks whole */
  #education { break-inside: avoid; }
  #education ul, #education p { margin-bottom: 0.03in; }
}
