/* ==========================================================================
   Academic homepage theme — inspired by al-folio
   ========================================================================== */

:root {
  --font-sans: "Inter", "Pretendard Variable", -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;

  --bg: #ffffff;
  --bg-muted: #f6f7f9;
  --text: #303640;
  --text-light: #6b7280;
  --heading: #171c26;
  --secondary: #596273;
  --divider: #e5e7eb;
  --theme: #2e57b8;
  --theme-soft: rgba(46, 87, 184, 0.08);
  --highlight: #b8452e;

  --max-width: 860px;
  --nav-height: 56px;
}

html[data-theme="dark"] {
  --bg: #1c1d21;
  --bg-muted: #24262b;
  --text: #d6dbe5;
  --text-light: #939eaf;
  --heading: #f3f5f9;
  --secondary: #a8b1c2;
  --divider: #34373e;
  --theme: #7391d9;
  --theme-soft: rgba(115, 145, 217, 0.12);
  --highlight: #e08a74;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

strong {
  font-weight: 600;
  color: var(--heading);
}

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

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 16px;
  top: 8px;
  z-index: 100;
  background: var(--bg);
  padding: 4px 8px;
}

/* --- Navbar --------------------------------------------------------------- */

.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--divider);
}

.nav-container {
  max-width: var(--max-width);
  height: var(--nav-height);
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--heading);
  font-size: 1.125rem;
  font-weight: 400;
  margin-right: auto;
}

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

.brand-avatar {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: #fff;
  object-fit: contain;
}

.nav-menu {
  display: flex;
  gap: 20px;
}

.nav-link {
  color: var(--text);
  font-size: 0.9375rem;
}

.nav-link:hover,
.nav-link.active {
  color: var(--theme);
  text-decoration: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.icon-btn {
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1rem;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--theme);
  background: var(--theme-soft);
}

.nav-toggle {
  display: none;
}

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

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

.section {
  margin-bottom: 48px;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--heading);
  letter-spacing: -0.01em;
  margin: 0 0 16px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--divider);
}

.subsection-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--heading);
  margin: 32px 0 8px;
}

/* --- About ---------------------------------------------------------------- */

.post-header {
  margin-bottom: 24px;
}

.post-title {
  font-size: 2.25rem;
  font-weight: 300;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--heading);
  margin: 0;
}

.post-title strong {
  font-weight: 700;
}

.desc {
  margin: 6px 0 0;
  color: var(--secondary);
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
}

.about {
  margin-bottom: 56px;
}

.about::after,
.about-body::after {
  content: "";
  display: block;
  clear: both;
}

.profile {
  float: right;
  width: 30%;
  max-width: 220px;
  margin: 6px 0 12px 32px;
  text-align: center;
}

.profile-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.profile figcaption {
  margin-top: 10px;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-light);
}

.about-text p {
  margin: 0 0 14px;
}

/* --- News / awards table -------------------------------------------------- */

.news-table {
  width: 100%;
  border-collapse: collapse;
}

.news-table th {
  width: 96px;
  padding: 6px 16px 6px 0;
  vertical-align: top;
  text-align: left;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--heading);
  white-space: nowrap;
}

.news-table td {
  padding: 6px 0;
  vertical-align: top;
}

/* Show at most 5 news items; newest first, older rows stay in the HTML */
#news .news-table tr:nth-child(n + 6) {
  display: none;
}

.awards-table th {
  width: 64px;
}

.item-meta {
  color: var(--text-light);
  font-size: 0.875rem;
  margin-left: 4px;
}

/* --- Projects (publication style) ----------------------------------------- */

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

.pub {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--divider);
}

.pub:first-child {
  padding-top: 4px;
}

.pub-preview {
  position: relative;
  padding-top: 4px;
}

.pub-preview img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--divider);
  display: block;
}

.pub-abbr {
  position: absolute;
  top: 12px;
  left: 8px;
  background: var(--theme);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 1px 8px;
  border-radius: 3px;
}

.pub-title {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--heading);
}

.pub-authors,
.pub-venue,
.pub-note {
  font-size: 0.9375rem;
  margin: 4px 0 0;
}

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

.pub-venue {
  color: var(--secondary);
}

.pub-note {
  color: var(--text-light);
  font-size: 0.875rem;
}

