/* ============================================================
   TED KANG — Design System
   Inspired by perell.com: editorial serif, charcoal, generous space
   ============================================================ */

/* ── Fonts ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;0,800;1,700&family=Inter:wght@300;400;500;600&display=swap');

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  --text:        #3a3a3a;
  --text-light:  #888;
  --text-muted:  #aaa;
  --bg:          #fff;
  --border:      #e8e8e8;
  --border-dark: #c8c8c8;
  --serif:       'Playfair Display', Georgia, serif;
  --sans:        'Inter', -apple-system, sans-serif;
  --max-site:    1100px;
  --max-content: 680px;
  --side-pad:    24px;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 18px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ── Masthead ───────────────────────────────────────────── */
.masthead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.masthead-inner {
  max-width: var(--max-content);
  margin: 0 auto;
  padding: 0 var(--side-pad);
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.masthead-brand {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.masthead-nav {
  display: flex;
  gap: 24px;
  list-style: none;
}
.masthead-nav a {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-light);
  letter-spacing: 0.01em;
  transition: color 0.15s;
}
.masthead-nav a:hover { color: var(--text); }

/* ── Hero / Intro ───────────────────────────────────────── */
.hero {
  max-width: var(--max-content);
  padding: 72px var(--side-pad) 56px;
  margin: 0 auto;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 24px;
}
.hero-bio { font-size: 1.05rem; line-height: 1.75; color: var(--text); margin-bottom: 8px; }
.hero-sub { font-size: 0.92rem; color: var(--text-light); margin-bottom: 28px; }
.hero-subscribe { display: flex; gap: 8px; flex-wrap: wrap; }
.hero-subscribe input[type="email"] {
  flex: 1; min-width: 220px; max-width: 300px;
  padding: 10px 14px; font-family: var(--sans); font-size: 0.9rem;
  border: 1px solid var(--border-dark); border-radius: 4px;
  outline: none; color: var(--text); background: #fff; transition: border-color 0.15s;
}
.hero-subscribe input[type="email"]:focus { border-color: var(--text); }
.hero-subscribe button {
  padding: 10px 20px; font-family: var(--sans); font-size: 0.9rem;
  font-weight: 600; color: #fff; background: var(--text);
  border: none; border-radius: 4px; cursor: pointer; transition: opacity 0.15s;
}
.hero-subscribe button:hover { opacity: 0.75; }
.subscribe-confirm { font-size: 0.85rem; color: var(--text-light); margin-top: 8px; min-height: 20px; }

/* ── Content Sections ───────────────────────────────────── */
.content-section {
  max-width: var(--max-content); margin: 0 auto;
  padding: 56px var(--side-pad); border-top: 1px solid var(--border);
}
.section-header { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.section-title { font-family: var(--serif); font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.section-link { font-size: 0.85rem; font-weight: 500; color: var(--text-light); transition: color 0.15s; }
.section-link:hover { color: var(--text); }
.section-desc { font-size: 0.95rem; color: var(--text-light); line-height: 1.6; margin-bottom: 36px; }

/* ── Latest Article ─────────────────────────────────────── */
.latest-article { margin-bottom: 36px; padding-bottom: 36px; border-bottom: 1px solid var(--border); }
.latest-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; }
.latest-article h3 { font-family: var(--serif); font-size: 1.45rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.02em; margin-bottom: 8px; }
.latest-article h3 a { transition: opacity 0.15s; }
.latest-article h3 a:hover { opacity: 0.6; }
.article-meta { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 10px; }
.latest-article p { font-size: 0.97rem; color: var(--text-light); line-height: 1.7; }

/* ── Featured List ──────────────────────────────────────── */
.featured-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 16px; }
.featured-list { list-style: none; display: flex; flex-direction: column; gap: 22px; }
.featured-item { display: flex; flex-direction: column; gap: 4px; }
.featured-item .article-meta { margin-bottom: 0; }
.featured-item a { font-family: var(--serif); font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.35; transition: opacity 0.15s; }
.featured-item a:hover { opacity: 0.6; }
.featured-desc { font-size: 0.88rem; color: var(--text-light); line-height: 1.6; }

/* ── Topics ─────────────────────────────────────────────── */
.topics-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.topic-pill { display: inline-block; padding: 6px 16px; font-size: 0.85rem; font-weight: 500; border: 1px solid var(--border-dark); border-radius: 100px; color: var(--text); transition: background 0.15s, border-color 0.15s, color 0.15s; }
.topic-pill:hover { background: var(--text); color: #fff; border-color: var(--text); }

/* ── Background / Roles ─────────────────────────────────── */
.role-list { display: flex; flex-direction: column; margin-bottom: 24px; }
.role-item { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 0; border-bottom: 1px solid var(--border); gap: 16px; }
.role-item:first-child { border-top: 1px solid var(--border); }
.role-title { font-size: 0.97rem; font-weight: 600; color: var(--text); }
.role-company { font-size: 0.88rem; color: var(--text-light); margin-top: 2px; }
.role-period { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; padding-top: 2px; }
.background-summary { font-size: 0.95rem; color: var(--text-light); line-height: 1.75; }

/* ── Footer ─────────────────────────────────────────────── */
footer { max-width: var(--max-content); margin: 0 auto; padding: 36px var(--side-pad) 56px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer-copy { font-size: 0.82rem; color: var(--text-muted); }
.footer-links { display: flex; gap: 20px; }
.footer-links a { font-size: 0.82rem; color: var(--text-light); transition: color 0.15s; }
.footer-links a:hover { color: var(--text); }

/* ── Article Page ───────────────────────────────────────── */
.article-page { max-width: var(--max-content); margin: 0 auto; padding: 56px var(--side-pad) 80px; }
.article-back { display: inline-block; font-size: 0.85rem; color: var(--text-light); margin-bottom: 40px; transition: color 0.15s; }
.article-back:hover { color: var(--text); }
.article-header { margin-bottom: 40px; }
.article-tags { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.article-tag { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted); }
.article-header h1 { font-family: var(--serif); font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; margin-bottom: 16px; }
.article-date { font-size: 0.85rem; color: var(--text-muted); }

/* ── Prose ──────────────────────────────────────────────── */
.prose { font-size: 1rem; line-height: 1.8; color: var(--text); }
.prose h2 { font-family: var(--serif); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; margin: 44px 0 14px; }
.prose h3 { font-family: var(--serif); font-size: 1.2rem; font-weight: 700; margin: 32px 0 10px; }
.prose p { margin-bottom: 22px; }
.prose a { text-decoration: underline; text-underline-offset: 3px; }
.prose a:hover { opacity: 0.7; }
.prose strong { font-weight: 600; }
.prose em { font-style: italic; }
.prose blockquote { margin: 32px 0; padding: 20px 24px; border-left: 3px solid var(--text); background: #f9f9f9; font-style: italic; color: var(--text-light); }
.prose blockquote p { margin: 0; }
.prose ul, .prose ol { margin: 0 0 22px 24px; display: flex; flex-direction: column; gap: 6px; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-bottom: 24px; }
.prose th, .prose td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.prose th { font-weight: 600; border-bottom: 2px solid var(--border-dark); }
.prose hr { margin: 44px 0; border: none; border-top: 1px solid var(--border); }
.tweet-embed { margin: 28px 0; padding: 20px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.9rem; color: var(--text-light); }

/* ── Writing Archive ────────────────────────────────────── */
.archive-page { max-width: var(--max-content); margin: 0 auto; padding: 56px var(--side-pad) 80px; }
.archive-page h1 { font-family: var(--serif); font-size: 2.4rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 40px; }
.year-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; margin-top: 44px; }
.year-label:first-of-type { margin-top: 0; }
.post-list { list-style: none; }
.post-item { display: flex; justify-content: space-between; align-items: baseline; padding: 15px 0; border-bottom: 1px solid var(--border); gap: 16px; }
.post-item:first-child { border-top: 1px solid var(--border); }
.post-item-title { font-family: var(--serif); font-size: 1.05rem; font-weight: 700; letter-spacing: -0.01em; transition: opacity 0.15s; }
.post-item-title:hover { opacity: 0.6; }
.post-item-meta { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }

/* ── Topic Page ─────────────────────────────────────────── */
.topic-page { max-width: var(--max-content); margin: 0 auto; padding: 56px var(--side-pad) 80px; }
.topic-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.topic-page h1 { font-family: var(--serif); font-size: 2.4rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 12px; }
.topic-desc { font-size: 0.95rem; color: var(--text-light); margin-bottom: 36px; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 600px) {
  :root { --side-pad: 18px; }
  .hero { padding: 48px var(--side-pad) 40px; }
  .hero h1 { font-size: 2.1rem; }
  .masthead-nav { gap: 16px; }
  .content-section { padding: 40px var(--side-pad); }
  .post-item { flex-direction: column; gap: 2px; }
  .post-item-meta { white-space: normal; }
  footer { flex-direction: column; align-items: flex-start; }
}
