/* ==========================================================================
   alex6095.github.io — single-page academic homepage
   Plain CSS, no build step. Light/dark follow the visitor's system setting.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --surface: #ffffff;
  --text: #16181d;
  --text-2: #3f4450;
  --text-3: #5d6271;
  --text-4: #8a909d;
  --line: #d9dce3;
  --line-soft: #e9ebf0;
  --link: #0b63ce;
  --accent: #4b47c9;
  --chip-ring: rgba(22, 24, 29, 0.09);
  --shadow: 0 12px 32px rgba(22, 24, 29, 0.08);
  --nav-bg: rgba(255, 255, 255, 0.8);
  --nav-line: rgba(22, 24, 29, 0.08);

  --container: 1040px;
  --gutter: 24px;
  --col: 280px;
  --gap: 40px;
  --nav-h: 52px;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f12;
    --bg-alt: #16181d;
    --surface: #1d2027;
    --text: #eceef3;
    --text-2: #c3c7d1;
    --text-3: #9298a6;
    --text-4: #6c7280;
    --line: #2c3039;
    --line-soft: #23262e;
    --link: #6aa9ff;
    --accent: #a9a5ff;
    --chip-ring: rgba(255, 255, 255, 0.12);
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    --nav-bg: rgba(14, 15, 18, 0.78);
    --nav-line: rgba(255, 255, 255, 0.08);
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
}

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

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR",
    "Malgun Gothic", "Helvetica Neue", Arial, sans-serif;
  font-optical-sizing: auto;
  font-size: 18px;
  line-height: 1.6;
  letter-spacing: -0.011em;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

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

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

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

::selection {
  background: color-mix(in srgb, var(--link) 20%, transparent);
}

.container {
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 200;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- Navigation ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--nav-line);
}

.nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  height: 100%;
}

.nav-brand {
  flex-shrink: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.022em;
  color: var(--text);
}

.nav-brand:hover {
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 28px;
}

.nav-links a {
  font-size: 16px;
  color: var(--text-3);
  white-space: nowrap;
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.is-active {
  color: var(--text);
  text-decoration: none;
}

/* ---------- Hero ---------- */
.hero {
  padding: 96px 0 104px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 72px;
}

.eyebrow {
  margin-bottom: 12px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--accent);
}

.hero-name {
  font-size: 60px;
  line-height: 1.07;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.hero-name-ko {
  margin-left: 10px;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 0.4em;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-3);
  vertical-align: 0.5em;
}

.hero-role {
  margin-top: 10px;
  font-size: 23px;
  line-height: 1.38;
  letter-spacing: -0.016em;
  color: var(--text-3);
}

.hero-role a {
  color: inherit;
}

.hero-bio {
  max-width: 660px;
  margin-top: 28px;
  line-height: 1.68;
  color: var(--text-2);
  text-wrap: pretty;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.button {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--text);
  font-size: 16px;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.button:hover {
  background: var(--line-soft);
  text-decoration: none;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  margin-top: 20px;
  font-size: 16px;
  color: var(--text-3);
}

.hero-meta span + span::before {
  content: "·";
  margin: 0 10px;
  color: var(--text-4);
}

.portrait {
  display: grid;
  place-items: center;
  width: 212px;
  height: 212px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-alt);
  /* A thin ring keeps the circle visible when the photo background is white. */
  box-shadow: 0 0 0 1px var(--line), 0 10px 30px rgba(22, 24, 29, 0.08);
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- Sections ---------- */
.section {
  padding: 96px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-head {
  margin-bottom: 48px;
}

.section-title {
  font-size: 44px;
  line-height: 1.1;
  font-weight: 650;
  letter-spacing: -0.026em;
}

.section-intro {
  margin-top: 12px;
  color: var(--text-3);
}

/* ---------- News ---------- */
.news-section {
  padding-top: 0;
}

.news {
  border-top: 1px solid var(--line);
}

.news > li {
  display: grid;
  grid-template-columns: var(--col) minmax(0, 1fr);
  column-gap: var(--gap);
  align-items: baseline;
  padding: 18px 0;
  border-bottom: 1px solid var(--line-soft);
}

.news time {
  font-size: 17px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.news p {
  color: var(--text-2);
}

.news b {
  font-weight: 600;
  color: var(--text);
}

/* ---------- Publications ---------- */
.pubs {
  display: grid;
  gap: 52px;
}

.pubs-group-title {
  margin: 64px 0 36px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: 23px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.pub {
  display: grid;
  grid-template-columns: var(--col) minmax(0, 1fr);
  column-gap: var(--gap);
  align-items: start;
}

.pub-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 10;
  padding: 10px;
  border-radius: var(--radius);
  background: #ffffff;
  overflow: hidden;
  transition: box-shadow 0.3s ease, transform 0.3s ease;
}

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

a.pub-thumb:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.pub-body {
  margin-top: -4px;
}

.pub-venue {
  font-size: 15px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--text);
}

.pub-tag {
  font-weight: 500;
  color: var(--text-3);
}

.pub-tag::before {
  content: "·";
  margin: 0 7px;
  color: var(--text-4);
}

.pub-title {
  margin-top: 6px;
  font-size: 21px;
  line-height: 1.32;
  font-weight: 600;
  letter-spacing: -0.018em;
  text-wrap: pretty;
}

.pub-title a {
  color: var(--text);
}

.pub-authors {
  margin-top: 8px;
  font-size: 17px;
  color: var(--text-3);
}

.pub-authors a {
  color: inherit;
}

.pub-authors a:hover {
  color: var(--text);
}

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

.pub-summary {
  margin-top: 10px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-2);
  text-wrap: pretty;
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px 0 15px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--chip-ring);
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  transition: box-shadow 0.2s ease, color 0.2s ease;
}

