:root {
  --paper: #f4f1ea;
  --paper-deep: #e9e4da;
  --ink: #1b211e;
  --muted: #646961;
  --line: rgba(27, 33, 30, 0.16);
  --accent: #2e5c4c;
  --accent-dark: #1f4438;
  --white: #fffdf9;
  --sans: "DM Sans", system-ui, sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --rail-width: min(34vw, 450px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}
a { color: inherit; }
a:focus-visible { outline: 3px solid #b66b3d; outline-offset: 4px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; background: var(--ink); color: white; padding: .75rem 1rem; }
.skip-link:focus { top: 1rem; }

.site-shell { display: grid; grid-template-columns: var(--rail-width) 1fr; min-height: 100vh; }
.profile-rail {
  position: relative;
  color: #f7f3ea;
  background: var(--accent-dark);
  border-right: 1px solid rgba(255,255,255,.12);
}
.rail-inner { position: sticky; top: 0; min-height: 100vh; padding: clamp(2rem, 4vw, 4.5rem); display: flex; flex-direction: column; }
.identity { display: grid; gap: 1.5rem; }
.portrait { width: clamp(104px, 12vw, 160px); height: clamp(104px, 12vw, 160px); object-fit: cover; object-position: center; border-radius: 50%; filter: saturate(.72) contrast(1.04); border: 1px solid rgba(255,255,255,.4); }
.eyebrow, .section-kicker, .entry-type { margin: 0; font-size: .71rem; line-height: 1.3; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; }
.identity .eyebrow { color: rgba(255,255,255,.62); }
h1 { margin: .7rem 0 0; font: 600 clamp(3rem, 4.4vw, 4.2rem)/.84 var(--serif); letter-spacing: -.055em; }
.role { margin: 1rem 0 0; max-width: 28ch; color: rgba(255,255,255,.72); line-height: 1.45; }

.section-nav { display: flex; flex-wrap: wrap; gap: .45rem 1.1rem; margin: 2rem 0; padding-block: 1.25rem; border-block: 1px solid rgba(255,255,255,.16); }
.section-nav a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; color: rgba(255,255,255,.7); text-decoration: none; font-size: .83rem; }
.section-nav a:hover { color: white; }
.rail-section { padding: .9rem 0; border-bottom: 1px solid rgba(255,255,255,.13); }
.rail-section h2 { margin: 0 0 .65rem; color: rgba(255,255,255,.52); font-size: .67rem; text-transform: uppercase; letter-spacing: .14em; }
.compact-list { list-style: none; padding: 0; margin: 0; }
.timeline li { display: grid; grid-template-columns: 5.6rem 1fr; margin-bottom: .48rem; line-height: 1.25; }
.timeline span { color: rgba(255,255,255,.46); font-size: .72rem; }
.timeline strong { font-size: .82rem; font-weight: 600; }
.timeline small { grid-column: 2; color: rgba(255,255,255,.62); font-size: .74rem; }
.education-item { margin-bottom: .6rem; line-height: 1.35; }
.education-item strong, .education-item span { display: block; font-size: .81rem; }
.education-item span, .language-list { color: rgba(255,255,255,.62); }
.language-list { margin: 0; font-size: .78rem; line-height: 1.6; }
.rail-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: auto; padding-top: 1.5rem; }
.button { display: inline-flex; align-items: center; justify-content: space-between; min-height: 44px; padding: .65rem .9rem; border: 1px solid rgba(255,255,255,.28); background: transparent; color: inherit; font: 500 .78rem var(--sans); text-decoration: none; cursor: pointer; flex: 1; transition: .2s ease; }
.button.primary { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.button.secondary { color: white; }
.contact-trigger { flex-basis: 100%; background: var(--paper); color: var(--ink); border-color: var(--paper); }
.button:hover { transform: translateY(-2px); }
.button:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #b66b3d; outline-offset: 3px; }

main { min-width: 0; }
main > section, footer { padding: clamp(3.5rem, 7vw, 7.5rem) clamp(2rem, 8vw, 8rem); }
.intro { min-height: 93vh; display: flex; flex-direction: column; justify-content: center; }
.section-kicker { color: var(--accent); margin-bottom: 1.4rem; }
.intro > h2 { max-width: 900px; margin: 0; font: 500 clamp(3.5rem, 7vw, 8rem)/.93 var(--serif); letter-spacing: -.045em; }
.intro > h2 em { color: var(--accent); font-weight: 500; }
.intro-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(220px, .65fr); gap: clamp(2rem, 6vw, 6rem); max-width: 1000px; margin-top: clamp(3rem, 6vw, 5.5rem); }
.intro-grid p { margin: 0; color: var(--muted); }
.intro-grid .lede { color: var(--ink); font: 500 clamp(1.45rem, 2vw, 2rem)/1.35 var(--serif); }
.focus-strip { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 3rem; }
.focus-strip span { border: 1px solid var(--line); padding: .45rem .78rem; font-size: .74rem; color: var(--muted); border-radius: 2rem; }

