/* ==========================================================================
   Modern Minimal — custom overlay for Beautiful Jekyll
   Loaded after the theme CSS via `site-css` in _config.yml.
   The upstream theme file (beautifuljekyll.css) is intentionally untouched
   so the theme can still be updated from upstream.
   ========================================================================== */

/* --- Design tokens ------------------------------------------------------ */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI',
               'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR',
               Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  --text:          #1b1e24;
  --body:          #3a4048;
  --muted:         #6b7280;
  --faint:         #9aa1ad;

  --border:        #e6e8ec;
  --border-strong: #d6d9df;

  --surface:       #ffffff;
  --surface-alt:   #f7f8fa;

  --accent:        #3b4cca;
  --accent-hover:  #2a37a0;
  --accent-soft:   rgba(59, 76, 202, 0.08);
  --on-accent:     #ffffff;

  --navbar-bg:     rgba(255, 255, 255, 0.85);

  --content-width: 46rem;   /* ~736px, keeps lines near 72ch */
  --radius:        0.5rem;
  --radius-sm:     0.3125rem;
}

/* Dark theme. Only the tokens are redefined — every component below styles
   through them, so nothing else needs a dark-specific rule. */
@media (prefers-color-scheme: dark) {
  :root {
    --text:          #e8eaee;
    --body:          #b8bec9;
    --muted:         #8b93a1;
    --faint:         #6b7280;

    --border:        #262a33;
    --border-strong: #343945;

    --surface:       #12141a;
    --surface-alt:   #1a1d25;

    --accent:        #8b9bff;
    --accent-hover:  #a8b4ff;
    --accent-soft:   rgba(139, 155, 255, 0.12);
    --on-accent:     #12141a;

    --navbar-bg:     rgba(18, 20, 26, 0.85);
  }

  /* The theme paints these from _config.yml values that are light-only. */
  html {
    background-color: var(--surface);
    color-scheme: dark;
  }

  .profile-photo {
    filter: brightness(0.92);
  }
}

/* --- Base --------------------------------------------------------------- */

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 1.0625rem;      /* 17px */
  line-height: 1.65;
  color: var(--body);
  background-color: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

/* The theme hardcodes Lora / Open Sans in a number of places. */
h1, h2, h3, h4, h5, h6,
.navbar-custom,
.navbar-custom .navbar-brand,
footer,
footer .copyright,
footer .footer-custom-content,
.post-preview a,
.post-preview .post-meta,
.post-heading .post-meta,
.intro-header .page-heading .page-subheading,
.intro-header .post-heading .post-subheading,
#full-tags-list,
blockquote {
  font-family: var(--font-sans);
}

p {
  margin: 0 0 1.1rem;
  line-height: 1.65;
}

p:last-child {
  margin-bottom: 0;
}

/* --- Headings ----------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

h1 { font-size: 2rem;      margin: 0 0 0.75rem; }
h2 { font-size: 1.375rem;  margin: 3rem 0 1.25rem; }
h3 { font-size: 1.0625rem; margin: 2rem 0 0.85rem; }
h4 { font-size: 1rem;      margin: 1.5rem 0 0.6rem; }

h1:first-child, h2:first-child, h3:first-child { margin-top: 0; }

/* Section headings get a hairline rule instead of sheer weight. */
h2 {
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* Year sub-headings inside lists read as labels, not titles. */
h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- Links -------------------------------------------------------------- */

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: color 0.15s ease;
}

a:hover,
a:focus {
  color: var(--accent-hover);
  text-decoration: underline;
}

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

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

/* The empty `.intro-header` div the theme emits is what clears the fixed
   navbar, on pages with a title and without one alike. */
[role="main"] {
  padding-bottom: 2rem;
}

/* One consistent measure for every page, full-width or not — and the page
   title is centred on the same measure so headings and body align. */
.page-content,
.intro-header .page-heading,
.intro-header .post-heading,
.container-fluid[role="main"] > .row > .col {
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}

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

