/* ==========================================================
   Atahar Nayeem, personal site
   All colors live in the tokens below. Change them here only.
   ========================================================== */

:root {
  --bg: #F3F0E9;
  --surface: #EAE6DD;
  --text: #1C1C1A;
  --muted: #66645D;
  --border: #D9D4C8;
  --accent: #0E7C5A;
  --on-accent: #FFFFFF;
  --mat: #FFFFFF;
  --red: #B23A34;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --measure: 680px;
  --wide: 960px;
  color-scheme: light;
}

/* Dark is the default. The light tokens above apply only when the visitor picks light. */
:root:not([data-theme="light"]) {
  --bg: #0B0E0D;
  --surface: #131917;
  --text: #E9EEEB;
  --muted: #8E9995;
  --border: #222B28;
  --accent: #34D399;
  --on-accent: #04130D;
  --mat: #ECE9E1;
  --red: #E8857A;
  color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, video { display: block; max-width: 100%; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent);
  transition: text-decoration-color .15s;
}
a:hover { text-decoration-color: var(--accent); }

p { margin: 0 0 1.1em; }

h1, h2, h3 { font-weight: 600; line-height: 1.25; margin: 0; }

::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* ---------- Header ---------- */

.site-header {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  font-family: var(--sans);
  font-size: 14px;
}

.site-name {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  align-items: baseline;
  gap: 22px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links {
  display: flex;
  align-items: baseline;
  gap: 22px;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--text); }

/* Light / dark switch, pinned to the top-right corner of the page */
.theme-toggle {
  position: absolute;
  top: 21px;
  right: 24px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: none;
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: color .15s, border-color .15s, background-color .15s;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface);
}
.theme-toggle svg { display: block; }

/* ---------- Page shell ---------- */

