/* ============================================================
   HAKKYUN KIM — Personal Site
   Design system: CSS custom properties for theming
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Mono:wght@300;400;500&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ---------- Light / Dark tokens ---------- */
:root {
  --accent:      #3B82F6;
  --accent-dim:  #93C5FD;

  /* Light mode defaults */
  --bg:          #F8F8F6;
  --bg-card:     #FFFFFF;
  --surface:     #EFEFED;
  --border:      #E0E0DC;
  --text-primary:   #111110;
  --text-secondary: #555552;
  --text-muted:     #999994;

  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;

  --radius: 10px;
  --nav-h: 64px;
  --transition: 0.2s ease;
}

[data-theme="dark"] {
  --bg:          #0F0F0E;
  --bg-card:     #1A1A18;
  --surface:     #232320;
  --border:      #2E2E2A;
  --text-primary:   #F0F0EC;
  --text-secondary: #A8A8A2;
  --text-muted:     #5A5A54;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity var(--transition);
}
a:hover { opacity: 0.75; }

img { max-width: 100%; display: block; }

/* ---------- Navigation ---------- */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  transition: background var(--transition), border-color var(--transition);
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  text-decoration: none;
}

.nav-logo span {
  color: var(--accent);
}

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

.nav-links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

.nav-links a.active {
  border-bottom: 1.5px solid var(--accent);
  padding-bottom: 1px;
}

/* Theme toggle button */
#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 34px;
  height: 34px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: border-color var(--transition), color var(--transition), background var(--transition);
  font-size: 1rem;
  flex-shrink: 0;
}
#theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface);
}

/* ---------- Page wrapper ---------- */
main {
  padding-top: calc(var(--nav-h) + 3rem);
  max-width: 780px;
  margin: 0 auto;
  padding-left: 2rem;
  padding-right: 2rem;
  padding-bottom: 6rem;
}

/* ---------- Typography ---------- */
h1 {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  line-height: 1.1;
  color: var(--text-primary);
  font-weight: 400;
  letter-spacing: -0.01em;
}

h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  letter-spacing: -0.01em;
}

h3 {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
  letter-spacing: 0.01em;
}

p {
  color: var(--text-secondary);
  font-size: 0.975rem;
  line-height: 1.75;
}

.label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---------- Section divider ---------- */
.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.section-header h2 {
  margin-bottom: 0;
  white-space: nowrap;
}

.section-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: var(--accent-dim);
  box-shadow: 0 4px 24px rgba(59,130,246,0.07);
}

/* ---------- Tags ---------- */
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.2rem 0.55rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

/* ---------- Page-entry animation ---------- */
.fade-in {
  opacity: 0;
  transform: translateY(14px);
  animation: fadeUp 0.5s ease forwards;
}
.fade-in:nth-child(1) { animation-delay: 0.05s; }
.fade-in:nth-child(2) { animation-delay: 0.12s; }
.fade-in:nth-child(3) { animation-delay: 0.19s; }
.fade-in:nth-child(4) { animation-delay: 0.26s; }
.fade-in:nth-child(5) { animation-delay: 0.33s; }

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Footer ---------- */
footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
  padding: 2rem 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

footer a {
  color: var(--text-muted);
  transition: color var(--transition);
}
footer a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  nav { padding: 0 1.25rem; }
  .nav-links { gap: 1.1rem; }
  main { padding-left: 1.25rem; padding-right: 1.25rem; }
  footer { flex-direction: column; gap: 0.5rem; text-align: center; }
}
