:root {
  --bg: #ffffff;
  --paper: #fbfcff;
  --text: rgba(18, 22, 30, 0.92);
  --muted: rgba(18, 22, 30, 0.66);
  --faint: rgba(18, 22, 30, 0.10);

  --brand: #2f6fb1;
  --brand-2: #1e4f86;
  --brand-wash: rgba(47, 111, 177, 0.10);

  --radius: 16px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px rgba(8, 12, 18, 0.10);
  --max: 1120px;

  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1100px 520px at 80% -10%, rgba(47, 111, 177, 0.11), transparent 60%),
    radial-gradient(900px 520px at 10% 10%, rgba(47, 111, 177, 0.07), transparent 65%),
    linear-gradient(180deg, var(--paper), var(--bg));
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

img { max-width: 100%; display: block; }

a {
  color: var(--brand-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover { color: var(--brand); }

.container {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
}

.skip {
  position: absolute;
  left: -999px;
  top: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(47, 111, 177, 0.12);
  border: 1px solid rgba(47, 111, 177, 0.18);
  color: var(--text);
}

.skip:focus { left: 10px; }

/* Topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(18, 22, 30, 0.10);
}

.topbar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.nav-left a {
  color: var(--muted);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14px;
}

.nav-left a[aria-current="page"] {
  color: var(--text);
  border-color: rgba(18, 22, 30, 0.12);
  background: rgba(18, 22, 30, 0.04);
}

.nav-left a:hover {
  color: var(--text);
  border-color: rgba(47, 111, 177, 0.22);
  background: rgba(47, 111, 177, 0.06);
}

.site-title {
  font-family: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
  font-weight: 600;
  letter-spacing: 0.2px;
  font-size: 22px;
  color: var(--brand-2);
  text-decoration: none;
  justify-self: center;
}

.nav-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.iconlink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(18, 22, 30, 0.12);
  background: rgba(255, 255, 255, 0.65);
  color: rgba(18, 22, 30, 0.72);
  font-size: 0;
  text-decoration: none;
}

.icon {
  width: 18px;
  height: 18px;
  display: block;
}

.icon path,
.icon rect,
.icon circle,
.icon polygon {
  fill: currentColor;
}

.iconlink:hover {
  color: var(--brand-2);
  border-color: rgba(47, 111, 177, 0.22);
  background: rgba(47, 111, 177, 0.06);
}

.menu-btn {
  display: none;
  border: 1px solid rgba(18, 22, 30, 0.12);
  background: rgba(255, 255, 255, 0.70);
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--text);
  font: inherit;
}

/* Hero */

.hero {
  padding: 26px 0 14px;
}

.hero-layout {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 22px;
  align-items: stretch;
}

.card {
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.80);
  border: 1px solid rgba(18, 22, 30, 0.10);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 20px 20px 18px;
}

.eyebrow {
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

h1 {
  margin: 10px 0 8px;
  font-family: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
  font-weight: 600;
  font-size: 38px;
  line-height: 1.08;
  letter-spacing: 0.2px;
}

.subhead {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.highlights {
  margin: 14px 0 0;
  padding-left: 18px;
  color: rgba(18, 22, 30, 0.84);
  line-height: 1.5;
}

.highlights li { margin: 8px 0; }

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 13px;
  color: rgba(18, 22, 30, 0.78);
  border: 1px solid rgba(47, 111, 177, 0.18);
  background: rgba(47, 111, 177, 0.08);
}

.cta-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(18, 22, 30, 0.12);
  background: rgba(255, 255, 255, 0.80);
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
}

.btn.primary {
  border-color: rgba(47, 111, 177, 0.28);
  background: rgba(47, 111, 177, 0.10);
  color: var(--brand-2);
}

.btn:hover {
  border-color: rgba(47, 111, 177, 0.34);
  background: rgba(47, 111, 177, 0.12);
}

.hero-visual {
  overflow: hidden;
  position: relative;
}

.mosaic {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 10px;
  padding: 14px;
}

.mosaic .tile {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(18, 22, 30, 0.10);
  background: rgba(18, 22, 30, 0.03);
}

.mosaic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile.t1 { grid-column: 1 / 4; grid-row: 1 / 7; }
.tile.t2 { grid-column: 4 / 7; grid-row: 1 / 4; }
.tile.t3 { grid-column: 4 / 7; grid-row: 4 / 7; }

.wave {
  pointer-events: none;
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 96px;
  opacity: 0.95;
}

/* Sections */

.section {
  padding: 18px 0 26px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 14px;
}

.section h2 {
  margin: 0;
  font-family: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
  font-weight: 550;
  font-size: 22px;
}

.hint {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search {
  border-radius: 999px;
  border: 1px solid rgba(18, 22, 30, 0.14);
  background: rgba(255, 255, 255, 0.85);
  padding: 10px 12px;
  font: inherit;
  min-width: 240px;
  outline: none;
}

.search:focus {
  border-color: rgba(47, 111, 177, 0.40);
  box-shadow: 0 0 0 4px rgba(47, 111, 177, 0.12);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter {
  cursor: pointer;
  border-radius: 999px;
  border: 1px solid rgba(18, 22, 30, 0.12);
  background: rgba(255, 255, 255, 0.82);
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  color: rgba(18, 22, 30, 0.78);
}

.filter[data-active="true"] {
  border-color: rgba(47, 111, 177, 0.34);
  background: rgba(47, 111, 177, 0.12);
  color: var(--brand-2);
}

/* Project cards */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.proj {
  display: grid;
  grid-template-rows: 170px 1fr;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(18, 22, 30, 0.10);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 16px 42px rgba(8, 12, 18, 0.10);
  text-decoration: none;
  transform: translateY(0);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.proj:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 52px rgba(8, 12, 18, 0.14);
}

.proj-media { position: relative; background: rgba(18, 22, 30, 0.04); }

.proj-media img { width: 100%; height: 100%; object-fit: contain; object-position: center; }

.proj-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.00), rgba(255, 255, 255, 0.20));
}

