/* Zaidur Rahman portfolio
   Theme: an industrial engineer's process chart. Clean paper, graphite ink,
   one green accent, and ASME process symbols as the repeating marker.
   Signature primitive: the section head. An outlined process symbol beside a
   serif heading and a one-line subtitle, used for every section, every
   workflow stage and every timeline stop. */

:root {
  --bg: #F5F6F3;        /* cool paper */
  --surface: #FFFFFF;   /* cards and panels */
  --ink: #1A2229;       /* graphite */
  --accent: #0B6B4F;    /* Bangladesh-flag green, about 6:1 on --bg */
  --neutral: #5C6670;   /* secondary text, AA on --bg and --surface */

  /* derived from --ink */
  --rule: rgba(26, 34, 41, 0.12);
  --tint: rgba(26, 34, 41, 0.035);
  --shadow: 0 1px 2px rgba(26, 34, 41, 0.06), 0 6px 18px rgba(26, 34, 41, 0.05);

  /* contact band: ink background, light accent */
  --band-bg: #1A2229;
  --band-ink: #F5F6F3;
  --band-accent: #7CC9A8;
  --band-muted: #B7C0BC;

  --radius: 6px;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", "Segoe UI", "Helvetica Neue", sans-serif;

  --container: 72rem;

  --fs-sm: 0.875rem;
  --fs-base: 1.0625rem;
  --fs-md: 1.25rem;
  --fs-lg: 1.5rem;
  --fs-xl: clamp(1.875rem, 3.4vw, 2.625rem);
  --fs-hero: clamp(2.25rem, 5.2vw, 4rem);

  color-scheme: light;
}

/* Dark: designed separately. Deep green-black, warm light ink, soft green accent. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111513;
    --surface: #181E1B;
    --ink: #E4E9E6;
    --accent: #7CC9A8;
    --neutral: #9DA8A3;
    --rule: rgba(228, 233, 230, 0.12);
    --tint: rgba(228, 233, 230, 0.03);
    --shadow: 0 0 0 1px rgba(228, 233, 230, 0.08);
    --band-bg: #181E1B;
    --band-ink: #E4E9E6;
    --band-accent: #7CC9A8;
    --band-muted: #9DA8A3;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111513;
  --surface: #181E1B;
  --ink: #E4E9E6;
  --accent: #7CC9A8;
  --neutral: #9DA8A3;
  --rule: rgba(228, 233, 230, 0.12);
  --tint: rgba(228, 233, 230, 0.03);
  --shadow: 0 0 0 1px rgba(228, 233, 230, 0.08);
  --band-bg: #181E1B;
  --band-ink: #E4E9E6;
  --band-accent: #7CC9A8;
  --band-muted: #9DA8A3;
  color-scheme: dark;
}

/* ---------------- base ---------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-base);
  font-weight: 400;
  line-height: 1.6;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
}
p, ul, ol, dl, figure { margin: 0; }
img { max-width: 100%; display: block; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

strong { font-weight: 600; }
cite { font-style: italic; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 50;
  background: var(--ink);
  color: var(--bg);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
}
.skip:focus { top: 0.75rem; }

.container {
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2.5rem);
}

mark.todo {
  background: var(--tint);
  color: var(--neutral);
  outline: 1px dashed var(--neutral);
  outline-offset: -1px;
  border-radius: 3px;
  padding: 0 0.3em;
  font-size: 0.85em;
}

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.55rem 1.15rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
  line-height: 1.2;
}
.btn:hover { filter: brightness(1.08); }
.btn--small { min-height: 2.25rem; padding: 0.35rem 0.85rem; font-size: var(--fs-sm); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn--ghost:hover { border-color: var(--ink); filter: none; }
.btn--light { background: var(--band-accent); border-color: var(--band-accent); color: var(--band-bg); }
.btn--ghost-light { background: transparent; color: var(--band-ink); border-color: rgba(245, 246, 243, 0.35); }
.btn--ghost-light:hover { border-color: var(--band-ink); filter: none; }

/* ---------------- header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  min-height: 4rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-right: auto;
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}
.brand-name { font-family: var(--serif); font-weight: 600; font-size: 1.125rem; }

.menu { display: flex; align-items: center; gap: 1.75rem; }
.menu ul { display: flex; gap: 1.5rem; list-style: none; padding: 0; }
.menu nav a {
  color: var(--neutral);
  text-decoration: none;
  font-size: 0.975rem;
  padding-block: 0.3rem;
}
.menu nav a:hover { color: var(--ink); }
.menu nav a[aria-current="page"] {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.5em;
}
.menu-actions { display: flex; align-items: center; gap: 0.75rem; }

.theme-toggle,
.menu-toggle {
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  min-height: 2.25rem;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
}
.theme-toggle:hover,
.menu-toggle:hover { border-color: var(--neutral); }
.menu-toggle { display: none; }

/* ---------------- hero ---------------- */
.hero {
  padding-block: clamp(3rem, 8vw, 6rem) clamp(3rem, 7vw, 5rem);
  border-bottom: 1px solid var(--rule);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 0.8fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}
