:root {
  --bg: #ffffff;
  --text: #262626;
  --text-light: #666666;
  --text-lighter: #767676;
  --divider: rgba(38, 38, 38, 0.12);
  --nav-line: rgba(38, 38, 38, 0.2);
  --hover-bg: rgba(0, 0, 0, 0.02);
  --accent: #b3122c;
  --accent-hover: #8a0e22;
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --measure: 800px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161616;
    --text: #e6e6e6;
    --text-light: #a8a8a8;
    --text-lighter: #929292;
    --divider: rgba(255, 255, 255, 0.12);
    --nav-line: rgba(255, 255, 255, 0.2);
    --hover-bg: rgba(255, 255, 255, 0.03);
    --accent: #f07a8a;
    --accent-hover: #ff9eab;
  }
}

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

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

body {
  margin: 0;
  padding-top: 3.5rem;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 16px;
  top: 8px;
  z-index: 100;
  background: var(--bg);
  padding: 0.25rem 0.5rem;
}

/* Navigation */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--nav-line);
}
.nav .container { max-width: calc(var(--measure) + 80px); }
.nav-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 0.9rem;
  padding-bottom: 0.6rem;
}
.brand {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  text-decoration: none;
}
.nav ul {
  list-style: none;
  display: flex;
  gap: clamp(0.7rem, 2vw, 1.25rem);
  margin: 0;
  padding: 0;
}
.nav ul a {
  color: var(--text-light);
  text-decoration: none;
}
.nav ul a:hover { color: var(--accent-hover); }
.nav ul a.active { color: var(--accent); font-weight: 600; }

/* Main */
main.container { padding-top: 3.75rem; padding-bottom: 2rem; }

main p { margin: 0 0 1rem; }

main p a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 0.055em;
  text-underline-offset: 0.22em;
}
main p a:hover { color: var(--accent-hover); }

h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.45rem;
  line-height: 1.25;
  margin: 2.25rem 0 0.9rem;
  scroll-margin-top: 4.5rem;
  clear: both;
}

#about { scroll-margin-top: 4.5rem; }

/* Profile photo */
.profile {
  float: right;
  width: 150px;
  margin: 0.75rem 0 1rem 1.75rem;
}
.profile img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12), 0 2px 10px rgba(0, 0, 0, 0.08);
}
.social {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 0.6rem;
}
.social a {
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
}
.social a:hover { color: var(--accent); }
.social svg {
  display: block;
  height: 21px;
  width: auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Experience / education entries */
.entries { margin: 0; }
.entry {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  margin: 0 -0.75rem 0.4rem;
  border: 1px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.entry:hover {
  background: var(--hover-bg);
  border-color: var(--divider);
}
.entry-year {
  font-size: 0.875rem;
  color: var(--text-light);
  padding-top: 0.15rem;
  font-variant-numeric: tabular-nums;
}
.entry-body p { margin: 0; }
.entry-title {
  color: var(--accent);
  font-weight: 500;
}
.entry-org {
  font-size: 0.95rem;
  color: var(--text-light);
  margin-top: 0.15rem !important;
}
.entry-note {
  font-size: 0.9rem;
  color: var(--text-lighter);
  font-style: italic;
  margin-top: 0.25rem !important;
}

/* Footer */
.footer {
  margin: 0;
  padding: 1.25rem 0 2rem;
  font-size: 0.85rem;
  color: var(--text-lighter);
  border-top: 1px solid var(--divider);
}

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

/* Small screens: photo sits above the text */
@media (max-width: 560px) {
  body { padding-top: 5.25rem; }
  .brand { font-size: 1.35rem; }
  .profile {
    float: none;
    width: 140px;
    margin: 0 auto 1.5rem;
  }
  .entry { grid-template-columns: 1fr; gap: 0.1rem; }
  main.container { padding-top: 2.25rem; }
  h2, #about { scroll-margin-top: 6rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* Section intro lines (used instead of headings) */
.section-intro {
  clear: both;
  margin: 2.25rem 0 0.9rem !important;
  scroll-margin-top: 4.5rem;
}

/* Contact */
.contact-section {
  clear: both;
  margin-top: 2.25rem;
}

main p strong { font-weight: 600; }


/* Selected research: same structure as yoonholee.com */
.selected-papers { margin-top: 0; }
.selected-papers .paper {
  position: relative;
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 1rem;
  margin: 0 -1rem 0.25rem;
  padding: 0.25rem 1rem;
  align-items: start;
  border: 1px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.selected-papers .paper:has(a[main-paper-link]) { cursor: pointer; }
.selected-papers .paper:hover {
  background-color: var(--hover-bg);
  border-color: var(--divider);
}
.selected-papers .paper:hover .paper-year { font-weight: 500; }
.selected-papers .paper:hover .paper-content a[main-paper-link] { font-weight: 600; }
.selected-papers .paper-year {
  font-size: 0.875rem;
  color: var(--text-light);
  padding-top: 0.15rem;
  font-variant-numeric: lining-nums tabular-nums;
}
.selected-papers .paper-content { position: relative; }
.selected-papers .paper-content a[main-paper-link],
.selected-papers .paper-content .paper-title {
  position: relative;
  z-index: 1;
  color: var(--accent);
  font-size: 1.0625rem;
  font-weight: 500;
  text-decoration: none;
}
.selected-papers .paper-content a[main-paper-link]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.selected-papers .paper-content a[main-paper-link]:hover { color: var(--accent-hover); }
.selected-papers .paper-content .authors {
  font-size: 0.95rem;
  color: var(--text-light);
  margin: 0.25rem 0;
}
.selected-papers .paper-content .venue {
  font-size: 0.875rem;
  color: var(--text-lighter);
  font-style: italic;
  margin: 0;
}
.selected-papers .paper-content .paper-title + .venue { margin-top: 0.25rem; }
.selected-papers .paper-content .paper-tooltip {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--divider);
  font-size: 0.9rem;
  color: var(--text-light);
  line-height: 1.5;
  font-style: italic;
}
.selected-papers .paper-content .paper-title { display: block; }

/* Secondary pages (Project Demo) */
.page-header {
  text-align: center;
  padding: 2.5rem 0 6rem;
}
.page-header h1 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.5rem, 5.5vw, 2.2rem);
  line-height: 1.2;
  margin: 0;
}
.page-header p {
  margin: 0;
  color: var(--text-light);
  font-size: 1.15rem;
}

/* Solid brand logos (ResearchGate) next to the outline icons */
.social svg.brand-icon {
  fill: currentColor;
  stroke: none;
}

/* The envelope is wider than tall: fit it to the same 21px box as the others */
.social svg.icon-wide {
  width: 21px;
  height: auto;
}
.social a { display: inline-flex; align-items: center; justify-content: center; width: 21px; height: 21px; }