.proj-body {
  padding: 14px 14px 16px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
}

.proj-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.1px;
  color: rgba(18, 22, 30, 0.92);
}

.proj-impact {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.proj-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(18, 22, 30, 0.10);
  color: rgba(18, 22, 30, 0.70);
  font-size: 13px;
}

.mini {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(47, 111, 177, 0.10);
  border: 1px solid rgba(47, 111, 177, 0.18);
  color: rgba(18, 22, 30, 0.78);
}

.mini code {
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(18, 22, 30, 0.70);
}

/* Publications */

.pub-list {
  display: grid;
  gap: 10px;
}

.pub {
  border-radius: var(--radius);
  border: 1px solid rgba(18, 22, 30, 0.10);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 14px 40px rgba(8, 12, 18, 0.08);
  padding: 14px 14px 12px;
}

.pub-title {
  margin: 0;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.4;
}

.pub-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.pub-note {
  margin-top: 8px;
  color: rgba(18, 22, 30, 0.84);
  font-size: 14px;
  line-height: 1.5;
}

.pub-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.chiplink {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(18, 22, 30, 0.12);
  background: rgba(255, 255, 255, 0.86);
  color: rgba(18, 22, 30, 0.78);
  text-decoration: none;
  font-size: 13px;
}

.chiplink:hover {
  border-color: rgba(47, 111, 177, 0.34);
  background: rgba(47, 111, 177, 0.10);
  color: var(--brand-2);
}

/* Work page */

.page { padding: 22px 0 44px; }

.work-head {
  padding: 18px 18px 16px;
}

.work-head h1 { font-size: 34px; }

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.fact {
  display: inline-flex;
  gap: 8px;
  align-items: baseline;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(18, 22, 30, 0.04);
  border: 1px solid rgba(18, 22, 30, 0.10);
  color: rgba(18, 22, 30, 0.78);
  font-size: 13px;
}

.fact b { color: rgba(18, 22, 30, 0.90); font-weight: 600; }

.work-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 14px;
  align-items: start;
  margin-top: 14px;
}

