/* Minjae Lee — personal homepage styles */

:root {
  --bg: #f7f6f2;
  /* off-white, easy on the eyes */
  --surface: #fffdfa;
  /* slightly lifted surface */
  --fg: #24292f;
  --muted: #6b7280;
  --faint: #9aa0a6;
  /* under-review / de-emphasized text */
  --revision: #b45309;
  /* under-revision / active status */
  --accent: #2563eb;
  --border: #e6e3da;
  --maxw: 820px;
}

* {
  box-sizing: border-box;
}

/* Always reserve the scrollbar gutter so short pages (e.g. Projects)
   don't shift the centered layout relative to tall, scrolling pages. */
html {
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  line-height: 1.7;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a:hover {
  text-decoration: underline;
}

/* ---- Header / nav ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 253, 250, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 13px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
}

.site-title:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 6px;
}

.site-nav a {
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 15px;
  color: var(--muted);
  transition: background-color .15s ease, color .15s ease;
}

.site-nav a:hover {
  background: rgba(37, 99, 235, 0.08);
  color: var(--accent);
  text-decoration: none;
}

.site-nav a.active {
  background: var(--accent);
  color: #fff;
}

/* ---- Language switch ---- */
html[data-lang="en"] .lang-ko {
  display: none !important;
}

html[data-lang="ko"] .lang-en {
  display: none !important;
}

/* Fixed to the browser's right edge, just below the header; stays visible on scroll. */
.lang-toggle {
  position: fixed;
  /* gap below the header equals the gap from the right edge (12px) */
  top: calc(var(--header-h, 64px) + 12px);
  right: 12px;
  z-index: 30;
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.10);
}

.lang-opt {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  padding: 6px 11px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  color: #9aa0a6;
  /* not selected: muted grey */
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}

.lang-opt:hover {
  color: var(--fg);
  background: rgba(0, 0, 0, 0.04);
}

html[data-lang="en"] .lang-opt[data-set-lang="en"],
html[data-lang="ko"] .lang-opt[data-set-lang="ko"] {
  background: #A6CE39;
  color: #24292f;
}

/* selected: ORCID green */

/* CV page: single download button aligns right (language decides which shows) */
.cv-bar {
  justify-content: flex-end;
}

/* ---- Content ---- */
.content {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 36px 24px 96px;
}

.content img[alt="Minjae Lee"] {
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.14);
}

h1 {
  font-size: 30px;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

h2 {
  font-size: 22px;
  letter-spacing: -0.01em;
  margin-top: 40px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
}

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

ul {
  padding-left: 22px;
}

li {
  margin: 6px 0;
}

code {
  background: #ece9e0;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

/* ---- Under review: greyed so it reads as not-yet-formal ---- */
.under-review,
.under-review * {
  color: var(--faint) !important;
}

.under-review em {
  font-style: italic;
}

/* ---- "under revision" status tag: active amber, even inside a grey list ---- */
.under-review .rev,
.rev {
  color: var(--revision) !important;
  font-weight: 600;
}

/* ---- Social link buttons (modern pill) ---- */
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 20px 0 4px;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--border);
  color: #37352f;
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.social-btn:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.10);
}

.social-btn:active {
  transform: translateY(0);
}

.social-btn svg {
  width: 18px;
  height: 18px;
  flex: none;
  display: block;
}

/* brand colors live in the logo */
.social-btn.scholar svg {
  color: #4285F4;
}

.social-btn.scholar:hover {
  border-color: #4285F4;
}

.social-btn.orcid svg {
  color: #A6CE39;
}

.social-btn.orcid:hover {
  border-color: #A6CE39;
}

.social-btn.linkedin svg {
  color: #0A66C2;
}

.social-btn.linkedin:hover {
  border-color: #0A66C2;
}

.social-btn.github svg {
  color: #181717;
}

.social-btn.github:hover {
  border-color: #181717;
}

/* ---- Contact email buttons ---- */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.email-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.email-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.10);
  border-color: var(--accent);
  text-decoration: none;
}

.email-btn svg {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--accent);
}

.email-btn strong {
  color: var(--fg);
  font-weight: 700;
}

.email-btn .addr {
  color: var(--muted);
}

/* header can wrap when nav has several items */
.header-inner {
  flex-wrap: wrap;
  row-gap: 8px;
}

.site-nav {
  flex-wrap: wrap;
}

/* ---- PDF download button ---- */
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  transition: transform .16s ease, box-shadow .16s ease;
}

.btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
  text-decoration: none;
  color: #fff;
}

/* ---- Inline PDF frame (CV) ---- */
.pdf-frame {
  margin: 10px 0 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.08);
}

.pdf-frame iframe {
  display: block;
  width: 100%;
  height: 82vh;
  border: 0;
}

.pdf-fallback {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin-top: 14px;
}

/* ---- CV page: language toggle ---- */
.cv {
  position: relative;
}

.cv-radio {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.cv-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.cv-tabs {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
  gap: 2px;
}

.cv-tabs label {
  padding: 7px 16px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}

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

#cv-ko:checked~.cv-bar .cv-tabs label[for="cv-ko"],
#cv-en:checked~.cv-bar .cv-tabs label[for="cv-en"] {
  background: var(--accent);
  color: #fff;
}