.hello {
  font-size: var(--fs-md);
  color: var(--accent);
  font-weight: 600;
}
.hero-role {
  margin-top: 0.75rem;
  font-family: var(--serif);
  font-size: clamp(1.375rem, 2.6vw, 1.875rem);
  font-weight: 600;
  line-height: 1.2;
  color: var(--accent);
}
h1 {
  margin-top: 0;
  font-size: var(--fs-hero);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: 18ch;
}
.hero-lede {
  margin-top: 1.5rem;
  font-size: var(--fs-md);
  line-height: 1.55;
  max-width: 54ch;
}
.hero-seeking {
  margin-top: 1rem;
  max-width: 60ch;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}
.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  list-style: none;
  padding: 0;
  margin-top: 1.5rem;
  font-size: 0.975rem;
}

.hero-portrait { position: relative; isolation: isolate; }
.hero-portrait .media { box-shadow: var(--shadow); }
.hero-portrait::before {
  /* offset frame behind the photo */
  content: "";
  position: absolute;
  inset: 1rem -1rem -1rem 1rem;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  z-index: -1;
}

/* ---------------- images ----------------
   Every image sits in a .media frame. The frame has a fixed shape
   (media--portrait, --wide, --card, --video, --landscape, --tall, --square,
   or --fill to take the height of its grid cell). Any photo, any size,
   is cropped to fill it with object-fit: cover, so nothing needs resizing.
   The .ph label underneath shows only while the image file is missing. */
.media {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--tint);
}
.media > .ph,
.media > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.media > img { object-fit: cover; object-position: center; }
.media--portrait { aspect-ratio: 4 / 5; }
.media--wide { aspect-ratio: 16 / 10; }
.media--card,
.media--video { aspect-ratio: 16 / 9; }
.media--landscape { aspect-ratio: 4 / 3; }
.media--tall { aspect-ratio: 3 / 4; }
.media--square { aspect-ratio: 1 / 1; }
.media--fill { height: 100%; }

.ph {
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: var(--tint);
  border: 1px dashed var(--neutral);
  border-radius: var(--radius);
  color: var(--neutral);
  font-size: var(--fs-sm);
  text-align: center;
}
.hero-portrait .ph { background: var(--surface); }

/* image at the top of a card: square corners, rule underneath */
.card > .media { border-radius: 0; border-bottom: 1px solid var(--rule); flex: none; }
.card > .media > .ph { border: 0; border-radius: 0; }

/* ---------------- sections ---------------- */
.section { padding-block: clamp(3.5rem, 8vw, 6rem); }
.section--tint { background: var(--tint); border-block: 1px solid var(--rule); }

/* Signature primitive */
.section-head {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: clamp(2rem, 4vw, 3rem);
}
.section-head h2 {
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.015em;
}
.section-sub {
  margin-top: 0.5rem;
  color: var(--neutral);
  max-width: 60ch;
}
.sym {
  flex: none;
  width: 2rem;
  height: 2rem;
  color: var(--accent);
  margin-top: 0.3rem;
}
.sym--filled circle { fill: currentColor; fill-opacity: 0.15; }
.sym--tiny { width: 1rem; height: 1rem; margin: 0; vertical-align: -0.15em; color: var(--neutral); }