main {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.page {
  max-width: var(--measure);
  margin: 0 auto;
}

.page-title {
  font-size: 32px;
  letter-spacing: -0.02em;
  margin-bottom: 32px;
}

.lede {
  font-size: 18px;
  margin-bottom: 64px;
}

.section-label {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 24px;
}

.meta {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

hr.rule {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 72px 0;
}

/* ---------- Home ---------- */

.home {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 72px;
  align-items: start;
}

.home > * { min-width: 0; }

.profile {
  grid-column: 2;
  grid-row: 1;
  position: sticky;
  top: 40px;
}

.profile-photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: var(--surface);
  border: 1px solid var(--border);
}

.profile-links {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 2;
}
.profile-links a {
  color: var(--muted);
  text-decoration: none;
}
.profile-links a:hover { color: var(--text); }

.home-name {
  font-size: 34px;
  letter-spacing: -0.025em;
  margin-bottom: 32px;
}

.bio { max-width: var(--measure); }
.bio p:first-child { font-size: 18px; }

.updates {
  margin-top: 64px;
  max-width: var(--measure);
}

.updates ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.updates li {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
  line-height: 1.5;
}
.updates li:last-child { border-bottom: 1px solid var(--border); }

.updates-more {
  margin-top: 20px;
  padding: 6px 14px;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.updates-more:hover { color: var(--text); border-color: var(--muted); }

.updates li[hidden] { display: none; }

.updates time {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  padding-top: 3px;
}

/* ---------- Work ---------- */

.company-head {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 28px;
}

.company-logo {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  margin-top: 3px;
  padding: 6px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.company h2 {
  font-size: 23px;
  letter-spacing: -0.015em;
  margin-bottom: 4px;
}

.company .meta { margin: 0; }

.company-links {
  font-family: var(--sans);
  font-size: 13px;
  display: flex;
  gap: 16px;
  margin: 6px 0 0;
}

.company-desc p { font-size: 15.5px; }

/* Each company: text on the left, framed photos on the right */
.company {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  grid-template-rows: auto 1fr;
  column-gap: 48px;
  align-items: start;
}
.company-head,
.company-desc { grid-column: 1; }
.company-desc p:last-child { margin-bottom: 0; }

/* Work page: experience, then projects and recognition */

.company + .company { margin-top: 72px; }

.work-section { margin-top: 72px; }
hr.rule + .work-section { margin-top: 0; }

/* page title with the counter level with it on the right */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 40px;
}
.page-head .page-title { margin-bottom: 0; }

.project {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.project img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.project-media {
  aspect-ratio: 16 / 9;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.project-media.letter::before { inset: 14% 38%; padding: 9% 6%; }

.project-body { padding: 16px 18px 18px; }

.project-client {
  margin: 0 0 6px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red);
}

.project h3 {
  font-size: 17px;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.project .meta { margin: 0; }
.project-desc { font-size: 14.5px; line-height: 1.55; margin: 12px 0; }
.project .meta { font-size: 12.5px; }

.project-letter {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 12px 0 0;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
}

/* ---------- Research ---------- */

.page.research { max-width: var(--wide); }
.research .lede { max-width: var(--measure); }

.research .lede { margin-bottom: 48px; }

.papers {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* each paper is a soft card */
.paper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 40px;
  align-items: start;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.paper-type {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.paper h3 {
  font-size: 19px;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}

.paper .meta { margin: 0 0 2px; }
.paper .meta strong { color: var(--text); font-weight: 600; }

.paper-links {
  font-family: var(--sans);
  font-size: 13px;
  display: flex;
  gap: 16px;
  margin: 8px 0 0;
}

.paper-desc { margin-top: 18px; }
.paper-desc p { font-size: 15.5px; }
.paper-desc p:last-child { margin-bottom: 0; }

.paper-fig { margin: 0; }

/* every figure sits in the same 4:3 frame, shown whole (never cropped) */
.paper-fig img,
.paper-fig video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.paper-fig figcaption {
  font-family: var(--sans);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
  margin-top: 8px;
}

.tag {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 3px;
  padding: 1px 6px;
  margin-left: 6px;
  white-space: nowrap;
}


/* ---------- Education ---------- */

.page.wide { max-width: var(--wide); }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}
.section-head h2 {
  font-size: 23px;
  letter-spacing: -0.015em;
}

/* Institutions */

.institutions { max-width: var(--measure); }

.org {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 40px;
}
.org:last-child { margin-bottom: 0; }

.org-logo {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  margin-top: 3px;
  padding: 6px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.org h3 { font-size: 18px; margin-bottom: 4px; }
.org .meta { margin: 0; }
.org-detail { font-size: 15.5px; margin: 12px 0 0; }

/* Certificate slider */

.carousel-controls { display: flex; gap: 8px; }

.carousel-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--text);
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color .15s, opacity .15s;
}
.carousel-btn:hover { border-color: var(--muted); }
.carousel-btn:disabled { opacity: .35; cursor: default; }
.carousel-btn:disabled:hover { border-color: var(--border); }

.carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - 48px) / 3);
  gap: 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  outline: none;
}
.carousel::-webkit-scrollbar { display: none; }

.carousel > * { scroll-snap-align: start; }
.carousel.dragging { scroll-snap-type: none; }

/* drag bar under a slider */
.carousel-bar {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 24px;
  margin: 16px 0 0;
  padding: 0;
  background: transparent;
  cursor: grab;
}
.carousel-bar:active { cursor: grabbing; }
.carousel-bar[hidden] { display: none; }

.carousel-bar::-webkit-slider-runnable-track {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
}
.carousel-bar::-moz-range-track {
  height: 4px;
  background: var(--border);
  border-radius: 999px;
}

.carousel-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: var(--thumb, 120px);
  height: 6px;
  margin-top: -1px;
  background: var(--muted);
  border: 0;
  border-radius: 999px;
  transition: background-color .15s;
}
.carousel-bar::-moz-range-thumb {
  width: var(--thumb, 120px);
  height: 6px;
  background: var(--muted);
  border: 0;
  border-radius: 999px;
  transition: background-color .15s;
}
.carousel-bar:hover::-webkit-slider-thumb,
.carousel-bar:active::-webkit-slider-thumb { background: var(--text); }
.carousel-bar:hover::-moz-range-thumb,
.carousel-bar:active::-moz-range-thumb { background: var(--text); }
.carousel-bar:focus-visible { outline: 1px solid var(--muted); outline-offset: 4px; }
.cert { margin: 0; }

.cert img,
.honour-media {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
}

.cert img {
  aspect-ratio: 1.414 / 1;
  object-fit: contain;
}

.cert figcaption,
.honour figcaption {
  margin-top: 12px;
  line-height: 1.4;
}
.cert figcaption strong,
.honour figcaption strong {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 3px;
}

/* Honours grid */

.honours {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 40px 24px;
}

.honour { margin: 0; }