.chip::after {
  content: "";
  width: 8px;
  height: 8px;
  background: currentColor;
  opacity: 0.5;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M1.5 6.5l5-5M2.5 1.5h4v4' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M1.5 6.5l5-5M2.5 1.5h4v4' fill='none' stroke='black' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}

.chip:hover {
  color: var(--link);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--link) 40%, transparent);
  text-decoration: none;
}

/* ---------- CV rows (education, experience, ...) ---------- */
.spec {
  display: grid;
  grid-template-columns: var(--col) minmax(0, 1fr);
  column-gap: var(--gap);
  align-items: baseline;
  padding: 36px 0 40px;
  border-top: 1px solid var(--line);
}

.spec:first-child {
  padding-top: 0;
  border-top: 0;
}

.spec-label {
  font-size: 23px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.spec-caption {
  margin-top: 4px;
  font-size: 16px;
  color: var(--text-3);
}

.spec-list > li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}

.spec-list > li:first-child {
  padding-top: 0;
  border-top: 0;
}

.spec-list > li:last-child {
  padding-bottom: 0;
}

.item-sub {
  margin-top: 2px;
  font-size: 17px;
  color: var(--text-3);
}

.item-sub a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line);
  text-underline-offset: 0.2em;
}

.item-sub a:hover {
  color: var(--text);
}

.item-date {
  flex-shrink: 0;
  font-size: 17px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Footer ---------- */
.footer {
  padding: 22px 0 26px;
  background: var(--bg-alt);
  font-size: 15px;
  color: var(--text-3);
}

.footer .container {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

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

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

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 90;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 44px;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.2s ease;
}

.back-to-top[hidden] {
  display: none;
}

.back-to-top svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.back-to-top:hover {
  background: var(--bg-alt);
  text-decoration: none;
  transform: translateY(-2px);
}

@media print {
  .back-to-top {
    display: none;
  }
}

/* ---------- 404 ---------- */
.not-found {
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--nav-h) - 64px);
  padding: 64px 0;
  text-align: center;
}

.not-found p {
  margin-top: 12px;
  color: var(--text-3);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  :root {
    --col: 220px;
    --gap: 32px;
  }

  .hero-name {
    font-size: 52px;
  }

  .hero-grid {
    gap: 48px;
  }

  .portrait {
    width: 180px;
    height: 180px;
  }
}

@media (max-width: 734px) {
  :root {
    --gutter: 16px;
  }

  .back-to-top {
    right: max(14px, env(safe-area-inset-right));
    bottom: max(14px, env(safe-area-inset-bottom));
    padding: 10px;
  }

  .back-to-top span {
    display: none;
  }

  .nav .container {
    gap: 20px;
  }

  .nav-links {
    gap: 20px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-right: 24px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  }

  .nav-links::-webkit-scrollbar {
    display: none;
  }

  .hero {
    padding: 48px 0 64px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .portrait {
    order: -1;
    width: 104px;
    height: 104px;
  }

  .hero-name {
    font-size: 40px;
  }

  .hero-role {
    font-size: 18px;
  }

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

  .hero-meta {
    flex-direction: column;
    gap: 2px;
  }

  .hero-meta span + span::before {
    content: none;
  }

  .section {
    padding: 64px 0;
  }

  .news-section {
    padding-top: 0;
  }

  .section-head {
    margin-bottom: 36px;
  }

  .section-title {
    font-size: 32px;
  }

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

  .pubs {
    gap: 44px;
  }

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

  .pub-body {
    margin-top: 0;
  }

  .pub-title {
    font-size: 18px;
  }

  .spec {
    grid-template-columns: 1fr;
    row-gap: 18px;
    padding: 28px 0 32px;
  }

  .spec-label {
    font-size: 19px;
  }

  .spec-list > li {
    flex-direction: column;
    gap: 2px;
  }
}