/* ---------------- about ---------------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.prose { max-width: 66ch; }
.prose p + p { margin-top: 1.1rem; }


.glance,
.side-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
.glance h3,
.side-card h3 {
  font-size: var(--fs-md);
  margin-bottom: 1rem;
}
.glance dl { display: grid; gap: 0.9rem; }
.glance dt { color: var(--neutral); font-size: var(--fs-sm); }
.glance dd { margin: 0.1rem 0 0; }

/* workflow explainer */
.workflow {
  margin-top: clamp(3rem, 6vw, 4.5rem);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.25rem, 3vw, 2.25rem);
}
.workflow-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 2rem;
}
.workflow-head h3,
.workflow-title { font-size: var(--fs-lg); letter-spacing: -0.01em; }
.workflow-head p { color: var(--neutral); }

.tabs {
  display: flex;
  gap: 0.25rem;
  margin-top: 1.5rem;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: none;
  font: inherit;
  font-weight: 600;
  color: var(--neutral);
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.tab-panel { padding-top: 1.75rem; }
.stages {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem;
  list-style: none;
  padding: 0;
  position: relative;
}
.stages li { position: relative; }
.stages li + li::before {
  /* connector line between stages */
  content: "";
  position: absolute;
  top: 1rem;
  left: calc(-2rem + 0.25rem);
  width: 1.5rem;
  border-top: 1.5px dashed var(--rule);
}
.stages .sym { margin: 0; width: 2rem; height: 2rem; }
.stages h4 {
  margin-top: 0.75rem;
  font-size: var(--fs-md);
}
.stages p {
  margin-top: 0.35rem;
  font-size: 0.975rem;
  line-height: 1.5;
}
.stages li:last-child p { font-weight: 600; }
.panel-source {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--neutral);
  font-size: var(--fs-sm);
}
@media (prefers-reduced-motion: no-preference) {
  .tab-panel:not([hidden]) { animation: panel-in 180ms ease-out; }
  @keyframes panel-in { from { opacity: 0; } to { opacity: 1; } }
}

/* ---------------- projects ---------------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.filters button {
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}
.filters button:hover { border-color: var(--neutral); }
.filters button[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.filter-count {
  margin-left: auto;
  color: var(--neutral);
  font-size: var(--fs-sm);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card[hidden] { display: none; }
.card-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.5rem;
  flex: 1;
}
.card h3 {
  font-size: var(--fs-lg);
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.applied {
  color: var(--neutral);
  font-size: var(--fs-sm);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
}
.tags li {
  font-size: 0.8125rem;
  line-height: 1.3;
  color: var(--ink);
  background: var(--tint);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.2rem 0.5rem;
}

details {
  margin-top: auto;
  border-top: 1px solid var(--rule);
  padding-top: 0.75rem;
}
summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: "+";
  font-weight: 400;
  font-size: 1.15rem;
  line-height: 1;
}
details[open] summary::after { content: "\2212"; }
.case {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}
.case dt { font-weight: 600; font-size: 0.95rem; }
.case dd { margin: 0.1rem 0 0; font-size: 0.975rem; }

.more-link { margin-top: 2rem; color: var(--neutral); }

/* ---------------- timeline ---------------- */
.timeline {
  list-style: none;
  padding: 0;
  max-width: 60rem;
}
.timeline > li {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 2.5rem;
  position: relative;
  padding-bottom: 2.5rem;
}
.timeline > li::before {
  /* vertical line */
  content: "";
  position: absolute;
  left: calc(11rem + 1.25rem);
  top: 0.4rem;
  bottom: -0.4rem;
  border-left: 1.5px solid var(--rule);
}
.timeline > li:last-child::before { bottom: auto; height: 1rem; }
.timeline > li::after {
  /* operation circle at each stop */
  content: "";
  position: absolute;
  left: calc(11rem + 1.25rem - 0.45rem);
  top: 0.4rem;
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--bg);
}
.tl-when {
  color: var(--neutral);
  font-size: 0.95rem;
  text-align: right;
  padding-top: 0.1rem;
  font-variant-numeric: tabular-nums;
}
.tl-body h3 { font-size: var(--fs-lg); line-height: 1.2; }
.tl-org { color: var(--neutral); margin-top: 0.2rem; }
.tl-body ul {
  margin-top: 0.75rem;
  padding-left: 1.1rem;
  max-width: 66ch;
}
.tl-body li + li { margin-top: 0.4rem; }
.tl-body li::marker { color: var(--neutral); }

