:root {
  --paper: #F6F8F7;
  --ink: #15231E;
  --muted: #5B6B65;
  --rule: #D5DDD9;
  --accent: #1E6E8A;
  --accent-ink: #FFFFFF;
  --display: "Archivo", "Franklin Gothic Medium", Arial, sans-serif;
  --text: "Source Serif 4", Georgia, serif;
  --gutter: clamp(16px, 5vw, 48px);
  --measure: 66ch;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #101A17;
    --ink: #E4ECE8;
    --muted: #9AABA4;
    --rule: #2A3833;
    --accent: #7CC0D8;
    --accent-ink: #101A17;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #101A17; --ink: #E4ECE8; --muted: #9AABA4; --rule: #2A3833;
  --accent: #7CC0D8; --accent-ink: #101A17; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.125rem/1.62 var(--text);
  font-optical-sizing: auto;
}
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--gutter); top: 12px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 10; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px var(--gutter);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
  font-family: var(--display);
}
.mark { font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; letter-spacing: -0.005em; }
.top nav { display: flex; align-items: center; gap: clamp(12px, 2.5vw, 28px); font-size: 0.95rem; }
.top nav a:not(.btn) { color: var(--ink); text-decoration: none; }
.top nav a:not(.btn):hover { color: var(--accent); }
.top nav a[aria-current="page"]:not(.btn) { color: var(--accent); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.35em; }
.top nav .btn[aria-current="page"] { outline: 2px solid var(--ink); outline-offset: 2px; }
.menu-btn {
  display: none;
  font: 600 0.95rem var(--display); color: var(--ink);
  background: none; border: 1px solid var(--rule); border-radius: 6px; padding: 7px 12px; cursor: pointer;
}
@media (max-width: 760px) {
  .top { flex-wrap: wrap; }
  .menu-btn { display: inline-block; }
  .top nav { display: none; width: 100%; flex-direction: column; align-items: flex-start; gap: 0; padding: 8px 0 6px; }
  .nav-open .top nav { display: flex; }
  .top nav a { width: 100%; padding: 12px 0; font-size: 1.15rem; border-top: 1px solid var(--rule); }
  .top nav .btn { width: auto; margin-top: 12px; border-top: 0; padding: 10px 16px; }
}

.btn {
  display: inline-block;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--display); font-weight: 600; font-size: 0.95rem;
  padding: 8px 14px; border-radius: 6px; text-decoration: none;
}
.btn:hover { filter: brightness(1.08); }

main { padding: 0 var(--gutter); max-width: 1080px; margin: 0 auto; }

/* Page headers (inner pages) */
.page-head { padding: clamp(48px, 10vw, 112px) 0 clamp(32px, 6vw, 64px); border-bottom: 1px solid var(--rule); }
.page-head h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.4rem, 7.5vw, 5.5rem); line-height: 0.95; letter-spacing: -0.01em;
  font-variation-settings: "wdth" 112; font-weight: 900;
  margin: 0 0 0.4em;
}
.page-head .lede { margin-bottom: 0; }

