:root {
  /* I change the palette and layout width here before editing individual rules. */
  --ink: #12345a;
  --muted: #5d6f82;
  --paper: #ffffff;
  --wash: #f1f6fb;
  --line: #cbd9e8;
  --accent: #b32635;
  --signal: #2f679f;
  --max-width: 1160px;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* ---------- I keep shared layout and accessibility rules here. ---------- */
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
main { position: relative; display: flex; flex-direction: column; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.container { width: min(calc(100% - 64px), var(--max-width)); margin: 0 auto; }
.skip-link { position: absolute; left: 16px; top: -50px; z-index: 20; padding: 8px 12px; color: white; background: var(--ink); }
.skip-link:focus { top: 16px; }

.site-header { position: sticky; top: 0; z-index: 4; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px); }
.header-inner { min-height: 82px; display: flex; align-items: center; }
.wordmark {
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid var(--ink); border-radius: 4px; font: 15px var(--serif); letter-spacing: .06em;
}
.header-status { margin-left: 32px; color: var(--muted); font-size: 11px; }
.header-status::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 8px 1px 0; border-radius: 50%; background: var(--signal); }
.site-nav { display: flex; align-items: center; gap: 29px; margin-left: auto; font-size: 13px; }
.site-nav a { transition: color .2s ease; }
.site-nav a:hover, .text-link:hover { color: var(--accent); }
.nav-contact { padding: 9px 13px; border: 1px solid var(--ink); border-radius: 99px; }
.menu-toggle { display: none; margin-left: auto; border: 0; color: var(--ink); background: none; font: inherit; }
.menu-icon { margin-left: 4px; }

