:root {
  --bg: #f4efe6;
  --bg-soft: #ece4d6;
  --ink: #2e2a24;
  --ink-soft: #6b6358;
  --accent: #9a6b43;
  --line: #ddd2c0;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Poppins', -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2rem clamp(1.5rem, 5vw, 4rem);
  max-width: 1200px;
  margin: 0 auto;
}

.brand-block {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  text-decoration: none;
}

.brand {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.01em;
  line-height: 1.1;
}

.brand-sub {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.nav {
  display: flex;
  gap: clamp(1.25rem, 3vw, 2.5rem);
}

.nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  position: relative;
  padding-bottom: 2px;
  transition: color 0.25s ease;
}

.nav a:hover { color: var(--ink); }

.nav a.active { color: var(--ink); }
.nav a.active::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 1px;
  background: var(--accent);
}

/* ---------- Content ---------- */
.content {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 5rem) clamp(1.5rem, 5vw, 4rem);
}

.page-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 2rem;
}

.prose { max-width: 600px; }
.prose p { color: var(--ink-soft); margin-bottom: 1.25rem; font-size: 1.02rem; }

/* ---------- Projects grid ---------- */
/* give the projects page a wider canvas so the thumbnails are bigger */
.content:has(.project-grid) { max-width: 1500px; }

.project-group { margin-bottom: 3.5rem; }
.project-group:last-child { margin-bottom: 0; }
.group-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  margin-bottom: 1.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5rem;
  padding: 1rem 0;
}

.thumb {
  display: block;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.3s ease;
}

.thumb:hover { transform: scale(1.05); }

.thumb-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: box-shadow 0.3s ease;
}

.thumb:hover .thumb-img {
  box-shadow: 0 14px 30px rgba(46, 42, 36, 0.16);
}

.thumb-title {
  display: block;
  margin-top: 1rem;
  font-family: var(--sans);
  font-size: 1.05rem;
  font-weight: 400;
  text-align: left;
  color: var(--ink);
}

.thumb-date {
  display: block;
  margin-top: 0.2rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 300;
  text-align: left;
  color: var(--ink-soft);
}

/* ---------- Project detail ---------- */
.project-detail { max-width: 820px; margin: 0 auto; }

.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.25s ease;
}
.back-link:hover { color: var(--accent); }

.project-stat {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}
.project-stat-number {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(3rem, 9vw, 6rem);
  line-height: 1;
  color: var(--ink);
}
.project-stat-label {
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: var(--ink-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.project-head { margin-bottom: 2rem; }
.project-head .page-title { margin-bottom: 0.5rem; }
.project-meta {
  display: flex;
  gap: 1.5rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.project-hero {
  width: 100%;
  aspect-ratio: 4 / 3;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 2.5rem;
}

.project-detail .prose { max-width: none; }

/* Lead / intro paragraph */
.project-lead {
  font-family: var(--sans);
  font-weight: 300;
  font-size: clamp(1.25rem, 2.6vw, 1.6rem);
  line-height: 1.5;
  color: var(--ink);
  max-width: 40ch;
  margin: 0;
}

/* Sections */
.project-section { margin-top: 3.5rem; }
.section-heading {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  margin-bottom: 1.5rem;
}

/* Outcome stat cards */
.outcome-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.25rem;
}
.outcome-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1.5rem 1.75rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.outcome-value {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  line-height: 1.05;
  color: var(--ink);
  white-space: nowrap;
  max-width: 100%;
}
.outcome-label {
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.outcome-period { display: block; }

@media (max-width: 600px) {
  .outcome-grid { grid-template-columns: 1fr; }
  .outcome-card { padding: 1.25rem 1.4rem; }
}

/* Sponsors */
.sponsor-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.75rem;
}
.sponsor-lead {
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-right: 0.25rem;
}
.sponsor-tag {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink);
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
}

/* Video example cards */
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.75rem;
}
.video-card {
  display: block;
  text-decoration: none;
  transition: transform 0.3s ease;
}
.video-card:hover { transform: translateY(-4px); }
.video-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-soft);
}
.video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.video-card:hover .video-thumb img { transform: scale(1.06); }
.video-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 54px; height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(46, 42, 36, 0.72);
  color: #fff;
  font-size: 1.1rem;
  padding-left: 4px;
  transition: background 0.25s ease;
}
.video-card:hover .video-play { background: var(--accent); }
.video-title {
  display: block;
  margin-top: 0.9rem;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--ink);
}
.video-card:hover .video-title { color: var(--accent); }

/* Media gallery (masonry) */
.media-masonry {
  column-count: 3;
  column-gap: 1rem;
}
.media-item {
  position: relative;
  break-inside: avoid;
  margin-bottom: 1rem;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  line-height: 0;
  background: var(--bg-soft);
}
.media-item img,
.media-item video {
  width: 100%;
  height: auto;
  display: block;
}
.media-item img { transition: transform 0.4s ease; }
.media-item:hover img { transform: scale(1.04); }

