@import url('https://fonts.googleapis.com/css2?family=Lato:wght@400;700;900&family=Nunito+Sans:wght@400;600;700;900&display=swap');

/* ===== CSS Custom Properties (Light Theme Default) ===== */
:root {
  --bg-primary: #EEEEF0;
  --bg-surface: #FFFFFF;
  --bg-card: #FFFFFF;
  --text-primary: #111417;
  --text-secondary: #262B30;
  --accent: #2D5F3C;
  --accent-hover: #1E4429;
  --accent-light: #7A9E7E;
  --border: #D4D4D0;
  --nav-bg: #C5E4F7EE;
  --shadow: rgba(0, 0, 0, 0.06);
  --shadow-lg: rgba(0, 0, 0, 0.1);
  --mountain-color: #D4D4D0;
  --toggle-bg: transparent;
  --toggle-glow: #F5C542;
  --toggle-glow-outer: rgba(245, 197, 66, 0.3);
  --nav-pill-border: rgba(35, 39, 43, 0.35);
}

/* ===== Dark Theme ===== */
[data-theme="dark"] {
  --bg-primary: #080B12;
  --bg-surface: #111827;
  --bg-card: #111827;
  --text-primary: #FFFFFF;
  --text-secondary: #CCCCCC;
  --accent: #5EADAD;
  --accent-hover: #7ECFCF;
  --accent-light: #3D7A5E;
  --border: #1E2436;
  --nav-bg: #111827DD;
  --shadow: rgba(94, 173, 173, 0.05);
  --shadow-lg: rgba(94, 173, 173, 0.08);
  --mountain-color: #1E2436;
  --toggle-bg: #1A2340;
  --toggle-glow: rgba(200, 220, 255, 0.5);
  --toggle-glow-outer: rgba(200, 220, 255, 0.15);
  --nav-pill-border: rgba(255, 255, 255, 0.28);
}

/* ===== Reset ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

img {
  max-width: 100%;
}

/* ===== Base ===== */
html {
  scroll-behavior: smooth;
  font-size: 17px;
}

body {
  font-family: 'Nunito Sans', 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  letter-spacing: 0.01em;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
}