.hero { position: relative; display: grid; grid-template-columns: 1fr 240px; gap: 100px; padding-top: 122px; padding-bottom: 91px; }
.hero::before { content: "Academic portfolio"; position: absolute; top: 39px; right: 0; color: var(--muted); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; }
.eyebrow, .section-number { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; }
.hero h1 { margin: 17px 0 7px; font: 400 clamp(4rem, 9vw, 7.8rem)/.96 var(--serif); letter-spacing: -.065em; }
.hero-role { margin: 0; color: var(--muted); font-size: 20px; }
.hero-intro { max-width: 550px; margin: 31px 0 35px; font: 21px/1.48 var(--serif); }
.hero-links { display: flex; align-items: center; gap: 26px; }
.button { display: inline-flex; gap: 25px; align-items: center; padding: 13px 17px; border-radius: 8px; font-size: 12px; letter-spacing: .03em; transition: background .2s ease, transform .2s ease, box-shadow .2s ease; }
.hero-links .button { min-height: 43px; }
.button:hover { transform: translateY(-2px); }
.button-dark { color: var(--paper); background: var(--ink); }
.button-dark:hover { background: var(--accent); }
.button-outline { border: 1px solid var(--ink); }
.button-outline:hover { color: var(--paper); background: var(--ink); }
.text-link { border-bottom: 1px solid currentColor; padding-bottom: 2px; font-size: 12px; }
.text-link span, .button span { font-size: 16px; line-height: 0; }
.profile-strip { display: grid; grid-template-columns: repeat(3, max-content); gap: 32px; margin-top: 56px; padding-top: 18px; border-top: 1px solid var(--line); }
.profile-strip div { display: flex; flex-direction: column; gap: 4px; }
.profile-strip span, .profile-strip strong { font-size: 10px; line-height: 1.3; }
.profile-strip span { color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.profile-strip strong { font-weight: 600; }
.hero-aside { padding-top: 28px; }
.hero-focus-panel { position: relative; display: flex; min-height: 250px; flex-direction: column; justify-content: space-between; padding: 24px; overflow: hidden; border-left: 3px solid var(--accent); background: var(--wash); color: var(--muted); }
.hero-focus-panel > * { position: relative; z-index: 1; }
.hero-focus-panel strong { max-width: 180px; color: var(--ink); font: 22px/1.15 var(--serif); }
.hero-focus-panel ul { margin: 20px 0 0; padding: 0; list-style: none; font-size: 11px; line-height: 1.8; }
.hero-focus-panel li::before { content: "—"; margin-right: 7px; color: var(--accent); }
#profile-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .34; }
.location { margin-top: 17px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.notice-bar { color: var(--paper); background: var(--ink); }
.notice-inner { display: flex; align-items: center; gap: 12px; min-height: 50px; font-size: 11px; letter-spacing: .02em; }
.notice-mark { color: var(--accent); font: 22px var(--serif); line-height: 0; }
.notice-code { margin-left: auto; color: #b9c9d8; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.rule { border-top: 1px solid var(--line); }
main > section, .notice-bar, .rule { position: relative; z-index: 1; }
#ambient-canvas { position: absolute; top: 0; right: 0; z-index: 0; width: 100%; height: 720px; pointer-events: none; opacity: .16; }
.section-3d-canvas { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; pointer-events: none; opacity: .14; }

/* ---------- I keep section layout and navigation order rules here. ---------- */
#experience, #research, #projects, #contact { overflow: hidden; }
#experience > .container, #research > .section-label, #research > .section-content, #projects > .container, #contact > *:not(.section-3d-canvas) { position: relative; z-index: 1; }
#top { order: 1; }
.notice-bar { order: 2; }
.rule { order: 3; }
#about { order: 4; }
#research { order: 5; }
#education { order: 6; }
#experience { order: 7; }
#projects { order: 8; }
#certifications { order: 9; }
#technical { order: 10; }
.fit-section { order: 11; }
.closing { order: 12; }

.section { padding-top: 120px; padding-bottom: 120px; }
.section:not(.hero) { animation: section-enter .7s ease both; }
@keyframes section-enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .section:not(.hero) { animation: none; } }
.section-tinted { background: transparent; }
.section-tinted > .container { max-width: calc(var(--max-width) + 80px); padding: 76px 64px; background: var(--wash); border: 1px solid var(--line); border-radius: 12px; }
.split-section { display: grid; grid-template-columns: 220px 1fr; gap: 75px; }
.section-label h2 { margin: 16px 0 0; font: 400 27px/1.1 var(--serif); }
.experience-total { max-width: 175px; margin: 24px 0 0; color: var(--accent) !important; font-size: 11px !important; line-height: 1.45; }
.section-content { max-width: 720px; }
.section-content p { color: var(--muted); }
.about-content { max-width: 660px; }
.about-content .lead, .lead { margin: 0 0 25px; color: var(--ink); font: 29px/1.27 var(--serif); }
.about-content p { margin: 0 0 21px; }
.about-content strong { color: var(--ink); font-weight: 600; }
.about-content .text-link { display: inline-block; margin-top: 17px; }
.profile-links { display: flex; flex-wrap: wrap; gap: 12px 20px; margin-top: 31px; padding-top: 18px; border-top: 1px solid var(--line); }
.profile-links a { color: var(--muted); font-size: 11px; }
.profile-links a:hover { color: var(--accent); }
.profile-links span { color: var(--accent); }

/* ---------- I keep education and experience rules here. ---------- */
.timeline { position: relative; }
.timeline::before { content: ""; position: absolute; top: 5px; bottom: 4px; left: 171px; width: 1px; background: var(--line); }
.timeline-item { position: relative; display: grid; grid-template-columns: 155px 1fr; gap: 30px; padding: 0 0 34px; margin-bottom: 34px; border-bottom: 1px solid var(--line); }
.timeline-item::before { content: ""; position: absolute; top: 5px; left: 167px; width: 9px; height: 9px; border: 2px solid var(--paper); border-radius: 50%; background: var(--accent); }
.section-banner { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 28px; }
.section-banner h2 { margin: 12px 0 0; font: 400 clamp(2.4rem, 5vw, 4.4rem)/.95 var(--serif); }
.section-banner p { max-width: 260px; margin: 0; color: var(--muted); font-size: 13px; }
.certification-section { background: var(--paper); }
.certification-panel { padding: 30px; border: 1px solid var(--line); border-radius: 12px; background: var(--wash); }
.certification-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; }
.certification-heading h3 { font: 400 22px var(--serif); }
.certification-heading + #cert-canvas { display: block; width: 100%; height: 300px; margin: 8px 0 -4px; cursor: grab; }
.certification-heading + #cert-canvas:active { cursor: grabbing; }
.certification-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 20px; margin-top: 30px; }
.certification-card { min-width: 0; padding: 16px 10px 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); text-align: center; transition: transform .28s ease, border-color .28s ease, box-shadow .28s ease; animation: cert-card-enter .7s ease both; }
.certification-card:nth-child(2) { animation-delay: .08s; }
.certification-card:nth-child(3) { animation-delay: .16s; }
.certification-card:nth-child(4) { animation-delay: .24s; }
.certification-card:nth-child(5) { animation-delay: .32s; }
.certification-card:hover, .certification-card.is-active { transform: translateY(-7px); border-color: var(--accent); box-shadow: 0 12px 26px rgba(18, 52, 90, .12); }
@keyframes cert-card-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.certification-card h4 { margin: 7px 0 3px; font-size: 13px; letter-spacing: .08em; }
.certification-card p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.35; }
.certification-note { margin: 16px 0 0; color: var(--muted); font: italic 12px/1.45 var(--serif); }
.cert-dialog { width: min(460px, calc(100% - 32px)); padding: 32px; border: 1px solid var(--line); border-top: 4px solid var(--accent); color: var(--ink); background: var(--paper); box-shadow: 0 20px 70px rgba(18, 52, 90, .22); }
.cert-dialog::backdrop { background: rgba(18, 52, 90, .35); backdrop-filter: blur(3px); }
.cert-dialog h2 { margin: 12px 0 14px; font: 400 30px/1.1 var(--serif); }
.cert-dialog p:last-child { color: var(--muted); font-size: 14px; line-height: 1.65; }
.dialog-close { position: absolute; top: 12px; right: 14px; border: 0; color: var(--muted); background: transparent; font-size: 26px; cursor: pointer; }
.timeline-item:last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
.timeline-meta { display: flex; flex-direction: column; color: var(--muted); font-size: 11px; line-height: 1.5; }
.lab-tag { display: block; color: var(--accent); font-size: 9px; letter-spacing: .04em; text-transform: uppercase; }
h3 { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.35; }
h3 em { color: var(--muted); font: .95em var(--serif); }
.timeline-item p { margin: 10px 0 0; font-size: 14px; line-height: 1.6; }
.education-content { max-width: 760px; }
.education-item { display: grid; grid-template-columns: 180px 1fr; gap: 30px; padding: 0 0 30px; margin-bottom: 30px; border-bottom: 1px solid var(--line); }
.education-item:last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
.education-meta { display: flex; flex-direction: column; color: var(--muted); font-size: 11px; line-height: 1.5; }
.fun-fact { margin-top: 14px !important; padding-left: 12px; border-left: 2px solid var(--accent); color: var(--ink) !important; font-size: 12px !important; line-height: 1.5 !important; }
.fun-fact strong { color: var(--accent); font-weight: 600; }
.volunteering { margin-top: 62px; }
.volunteer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 20px; }
.volunteer-item { display: grid; grid-template-columns: 48px 1fr; gap: 14px; padding: 18px; border: 1px solid var(--line); background: var(--paper); }
.volunteer-logo { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 9px; color: var(--paper); font-size: 11px; font-weight: 800; letter-spacing: -.05em; }
.infragard-logo { background: #193b68; }
.ballotpedia-logo { background: #b32635; }
.usdr-logo { background: #2f679f; font-size: 9px; letter-spacing: -.08em; }
.volunteer-meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; color: var(--muted); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.volunteer-item h3 { font-size: 15px; }
.volunteer-item p { margin: 8px 0 14px; font-size: 12px; line-height: 1.5; }
.volunteer-item .text-link { font-size: 10px; }

/* ---------- I keep research and project rules here. ---------- */
.research-list { margin-top: 37px; }
.research-item { display: grid; grid-template-columns: 46px 1fr; gap: 15px; padding: 25px 0; border-top: 1px solid var(--line); }
.research-item:last-child { border-bottom: 1px solid var(--line); }
.research-year { color: var(--accent); font: 16px var(--serif); }
.research-item p { margin: 8px 0 14px; font-size: 14px; }
.tag { display: inline-block; margin: 0 5px 5px 0; color: var(--muted); font-size: 10px; letter-spacing: .04em; }
.tag::before { content: "#"; color: var(--accent); }
.tag { border-bottom: 1px solid rgba(58, 152, 150, .35); }
.research-writing { margin-top: 55px; }
.subsection-heading { display: flex; justify-content: space-between; padding-bottom: 13px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.subsection-heading span:last-child { color: var(--accent); }

.project-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.project-card { min-height: 245px; padding: 24px; border: 1px solid var(--line); border-radius: 3px; display: flex; flex-direction: column; transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.project-card:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: 0 15px 28px rgba(32, 42, 45, .08); }
.project-topline { display: flex; justify-content: space-between; margin-bottom: 49px; color: var(--muted); font-size: 10px; letter-spacing: .05em; text-transform: uppercase; }
.project-card h3 { font: 400 22px/1.1 var(--serif); }
.project-card p { margin: 9px 0 20px; font-size: 13px; line-height: 1.55; }
.project-card .text-link { margin-top: auto; align-self: flex-start; }
.tool-card { background: var(--paper); }
.tool-card .project-topline { margin-bottom: auto; }
.tool-card .tool-list { color: var(--ink); font: 20px/1.45 var(--serif); }
.project-card:nth-child(1) { background: #edf5fc; }
.project-card:nth-child(2) { background: #fbecef; }
.project-card:nth-child(3) { background: #eef2fa; }
.project-card:nth-child(4) { background: #f5f8fc; }
.section-footnote { margin: 20px 0 0; color: var(--muted); font: italic 12px var(--serif); }
.technical-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.technical-grid article { min-height: 210px; padding: 24px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.technical-label { display: block; margin-bottom: 42px; color: var(--accent); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.technical-grid h3 { font: 400 21px/1.2 var(--serif); }
.technical-grid p { margin: 9px 0 19px; font-size: 13px; }
.technical-links { display: flex; flex-wrap: wrap; gap: 12px 18px; }
.technical-grid .text-link { display: inline-block; }
.publication-list { margin-top: 37px; }
.publication-item { padding: 22px 0 27px; border-top: 1px solid var(--line); }
.publication-item:last-child { border-bottom: 1px solid var(--line); }
.publication-meta { display: flex; justify-content: space-between; margin-bottom: 18px; color: var(--accent); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.author-badge { display: inline-block; margin-left: 7px; padding: 3px 6px; border: 1px solid var(--red); color: var(--red); font-size: 9px; letter-spacing: .06em; white-space: nowrap; }
.publication-item h3 { font: 400 21px/1.2 var(--serif); }
.publication-item p { margin: 9px 0 17px; font-size: 13px; }

/* ---------- I keep the standalone CV page rules here. ---------- */
.cv-page { background: var(--paper); color: var(--ink); }
.cv-shell { max-width: 860px; margin: 0 auto; padding: 72px 28px 96px; }
.cv-header { border-bottom: 2px solid var(--ink); padding-bottom: 28px; }
.cv-header h1 { margin: 8px 0 10px; font: 400 clamp(42px, 8vw, 76px)/.95 var(--serif); }
.cv-header p:not(.eyebrow) { max-width: 650px; margin-bottom: 24px; }
.cv-section { border-bottom: 1px solid var(--line); padding: 30px 0; }
.cv-section h2 { margin: 0 0 17px; font: 400 25px/1.1 var(--serif); }
.cv-publications { margin: 0; padding-left: 24px; }
.cv-publications li { margin-bottom: 17px; padding-left: 6px; line-height: 1.65; }
@media (max-width: 620px) {
  .publication-meta { align-items: flex-start; gap: 8px; flex-direction: column; }
  .author-badge { margin-left: 4px; }
}
.fit-section { padding: 88px 0; color: var(--paper); background: var(--ink); }
.fit-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 100px; align-items: end; }
.fit-section h2 { margin: 22px 0 0; font: 400 clamp(3rem, 5vw, 5rem)/.95 var(--serif); letter-spacing: -.05em; }
.fit-section h2 em { color: var(--accent); font-style: normal; }
.fit-copy { max-width: 470px; }
.fit-copy p { color: #d5e0ed; font-size: 16px; }
.fit-copy .small-note { font-size: 11px; }

.recognition-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 55px; }
.recognition-grid h3 { margin-bottom: 17px; font: 400 22px var(--serif); }
.recognition-grid p { font-size: 14px; }
.plain-list { margin: 0; padding: 0; list-style: none; }
.plain-list li { display: grid; grid-template-columns: 50px 1fr; gap: 15px; padding: 11px 0; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.45; }
.plain-list li:last-child { border-bottom: 1px solid var(--line); }
.plain-list li span:first-child { color: var(--accent); }
.small-note { font-size: 11px !important; }
.closing { padding-top: 126px; padding-bottom: 138px; }
.closing h2 { margin: 20px 0 30px; font: 400 clamp(3rem, 6vw, 5.3rem)/1.02 var(--serif); letter-spacing: -.045em; }
.closing h2 em { color: var(--accent); font-weight: 400; }
.contact-copy { max-width: 500px; margin: 0 0 28px; color: var(--muted); font-size: 16px; }
.contact-section .hero-links { gap: 12px; }
.site-footer { padding: 25px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; }
.footer-inner a { color: var(--ink); }

@media (max-width: 760px) {
  .volunteer-grid { grid-template-columns: 1fr; }
  .container { width: min(calc(100% - 40px), var(--max-width)); }
  .header-inner { min-height: 70px; }
  .header-status { display: none; }
  .menu-toggle { display: flex; align-items: center; gap: 8px; font-size: 12px; }
  .site-nav { display: none; position: absolute; top: 70px; left: 0; right: 0; z-index: 5; padding: 18px 20px 22px; background: var(--paper); border-bottom: 1px solid var(--line); flex-direction: column; align-items: flex-start; gap: 14px; }
  .site-nav.is-open { display: flex; }
  .hero { display: block; padding-top: 75px; padding-bottom: 62px; }
  .hero h1 { font-size: clamp(3.8rem, 19vw, 6rem); }
  .hero-intro { font-size: 19px; }
  .hero::before { top: 25px; left: 0; right: auto; }
  .profile-strip { grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 42px; }
  .profile-strip div:last-child { grid-column: 1 / -1; }
  .hero-aside { display: grid; grid-template-columns: 120px 1fr; gap: 20px; align-items: end; padding-top: 53px; }
  .hero-focus-panel { min-height: 190px; }
  .location { margin: 0; }
  .notice-inner { min-height: 64px; }
  .notice-code { display: none; }
  .section { padding-top: 75px; padding-bottom: 75px; }
  .section-tinted > .container { width: min(calc(100% - 24px), var(--max-width)); padding: 52px 20px; border-radius: 17px; }
  .split-section { display: block; }
  .section-label { margin-bottom: 38px; }
  .about-content .lead, .lead { font-size: 25px; }
  .fit-section { padding: 70px 0; }
  .fit-inner { display: block; }
  .fit-copy { margin-top: 35px; }
  .timeline::before { display: none; }
  .timeline-item { grid-template-columns: 1fr; gap: 11px; }
  .timeline-item::before { display: none; }
  .education-item { grid-template-columns: 1fr; gap: 11px; }
  .section-banner { display: block; }
  .section-banner p { margin-top: 16px; }
  .certification-panel { padding: 21px 16px 18px; }
  .certification-heading { display: block; }
  .certification-heading h3 { margin-top: 8px; }
  .certification-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .certification-card:last-child { grid-column: 1 / -1; max-width: calc(50% - 5px); justify-self: center; }
  .certification-heading + #cert-canvas { height: 230px; }
  .project-grid, .recognition-grid { grid-template-columns: 1fr; }
  .technical-grid { grid-template-columns: 1fr; }
  .project-card { min-height: 220px; }
  .footer-inner { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