/* clickable triggers */
button.media-trigger {
  display: block;
  width: 100%;
  padding: 0;
  cursor: zoom-in;
  font: inherit;
  color: inherit;
}
.media-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 60px; height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(46, 42, 36, 0.7);
  color: #fff;
  font-size: 1.3rem;
  padding-left: 4px;
  line-height: 1;
  transition: background 0.25s ease;
  pointer-events: none;
}
.media-trigger:hover .media-play { background: var(--accent); }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(34, 30, 24, 0.88);
  backdrop-filter: blur(4px);
}
.lightbox.open { display: flex; }
.lightbox-content {
  max-width: min(92vw, 1000px);
  max-height: 90vh;
  display: flex;
  line-height: 0;
}
.lightbox-content img,
.lightbox-content video {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.lightbox-close {
  position: absolute;
  top: 1.2rem; right: 1.5rem;
  width: 44px; height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.25s ease;
}
.lightbox-close:hover { background: var(--accent); }

@media (max-width: 760px) {
  .media-masonry { column-count: 2; }
}
@media (max-width: 460px) {
  .media-masonry { column-count: 1; }
}

/* Instagram example link cards */
.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
}
.link-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.4rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  text-decoration: none;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.link-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 30px rgba(46, 42, 36, 0.14);
}
.link-icon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--accent);
}
.link-text { display: flex; flex-direction: column; gap: 0.15rem; }
.link-type {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--ink);
}
.link-cta {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--ink-soft);
  transition: color 0.25s ease;
}
.link-card:hover .link-cta { color: var(--accent); }

/* ---------- Essays ---------- */
.essay-year { max-width: 680px; margin-bottom: 3rem; }
.essay-year:last-child { margin-bottom: 0; }
.year-heading {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  color: var(--ink);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
}
.essay-empty {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-style: italic;
  color: var(--ink-soft);
  padding: 0.5rem 0 0.25rem;
}

.essay-list { list-style: none; max-width: 680px; }
.essay { padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
.essay:last-child { border-bottom: none; }

.essay-link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  text-decoration: none;
}
.essay-title {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--ink);
  transition: color 0.25s ease;
}
.essay-link:hover .essay-title { color: var(--accent); }
.essay-date { font-size: 0.85rem; color: var(--ink-soft); white-space: nowrap; }
.essay-excerpt { margin-top: 0.5rem; color: var(--ink-soft); }

/* ---------- Essay detail (reading view) ---------- */
.essay-detail { max-width: 680px; margin: 0 auto; }

.essay-head { margin-bottom: 2.5rem; }
.essay-page-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.1rem);
  line-height: 1.15;
}
.essay-page-date {
  margin-top: 0.6rem;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.essay-body { font-family: var(--sans); }

.essay-body p {
  font-size: 1.12rem;
  line-height: 1.8;
  color: #3a352d;
  margin-bottom: 1.5rem;
}

.essay-body h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  margin: 3rem 0 1.25rem;
  scroll-margin-top: 1.5rem;
}

.essay-body em { font-style: italic; }

/* Table of contents */
.essay-toc {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 3rem;
}
.essay-toc .toc-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
}
.essay-toc ol {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.4rem;
}
.essay-toc li { color: var(--ink-soft); }
.essay-toc a {
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.2s ease;
}
.essay-toc a:hover { color: var(--accent); }

/* Blockquotes */
.essay-body blockquote {
  margin: 2rem 0;
  padding: 0.4rem 0 0.4rem 1.5rem;
  border-left: 3px solid var(--accent);
}
.essay-body blockquote p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.18rem;
  line-height: 1.7;
  color: var(--ink);
  margin-bottom: 0;
}

/* Footnote references */
.fn-ref {
  font-size: 0.7em;
  line-height: 0;
  margin-left: 1px;
}
.fn-ref a {
  color: var(--accent);
  text-decoration: none;
  font-style: normal;
}
.fn-ref a:hover { text-decoration: underline; }

/* Footnotes list */
.footnotes {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}
.footnotes h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.3rem;
  margin-bottom: 1.25rem;
}
.footnotes ol {
  padding-left: 1.2rem;
  display: grid;
  gap: 0.85rem;
}
.footnotes li {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink-soft);
  scroll-margin-top: 1.5rem;
}
.footnotes a { color: var(--accent); }
.fn-back { margin-left: 0.35rem; text-decoration: none; }

/* ---------- About signature ---------- */
.signature-wrap {
  max-width: 600px;
  margin: 2.5rem 0 0;
  text-align: right;
}
.signature {
  width: 200px;
  max-width: 60%;
  height: auto;
  opacity: 0.92;
}

/* ---------- Contact ---------- */
.contact .prose a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s ease;
}
.contact .prose a:hover { border-color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .site-header { flex-direction: column; gap: 1rem; }
  .project-grid { grid-template-columns: 1fr; }
}
