:root {
  --bg: #ffffff;
  --fg: #1c1c1e;
  --muted: #6b6b70;
  --line: #e4e4e7;
  --accent: #1f4fd8;
  --max: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131315;
    --fg: #ececee;
    --muted: #9a9aa0;
    --line: #2c2c30;
    --accent: #8fb0ff;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  line-height: 1.7;
}

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

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

header.site {
  border-bottom: 1px solid var(--line);
}

header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}

.brand { display: block; }
.brand img { display: block; height: 36px; width: auto; }

/* Hero: header image from the 2016-2018 homepage, darkened for legibility */
.hero {
  background: linear-gradient(rgba(20,20,22,.72), rgba(20,20,22,.55)), #383838 url(assets/hero.jpg) center / cover no-repeat;
  color: #f4f4f5;
  padding: 72px 0 64px;
}
.hero h1 { margin-bottom: 8px; font-size: 2.3rem; }
.hero .years, .hero .lead { color: #d4d4d8; }
.hero .lead { margin: 0; max-width: 46em; }
.hero + main > .content:first-child { padding-top: 8px; }

/* Forest picture next to the name story */
figure.forest { float: right; margin: 8px 0 16px 24px; width: 200px; text-align: center; }
figure.forest img { width: 100%; height: auto; border-radius: 6px; background: #fff; }
figure.forest figcaption { font-size: .8rem; color: var(--muted); }
h2 { clear: both; }

/* Project cards */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
  margin: 16px 0 8px;
}
.projects article { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); }
.projects img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; background: #fff; }
.projects h3 { font-size: 1.05rem; margin: 12px 14px 4px; }
.projects h3 span { font-weight: 400; color: var(--muted); font-size: .9rem; margin-left: 4px; }
.projects p { margin: 0 14px 14px; font-size: .93rem; color: var(--muted); }
h3.more { font-size: 1rem; margin: 24px 0 4px; }

/* Full-width photo band, plus the old circuit pattern in the footer */
.band {
  background: linear-gradient(rgba(20,20,22,.6), rgba(20,20,22,.6)), url(assets/band_photos.jpg) center / cover no-repeat;
  color: #f4f4f5;
  padding: 56px 0;
  margin: 24px 0 0;
}
.band h2 { margin-top: 0; }
.band a { color: #fff; font-weight: 600; }
.band + .content { padding-top: 8px; }
footer.site { background: #383838 url(assets/hero_bg.png) center / auto 100% repeat-x; color: #c8c8cc; border-top: 0; padding: 28px 0; }

@media (max-width: 600px) {
  figure.forest { float: none; margin: 8px auto 16px; }
  .hero { padding: 48px 0 40px; }
}

@media (prefers-color-scheme: dark) {
  /* Logo wordmark is dark grey; flip lightness while keeping hues */
  .brand img { filter: invert(1) hue-rotate(180deg); }
}

nav a {
  margin-left: 20px;
  color: var(--muted);
  text-decoration: none;
}

nav a[aria-current="page"] {
  color: var(--fg);
  font-weight: 600;
}

main.wrap, .content { padding: 40px 16px 64px; }

h1 { font-size: 1.9rem; line-height: 1.3; margin: 0 0 12px; }
h2 { font-size: 1.25rem; margin: 40px 0 8px; }

.lead { font-size: 1.1rem; color: var(--muted); margin: 0 0 8px; }

.years { color: var(--muted); letter-spacing: 0.04em; margin: 0 0 16px; }

ol.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 16px;
  border-left: 2px solid var(--line);
}
ol.timeline li { margin: 0 0 8px; }
ol.timeline .year {
  display: inline-block;
  min-width: 4.5em;
  margin-right: 8px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.95em; }

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

/* Gallery */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  margin-top: 24px;
}

.grid button {
  padding: 0;
  border: 0;
  background: var(--line);
  cursor: zoom-in;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
}

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

.grid button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.empty { color: var(--muted); }

dialog.viewer {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.92);
}

dialog.viewer[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

dialog.viewer img {
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
}

dialog.viewer button {
  position: absolute;
  border: 0;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 1.6rem;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
}

.viewer .close { top: 12px; right: 12px; }
.viewer .prev { left: 12px; top: 50%; transform: translateY(-50%); }
.viewer .next { right: 12px; top: 50%; transform: translateY(-50%); }

.viewer .count {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  color: #ddd;
  font-size: 0.9rem;
}

ol.timeline li { display: flex; }
ol.timeline .year { flex: none; }
.content:has(+ .band) { padding-bottom: 24px; }

/* Memorial for the founder */
.memorial { margin: 8px 0 48px; }
.memorial-card {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 28px;
  align-items: start;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--memorial-bg);
}
.portrait { margin: 0; }
.portrait img, .portrait-ph {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}
.portrait-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--line);
  color: var(--muted);
  font-size: .9rem;
}
.memorial-name { font-size: 1.6rem; font-weight: 700; margin: 0; line-height: 1.3; }
.memorial-dates { color: var(--muted); margin: 2px 0 16px; letter-spacing: .03em; }
.memorial h3 { font-size: 1.05rem; margin: 28px 0 6px; }
.memorial ul.path { margin: 0; padding-left: 1.2em; }
blockquote.words {
  margin: 8px 0 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid #6aa84f;
}
blockquote.words p { margin: 0 0 6px; font-size: 1.05rem; }
blockquote.words footer { color: var(--muted); font-size: .88rem; }
blockquote.words footer::before { content: "— "; }

:root { --memorial-bg: #f7f7f5; }
@media (prefers-color-scheme: dark) { :root { --memorial-bg: #1b1b1e; } }

@media (max-width: 600px) {
  .memorial-card { grid-template-columns: 1fr; padding: 18px; gap: 16px; }
  .portrait { max-width: 180px; }
}
