:root {
  --bg: #f7f4ee;
  --surface: #efebe2;
  --text: #22221f;
  --muted: #5f5c55;
  --line: #ddd6c9;
  --accent: #2f5d3e;
  --accent-dark: #234731;
  --max: 900px;
  --gutter: 20px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
}

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

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  background: var(--accent);
  color: #fff;
  padding: 8px 14px;
  border-radius: 4px;
  z-index: 10;
}
.skip-link:focus { top: 12px; color: #fff; }

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

/* Header and introduction */
.site-header { padding-top: 64px; }

.intro {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 40px;
  align-items: center;
}

h1, h2, h3 { line-height: 1.25; margin: 0; font-weight: 600; }

h1 { font-size: 2.1rem; letter-spacing: -0.01em; }

.subtitle {
  margin: 4px 0 20px;
  color: var(--accent);
  font-size: 1.05rem;
  font-weight: 500;
}

.lead { margin: 0; font-size: 1.15rem; max-width: 34em; }

.site-nav {
  margin-top: 48px;
}
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 14px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.site-nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}
.site-nav a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }

/* Sections */
.section {
  padding: 56px 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 16px;
}
.section:last-child { border-bottom: 0; }
#introduction { scroll-margin-top: 0; }

h2 {
  font-size: 1.4rem;
  margin-bottom: 28px;
}

.entry {
  display: grid;
  grid-template-columns: 1fr 200px;
  gap: 36px;
  align-items: start;
}
.entry + .entry {
  margin-top: 40px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}

h3 { font-size: 1.15rem; margin-bottom: 8px; }

.desc p { margin: 0 0 14px; }
.desc p:last-child { margin-bottom: 0; }
.desc-short p { color: var(--muted); }

[hidden] { display: none !important; }

.toggle {
  margin-top: 16px;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: 4px;
  padding: 7px 16px;
  cursor: pointer;
}
.toggle:hover { background: var(--accent); color: #fff; }

/* Photos and placeholders */
.photo { margin: 0; }

.photo img,
.placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
}
.photo img { object-fit: cover; background: var(--surface); }

.photo--portrait img,
.photo--portrait .placeholder { aspect-ratio: 4 / 5; }

.placeholder {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  gap: 4px;
  padding: 12px;
  background: var(--surface);
  border: 1px dashed #c6bfb1;
  color: var(--muted);
}
.placeholder-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.placeholder-note { font-size: 0.85rem; line-height: 1.4; }

.photo figcaption {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer p { margin: 0; }

/* Tablet */
@media (max-width: 720px) {
  .site-header { padding-top: 40px; }
  .intro { grid-template-columns: 1fr 130px; gap: 24px; }
  h1 { font-size: 1.8rem; }
  .entry { grid-template-columns: 1fr 150px; gap: 24px; }
}

/* Phone: photo sits above the text, kept small */
@media (max-width: 540px) {
  :root { --gutter: 16px; }
  body { font-size: 1rem; }
  .intro { grid-template-columns: 1fr; gap: 24px; }
  .photo--portrait { order: -1; width: 120px; }
  .site-nav { margin-top: 32px; }
  .section { padding: 40px 0; }
  .entry { grid-template-columns: 1fr; gap: 16px; }
  .entry .photo { order: -1; width: 100%; max-width: 240px; }
  .entry .photo img,
  .entry .placeholder { aspect-ratio: 16 / 9; }
}

/* Why it matters */
.why {
  margin: 18px 0 0;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
  font-size: 0.98rem;
}
.why strong { color: var(--accent); font-weight: 600; }

/* Links under a section */
.links {
  grid-column: 1 / -1;
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 0.95rem;
}

/* Gallery: the proof-of-work photos under each entry */
.gallery {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.gallery-item { margin: 0; min-width: 0; }
.gallery-item img,
.gallery-item video,
.gallery-item .placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  object-fit: cover;
  background: var(--surface);
}
.gallery-item img,
.gallery-item video { display: block; }
.gallery-item .placeholder { padding: 8px; }
.gallery-item .placeholder-title { font-size: 0.65rem; }
.gallery-item .placeholder-note { font-size: 0.78rem; }
.gallery-item figcaption {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

/* Clickable photos */
.zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  border-radius: 4px;
}
.zoom img { transition: opacity 0.15s; }
.zoom:hover img { opacity: 0.88; }

/* Full-size viewer */
.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
  width: 100vw;
  height: 100vh;
  margin: 0;
}
.lightbox[open] {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.lightbox::backdrop { background: rgba(20, 20, 18, 0.88); }
.lightbox-figure {
  margin: 0;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.lightbox-img {
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 140px);
  width: auto;
  height: auto;
  margin: 0 auto;
  border-radius: 4px;
  pointer-events: auto;
}
.lightbox-caption {
  margin-top: 10px;
  color: #ece8df;
  font-size: 0.95rem;
  text-align: center;
}
.lightbox-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.lb-btn {
  font: inherit;
  font-size: 0.9rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  padding: 7px 14px;
  cursor: pointer;
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.24); }
.lb-btn:focus-visible { outline-color: #fff; }
.lb-count { color: #ece8df; font-size: 0.9rem; min-width: 3.5em; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .zoom img { transition: none; }
}

/* Main section photo a bit larger, to give photos more room */
@media (min-width: 721px) {
  .entry { grid-template-columns: 1fr 240px; }
}

@media (max-width: 540px) {
  .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .why { font-size: 0.95rem; }
}

.desc .site-link { margin-top: 10px; }
.desc .site-link a { font-weight: 500; text-underline-offset: 3px; }

/* Academic record under Education */
.record {
  grid-column: 1 / -1;
  margin: 0;
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  align-items: start;
  padding: 20px;
  background: var(--surface);
  border-radius: 4px;
}
.record-thumb { display: block; cursor: pointer; }
.record-thumb:hover img { opacity: 0.88; }
.record-thumb img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
}
.record figcaption p { margin: 0 0 8px; font-size: 0.95rem; }
.record figcaption p:last-child { margin-bottom: 0; }
.record-title { font-weight: 600; }

@media (max-width: 540px) {
  .record { grid-template-columns: 1fr; padding: 16px; }
  .record-thumb { max-width: 200px; }
}

.photo video { display: block; width: 100%; border-radius: 4px; background: var(--surface); }

.facts { margin: 0; padding-left: 1.1em; color: var(--muted); }
.facts li { margin: 0 0 6px; }
.facts li:last-child { margin-bottom: 0; }
.facts strong { color: var(--text, inherit); font-weight: 600; }

.pdf-thumb { display: block; border-radius: 4px; }
.pdf-thumb img { border: 1px solid var(--line); background: #fff; transition: opacity 0.15s; }
.pdf-thumb:hover img { opacity: 0.88; }