.work-grid[data-cols="1"] {
  grid-template-columns: 1fr;
}

.work-section {
  padding: 14px 14px 12px;
}

.work-section h2 {
  margin: 0 0 10px;
  font-family: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
  font-weight: 550;
  font-size: 18px;
}

.bullets {
  margin: 0;
  padding-left: 18px;
  color: rgba(18, 22, 30, 0.84);
  line-height: 1.55;
}

.bullets li { margin: 8px 0; }

.video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(18, 22, 30, 0.10);
  background: rgba(18, 22, 30, 0.03);
}

.video iframe { width: 100%; height: 100%; border: 0; }


/* Work page banner + slideshow */

.banner {
  margin-top: 12px;
}

.slideshow {
  display: grid;
  gap: 10px;
  outline: none;
}

.slide-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(18, 22, 30, 0.10);
  background: rgba(18, 22, 30, 0.03);
  touch-action: pan-y;
}

.slide-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.slide-cap {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(18, 22, 30, 0.10);
  background: rgba(255, 255, 255, 0.70);
  color: var(--muted);
  font-size: 13px;
}

.slide-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(18, 22, 30, 0.14);
  background: rgba(255, 255, 255, 0.80);
  color: rgba(18, 22, 30, 0.72);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease, background 150ms ease, border-color 150ms ease;
}

.slide-arrow svg {
  width: 18px;
  height: 18px;
}

.slide-arrow path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.slide-arrow.prev { left: 10px; }
.slide-arrow.next { right: 10px; }

.slide-stage:hover .slide-arrow,
.slideshow:focus-within .slide-arrow {
  opacity: 1;
  pointer-events: auto;
}

.slide-arrow:hover {
  border-color: rgba(47, 111, 177, 0.34);
  background: rgba(47, 111, 177, 0.10);
  color: var(--brand-2);
}

.slide-thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

/* Back-compat for older markup (no-JS fallback) */

.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.gitem {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid rgba(18, 22, 30, 0.10);
  background: rgba(18, 22, 30, 0.03);
}

.gcap {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid rgba(18, 22, 30, 0.08);
  background: rgba(255, 255, 255, 0.70);
}

.thumb {
  cursor: pointer;
  border: 1px solid rgba(18, 22, 30, 0.14);
  background: rgba(255, 255, 255, 0.70);
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  flex: 0 0 auto;
  width: 72px;
  height: 48px;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb.is-active {
  border-color: rgba(47, 111, 177, 0.42);
  box-shadow: 0 0 0 3px rgba(47, 111, 177, 0.12);
}

.note {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(18, 22, 30, 0.10);
  background: rgba(18, 22, 30, 0.03);
  color: var(--muted);
  font-size: 14px;
}

/* Footer */

.footer {
  padding: 26px 0 34px;
  border-top: 1px solid rgba(18, 22, 30, 0.10);
  color: var(--muted);
  font-size: 13px;
}

.footer a { color: var(--brand-2); }

/* Motion */

.js .reveal { opacity: 0; transform: translateY(6px); }
.js .reveal.is-on { opacity: 1; transform: translateY(0); transition: opacity 320ms ease, transform 320ms ease; }

@media (max-width: 980px) {
  .hero-layout { grid-template-columns: 1fr; }
  .work-grid { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .container { width: min(var(--max), calc(100% - 28px)); }
  .topbar-inner { grid-template-columns: auto 1fr auto; }
  .site-title { justify-self: start; margin-left: 4px; }

  .nav-left {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 58px;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid rgba(18, 22, 30, 0.10);
    padding: 10px 12px;
    gap: 8px;
    justify-content: center;
  }

  .nav-left.is-open { display: flex; }
  .menu-btn { display: inline-flex; }
  h1 { font-size: 32px; }
  .grid { grid-template-columns: 1fr; }
  .search { min-width: 0; width: 100%; }
  .thumb { width: 64px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .proj { transition: none; }
  .proj:hover { transform: none; }
  .js .reveal, .js .reveal.is-on { opacity: 1; transform: none; transition: none; }
}