.navbar-custom {
  background-color: var(--navbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.navbar-custom .navbar-brand {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.navbar-custom .navbar-nav .nav-item {
  text-transform: none;
  font-size: 0.875rem;
  letter-spacing: 0;
}

.navbar-custom .navbar-nav .nav-link {
  font-weight: 500;
  color: var(--muted);
}

.navbar-custom .navbar-brand:hover,
.navbar-custom .navbar-brand:focus,
.navbar-custom .navbar-nav .nav-link:hover,
.navbar-custom .navbar-nav .nav-link:focus,
.navbar-custom .navbar-nav .dropdown-menu .dropdown-item:hover,
.navbar-custom .navbar-nav .dropdown-menu .dropdown-item:focus {
  color: var(--accent);
  text-decoration: none;
}

/* The current page is marked up in nav.html. */
.navbar-custom .navbar-nav .nav-link.nav-link-active {
  color: var(--text);
  font-weight: 600;
}

@media (min-width: 1200px) {
  .navbar-custom {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
  .navbar-custom .nav-item.dropdown:hover {
    background: transparent;
  }
}

@media (max-width: 1199px) {
  .navbar-custom .navbar-collapse {
    border-top: 1px solid var(--border);
    margin: 0 -1.5rem;
    padding: 0 1.5rem;
  }
}

.navbar-custom .nav-item.dropdown.show {
  background: transparent;
}

.navbar-custom .nav-item.dropdown .dropdown-menu .dropdown-item {
  background-color: var(--surface);
  color: var(--muted);
  font-size: 0.875rem;
}

/* --- Page header -------------------------------------------------------- */

.intro-header {
  margin: 5rem 0 0;
}

/* Titled pages need breathing room between the title and the content. */
.header-section .intro-header {
  margin-bottom: 1.75rem;
}

.intro-header .page-heading,
.intro-header .post-heading {
  text-align: left;
}

.intro-header .page-heading h1 {
  font-size: 2rem;
  margin: 0;
}

.intro-header .page-heading hr.small {
  display: none;
}

.intro-header .page-heading .page-subheading {
  font-size: 1.0625rem;
  font-weight: 400;
  color: var(--muted);
  margin-top: 0.5rem;
}

@media (min-width: 1200px) {
  .intro-header,
  nav.top-nav-short-permanent ~ header > .intro-header {
    margin-top: 6.5rem;
  }
  .intro-header .page-heading h1 {
    font-size: 2.25rem;
  }
}

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

footer {
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 2.5rem 0;
  font-size: 0.875rem;
}

footer .list-inline {
  margin-bottom: 1.25rem;
}

footer p.text-muted {
  color: var(--faint) !important;
}

footer a {
  color: var(--muted);
}

footer a:hover,
footer a:focus {
  color: var(--accent);
}

footer .copyright,
footer .theme-by {
  font-size: 0.8125rem;
}

@media (min-width: 768px) {
  footer {
    padding: 2.5rem 0;
  }
  footer .copyright,
  footer .footer-custom-content {
    font-size: 0.8125rem;
  }
}

footer .footer-links a {
  color: var(--muted);
}

/* ==========================================================================
   Components
   ========================================================================== */

/* --- Sections ----------------------------------------------------------- */

.section {
  margin-top: 3.25rem;
}

.section > h2 {
  margin-top: 0;
}

/* --- Profile ------------------------------------------------------------ */

/* The photo floats so the bio wraps beside it and then reflows to the full
   measure underneath. A flex row would instead pin the whole bio into a
   narrow column and leave dead space below the photo. */
.profile {
  display: block;
  margin-bottom: 1rem;
}

.profile::after {
  content: "";
  display: table;
  clear: both;
}

.profile-photo {
  float: left;
  margin: 0.4rem 1.5rem 0.75rem 0;
  /* 144 x 192 — a 3:4 ID photo at roughly its printed 3cm x 4cm scale.
     The source file is cropped to the same ratio, so nothing is cut here. */
  width: 9rem;
  /* `height: auto` is required: the <img> carries width/height attributes for
     layout stability, and without it that height wins and aspect-ratio is
     ignored, rendering the photo 600px tall. */
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* No BFC here (no overflow/flex on .profile-body) — the text must be allowed
   to wrap around the floated photo. */
.profile-body {
  min-width: 0;
}

.profile-name {
  font-size: 1.75rem;
  margin: 0 0 0.35rem;
}

.profile-role {
  font-size: 0.9375rem;
  color: var(--muted);
  margin: 0 0 1rem;
}

.profile-role .sep {
  color: var(--border-strong);
  margin: 0 0.4rem;
}

.profile-bio p {
  margin-bottom: 0.9rem;
}

/* A flex container will not overlap a float, so clear it: the buttons always
   start on a clean full-width line rather than being squeezed beside the photo. */
.profile-actions {
  clear: both;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* Below this width the wrapped column gets too narrow to read, so the photo
   stops floating and the bio takes the full measure. */
@media (max-width: 575px) {
  .profile-photo {
    float: none;
    display: block;
    width: 8rem;
    margin: 0 0 1.25rem;
  }
}

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

.btn-soft {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--body);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-soft:hover,
.btn-soft:focus {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
  text-decoration: none;
}

.btn-soft-primary {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}

.btn-soft-primary:hover,
.btn-soft-primary:focus {
  color: var(--on-accent);
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* --- Entry list (News / Education / Experience) ------------------------- */

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

.entry {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 0 1.25rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

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

.entry-date {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  padding-top: 0.2rem;
  white-space: nowrap;
}

.entry-body {
  font-size: 0.9688rem;
  min-width: 0;
}

.entry-title {
  font-weight: 600;
  color: var(--text);
}

.entry-note {
  display: block;
  color: var(--muted);
  font-size: 0.875rem;
  margin-top: 0.1rem;
}

@media (max-width: 575px) {
  .entry {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
  .entry-date {
    padding-top: 0;
  }
}

/* --- Definition-style rows (Services, Talks) ---------------------------- */

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

.meta-list li {
  padding: 0.5rem 0;
  font-size: 0.9375rem;
  border-bottom: 1px solid var(--border);
}

.meta-list li:last-child {
  border-bottom: 0;
}

.meta-list .meta-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 0.15rem;
}

/* --- Venue badge -------------------------------------------------------- */

.venue {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  vertical-align: 0.05em;
  white-space: nowrap;
}

.venue-plain {
  color: var(--muted);
  background: var(--surface-alt);
}

/* --- Show-more toggle (CSS only) ---------------------------------------- */

.more-toggle {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.more-item {
  display: none;
}

.more-toggle:checked ~ .entry-list .more-item {
  display: grid;
}

.more-label {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
}

.more-label:hover {
  color: var(--accent-hover);
}

.more-label .more-less {
  display: none;
}

.more-toggle:checked ~ .more-label .more-more {
  display: none;
}

.more-toggle:checked ~ .more-label .more-less {
  display: inline;
}

/* --- Publication list --------------------------------------------------- */

.pub-list h2 {
  margin-top: 3rem;
}

.pub-list h3 {
  margin: 2rem 0 0.5rem;
}

/* Each markdown paragraph inside .pub-list is one publication entry. */
.pub-list p {
  position: relative;
  margin: 0;
  padding: 0.9rem 0 0.9rem 0.9rem;
  border-left: 2px solid transparent;
  border-bottom: 1px solid var(--border);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--muted);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.pub-list p:hover {
  border-left-color: var(--accent);
  background: linear-gradient(90deg, var(--accent-soft), transparent 60%);
}

/* The title is the first <strong> on the first line. */
.pub-list p > strong:first-child {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* Venue emphasis, e.g. **(ICML 2026)** */
.pub-list p strong {
  color: var(--body);
  font-weight: 600;
}

/* Own name, marked up with <ins> in the source. */
.pub-list ins,
ins.me {
  text-decoration: none;
  font-weight: 650;
  color: var(--text);
}

.pub-list hr {
  display: none;
}

.pub-list a {
  font-size: 0.8125rem;
  font-weight: 500;
}

/* --- Misc --------------------------------------------------------------- */

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

blockquote {
  color: var(--muted);
  font-style: normal;
  border-left: 2px solid var(--border-strong);
  padding-left: 1rem;
  margin-left: 0;
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

::selection {
  background: var(--accent-soft);
}

img {
  max-width: 100%;
}

/* Leftover hardcoded light colours on the feed / tags / post pages, so those
   still resolve correctly in the dark theme. */
.post-preview {
  border-bottom: 1px solid var(--border);
}

.post-preview a {
  color: var(--text);
}

.post-preview .post-title {
  font-size: 1.375rem;
}

.post-preview .post-meta,
.post-heading .post-meta,
#full-tags-list .tag-entry .entry-date {
  color: var(--muted);
  font-size: 0.875rem;
  font-style: normal;
}

.blog-post blockquote {
  border-left: 2px solid var(--border-strong);
}

.blog-post hr {
  border-color: var(--border);
  border-width: 1px;
  max-width: 100%;
}

.blog-post .caption {
  color: var(--muted);
  font-style: normal;
}

/* The theme's own override widens `.container` to 1800px; the measure above
   is what should decide line length. */
.container {
  max-width: 1140px !important;
}

@media (min-width: 1200px) {
  .container {
    max-width: 1140px;
  }
}