.honour-media {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.honour-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Confidential letter: a blurred page with a stamp, drawn in CSS */
.letter { position: relative; }

.letter::before {
  content: "";
  position: absolute;
  inset: 12% 24%;
  background-color: var(--bg);
  background-image: repeating-linear-gradient(to bottom, color-mix(in srgb, var(--muted) 45%, transparent) 0 3px, transparent 3px 10px);
  background-clip: content-box;
  padding: 18% 14%;
  border: 1px solid color-mix(in srgb, var(--muted) 35%, transparent);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--text) 8%, transparent);
  filter: blur(1.2px);
}

.stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-8deg);
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--text);
  border-radius: 3px;
  padding: 5px 10px;
  opacity: .75;
  white-space: nowrap;
}


/* ---------- Honours counter (split-flap) ---------- */

.stat {
  display: flex;
  align-items: center;
  gap: 28px;
}

.stat-title {
  margin: 0;
  color: var(--muted);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.flapboard {
  display: flex;
  gap: 5px;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
}


.flap {
  position: relative;
  width: 38px;
  height: 52px;
  display: grid;
  place-items: center;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  box-shadow: 0 1px 2px color-mix(in srgb, var(--text) 8%, transparent);
  perspective: 160px;
  overflow: hidden;
}

/* the split across the middle of each card */
.flap::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: color-mix(in srgb, var(--text) 16%, transparent);
}

.flap-plus { color: var(--accent); }

.flap .digit { display: block; }

.flap.tick .digit { animation: flap-in 75ms ease-out; }

@keyframes flap-in {
  from { transform: rotateX(75deg); opacity: .35; }
  to   { transform: rotateX(0);     opacity: 1; }
}

/* ---------- About ---------- */

.about p { margin-bottom: 1.3em; }

.about .photo { margin: 48px 0; }

.about .photo img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  background: var(--surface);
  border: 1px solid var(--border);
}

.about .photo.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.about .photo.pair img { aspect-ratio: 4 / 5; }

/* ---------- Footer ---------- */

.site-footer {
  width: calc(100% - 48px);
  max-width: calc(var(--wide) - 48px);
  margin: 0 auto;
  padding: 24px 0 40px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 24px;
  flex-wrap: wrap;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }

/* ---------- Mobile ---------- */

@media (max-width: 780px) {
  body { font-size: 16px; }

  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 16px;
  }
  .nav-links { gap: 14px; font-size: 13.5px; }
  .theme-toggle { top: 12px; right: 10px; }

  main { padding: 28px 16px 72px; }
  .site-footer { width: calc(100% - 32px); padding: 20px 0 32px; }

  .home { grid-template-columns: 1fr; gap: 36px; }
  .profile { grid-column: auto; grid-row: auto; position: static; max-width: 200px; }

  .home-name { font-size: 30px; }
  .page-title { font-size: 28px; }
  .lede { font-size: 17px; margin-bottom: 48px; }

  .updates li { grid-template-columns: 1fr; gap: 2px; }

  .company { display: block; }
  .photo-slider { margin-top: 28px; }

  .company-logo { width: 46px; height: 46px; padding: 5px; }
  .company + .company { margin-top: 56px; }
  .work-section { margin-top: 56px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 18px; margin-bottom: 36px; }
  .project-body { padding: 18px 18px 20px; }

  .papers { gap: 16px; }
  .paper { grid-template-columns: 1fr; gap: 20px; padding: 20px; }

  .org-logo { width: 46px; height: 46px; padding: 5px; }

  .carousel { grid-auto-columns: 82%; gap: 16px; }
  .section-head h2 { font-size: 21px; }

  .honours { grid-template-columns: repeat(2, 1fr); gap: 28px 14px; }

  .stat { gap: 20px; }
  .stat-title { font-size: 17px; }
  .flapboard { font-size: 26px; gap: 4px; }
  .flap { width: 33px; height: 45px; }
  .cert figcaption strong,
  .honour figcaption strong { font-size: 14px; }

  hr.rule { margin: 56px 0; }
}

/* ==========================================================
   Modern theme layer
   One signature colour (emerald), bold sans headings, serif reading text.
   Everything below overrides the base styles above.
   ========================================================== */

:root {
  --display: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 14px;
}

html { scroll-behavior: smooth; }

body {
  position: relative;
  font-size: 17px;
  background-image: radial-gradient(900px 440px at 50% -140px, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%);
  background-repeat: no-repeat;
}