/* Hero */
.hero { padding: clamp(56px, 12vw, 140px) 0 clamp(40px, 8vw, 88px); border-bottom: 1px solid var(--rule); }
.name {
  font-family: var(--display);
  font-size: clamp(2.6rem, 10.5vw, 8.25rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
  font-stretch: 118%;
  font-variation-settings: "wdth" 118;
  animation: widen 1.1s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes widen {
  from { font-variation-settings: "wdth" 62; opacity: 0; }
  30% { opacity: 1; }
  to { font-variation-settings: "wdth" 118; }
}
.lede { font-size: clamp(1.25rem, 2.4vw, 1.6rem); line-height: 1.45; max-width: 34em; margin: 0 0 2.2em; }

.now { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: 0; max-width: 900px; }
.now div { padding: 14px 20px 4px 0; border-top: 2px solid var(--ink); margin-right: 20px; }
.now dt { font-family: var(--display); font-weight: 600; font-size: 0.9rem; color: var(--muted); }
.now dd { margin: 4px 0 0; font-size: 1.05rem; line-height: 1.4; }
@media (max-width: 720px) { .now { grid-template-columns: 1fr; } .now div { margin-right: 0; padding-bottom: 12px; } }

/* Sections */
.block {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 32px;
  padding: clamp(48px, 8vw, 88px) 0;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 64px;
}
.block > h2 {
  font-family: var(--display);
  font-weight: 700; font-size: 1.6rem; letter-spacing: -0.005em;
  margin: 0; line-height: 1.2;
  position: sticky; top: 88px; align-self: start;
}
@media (max-width: 820px) {
  .block { grid-template-columns: 1fr; gap: 20px; }
  .block > h2 { position: static; }
}
.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1em; }
.prose p:last-child { margin-bottom: 0; }

h3 { font-family: var(--display); font-weight: 700; font-size: 1.3rem; letter-spacing: 0; line-height: 1.25; margin: 0; }
h3 .at { font-weight: 400; color: var(--muted); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li {
  display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 24px;
  padding: 0 0 36px;
}
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li + li { padding-top: 36px; border-top: 1px solid var(--rule); }
.when { font-family: var(--display); font-size: 0.95rem; color: var(--muted); margin: 0.2em 0 0; font-variant-numeric: tabular-nums; }
.where { color: var(--muted); font-style: italic; margin: 2px 0 12px; }
.timeline ul { margin: 0; padding-left: 1.1em; max-width: var(--measure); }
.timeline ul li { margin-bottom: 0.45em; }
.timeline ul li::marker { color: var(--accent); }
@media (max-width: 600px) {
  .timeline > li { grid-template-columns: 1fr; gap: 4px; }
}

/* Projects */
.projects { display: grid; gap: 0; }
.projects article { padding: 0 0 32px; max-width: var(--measure); }
.projects article + article { padding-top: 32px; border-top: 1px solid var(--rule); }
.projects article:first-child h3 { font-size: 1.75rem; }
.projects .status { font-family: var(--display); font-size: 0.95rem; color: var(--accent); margin: 4px 0 10px; }
.projects p { margin: 0 0 10px; }
.projects .stack { color: var(--muted); font-size: 1rem; margin: 0; }

/* Skills */
.skills { margin: 0; max-width: var(--measure); }
.skills div { padding: 14px 0; border-top: 1px solid var(--rule); }
.skills div:first-child { border-top: 0; padding-top: 0; }
.skills dt { font-family: var(--display); font-weight: 700; font-size: 1.05rem; }
.skills dd { margin: 4px 0 0; }

/* Contact */
.contact { border-bottom: 0; }
.contact .big { font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.3; max-width: 24em; margin: 0 0 28px; }
.contact .links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin: 0; font-family: var(--display); }
.contact .btn { font-size: 1.05rem; padding: 12px 18px; overflow-wrap: anywhere; }

.foot { padding: 28px var(--gutter) 40px; border-top: 1px solid var(--rule); color: var(--muted); font-family: var(--display); font-size: 0.9rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .name { animation: none; }
}

/* Home extras */
.roles { list-style: none; margin: 0; padding: 0; max-width: var(--measure); }
.roles li { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--rule); }
.roles li:first-child { border-top: 0; padding-top: 0; }
.roles .r { font-family: var(--display); font-weight: 600; }
.roles .d { color: var(--muted); font-family: var(--display); font-size: 0.95rem; }
.more { margin: 24px 0 0; font-family: var(--display); font-weight: 600; }
.cta { padding: clamp(48px, 8vw, 96px) 0; }
.cta .big, .contact .big { font-family: var(--display); font-weight: 700; letter-spacing: -0.005em; font-size: clamp(1.8rem, 4.5vw, 3rem); line-height: 1.1; margin: 0 0 24px; }
.links { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin: 24px 0 0; font-family: var(--display); }
.cta .links { margin-top: 0; }
.projects .tagline { font-style: italic; color: var(--muted); margin-top: -4px; }
.plain { margin: 0.5em 0 0; padding-left: 1.1em; }
.plain li { margin-bottom: 0.35em; }
.plain li::marker { color: var(--accent); }
.home .block:last-of-type { border-bottom: 1px solid var(--rule); }

/* Resume */
.resume { padding: 32px 0 clamp(48px, 8vw, 88px); }
.resume .links { margin: 0 0 24px; }
.pdf { width: 100%; max-width: 900px; height: min(1150px, 130vw); border: 1px solid var(--rule); border-radius: 6px; background: #fff; display: block; }

.foot-inner { max-width: 1080px; margin: 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 24px; }
.foot-inner p { margin: 0; }
.foot-links { display: flex; gap: 20px; }
.foot a { color: var(--muted); }

/* Photos */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) clamp(220px, 26vw, 320px); column-gap: clamp(24px, 5vw, 64px); align-items: start; }
.hero .name { grid-column: 1 / -1; }
.hero .portrait { grid-column: 2; grid-row: 2; width: 100%; height: auto; border-radius: 6px; display: block; }
.hero .hero-text { grid-column: 1; grid-row: 2; }
.hero .now { grid-template-columns: 1fr; max-width: 34em; }
.hero .now div { margin-right: 0; padding-bottom: 12px; }
@media (min-width: 1000px) { .hero .now { grid-template-columns: repeat(3, 1fr); } .hero .now div { margin-right: 20px; } }
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; }
  .hero .portrait { grid-column: 1; grid-row: 2; width: min(100%, 300px); aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 25%; margin-bottom: 28px; }
  .hero .hero-text { grid-row: 3; }
}
.wide-photo { margin: clamp(32px, 6vw, 56px) 0 0; }
.wide-photo img { width: 100%; max-width: 1080px; height: auto; display: block; border-radius: 6px; }
