/* ================================================================
   PERSONAL WEBSITE — style.css
   Inspired by pradyunsg.me — minimalist, clean, light/dark mode
   ================================================================ */

/* ───────────── CSS Custom Properties ───────────── */
:root {
  --bg: #f7f7f9;
  --bg-header: rgba(247, 247, 249, 0.88);
  --surface: #ffffff;
  --text: #1f1f23;
  --text-muted: #7a7a85;
  --text-link: #1f1f23;
  --border: #e2e2ea;
  --accent: #4a4aff;
  --card-bg: #ffffff;
  --card-border: #e2e2ea;
  --card-hover-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 8px;
  --max-width: 740px;
  --header-h: 64px;

  --transition-fast: 150ms ease;
  --transition-med: 250ms ease;
}

[data-theme="dark"] {
  --bg: #18181b;
  --bg-header: rgba(24, 24, 27, 0.90);
  --surface: #27272a;
  --text: #e4e4e7;
  --text-muted: #71717a;
  --text-link: #e4e4e7;
  --border: #3f3f46;
  --accent: #818cf8;
  --card-bg: #232326;
  --card-border: #3f3f46;
  --card-hover-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

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

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

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  background-color: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color var(--transition-med), color var(--transition-med);
}

a {
  color: var(--text-link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: opacity var(--transition-fast);
}

a:hover {
  opacity: 0.7;
}

/* ───────────── Header ───────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background-color: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition-med), border-color var(--transition-med);
}

.header-inner {
  max-width: calc(var(--max-width) + 80px);
  margin: 0 auto;
  padding: 0 40px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-brand {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
  transition: opacity var(--transition-fast);
}

.site-brand:hover {
  opacity: 0.7;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.site-nav {
  display: flex;
  gap: 20px;
}

.nav-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  opacity: 1;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--text);
  border-radius: 2px;
}

/* ───────────── Theme Toggle ───────────── */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  font-size: 1.1rem;
  line-height: 1;
}

.theme-toggle:hover {
  background-color: var(--border);
  color: var(--text);
}

/* ───────────── Main Content ───────────── */
.main-content {
  flex: 1;
  max-width: calc(var(--max-width) + 80px);
  margin: 0 auto;
  padding: 72px 40px 80px;
  width: 100%;
}

/* ───────────── Hero ───────────── */
.hero {
  max-width: var(--max-width);
}

.hero-title {
  font-size: clamp(2rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 18px;
}

.name-highlight {
  color: var(--text);
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 36px;
  max-width: 580px;
}

.hero-subtitle a {
  color: var(--text);
  font-weight: 500;
}

/* ───────────── Social Links ───────────── */
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.social-link:hover {
  background-color: var(--border);
  color: var(--text);
  opacity: 1;
}

/* ───────────── Page (About / Blog) ───────────── */
.page-content {
  max-width: var(--max-width);
}

.page-header {
  margin-bottom: 40px;
}

.page-header h1 {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}

.page-meta {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ───────────── Prose ───────────── */
.prose p {
  margin-bottom: 18px;
  color: var(--text);
}

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

/* ───────────── Section Divider ───────────── */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 48px 0;
}

/* ───────────── Section Headings ───────────── */
section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

section>p {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 0.95rem;
}

/* ───────────── Timeline ───────────── */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

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

.timeline-date {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  padding-top: 4px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.timeline-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timeline-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.timeline-role {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: 6px;
}

.timeline-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ───────────── Blog List ───────────── */
.blog-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 16px;
}

.blog-card {
  display: block;
  text-decoration: none;
  padding: 28px 28px;
  margin: 0 -28px;
  border-radius: var(--radius);
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition-fast);
  color: inherit;
}

.blog-card:last-child {
  border-bottom: none;
}

.blog-card:hover {
  background-color: var(--card-bg);
  opacity: 1;
  box-shadow: var(--card-hover-shadow);
}

.blog-card-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.blog-card-excerpt {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;

  /* Clamp to 3 lines */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.blog-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ───────────── Footer ───────────── */
.site-footer {
  text-align: center;
  padding: 32px 20px;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  transition: border-color var(--transition-med);
}

/* ───────────── Responsive ───────────── */
@media (max-width: 640px) {
  .header-inner {
    padding: 0 20px;
  }

  .main-content {
    padding: 48px 20px 64px;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .blog-card {
    margin: 0 -16px;
    padding: 20px 16px;
  }

  .hero-title {
    font-size: 1.8rem;
  }
}

/* ───────────── Blog Empty State ───────────── */
.blog-empty {
  margin-top: 32px;
  padding: 48px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ───────────── Fade-in animation ───────────── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

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

.hero,
.page-content {
  animation: fadeUp 0.4s ease both;
}