/* faint dot grid that fades out below the top of the page */
body::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 560px;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--muted) 30%, transparent) 1px, transparent 1.5px);
  background-size: 26px 26px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent);
  mask-image: linear-gradient(to bottom, #000, transparent);
}

::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }

h1, h2, h3 { font-family: var(--display); letter-spacing: -0.025em; }
h1, h2 { font-weight: 700; }
h3 { font-weight: 600; }

/* ---------- Header: stays in view, blurs what scrolls under it ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: block;
  max-width: none;
  margin: 0;
  padding: 0;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.site-header.scrolled { border-bottom-color: var(--border); }

.site-header-inner {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 15px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-name { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }

.nav-links a {
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.nav-links a[aria-current="page"] { border-bottom-color: var(--accent); }

.theme-toggle { position: fixed; top: 9px; right: 20px; z-index: 30; }
.theme-toggle:hover { color: var(--accent); }

/* ---------- Titles ---------- */

.page-title {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.035em;
  margin-bottom: 36px;
}
.section-head h2 { font-size: 26px; }
.section-label { color: var(--accent); }
.lede { font-size: 20px; }

/* ---------- Home ---------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 18px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before { content: ""; width: 28px; height: 1px; background: currentColor; }

.home-name {
  font-size: 60px;
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.02;
  margin-bottom: 28px;
}
.home-name .dot { color: var(--accent); }

.bio p:first-child { font-size: 21px; }

.home-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
.btn-ghost { color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.home-stats {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: start;
  gap: 16px 48px;
  max-width: var(--measure);
  margin-top: 44px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}
.home-stat strong {
  display: block;
  font-family: var(--display);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: var(--accent);
}
.home-stat span {
  display: block;
  margin-top: 6px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.profile-photo {
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 24px 44px -28px rgba(0, 0, 0, .55);
}
.profile-links a { transition: color .15s; }
.profile-links a::after { content: " \2197"; opacity: .45; }
.profile-links a:hover { color: var(--accent); }

.updates-more:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Counter ---------- */

.stat-title { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; }
.flapboard { font-family: var(--display); font-weight: 700; }
.flap { border-radius: 8px; }

/* ---------- Cards ---------- */

.company h2 { font-size: 24px; }

.paper,
.project {
  border-radius: var(--radius);
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.project-client { color: var(--accent); }

.tag {
  padding: 2px 9px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: transparent;
  border-radius: 999px;
}

.paper-fig img,
.paper-fig video { border-radius: 10px; }

.honour-media,
.cert img,
.about .photo img { border-radius: 12px; }

.cert figcaption strong,
.honour figcaption strong {
  font-family: var(--display);
  font-size: 14.5px;
  letter-spacing: -0.01em;
}

/* room for the hover lift and shadow inside the scrolling row */
.projects.carousel { padding: 6px 0 24px; margin: -6px 0 -8px; }

.carousel-btn:hover { border-color: var(--accent); color: var(--accent); }
.carousel-btn:disabled:hover { border-color: var(--border); color: var(--text); }
.carousel-bar:hover::-webkit-slider-thumb,
.carousel-bar:active::-webkit-slider-thumb { background: var(--accent); }
.carousel-bar:hover::-moz-range-thumb,
.carousel-bar:active::-moz-range-thumb { background: var(--accent); }

.footer-links a:hover { color: var(--accent); }

/* ---------- Fade-in on scroll (classes are added by ui.js) ---------- */

.reveal { opacity: 0; transform: translateY(16px); }
.reveal.in {
  opacity: 1;
  transform: none;
  transition: opacity .6s ease, transform .6s ease;
}

.paper:hover,
.project:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: 0 20px 38px -26px rgba(0, 0, 0, .5);
}

/* ---------- Sizes ---------- */

@media (min-width: 781px) and (max-width: 1120px) {
  /* keep the nav clear of the theme switch in the corner */
  .site-header-inner { padding-right: 68px; }
}

@media (max-width: 780px) {
  body { font-size: 16px; }

  .site-header {
    position: static;
    background: transparent;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: 0;
  }
  .site-header-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 18px 16px 10px;
  }
  .theme-toggle { position: absolute; top: 12px; right: 10px; }

  .page-title { font-size: 34px; margin-bottom: 28px; }
  .section-head h2 { font-size: 22px; }
  .lede { font-size: 18px; }

  .home-name { font-size: 42px; margin-bottom: 22px; }
  .bio p:first-child { font-size: 19px; }
  .home-actions .btn { flex: 1 1 auto; }
  .home-stats { grid-template-columns: repeat(3, 1fr); gap: 12px 16px; margin-top: 36px; }
  .home-stat strong { font-size: 28px; }
  .home-stat span { font-size: 10.5px; letter-spacing: 0.06em; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  .btn:hover,
  .paper:hover,
  .project:hover { transform: none; }
}