[data-theme="dark"] body {
  background-image: radial-gradient(ellipse at top, #1a2540 0%, #0B0E17 70%);
}

/* ===== Typography ===== */
h1, h2, h3, h4 {
  line-height: 1.3;
  font-weight: 700;
  color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; margin-bottom: 1rem; }
h3 { font-size: 1.15rem; margin-bottom: 0.75rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* ===== Container ===== */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ===== Navigation ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0.8rem 0;
  transition: background-color 0.3s ease;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-name {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-name:hover {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
}

.nav-links a {
  font-family: 'Lato', 'Helvetica Neue', Arial, sans-serif;
  font-variant-caps: small-caps;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 10px;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.nav-links a:hover,
.nav-links a:active,
.nav-links a:focus-visible {
  background-color: #FFFFFF;
  border-color: var(--nav-pill-border);
  color: #23272B;
}

/* Theme Toggle */
.theme-toggle {
  background-color: var(--toggle-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
  position: relative;
}

.theme-toggle:hover {
  border-color: var(--toggle-glow);
  box-shadow: 0 0 12px var(--toggle-glow), 0 0 24px var(--toggle-glow-outer);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* Sun icon styling */
.icon-sun {
  color: #B8860B;
}

.theme-toggle:hover .icon-sun {
  color: #F5C542;
  filter: drop-shadow(0 0 4px #F5C542);
}

/* Moon icon styling */
.icon-moon path {
  fill: #E8E8E8;
  stroke: #C0C0C0;
}

.theme-toggle:hover .icon-moon path {
  fill: #FFFFFF;
  stroke: #FFFFFF;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.7));
}

/* Hamburger (mobile) */
.nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-primary);
}

.nav-hamburger svg {
  width: 24px;
  height: 24px;
}

/* ===== Content Box ===== */
.content-box {
  background-color: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 2px 12px var(--shadow), 0 1px 3px var(--shadow);
  padding: 2rem;
  margin-bottom: 1.5rem;
}

/* ===== Hero Section (Homepage Two-Column) ===== */
.hero {
  padding: 1rem 0 2rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
  align-items: start;
}

/* Left Column - Profile */
.profile-card {
  text-align: center;
}

.profile-photo {
  width: 180px;
  height: 180px;
  min-width: 180px;
  min-height: 180px;
  border-radius: 12px;
  object-fit: cover;
  object-position: center 30%;
  border: 3px solid var(--border);
  box-shadow: 0 4px 12px var(--shadow);
  margin-bottom: 1.2rem;
  transition: border-color 0.3s ease;
  background-color: var(--bg-surface);
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.profile-photo:hover {
  border-color: var(--accent-light);
}

.profile-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.profile-title {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 0.2rem;
}

.profile-affiliation {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
}

.social-links {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1rem;
}

.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.social-links a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background-color: var(--bg-surface);
}

.social-links svg {
  width: 18px;
  height: 18px;
}

/* Left Column */
.profile-column {
  display: flex;
  flex-direction: column;
}

/* Left Column - Sidebar Sections */
.sidebar-section {
  text-align: left;
}

/* Section Label (like Minsun Kim's "ABOUT", "FOCUS") */
.section-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.8rem;
}

.sidebar-section p {
  font-size: 0.88rem;
  line-height: 1.75;
}

.sidebar-news {
  list-style: none;
  padding: 0;
}

.sidebar-news li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.sidebar-news li:last-child {
  border-bottom: none;
}

.sidebar-news .news-date {
  font-weight: 700;
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.82rem;
}

.sidebar-news .news-text {
  color: var(--text-secondary);
}

/* Right Column - Research Info */
.research-info h2 {
  font-size: 1.3rem;
  margin-bottom: 0.8rem;
  color: var(--text-primary);
}

.research-info p {
  font-size: 0.95rem;
  line-height: 1.8;
}

/* Focus Area Cards */
.focus-card {
  display: flex;
  gap: 1.2rem;
  align-items: flex-start;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1.5rem;
  transition: border-color 0.2s ease;
}

.focus-card:hover {
  border-color: var(--accent-light);
}

.focus-icon {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.focus-icon svg {
  width: 32px;
  height: 32px;
  color: var(--accent);
}

.focus-content h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
  font-variant: small-caps;
  letter-spacing: 0.02em;
}

.focus-content p {
  font-size: 0.88rem;
  margin-bottom: 0;
}

/* ===== Mountain Divider ===== */
.mountain-divider {
  width: 100%;
  height: 40px;
  margin: 2rem 0;
  opacity: 0.3;
}

.mountain-divider path {
  fill: var(--mountain-color);
}

/* ===== News Section ===== */
.news-section {
  padding: 2rem 0 3rem;
}

.news-section h2 {
  margin-bottom: 1.5rem;
}

.news-list {
  list-style: none;
  padding: 0;
}

.news-item {
  display: flex;
  gap: 1.5rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.news-item:last-child {
  border-bottom: none;
}

.news-date {
  color: var(--accent);
  font-weight: 500;
  white-space: nowrap;
  min-width: 90px;
}

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

/* ===== Page Content (inner pages) ===== */
.page-content {
  padding: 3rem 0;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  margin-bottom: 0.5rem;
}

.page-header p {
  font-size: 0.9rem;
}

/* Cards */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  border-color: var(--accent-light);
  box-shadow: 0 4px 16px var(--shadow);
}

.card h3 {
  margin-bottom: 0.5rem;
}

.card p {
  font-size: 0.85rem;
}

.card-meta {
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
  font-weight: 500;
}

/* Tags */
.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  margin-right: 0.4rem;
  margin-top: 0.5rem;
}

/* Teaching Page */
.institution-heading {
  font-variant: small-caps;
  letter-spacing: 0.03em;
  font-size: 1.6rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--text-primary);
  margin-bottom: 1rem;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  align-items: start;
}

.course-card {
  margin-bottom: 0;
}

.course-card h3 {
  margin-bottom: 0.15rem;
}

.course-code {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.course-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.tag-pill {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 12px;
  border-radius: 5px;
}

.tag-graduate { background-color: #E9E2F7; color: #553C9A; }
.tag-undergraduate { background-color: #DCEAF8; color: #2C5987; }
.tag-ta { background-color: #DDF0E4; color: #2D5F3C; }
.tag-instructor { background-color: #F6E3F0; color: #86277A; }
.tag-project { background-color: #D9F0EF; color: #1F6363; }
.tag-term { background-color: #E8EAEC; color: #4A5560; }

[data-theme="dark"] .tag-graduate { background-color: #2E2547; color: #C4B0F0; }
[data-theme="dark"] .tag-undergraduate { background-color: #1D3049; color: #9CC5EC; }
[data-theme="dark"] .tag-ta { background-color: #1B3328; color: #8FD1A8; }
[data-theme="dark"] .tag-instructor { background-color: #352032; color: #DFA3D6; }
[data-theme="dark"] .tag-project { background-color: #16302F; color: #85CFCB; }
[data-theme="dark"] .tag-term { background-color: #252C36; color: #A8B2BC; }

.course-desc {
  margin-top: 1rem;
}

@media (max-width: 768px) {
  .course-grid {
    grid-template-columns: 1fr;
  }
}

/* Publication List */
.pub-list {
  list-style: none;
  padding: 0;
}

.pub-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.pub-item:last-child {
  border-bottom: none;
}

.pub-item p {
  margin-bottom: 0.15rem;
  line-height: 1.5;
}

.pub-item p:last-child {
  margin-bottom: 0;
}

.pub-title {
  font-weight: 700;
  color: var(--text-primary);
}

.pub-authors {
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.pub-venue {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 500;
}

/* CV */
.cv-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  background-color: var(--accent);
  color: var(--bg-primary);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s ease;
  margin-bottom: 2rem;
}

.cv-download:hover {
  background-color: var(--accent-hover);
  color: var(--bg-primary);
}

.cv-section {
  margin-bottom: 2rem;
}

.cv-section h2 {
  font-variant: small-caps;
  letter-spacing: 0.03em;
  font-size: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--text-primary);
  margin-bottom: 1.5rem;
}

/* CV entry cards */
.cv-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cv-card:hover {
  border-color: var(--accent-light);
  box-shadow: 0 4px 16px var(--shadow);
}

.cv-logo {
  flex-shrink: 0;
  width: 58px;
  height: 58px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.62rem;
  color: #FFFFFF;
  overflow: hidden;
}

/* Logo tile holding a real image instead of initials */
.cv-logo-img {
  background-color: #FFFFFF;
  padding: 3px;
}

.cv-logo-img img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: 6px;
}

.cv-card-body {
  flex: 1;
  min-width: 0;
}

.cv-card-body h3 {
  font-size: 0.98rem;
  margin-bottom: 0.2rem;
}

.cv-role {
  font-style: italic;
  font-size: 0.88rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.cv-desc {
  font-size: 0.85rem;
}

.cv-date-badge {
  flex-shrink: 0;
  align-self: flex-start;
  background-color: #7E868F;
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 8px;
  white-space: nowrap;
}

[data-theme="dark"] .cv-date-badge {
  background-color: #4A5361;
  color: #FFFFFF;
}

@media (max-width: 640px) {
  .cv-card {
    flex-wrap: wrap;
  }
  .cv-date-badge {
    order: -1;
    width: 100%;
    text-align: center;
  }
}

.cv-entry {
  margin-bottom: 1.2rem;
}

.cv-entry h3 {
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
}

.cv-entry .cv-meta {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 500;
}

.cv-entry p {
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

/* Project Cards */
.project-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.9rem;
  align-items: start;
}

.project-card {
  margin-bottom: 0;
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
}

.project-card h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.project-card .project-desc {
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
  flex: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.project-tags .tag {
  margin-right: 0;
  margin-top: 0;
  background-color: var(--bg-primary);
}

/* Blog Post Cards */
.blog-grid {
  display: grid;
  gap: 1.5rem;
}

.blog-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  display: block;
}

.blog-card:hover {
  border-color: var(--accent-light);
  box-shadow: 0 4px 16px var(--shadow);
}

.blog-card h3 {
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.blog-card p {
  font-size: 0.85rem;
}

/* Blog Post Page */
.post-header {
  margin-bottom: 2rem;
}

.post-header h1 {
  margin-bottom: 0.5rem;
}

.post-meta {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 500;
}

.post-content {
  font-size: 0.92rem;
  line-height: 1.85;
}

.post-content h2 {
  margin-top: 2rem;
}

.post-content ul, .post-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.post-content li {
  margin-bottom: 0.3rem;
  color: var(--text-secondary);
}

.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  font-size: 0.85rem;
}

/* ===== Footer ===== */
.footer {
  padding: 1rem 0;
  padding-bottom: 140px;
  text-align: center;
  margin-top: 0;
}

.footer p {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.footer-tree {
  opacity: 0.12;
  margin-bottom: 0.5rem;
}

/* ===== Nature Background (bottom of page) ===== */
.nature-bg {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.nature-bg svg {
  position: absolute;
  bottom: 0;
  width: 100%;
}

/* Mountains */
.nature-mountains {
  height: 60px;
}

.nature-mountains path {
  fill: var(--accent);
  fill-opacity: 0.12;
}

/* Trees */
.nature-trees {
  height: 35px;
}

.nature-trees polygon {
  fill: var(--accent);
  fill-opacity: 0.25;
}

/* Rain */
.rain-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.raindrop {
  position: absolute;
  width: 1px;
  background: var(--accent);
  opacity: 0.08;
  animation: rain-fall linear infinite;
}

@keyframes rain-fall {
  0% {
    transform: translateY(-10px);
    opacity: 0;
  }
  10% {
    opacity: 0.08;
  }
  90% {
    opacity: 0.08;
  }
  100% {
    transform: translateY(100vh);
    opacity: 0;
  }
}

/* Ensure main content sits above nature bg */
.navbar { z-index: 100; }
main { position: relative; z-index: 1; }
.footer { position: relative; z-index: 1; }

/* ===== Stars (dark mode only) ===== */
.stars-container {
  position: fixed;
  bottom: 120px;
  left: 0;
  right: 0;
  height: 200px;
  pointer-events: none;
  z-index: 0;
  display: none;
}

[data-theme="dark"] .stars-container {
  display: block;
}

.star {
  position: absolute;
  border-radius: 50%;
  background: #FFFFFF;
  animation: twinkle ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.15; }
  50% { opacity: 0.8; }
}

/* ===== 404 Page ===== */
.page-404 {
  text-align: center;
  padding: 6rem 0;
}

.page-404 h1 {
  font-size: 4rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.page-404 p {
  font-size: 1rem;
  margin-bottom: 2rem;
}

.page-404 a {
  font-weight: 500;
}

/* ===== Responsive ===== */

/* Tablet */
@media (max-width: 1024px) {
  .hero-grid {
    gap: 2rem;
  }
}

/* Mobile */
@media (max-width: 640px) {
  html { font-size: 16px; }

  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    gap: 0.8rem;
  }

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

  .nav-hamburger {
    display: flex;
  }

  .navbar {
    position: relative;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }

  .profile-card {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .focus-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .profile-column {
    gap: 0;
  }
}
