/* ═══════════════════════════════════════════════════════════════
   Portfolio — Design System Tokens & Styles
   Based on OpenAI-inspired DESIGN.md
   ═══════════════════════════════════════════════════════════════ */

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

/* ── Tokens ────────────────────────────────────────────────────── */
:root {
  --bg: #ffffff;
  --bg-sidebar: #f7f7f8;
  --bg-surface: #f7f7f8;
  --bg-card: #ffffff;
  --bg-nav-active: #ececf1;
  --border: #ececf1;
  --text-primary: #202123;
  --text-secondary: #6e6e80;
  --text-dim: #8e8ea0;
  --accent: #10a37f;
  --accent-hover: #0d8a6a;
  --avatar: transparent;
  --img-placeholder: transparent;
  --toggle-bg: #f7f7f8;
  --toggle-active: #ececf1;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="dark"] {
  --bg: #212121;
  --bg-sidebar: #202123;
  --bg-surface: #2f2f2f;
  --bg-card: #212121;
  --bg-nav-active: #2f2f2f;
  --border: #4d4d4d;
  --text-primary: #ececec;
  --text-secondary: #b4b4b4;
  --text-dim: #8e8e8e;
  --toggle-bg: #2f2f2f;
  --toggle-active: #404040;
}

/* ── Base ──────────────────────────────────────────────────────── */
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── Layout Shell ──────────────────────────────────────────────── */
.shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 32px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar__profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding-bottom: 24px;
}
.sidebar__avatar {
  width: 80px;
  height: 80px;
  border-radius: 40px;
  background: var(--avatar);
  overflow: hidden;
}
.sidebar__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.sidebar__name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.sidebar__role {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar__nav a {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 150ms ease, color 150ms ease;
}
.sidebar__nav a:hover {
  background: var(--bg-nav-active);
  color: var(--text-primary);
}
.sidebar__nav a.active {
  background: var(--bg-nav-active);
  color: var(--text-primary);
  font-weight: 600;
}
.sidebar__spacer { flex: 1; }
.sidebar__social {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.sidebar__social a {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: border-color 150ms ease;
}
.sidebar__social a:hover {
  border-color: var(--text-dim);
}
.sidebar__social svg { width: 16px; height: 16px; }

/* ── Main Content ──────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 16px 40px;
}
.scroll-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  padding: 40px 0;
}
.content-width {
  width: 530px;
  max-width: 100%;
}

/* ── Theme Toggle ──────────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--toggle-bg);
  border-radius: 100px;
  border: none;
  cursor: pointer;
}
.theme-toggle__btn {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: background 150ms ease, color 150ms ease;
}
.theme-toggle__btn.active {
  background: var(--toggle-active);
  color: var(--text-primary);
}
.theme-toggle__btn svg { width: 16px; height: 16px; }

/* ── Footer ────────────────────────────────────────────────────── */
.footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 24px 40px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}

/* ── Hero ──────────────────────────────────────────────────────── */
.hero { display: flex; flex-direction: column; gap: 20px; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  width: fit-content;
}
.status-badge__dot {
  width: 8px; height: 8px;
  background: #22c55e;
  border-radius: 4px;
}
.status-badge__text { font-size: 13px; color: var(--text-secondary); }
.hero__title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}
.hero__subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}
.hero__cta {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-family: var(--font);
  cursor: pointer;
  transition: background 150ms ease;
  border: none;
}
.btn--primary {
  background: var(--accent);
  color: #ffffff;
  font-weight: 500;
}
.btn--primary:hover { background: var(--accent-hover); }
.btn--secondary {
  background: var(--bg);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn--secondary:hover {
  background: var(--bg-surface);
}

/* ── Section Titles ────────────────────────────────────────────── */
.section-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}
.section-title--lg {
  font-size: 24px;
  font-weight: 700;
}