/* show one CV (frame + matching download) at a time */
.frame-en,
.cv-dl-en {
  display: none;
}

#cv-en:checked~.frame-ko {
  display: none;
}

#cv-en:checked~.frame-en {
  display: block;
}

#cv-en:checked~.cv-bar .cv-dl-ko {
  display: none;
}

#cv-en:checked~.cv-bar .cv-dl-en {
  display: inline-flex;
}

/* single page fits its frame exactly (aspect-ratio set inline) */
.cv-frame {
  margin: 0;
  border-radius: 0;
}

.cv-frame iframe {
  height: 100%;
}

/* ---- Projects: vertical list <-> reading mode (sidebar + detail) ---- */
.p-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.p-head {
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: box-shadow .16s ease, border-color .16s ease, background-color .16s ease;
}

.p-head:hover {
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.10);
}

.p-thumb {
  width: 96px;
  height: 96px;
  flex: none;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.p-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.p-title {
  font-weight: 700;
  font-size: 17px;
  color: var(--fg);
}

.p-desc {
  color: var(--muted);
  font-size: 14px;
}

.p-back {
  display: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 0;
  padding: 4px 6px;
  margin-bottom: 12px;
  cursor: pointer;
}

.p-back:hover {
  color: var(--accent);
}

.p-detail {
  display: none;
}

.p-panel {
  display: none;
}

.p-panel > :first-child {
  margin-top: 0;
}

.p-panel img,
.p-panel video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin: 16px 0;
}

/* Reading mode: compact list on the left, the selected panel on the right */
/* Reading mode: the detail stays in the centered page column (aligned with the
   title); the compact list becomes the navigator. */
.projects.reading .p-back {
  display: inline-block;
}

.projects.reading .p-detail {
  display: block;
}

.projects.reading .p-panel.active {
  display: block;
}

.projects.reading .p-item.active .p-head {
  border-color: var(--accent);
  background: rgba(37, 99, 235, 0.06);
}

/* Default (narrower): list becomes a horizontal strip above the centered detail */
.projects.reading .p-sidebar {
  margin-bottom: 18px;
}

.projects.reading .p-list {
  flex-direction: row;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.projects.reading .p-head {
  flex: none;
  flex-direction: column;
  width: 104px;
  text-align: center;
  gap: 8px;
  padding: 10px;
  border-radius: 10px;
  box-shadow: none;
}

.projects.reading .p-thumb {
  width: 46px;
  height: 46px;
  border-radius: 8px;
}

.projects.reading .p-meta {
  align-items: center;
  gap: 2px;
}

.projects.reading .p-title {
  font-size: 12px;
  line-height: 1.3;
}

.projects.reading .p-desc {
  display: none;
}

/* Wide: list docks into the left gutter as a fixed sidebar; the detail stays
   in the centered column, aligned with the page title. */
@media (min-width: 1280px) {
  .projects.reading .p-sidebar {
    position: fixed;
    top: calc(var(--header-h, 64px) + 16px);
    left: max(16px, calc(50% - 634px)); /* 410 half-column + 24 gap + 200 sidebar */
    width: 200px;
    max-height: calc(100vh - var(--header-h, 64px) - 32px);
    overflow-y: auto;
    margin-bottom: 0;
  }

  .projects.reading .p-list {
    flex-direction: column;
    overflow: visible;
    padding-bottom: 0;
  }

  .projects.reading .p-head {
    flex-direction: row;
    width: 100%;
    text-align: left;
    gap: 10px;
    padding: 9px 10px;
  }

  .projects.reading .p-thumb {
    width: 42px;
    height: 42px;
  }

  .projects.reading .p-meta {
    align-items: flex-start;
  }

  .projects.reading .p-title {
    font-size: 14px;
  }
}

/* ---- Collapsible older news ---- */
.news-more {
  margin-top: 6px;
}

.news-more > summary {
  cursor: pointer;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  padding: 4px 0;
  user-select: none;
}

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

.news-more > summary::before {
  content: "▸";
  font-size: 12px;
  transition: transform .15s ease;
}

.news-more[open] > summary::before {
  transform: rotate(90deg);
}

.news-more > summary:hover {
  color: var(--fg);
}

/* Tighten the gap the closed list would otherwise leave. */
.news-more[open] > ul,
.news-more[open] > :not(summary) {
  margin-top: 6px;
}

/* ---- Under-maintenance notice ---- */
.maintenance {
  max-width: 520px;
  margin: 28px auto 0;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  padding: 48px 28px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.maintenance-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--fg);
  margin: 0 0 6px;
}

.maintenance-sub {
  color: var(--muted);
  font-size: 15px;
  margin: 0;
}

@media (max-width: 600px) {
  .header-inner {
    padding: 11px 16px;
  }

  .content {
    padding: 26px 16px 72px;
  }

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

  .social-btn {
    padding: 8px 13px;
    font-size: 13px;
  }

  .p-thumb {
    width: 76px;
    height: 76px;
  }

  .pdf-frame iframe {
    height: 72vh;
  }
}