/* ---------------- skills ---------------- */
.skills-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
}
.skill-rows { display: grid; }
.skill-row {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 0.5rem 2rem;
  padding-block: 1.5rem;
  border-top: 1px solid var(--rule);
}
.skill-row:first-child { border-top: 0; padding-top: 0; }
.skill-row h3 { font-size: var(--fs-md); line-height: 1.3; grid-row: span 2; }
.skill-row .tags li { background: var(--surface); }
.side-card h3 + ul,
.side-card h3 + p { margin-bottom: 1.5rem; }
.side-card h3:not(:first-child) { margin-top: 0.5rem; }
.side-card p { font-size: 0.975rem; }

.plain { list-style: none; padding: 0; }
.plain li + li { margin-top: 0.5rem; }
.list-spaced li + li { margin-top: 0.9rem; }

/* ---------------- education ---------------- */
.edu-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: clamp(2rem, 6vw, 5rem);
}
.degrees { list-style: none; padding: 0; }
.degrees li {
  padding-block: 1.1rem;
  border-top: 1px solid var(--rule);
}
.degrees li:first-child { border-top: 0; padding-top: 0; }
.degrees h3 { font-size: var(--fs-md); }
.degrees p { color: var(--neutral); margin-top: 0.2rem; }
.sub-title { font-size: var(--fs-md); margin: 2.5rem 0 1rem; }
.sub-title--first { margin-top: 0; }
.pubs { list-style: none; padding: 0; }
.pubs li {
  padding: 1rem 0;
  border-top: 1px solid var(--rule);
  max-width: 66ch;
}
.pubs li:first-child { border-top: 0; padding-top: 0; }
.pub-status {
  display: block;
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: 0.15rem;
}

/* ---------------- footer: get in touch ---------------- */
.site-footer {
  background: var(--band-bg);
  color: var(--band-ink);
  padding-block: clamp(3rem, 7vw, 4.5rem) 1.75rem;
  text-align: center;
}
.footer-cta h2 {
  color: var(--band-ink);
  font-size: 2.125rem;
  font-weight: 600;
  line-height: 1.2;
}
.footer-cta .hero-actions {
  justify-content: center;
  margin-top: 1.25rem;
}
.footer-base {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
  padding-top: 1.25rem;
  border-top: 1px solid rgba(245, 246, 243, 0.14);
  color: var(--band-muted);
  font-size: var(--fs-sm);
}
.legend { max-width: 60ch; }
.legend span { white-space: nowrap; margin-right: 0.75rem; }

/* ================= multi-page additions ================= */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* inner page header */
.page-hero {
  padding-block: clamp(3rem, 7vw, 5rem) clamp(2rem, 4vw, 3rem);
  border-bottom: 1px solid var(--rule);
}
.section-head--page { margin-bottom: 1.75rem; }
.section-head--page .sym { width: 2.5rem; height: 2.5rem; margin-top: 0.55rem; }
.section-head--page h1 {
  margin: 0;
  max-width: none;
  font-size: clamp(2.5rem, 6vw, 4.25rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
}
.page-lede {
  margin-top: 1rem;
  font-size: var(--fs-md);
  line-height: 1.55;
  max-width: 60ch;
}
.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.jump a {
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.3rem 0.75rem;
  background: var(--surface);
}
.jump a:hover { border-color: var(--accent); }

.section-head--split { align-items: flex-end; }
.section-head--split > div { flex: 1; }
.head-action { flex: none; }

.glance-link {
  display: inline-block;
  margin-top: 1.25rem;
  font-weight: 600;
  color: var(--accent);
}

/* home: featured teasers */
.teaser-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
  gap: 1.5rem;
}
.teaser { text-decoration: none; color: inherit; }
.teaser:hover { box-shadow: var(--shadow), 0 0 0 1px var(--accent); }
.teaser:hover h3 { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 0.15em; }
.read-more {
  margin-top: auto;
  padding-top: 0.5rem;
  font-weight: 600;
  color: var(--accent);
}
.read-more::after { content: " \2192"; }

/* home: life teaser */
.life-teaser {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}
.life-teaser .prose { margin-bottom: 1.75rem; }
.mini-mosaic {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 9rem;
  gap: 0.75rem;
}