.pub-highlight {
  color: var(--highlight);
  font-weight: 600;
}

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

.btn-link {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text);
  border: 1px solid var(--divider);
  border-radius: 4px;
  padding: 2px 10px;
}

.btn-link:hover {
  color: var(--theme);
  border-color: var(--theme);
  text-decoration: none;
}

.more {
  margin-top: 28px;
}

.more summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  font-size: 0.9375rem;
  color: var(--text-light);
}

.more summary::-webkit-details-marker {
  display: none;
}

.more summary::before {
  content: "+";
  display: inline-block;
  width: 1em;
  text-align: center;
  font-weight: 600;
}

.more[open] summary::before {
  content: "−";
}

.more summary:hover {
  color: var(--theme);
}

.more[open] .plain-list {
  margin-top: 10px;
}

.plain-list {
  margin: 0;
  padding-left: 20px;
}

.plain-list li {
  margin-bottom: 6px;
}

.item-title {
  font-weight: 600;
  color: var(--heading);
}

.inline-link {
  font-size: 0.875rem;
  margin-left: 4px;
}

/* --- CV-style lists ------------------------------------------------------- */

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

.cv-item {
  margin-bottom: 18px;
}

.cv-item.has-logo {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 16px;
}

.cv-logo {
  width: 48px;
  height: 48px;
  margin-top: 2px;
  padding: 6px;
  border: 1px solid var(--divider);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
}

.cv-logo-tight {
  padding: 3px;
}

.cv-logo-photo {
  padding: 0;
  object-fit: cover;
}

.cv-logo-mono {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-muted);
  color: var(--secondary);
  font-weight: 600;
}

.cv-main {
  min-width: 0;
}

.cv-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.cv-title {
  font-weight: 600;
  color: var(--heading);
}

.cv-date {
  flex-shrink: 0;
  font-size: 0.875rem;
  color: var(--text-light);
  font-variant-numeric: tabular-nums;
}

.cv-sub {
  font-size: 0.9375rem;
  color: var(--secondary);
}

.cv-points {
  margin: 4px 0 0;
  padding-left: 20px;
  font-size: 0.9375rem;
}

.cv-points li {
  margin-bottom: 2px;
}

.cv-subpoints {
  margin: 2px 0 4px;
  padding-left: 18px;
  list-style: "– ";
}

.skills-list {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 6px 16px;
  margin: 0;
}

.skills-list dt {
  font-weight: 600;
  color: var(--heading);
}

.skills-list dd {
  margin: 0;
}

/* --- Contact / footer ----------------------------------------------------- */

.contact {
  text-align: center;
  margin-top: 56px;
}

.social {
  display: flex;
  gap: 18px;
  margin-top: 18px;
  font-size: 1.375rem;
}

.social a {
  display: inline-flex;
  align-items: center;
  color: var(--text-light);
}

.icon-svg {
  width: 0.85em;
  height: 0.85em;
  fill: currentColor;
}

.social a:hover {
  color: var(--theme);
  text-decoration: none;
}

.contact-note {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-light);
}

.footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px 16px 32px;
  border-top: 1px solid var(--divider);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-light);
}

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 720px) {
  .nav-toggle {
    display: inline-block;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--divider);
  }

  .nav-menu.open {
    display: flex;
  }

  .nav-link {
    padding: 10px 16px;
  }

  .page {
    padding-top: 28px;
  }

  .post-title {
    font-size: 1.875rem;
  }

  .profile {
    float: none;
    width: 160px;
    margin: 0 auto 20px;
  }

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

  .pub-preview {
    max-width: 220px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .news-table th {
    width: 78px;
    padding-right: 12px;
  }

  .awards-table th {
    width: 48px;
  }

  .awards-table .item-meta {
    display: block;
    margin-left: 0;
  }

  .cv-head {
    flex-direction: column;
    gap: 0;
  }

  .skills-list {
    grid-template-columns: 1fr;
  }

  .skills-list dd {
    margin-bottom: 8px;
  }
}

@media print {
  .navbar,
  .contact,
  .pub-links {
    display: none;
  }
}

/* --- Toast ---------------------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  top: calc(var(--nav-height) + 16px);
  transform: translate(-50%, -8px);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--heading);
  color: var(--bg);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  font-size: 0.875rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast .fa-circle-check {
  color: #4ade80;
}
