/* ============================================
   Max Cho — Personal Website
   Inspired by jeffsu.org's clean, modern style
   ============================================ */

/* --- CSS Custom Properties (Themes) --- */
:root,
[data-theme="light"] {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f8f8;
  --bg-card: #ffffff;
  --text-primary: #1a1a1a;
  --text-secondary: #555555;
  --text-muted: #888888;
  --accent: #00b2fe;
  --accent-hover: #009de0;
  --border: #e6e6e6;
  --border-dashed: #d0d0d0;
  --sidebar-bg: #fafafa;
  --sidebar-border: #eeeeee;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --card-hover-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  --code-bg: #f4f4f4;
}

[data-theme="dark"] {
  --bg-primary: #141414;
  --bg-secondary: #1c1c1c;
  --bg-card: #1e1e1e;
  --text-primary: #e8e8e8;
  --text-secondary: #a0a0a0;
  --text-muted: #666666;
  --accent: #00b2fe;
  --accent-hover: #33c4ff;
  --border: #2a2a2a;
  --border-dashed: #333333;
  --sidebar-bg: #181818;
  --sidebar-border: #222222;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  --card-hover-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  --code-bg: #2a2a2a;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.mono {
  font-family: 'Roboto Mono', monospace;
}

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

a:hover {
  opacity: 0.85;
}

strong {
  font-weight: 600;
}

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  z-index: 100;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.sidebar-logo {
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.mobile-close {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-primary);
  cursor: pointer;
}

.sidebar-nav {
  list-style: none;
  flex: 1;
}

.sidebar-nav li {
  margin-bottom: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
  opacity: 1;
}

.nav-link.active {
  background: var(--bg-secondary);
  color: var(--accent);
}

.nav-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-link.active svg {
  opacity: 1;
  stroke: var(--accent);
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin-top: auto;
}

.theme-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-btn:hover {
  color: var(--text-primary);
}

.theme-btn.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--card-shadow);
}

/* --- Mobile Header --- */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 90;
  transition: background 0.3s ease;
}

.hamburger {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: background 0.3s ease;
}

.mobile-logo {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.mobile-theme-toggle {
  display: flex;
  gap: 4px;
}

.theme-btn-sm {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-btn-sm:hover {
  color: var(--text-primary);
}

.theme-btn-sm.active {
  background: var(--bg-secondary);
  color: var(--accent);
}

/* --- Main Content --- */
.main-content {
  max-width: 760px;
  padding: 48px 40px;
  margin-left: calc(220px + (100vw - 220px - 760px) / 2);
  margin-right: auto;
}

@media (max-width: 1040px) {
  .main-content {
    margin-left: 220px;
    margin-right: 0;
  }
}

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

.section-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.section-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}

.section-divider {
  border: none;
  border-top: 1px dashed var(--border-dashed);
  margin: 0;
}

/* --- Hero Section --- */
.hero {
  padding-top: 20px;
}

.hero-greeting {
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 8px;
  font-weight: 500;
}

.hero-name {
  font-size: 3rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 16px;
  letter-spacing: -0.03em;
}

.hero-tagline {
  font-size: 1.2rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}

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

.hero-description {
  font-size: 1rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 28px;
}

.hero-cta {
  display: flex;
  gap: 12px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'Roboto Mono', monospace;
  transition: all 0.2s ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  opacity: 1;
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  opacity: 1;
}

/* Stats */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: var(--accent);
  box-shadow: var(--card-hover-shadow);
}

.stat-number {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* --- About --- */
.about-content p {
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-size: 1rem;
}

.about-content p:last-child {
  margin-bottom: 0;
}

/* --- Experience --- */
.experience-timeline {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.experience-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  transition: all 0.3s ease;
}

.experience-card:hover {
  box-shadow: var(--card-hover-shadow);
  border-color: var(--accent);
}

.experience-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 16px;
}

.experience-company {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.experience-role {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
}

.experience-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 2px;
}

.experience-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.experience-list li {
  position: relative;
  padding-left: 16px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.65;
}

.experience-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* --- Competencies --- */
.competency-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.competency-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  transition: all 0.3s ease;
}

.competency-card:hover {
  box-shadow: var(--card-hover-shadow);
  border-color: var(--accent);
}

.competency-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--bg-secondary);
  border-radius: 10px;
  margin-bottom: 16px;
  color: var(--accent);
}

.competency-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 14px;
  color: var(--text-primary);
}

.competency-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.competency-card li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
  padding-left: 14px;
  position: relative;
}

.competency-card li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border-dashed);
}

/* --- Education --- */
.education-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  transition: all 0.3s ease;
}

.education-card:hover {
  box-shadow: var(--card-hover-shadow);
  border-color: var(--accent);
}

.education-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: var(--bg-secondary);
  border-radius: 12px;
  color: var(--accent);
  flex-shrink: 0;
}

.education-card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.education-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Contact --- */
.contact-description {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 1rem;
}

.contact-links {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.contact-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 20px;
  text-align: center;
  transition: all 0.3s ease;
  color: var(--text-primary);
}

.contact-card:hover {
  box-shadow: var(--card-hover-shadow);
  border-color: var(--accent);
  opacity: 1;
}

.contact-card svg {
  color: var(--accent);
}

.contact-card-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.contact-card-value {
  font-size: 0.9rem;
  color: var(--text-secondary);
  word-break: break-all;
}

/* --- Footer --- */
.footer {
  padding: 40px 0 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

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

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease, background 0.3s ease;
    width: 260px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-close {
    display: block;
  }

  .mobile-header {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: 80px 20px 40px;
    max-width: 100%;
  }

  .hero-name {
    font-size: 2.2rem;
  }

  .section-title {
    font-size: 1.4rem;
  }

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

  .stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    text-align: left;
    padding: 16px 20px;
  }

  .stat-number {
    font-size: 1.4rem;
    margin-bottom: 0;
  }

  .experience-header {
    flex-direction: column;
    gap: 4px;
  }

  .contact-links {
    grid-template-columns: 1fr;
  }

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

  .hero-cta {
    flex-direction: column;
  }

  .btn {
    justify-content: center;
  }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
}

.sidebar-overlay.show {
  display: block;
}

/* --- Animations --- */
@media (prefers-reduced-motion: no-preference) {
  .section {
    animation: fadeInUp 0.5s ease both;
  }

  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(16px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* --- Selection --- */
::selection {
  background: var(--accent);
  color: #ffffff;
}

/* --- Scrollbar (Webkit) --- */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