.content-section { border-top: 1px solid var(--line); }
.section-heading { max-width: 700px; margin-bottom: clamp(3rem, 6vw, 6rem); }
.section-heading h2 { margin: 0 0 1rem; font: 500 clamp(2.5rem, 5vw, 5.4rem)/.98 var(--serif); letter-spacing: -.035em; }
.section-heading > p:last-child { color: var(--muted); max-width: 50ch; }
.case-list { border-top: 1px solid var(--line); }
.case-study { display: grid; grid-template-columns: minmax(140px, .5fr) minmax(250px, 1.25fr) 1.1fr; gap: clamp(1.5rem, 4vw, 4rem); align-items: start; padding: 2.2rem 0; border-bottom: 1px solid var(--line); }
.case-study h3 { margin: 0; font: 500 clamp(1.55rem, 2.4vw, 2.45rem)/1.08 var(--serif); }
.case-study p { margin: 0; color: var(--muted); }
.case-study a, .entry a { display: inline-flex; align-items: center; min-height: 44px; width: fit-content; color: var(--accent); font-size: .82rem; font-weight: 600; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.case-study a { grid-column: 3; }
.case-meta { display: flex; flex-direction: column; gap: .25rem; font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }

.split-section { display: grid; grid-template-columns: minmax(230px, .6fr) minmax(0, 1fr); gap: clamp(3rem, 8vw, 9rem); }
.sticky-heading { align-self: start; position: sticky; top: 4rem; }
.entry-list { border-top: 1px solid var(--line); }
.entry { display: grid; grid-template-columns: 4.5rem 1fr; gap: 1.25rem; padding: 2.25rem 0 2.8rem; border-bottom: 1px solid var(--line); }
.entry-index { color: var(--muted); font: 500 .76rem/1 var(--sans); }
.entry-type { color: var(--muted); margin-bottom: .65rem; }
.entry h3 { margin: 0 0 .8rem; font: 500 clamp(1.55rem, 2.4vw, 2.35rem)/1.08 var(--serif); }
.entry p:not(.entry-type) { color: var(--muted); margin: 0 0 1rem; }
.muted-entry { opacity: .58; }
.pending-link { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; color: #8c593d; }

.code-section { background: var(--paper-deep); }
.github-card { display: flex; justify-content: space-between; gap: 3rem; padding: clamp(2rem, 5vw, 4rem); background: var(--accent-dark); color: #fff; text-decoration: none; transition: transform .25s ease; }
.github-card:hover { transform: translateY(-4px); }
.github-card h3 { margin: .7rem 0 1rem; font: 500 clamp(2rem, 4vw, 4rem)/1 var(--serif); }
.github-card p:last-child { max-width: 62ch; color: rgba(255,255,255,.66); }
.round-arrow { flex: 0 0 auto; display: grid; place-items: center; width: 56px; height: 56px; border: 1px solid rgba(255,255,255,.45); border-radius: 50%; font-size: 1.3rem; }
footer { display: flex; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--line); font-size: .76rem; color: var(--muted); }
footer p { margin: 0; }
footer a { display: inline-flex; align-items: center; min-height: 44px; }

body.modal-open { overflow: hidden; }
.contact-dialog { width: min(92vw, 600px); max-height: min(90vh, 760px); margin: auto; padding: 0; border: 0; background: var(--white); color: var(--ink); box-shadow: 0 24px 80px rgba(12, 25, 20, .28); }
.contact-dialog::backdrop { background: rgba(15, 29, 24, .72); backdrop-filter: blur(4px); }
.contact-form { display: grid; gap: .65rem; padding: clamp(1.5rem, 5vw, 3rem); }
.contact-heading { display: flex; justify-content: space-between; gap: 1.5rem; margin-bottom: 1rem; }
.contact-heading h2 { margin: 0 0 .55rem; font: 500 clamp(2.2rem, 6vw, 3.8rem)/.96 var(--serif); letter-spacing: -.035em; }
.contact-heading p:last-child { margin: 0; color: var(--muted); }
.dialog-close { flex: 0 0 auto; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); font: 400 1.6rem/1 var(--sans); cursor: pointer; }
.contact-form > label { margin-top: .35rem; font-size: .76rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.contact-form input, .contact-form textarea { width: 100%; border: 1px solid var(--line); border-radius: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.5 var(--sans); padding: .8rem .9rem; }
.contact-form textarea { resize: vertical; min-height: 9rem; }
.contact-submit { min-height: 48px; margin-top: .8rem; border: 1px solid var(--accent-dark); background: var(--accent-dark); color: white; font: 600 .85rem var(--sans); cursor: pointer; }
.contact-submit:disabled { cursor: wait; opacity: .62; }
.contact-status { min-height: 1.5rem; margin: .25rem 0 0; color: var(--muted); font-size: .84rem; }
.contact-status.success { color: var(--accent); }
.contact-status.error { color: #8c3f32; }
.honeypot { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 980px) {
  :root { --rail-width: 330px; }
  .rail-inner { padding: 2rem; }
  .case-study { grid-template-columns: 1fr; gap: .85rem; }
  .case-study a { grid-column: auto; }
  .split-section { grid-template-columns: 1fr; }
  .sticky-heading { position: static; }
}

@media (max-width: 720px) {
  .site-shell { display: block; }
  .profile-rail { position: static; }
  .rail-inner { position: static; min-height: auto; }
  .identity { grid-template-columns: 92px minmax(0, 1fr); align-items: start; }
  .identity > div, .github-card > div { min-width: 0; }
  .portrait { width: 92px; height: 92px; }
  h1 { font-size: clamp(2.2rem, 9vw, 2.6rem); }
  .role { font-size: .86rem; }
  .section-nav { margin-bottom: 1rem; }
  .rail-section { display: none; }
  .rail-actions { max-width: 360px; }
  main > section, footer { padding: 4rem 1.35rem; }
  .intro { min-height: auto; padding-top: 5rem; padding-bottom: 5rem; }
  .intro > h2 { font-size: clamp(3rem, 14vw, 5rem); }
  .intro-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .entry { grid-template-columns: 3rem 1fr; }
  .github-card { gap: 1rem; padding: 2rem; }
  .round-arrow { width: 48px; height: 48px; }
  .contact-form { gap: .45rem; padding: 1.25rem 1.5rem; }
  .contact-heading { margin-bottom: .25rem; }
  .contact-heading .section-kicker { margin-bottom: .6rem; }
  .contact-heading h2 { font-size: 2rem; }
  .contact-form textarea { height: 5rem; min-height: 5rem; }
  footer { flex-direction: column; }
}

@media (max-width: 360px) {
  .identity { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