/* projects: earlier builds */
.build {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
  padding-block: 2.5rem;
  border-top: 1px solid var(--rule);
}
.build:first-of-type { border-top: 0; padding-top: 0; }
.build--flip .build-media { order: 2; }
.build-media iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
}
.build-body { display: flex; flex-direction: column; gap: 0.85rem; }
.build-body h3 { font-size: var(--fs-xl); line-height: 1.1; letter-spacing: -0.015em; }
.build-body > p { max-width: 60ch; }
.mini-stages { list-style: none; padding: 0; display: grid; gap: 0.6rem; }
.mini-stages li {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}
.mini-stages .sym { width: 1.5rem; height: 1.5rem; margin-top: 0.1rem; }
.build-note { color: var(--neutral); font-size: 0.975rem; }

/* experience: education */
.degree-cards {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
}
.degree {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
.degree--current {
  grid-column: 1 / -1;
  padding: clamp(1.5rem, 3vw, 2.25rem);
}
.degree--current h3 { font-size: var(--fs-xl); }
.degree h3 { font-size: var(--fs-lg); line-height: 1.2; margin-top: 0.25rem; }
.degree-when { color: var(--accent); font-weight: 600; font-size: var(--fs-sm); }
.degree-school { color: var(--neutral); margin-top: 0.3rem; }
.degree-courses { margin-top: 0.9rem; font-size: 0.975rem; max-width: 70ch; }

/* research */
.interests {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(2rem, 5vw, 4rem);
}
.interests > div {
  padding-block: 1.4rem;
  border-top: 1px solid var(--rule);
}
.interests dt {
  font-family: var(--serif);
  font-weight: 600;
  font-size: var(--fs-lg);
  line-height: 1.25;
}
.interests dd { margin: 0.5rem 0 0; max-width: 56ch; }

.research-chain {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.5rem;
  position: relative;
}
.research-chain li {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.research-chain li + li::before {
  /* "feeds into" arrow between projects */
  content: "\2192";
  position: absolute;
  left: -1.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 1.25rem;
}
.research-chain h3 { font-size: var(--fs-md); line-height: 1.3; }
.research-chain a { margin-top: auto; font-weight: 600; color: var(--accent); }
.chain-status { color: var(--neutral); font-size: var(--fs-sm); }

.service-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.5rem;
}
.service-grid h3 { font-size: var(--fs-md); margin: 0.3rem 0 0.6rem; }

/* life page */
.life-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

.split-feature {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}
.split-feature--text { align-items: start; }
.split-feature--text .section-head { margin-bottom: 0; }
.photo-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
}
.photo-pair > :last-child { margin-top: 2.5rem; }

.cert-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  max-width: 60rem;
}

.pets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 18rem));
  gap: 1.5rem;
}
.pet figcaption { margin-top: 0.75rem; }
.pet h3 { font-size: var(--fs-md); }
.pet p { color: var(--neutral); }
.learning-now { margin-top: 1.25rem; }

/* adventure log: identical tiles, add as many as you like */
.log-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
  gap: 0.75rem;
}
.log-item {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--tint);
  cursor: zoom-in;
  font: inherit;
}
.log-item img,
.log-item .ph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.log-item img { object-fit: cover; }
.log-item:hover img { filter: brightness(1.05); }
.log-item:focus-visible { outline-offset: 2px; }

.lightbox {
  width: min(64rem, 94vw);
  max-height: 92vh;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.lightbox::backdrop { background: rgba(10, 14, 12, 0.82); }
.lightbox-inner { display: flex; flex-direction: column; }
.lightbox-media {
  display: grid;
  place-items: center;
  background: #0F1311;
  min-height: 50vh;
  max-height: 76vh;
}
.lightbox-media img {
  max-width: 100%;
  max-height: 76vh;
  object-fit: contain;
}
.lightbox-media .ph {
  width: 100%;
  min-height: 50vh;
  border: 0;
  border-radius: 0;
  background: #0F1311;
  color: #B7C0BC;
}
.lightbox-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  padding: 0.9rem 1.1rem;
}
.lightbox-caption { flex: 1 1 14rem; }
.lightbox-count { color: var(--neutral); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.lightbox-controls { display: flex; gap: 0.5rem; }
.lightbox-controls button {
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  min-height: 2.5rem;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
}
.lightbox-controls button:hover { border-color: var(--ink); }
.lightbox-controls .lb-close { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------------- tablet ---------------- */
@media (max-width: 1000px) {
  .menu ul { gap: 1.1rem; }
  .stages { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 2rem; }
  .stages li:nth-child(3)::before { display: none; }
  .skills-layout,
  .about-grid { grid-template-columns: minmax(0, 1fr); }
  .glance { max-width: 36rem; }
}

/* ---------------- menu collapse ---------------- */
@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; align-items: center; }
  .js .menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 1rem clamp(1rem, 4vw, 2.5rem) 1.25rem;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
  }
  .js .menu.is-open { display: flex; }
  .js .menu ul { flex-direction: column; gap: 0; }
  .js .menu nav a { display: block; padding: 0.6rem 0; font-size: 1.0625rem; }
  .menu-actions { justify-content: space-between; }
  /* without JS, show links inline below the brand */
  html:not(.js) .header-inner { flex-wrap: wrap; padding-block: 0.75rem; }
  html:not(.js) .menu { width: 100%; flex-wrap: wrap; }
  html:not(.js) .menu-toggle { display: none; }
}