/* ── Work Experience ───────────────────────────────────────────── */
.work-experience { display: flex; flex-direction: column; }
.we-divider {
  height: 1px;
  background: var(--border);
}
.we-entry {
  display: flex;
  gap: 24px;
  padding: 24px 0;
  align-items: flex-start;
}
.we-logo {
  width: 120px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
}
.we-logo img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
[data-theme="dark"] .we-logo img {
  filter: brightness(1.65) saturate(0.7);
}
.we-logo__initials {
  font-size: 13px;
  font-weight: 700;
  color: #6e6e80;
}
.we-details { flex: 1; }
.we-role {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.we-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Current Interests ─────────────────────────────────────────── */
.interests-grid {
  display: flex;
  gap: 20px;
}
.interest-card {
  flex: 1;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.interest-card__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}
.interest-card__desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── Projects Grid ─────────────────────────────────────────────── */
.projects-header { display: flex; flex-direction: column; gap: 12px; }
.projects-header__title { font-size: 28px; font-weight: 700; }
.projects-header__desc { font-size: 14px; color: var(--text-secondary); }

.projects-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.project-card {
  width: calc(50% - 10px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 200ms ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.project-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.project-card__image {
  width: 100%;
  overflow: hidden;
}
.project-card__image img {
  width: 100%;
  height: auto;
  display: block;
}
.project-card__body { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.project-card__meta { display: flex; align-items: center; gap: 8px; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  background: var(--bg-surface);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.project-card__year { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.project-card__title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.project-card__desc { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

/* ── Project Detail ────────────────────────────────────────────── */
.back-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 150ms;
}
.back-nav:hover { color: var(--text-primary); }

.project-header { display: flex; flex-direction: column; gap: 24px; }
.project-header__title-block { display: flex; flex-direction: column; gap: 12px; }
.project-header__name { font-size: 32px; font-weight: 700; }
.project-header__meta { display: flex; align-items: center; gap: 12px; }
.project-header__overview { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

.detail-section { display: flex; flex-direction: column; gap: 24px; }
.detail-section--tight { display: flex; flex-direction: column; gap: 16px; }
.detail-section .btn,
.detail-section--tight .btn { align-self: flex-start; }
.detail-section__heading {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}
.detail-section__body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}
.meta-grid {
  display: flex;
  gap: 24px;
}
.meta-grid__item { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.meta-grid__label { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.meta-grid__value { font-size: 14px; color: var(--text-secondary); }

.image-placeholder {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
}
.image-placeholder img {
  width: 100%;
  height: auto;
  display: block;
}

/* ── Mobile Nav ────────────────────────────────────────────────── */
.mobile-nav {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}
.mobile-nav__name { font-size: 16px; font-weight: 600; }
.mobile-nav__right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mobile-nav__hamburger {
  width: 24px; height: 24px;
  display: flex; flex-direction: column;
  justify-content: center; gap: 5px;
  cursor: pointer; background: none; border: none; padding: 0;
}
.mobile-nav__hamburger span {
  display: block; width: 18px; height: 2px;
  background: var(--text-primary); border-radius: 1px;
  transition: transform 200ms ease, opacity 200ms ease;
}

/* ── Mobile Menu Overlay ───────────────────────────────────────── */
.menu-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 300ms ease;
}
.menu-overlay.open { transform: translateX(0); }
.menu-overlay__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 56px;
  border-bottom: 1px solid var(--border);
}
.menu-overlay__close {
  width: 24px; height: 24px;
  position: relative; cursor: pointer;
  background: none; border: none;
}
.menu-overlay__close span {
  display: block; width: 18px; height: 2px;
  background: var(--text-primary); border-radius: 1px;
  position: absolute; left: 3px; top: 11px;
}
.menu-overlay__close span:first-child { transform: rotate(45deg); }
.menu-overlay__close span:last-child { transform: rotate(-45deg); }
.menu-overlay__body {
  flex: 1; padding: 32px 20px;
  display: flex; flex-direction: column;
}
.menu-overlay__profile {
  display: flex; flex-direction: column; gap: 12px;
  padding-bottom: 32px;
}
.menu-overlay__avatar {
  width: 64px; height: 64px; border-radius: 32px; background: var(--avatar);
}
.menu-overlay__name { font-size: 20px; font-weight: 700; }
.menu-overlay__role { font-size: 14px; color: var(--text-secondary); }
.menu-overlay__nav {
  display: flex; flex-direction: column;
  border-top: 1px solid var(--border);
}
.menu-overlay__nav a {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px; font-size: 18px; font-weight: 500;
  color: var(--text-primary);
}
.menu-overlay__nav a::after { content: '→'; color: var(--text-dim); }
.menu-overlay__cta {
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.menu-overlay__cta .btn { width: 100%; }
.menu-overlay__spacer { flex: 1; }
.menu-overlay__social {
  display: flex; gap: 12px; justify-content: center;
  padding-top: 24px;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .mobile-nav { display: flex; }
  .topbar { display: none; }
  .scroll-content { padding: 24px 20px; }
  .content-width { width: 100%; }
  .hero__title { font-size: 28px; }
  .projects-header__title { font-size: 24px; }
  .project-card { width: 100%; }
  .interests-grid { flex-direction: column; }
  .meta-grid { flex-direction: column; gap: 16px; }
  .project-header__name { font-size: 28px; }
  .detail-section__heading { font-size: 22px; }
  .we-entry { gap: 12px; }
  .we-logo { width: 80px; height: 32px; border-radius: 8px; }
  .we-role { font-size: 13px; }
  .we-desc { font-size: 12px; }
  .image-placeholder img { width: 100%; height: auto; }
  .footer { justify-content: center; padding: 16px 20px; }
}
