:root {
  --bg: #ece4d9;
  --ink: #3a332e;
  --ink-soft: #5a524c;
  --muted: #7a716a;
  --tag: #d9d6d2;
  --tag-ink: #4a4440;
  --rule: #3a332e;
  --accent: #1f9d63;
  --max: 1160px;
  --gutter: clamp(16px, 5vw, 80px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-weight: 300;
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

/* Header */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 28px var(--gutter);
}
.site-header .brand {
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 400;
  text-decoration: none;
  color: var(--ink-soft);
}
.site-header nav { display: flex; gap: clamp(16px, 2.5vw, 40px); }
.site-header nav a {
  text-decoration: none;
  font-weight: 400;
  color: var(--ink-soft);
}
.site-header nav a:hover,
.site-header .brand:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

main { padding: 0 var(--gutter) 96px; }
.wrap { max-width: var(--max); margin: 0 auto; }

h1, h2, h3 { font-weight: 700; color: var(--ink); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(34px, 4vw, 46px); }
h2 { font-size: clamp(28px, 3vw, 36px); }
h3 { font-size: 20px; }
p { margin: 0 0 1em; }
strong { font-weight: 700; }

/* Section heading with a rule beside it */
.section-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 48px;
  margin: 140px 0 56px;
}
.section-head::before { content: ""; border-top: 1px solid var(--rule); }
.section-head.flip { grid-template-columns: auto 1fr; }
.section-head.flip::before { order: 2; }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 14px; margin: 0 0 28px; padding: 0; list-style: none; }
.tags li {
  background: var(--tag);
  color: var(--tag-ink);
  font-weight: 500;
  font-size: 17px;
  letter-spacing: 0.04em;
  padding: 10px 16px;
  border-radius: 3px;
}

.site-header nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Home ---------- */
.landing {
  min-height: calc(100vh - 260px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 760px;
  padding: 48px 0;
}
.landing h1 { font-size: clamp(44px, 7vw, 84px); margin-bottom: 20px; }
.landing p { font-size: clamp(20px, 2vw, 24px); color: var(--ink-soft); margin-bottom: 36px; }
.button {
  align-self: flex-start;
  text-decoration: none;
  font-weight: 400;
  border: 1px solid var(--ink);
  padding: 12px 22px;
  transition: background .2s, color .2s;
}
.button:hover { background: var(--ink); color: var(--bg); }

.page-intro { padding: 56px 0 48px; max-width: 760px; }
.page-intro h1 { margin-bottom: 20px; }
.page-intro p { font-size: 20px; color: var(--ink-soft); }

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 48px 40px;
}
.card { text-decoration: none; display: block; }
.card .thumb { overflow: hidden; background: #ddd; aspect-ratio: 1 / 1; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .thumb img { transform: scale(1.03); }
.card h3 { margin: 18px 0 4px; font-size: 24px; }
.card p { margin: 0; color: var(--muted); font-size: 16px; }

.about { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; }
.about p { color: var(--ink-soft); }

/* ---------- Project page ---------- */
.project-hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(32px, 6vw, 96px);
  padding-top: 48px;
}
.project-meta { margin: 14px 0 24px; font-size: 22px; line-height: 1.4; font-weight: 300; }
.project-meta strong { font-weight: 500; }
.lede p { text-align: justify; hyphens: auto; font-size: 19px; color: var(--ink-soft); }

/* Research: sized in cqi (1cqi = 1% of the section width) so the
   layout keeps the proportions of the original page at any desktop width. */
.research {
  container-type: inline-size;
  margin-top: 140px;
}
.research-grid {
  display: grid;
  grid-template-columns: 41.5% 11.6% 1fr;
}
.research-head {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  align-items: center;
  margin-bottom: 6.7cqi;
}
.research-rule {
  grid-column: 1 / 3;
  border-top: 1px solid var(--rule);
  margin: 0 2.1cqi 0 1.6cqi;
}
.research-head h2 { grid-column: 3; padding-left: 3.8cqi; }
.r-left { grid-column: 1; }
.r-right { grid-column: 3; }

.r-labels {
  display: flex;
  justify-content: space-between;
  font-size: 1.46cqi;
  line-height: 1.2;
  letter-spacing: 0.05em;
  font-weight: 300;
  color: var(--ink);
  margin-bottom: 3.3cqi;
}
.r-left .r-label-2 { margin: 0 8cqi 0 auto; }

.r-row {
  display: flex;
  margin-bottom: 2.4cqi;
  font-size: 1.49cqi;
}
.r-between { justify-content: space-between; }
.r-end { justify-content: flex-end; }
.r-tight { gap: 0.55cqi; margin-bottom: 2.1cqi; }
.r-in1 { padding-left: 8.2cqi; }
.r-in2 { padding-left: 17.5cqi; }

.tag {
  background: var(--tag);
  color: #4b4b4b;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.2;
  padding: 0.5em 0.65em;
  border-radius: 0.15em;
  white-space: nowrap;
  text-align: center;
}
.tag-wide { padding-left: 1.3em; padding-right: 1.3em; }
.tag-grow { flex: 1; }

.r-question {
  white-space: nowrap;
  font-size: 1.83cqi;
  font-weight: 300;
  letter-spacing: 0.05em;
  line-height: 1.15;
  color: #555;
  margin: -0.4cqi 0 3cqi 0.4cqi;
}
.r-question strong { color: var(--ink); font-weight: 700; }
.r-right .r-row + .r-question { margin-top: 0.6cqi; }
.r-indent { margin-left: 2.25cqi; margin-bottom: 2.2cqi; }

.exploration img { width: 100%; }

.final {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 72px);
  align-items: start;
}
.final .rule { border-top: 1px solid var(--rule); margin: 18px 0 64px; }
.final p { text-align: justify; hyphens: auto; color: var(--ink-soft); }
.final h2 { margin-bottom: 40px; }

.next {
  margin-top: 140px;
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.next a { text-decoration: none; font-weight: 400; }
.next a:hover { text-decoration: underline; text-underline-offset: 4px; }

footer {
  padding: 32px var(--gutter) 48px;
  color: var(--muted);
  font-size: 15px;
}
footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

@media (max-width: 820px) {
  body { font-size: 17px; }
  .project-hero, .final, .about { grid-template-columns: 1fr; gap: 40px; }
  .research { margin-top: 88px; }
  .research-grid { grid-template-columns: minmax(0, 1fr); gap: 48px; }
  .tag { white-space: normal; text-align: left; }
  .research-head { grid-template-columns: 1fr auto; gap: 24px; margin-bottom: 0; }
  .research-rule { grid-column: 1; margin: 0; }
  .research-head h2 { grid-column: 2; padding: 0; }
  .r-left, .r-right { grid-column: 1; }
  .r-labels { font-size: 14px; gap: 16px; margin-bottom: 18px; }
  .r-left .r-label-2 { margin: 0; }
  .r-row { font-size: 14px; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; justify-content: flex-start; padding-left: 0; }
  .r-question { white-space: normal; }
  .r-question br.d { display: none; }
  .r-question { font-size: 19px; margin: 18px 0 22px; }
  .r-indent { margin-left: 0; }
  .final .rule { display: none; }
  .final .text { order: -1; }
  .final h2 { margin-bottom: 20px; }
  .section-head { margin: 88px 0 36px; gap: 24px; }
  .lede p, .final p { text-align: left; }
  .tags li { font-size: 15px; padding: 8px 12px; }
}