/* ---------- Home portrait: circle ---------- */
.profile-photo {
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 22%;
}

/* ---------- Work page photo slider ---------- */

.photo-slider {
  grid-column: 2;
  grid-row: 1 / span 2;
  position: relative;
  margin-top: 6px;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 36px -22px rgba(0, 0, 0, .6);
}

.slides {
  display: flex;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.slides::-webkit-scrollbar { display: none; }

.slide {
  position: relative;
  flex: 0 0 100%;
  margin: 0;
  scroll-snap-align: start;
}
.slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(.88);
}

/* soft dark fade at the bottom, so the headline reads and faces stay clear */
.slide::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to top, rgba(0, 0, 0, .78) 0%, rgba(0, 0, 0, .3) 34%, transparent 62%);
}

.slide figcaption {
  position: absolute;
  left: 18px;
  right: 64px;
  bottom: 18px;
  z-index: 1;
  color: #AEB6B2; /* soft grey, like the nav links, a touch lighter to read over photos */
  /* editorial serif: lighter weight */
  font-family: var(--serif);
  font-size: 14.5px;
  font-weight: 400;
  line-height: 1.3;
  /* always one line; anything too long ends in an ellipsis */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.005em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}

.slide-btn {
  position: absolute;
  top: 42%;
  z-index: 2;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #fff;
  background: rgba(0, 0, 0, .45);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity .2s ease, background-color .2s ease;
}
.slide-btn.prev { left: 10px; }
.slide-btn.next { right: 10px; }
.photo-slider:hover .slide-btn,
.slide-btn:focus-visible { opacity: 1; }
.slide-btn:hover { background: rgba(0, 0, 0, .7); }
.photo-slider .slide-btn:disabled { opacity: 0; pointer-events: none; }

.slide-dots {
  position: absolute;
  right: 18px;
  bottom: 22px;
  z-index: 2;
  display: flex;
  gap: 6px;
}
.slide-dots button {
  width: 7px;
  height: 7px;
  padding: 0;
  background: rgba(255, 255, 255, .45);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
  transition: width .2s ease, background-color .2s ease;
}
.slide-dots button[aria-current="true"] { width: 18px; background: #fff; }

/* touch screens swipe, so the arrows are not needed there */
@media (hover: none) { .slide-btn { display: none; } }

@media (max-width: 780px) {
  .slide figcaption { left: 14px; bottom: 14px; font-size: 13.5px; }
  .slide-dots { right: 14px; bottom: 18px; }
}

/* ---------- About: one photo at a time, same slider as the Work page ---------- */
.page.about { max-width: var(--wide); }
.page.about > p { max-width: var(--measure); }

.about-slider {
  grid-column: auto;
  grid-row: auto;
  max-width: 340px;
  aspect-ratio: 4 / 5;
  margin-top: 44px;
}

/* arrows always visible here, so visitors know there are more photos */
.about-slider .slide-btn { opacity: 1; }
.about-slider .slide-btn:disabled { opacity: 0; pointer-events: none; }

@media (max-width: 780px) {
  .about-slider { max-width: 300px; margin-top: 32px; }
}

/* ---------- About: Let's connect ---------- */
.connect {
  margin-top: 120px;
}
.connect h2 {
  font-size: 52px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 18px;
}
.connect h2 .dot { color: var(--accent); }
.connect-lede {
  max-width: 520px;
  margin: 0 0 32px;
  font-size: 18px;
  color: var(--muted);
}
.connect-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 32px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
}
.connect-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  text-decoration: none;
  transition: color .15s;
}
.connect-link svg { color: var(--muted); transition: color .15s, transform .15s; }
.connect-link:hover { color: var(--accent); }
.connect-link:hover svg { color: var(--accent); transform: translate(2px, -2px); }

.copy-email {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.copy-email:hover { color: var(--accent); border-color: var(--accent); }

@media (max-width: 780px) {
  .connect { margin-top: 80px; }
  .connect h2 { font-size: 38px; }
  .connect-lede { font-size: 16px; }
  .connect-links { gap: 14px 22px; }
}
