/* =========================================================
   SeungWon Seo — personal homepage
   Monochrome, single-column layout. Colors live in :root.
   ========================================================= */

:root {
  --bg: #ffffff;
  --text: #111111;
  --text-soft: #3f3f3f;
  --muted: #6e6e6e;
  --line: #e6e6e6;
  --line-strong: #cfcfcf;
  --soft: #f4f4f4;

  --max-width: 880px;
  --gutter: 24px;
  --header-h: 60px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* --header-offset is the measured header height, set in main.js. */
  scroll-padding-top: calc(var(--header-offset, var(--header-h)) + 8px);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

p {
  margin: 0;
}

sup {
  font-size: 0.7em;
  line-height: 0;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}

a:hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.site-header-inner {
  max-width: var(--max-width);
  min-height: var(--header-h);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-name {
  flex-shrink: 0;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

/* Wraps onto a second line instead of clipping when space runs out. */
.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 2px;
  margin-right: -10px;
}

.site-nav a {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--soft);
}

.site-nav a.is-active {
  color: var(--text);
}

/* ---------- Layout ---------- */

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

.section {
  padding-top: 64px;
}

.section > h2 {
  margin: 0 0 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--text);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.section > h3 {
  margin: 32px 0 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-note {
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.btn:hover {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

.btn i {
  width: 14px;
  font-size: 13px;
  text-align: center;
}

.btn-sm {
  gap: 6px;
  padding: 3px 10px;
  font-size: 13px;
}

.btn-sm i {
  width: 12px;
  font-size: 12px;
}

/* ---------- About (hero) ---------- */

.hero {
  display: grid;
  grid-template-columns: 168px 1fr;
  gap: 40px;
  align-items: start;
  padding-top: 56px;
}

.hero-photo {
  width: 168px;
  height: 168px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--soft);
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.hero-role {
  margin-bottom: 16px;
  font-size: 17px;
  color: var(--text-soft);
}

.hero-bio {
  max-width: 62ch;
  margin-bottom: 20px;
  color: var(--text-soft);
}

.topics {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 16px;
  align-items: center;
  margin: 0 0 24px;
}

.topics dt {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.topics dd {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}

.tag {
  padding: 2px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-soft);
}

.tag.is-primary {
  border-color: var(--text);
  color: var(--text);
  font-weight: 500;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Publications ---------- */

.pub-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pub {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.pub:last-child {
  border-bottom: 0;
}

.pub-thumb {
  display: block;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: zoom-in;
  transition: border-color 0.15s ease;
}

.pub-thumb:hover {
  border-color: var(--text);
}

.pub-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pub-venue {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--muted);
}

.venue {
  padding: 1px 8px;
  border-radius: 4px;
  background: var(--text);
  color: var(--bg);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pub-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.4;
}

.pub-authors {
  font-size: 15px;
  color: var(--text-soft);
}

.pub-authors .me {
  color: var(--text);
  font-weight: 600;
}

.pub-highlight {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
  font-size: 14px;
  font-weight: 500;
}

.pub-highlight i {
  font-size: 13px;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

/* ---------- Rows (education, experience, awards, service) ---------- */

.rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 24px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.row:last-child {
  border-bottom: 0;
}

.row-date {
  font-size: 14px;
  line-height: 25.6px; /* aligns with the first line of .row-title */
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.row-title {
  font-weight: 600;
}

.row-items {
  color: var(--text);
}

.row-code {
  margin-left: 4px;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

.row-sub {
  margin-top: 2px;
  font-size: 15px;
  color: var(--text-soft);
}

.row-desc {
  margin-top: 4px;
  font-size: 14px;
  color: var(--muted);
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 96px;
  border-top: 1px solid var(--line);
}

.site-footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px var(--gutter) 40px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 13px;
  color: var(--muted);
}

.site-footer a {
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
}

/* ---------- Figure preview ---------- */

.lightbox {
  max-width: min(1200px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  cursor: zoom-out;
}

.lightbox::backdrop {
  background: rgba(17, 17, 17, 0.7);
}

.lightbox figure {
  margin: 0;
}

.lightbox img {
  max-height: calc(100vh - 96px);
  margin: 0 auto;
}

.lightbox figcaption {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--text-soft);
}

/* ---------- Small screens ---------- */

/* Tablet widths: tighten the menu so it stays on one line next to the name. */
@media (max-width: 880px) {
  .site-header-inner {
    gap: 16px;
  }

  .site-nav {
    margin-right: -7px;
  }

  .site-nav a {
    padding: 6px 7px;
  }
}

@media (max-width: 720px) {
  :root {
    --gutter: 16px;
    --header-h: 80px;
  }

  /* The name is already at the top of the page, so the header keeps only the menu,
     wrapped onto two lines so every section stays visible. */
  .site-name {
    display: none;
  }

  .site-header-inner {
    min-height: 0;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .site-nav {
    justify-content: flex-start;
    gap: 2px 0;
    margin: 0 -8px;
  }

  .site-nav a {
    padding: 5px 8px;
  }

  /* Photo sits beside the name and role; the rest runs full width below. */
  .hero {
    grid-template-columns: 96px 1fr;
    gap: 0 16px;
    align-items: center;
    padding-top: 28px;
  }

  .hero-body {
    display: contents;
  }

  .hero-photo {
    grid-row: 1 / span 2;
    width: 96px;
    height: 96px;
    border-radius: 10px;
  }

  .hero h1 {
    align-self: end;
    margin-bottom: 4px;
    font-size: 26px;
  }

  .hero-role {
    align-self: start;
    margin-bottom: 0;
    font-size: 15px;
    line-height: 1.5;
  }

  .hero-role-sep {
    display: none;
  }

  .hero-affiliation {
    display: block;
  }

  .hero-bio,
  .topics,
  .hero-links {
    grid-column: 1 / -1;
  }

  .hero-bio {
    margin-top: 20px;
  }

  .topics {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .topics dd + dt {
    margin-top: 8px;
  }

  .section {
    padding-top: 48px;
  }

  .pub {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 24px 0;
  }

  .row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .row-date {
    line-height: 1.5;
  }
}