/* ---------------- phone (checked at 375px) ---------------- */
@media (max-width: 640px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
  .hero-portrait { max-width: 15rem; order: -1; margin-right: 1rem; }
  .hero-portrait .media { aspect-ratio: 1 / 1; }
  .hero-actions .btn { flex: 1 1 auto; }

  .stages { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
  .stages li {
    display: grid;
    grid-template-columns: 2rem minmax(0, 1fr);
    column-gap: 1rem;
  }
  .stages li .sym { grid-row: span 2; }
  .stages h4 { margin-top: 0.1rem; }
  .stages li + li::before {
    top: -1.35rem;
    left: 1rem;
    width: 0;
    height: 1.2rem;
    border-top: 0;
    border-left: 1.5px dashed var(--rule);
  }
  .stages li:nth-child(3)::before { display: block; }

  .filter-count { width: 100%; margin-left: 0; }
  .project-grid { grid-template-columns: minmax(0, 1fr); }
  .card-body { padding: 1.25rem; }

  .timeline > li {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.25rem;
    padding-left: 2rem;
  }
  .timeline > li::before { left: 0.45rem; }
  .timeline > li::after { left: 0; }
  .tl-when { text-align: left; }

  .skill-row { grid-template-columns: minmax(0, 1fr); }
  .skill-row h3 { grid-row: auto; }

  .edu-layout { grid-template-columns: minmax(0, 1fr); }
  .sym { width: 1.75rem; height: 1.75rem; }
}

/* ---------------- multi-page: tablet ---------------- */
@media (max-width: 1000px) {
  .research-chain { grid-template-columns: minmax(0, 1fr); gap: 2.25rem; }
  .research-chain li + li::before { content: "\2193"; left: 1.5rem; top: -1.85rem; transform: none; }
  .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .service-grid > :first-child { grid-column: 1 / -1; }
  .build,
  .build--flip { grid-template-columns: minmax(0, 1fr); }
  .build--flip .build-media { order: 0; }
}

/* ---------------- multi-page: phone ---------------- */
@media (max-width: 640px) {
  .jump { padding-left: 0; }
  .section-head--page .sym { width: 2rem; height: 2rem; margin-top: 0.4rem; }
  .section-head--split { flex-wrap: wrap; }
  .head-action { order: 3; margin-left: 2.75rem; }

  .life-teaser,
  .life-hero,
  .split-feature { grid-template-columns: minmax(0, 1fr); }
  .mini-mosaic { grid-auto-rows: 7rem; }
  .hero-portrait--life { order: 0; max-width: none; margin-right: 1rem; }
  .hero-portrait--life .media { aspect-ratio: 4 / 3; }
  .photo-pair > :last-child { margin-top: 1.5rem; }

  .degree-cards,
  .interests,
  .service-grid,
  .cert-grid { grid-template-columns: minmax(0, 1fr); }
  .service-grid > :first-child { grid-column: auto; }

  .pets { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }

  .log-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }

  .lightbox { width: 100vw; max-width: 100vw; max-height: 100vh; border-radius: 0; }
  .lightbox-media,
  .lightbox-media .ph { min-height: 40vh; }
  .lightbox-controls { width: 100%; }
  .lightbox-controls button { flex: 1; }
}
