/* ============================================================
   YEGAPPAN'S PORTFOLIO — Main Stylesheet
   Aesthetic: Refined editorial / technical journal
   Fonts: Fraunces (display) + IBM Plex Mono (code) + Lora (body)
   ============================================================ */

/* ── Google Fonts ──────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,500;0,9..144,700;1,9..144,400&family=Lora:ital,wght@0,400;0,500;1,400&family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

/* ── Custom Properties ─────────────────────────────────────── */
:root {
  /* Colors - Light Mode */
  --bg: #F7F4EF;
  --bg-alt: #F0EDE7;
  --bg-card: #FDFAF7;
  --surface: #FFFFFF;
  --border: #E2DEDA;
  --border-strong: #C5BFB8;

  --text: #1C1917;
  --text-2: #44403C;
  --text-3: #78716C;
  --text-4: #A8A29E;

  --accent: #C2410C;        /* Burned orange — primary accent */
  --accent-light: #FED7AA;  /* Peach tint */
  --accent-bg: #FFF7ED;     /* Very light orange */

  --link: #B45309;
  --link-hover: #C2410C;

  --green: #166534;
  --green-bg: #DCFCE7;
  --red: #991B1B;
  --red-bg: #FEE2E2;

  --code-bg: #F5F0EB;
  --code-text: #7C3AED;

  /* Typography */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Lora', Georgia, serif;
  --font-ui: 'IBM Plex Sans', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;

  /* Layout */
  --content-width: 720px;
  --wide-width: 1200px;
  --prose-width: 680px;

  /* Transitions */
  --transition: 180ms ease;
  --transition-slow: 320ms ease;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(28,25,23,0.06);
  --shadow-md: 0 4px 12px rgba(28,25,23,0.08);
  --shadow-lg: 0 8px 24px rgba(28,25,23,0.10);
  --shadow-xl: 0 16px 40px rgba(28,25,23,0.12);
}

/* Dark mode */
[data-theme="dark"] {
  --bg: #131110;
  --bg-alt: #1C1917;
  --bg-card: #1F1C1A;
  --surface: #292524;
  --border: #3C3532;
  --border-strong: #57534E;

  --text: #F7F4EF;
  --text-2: #D6D3D1;
  --text-3: #A8A29E;
  --text-4: #78716C;

  --accent: #FB923C;
  --accent-light: #431407;
  --accent-bg: #1C1410;

  --link: #FDBA74;
  --link-hover: #FB923C;

  --green: #4ADE80;
  --green-bg: #14532D;
  --red: #F87171;
  --red-bg: #450A0A;

  --code-bg: #1C1917;
  --code-text: #C084FC;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-xl: 0 16px 40px rgba(0,0,0,0.6);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color var(--transition); }
a:hover { color: var(--link-hover); }
button { font-family: var(--font-ui); cursor: pointer; }
input, textarea, select { font-family: var(--font-ui); }

/* ── Typography ────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.2;
  color: var(--text);
  letter-spacing: -0.02em;
}

h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); }
h3 { font-size: clamp(1.25rem, 2.5vw, 1.75rem); }
h4 { font-size: 1.25rem; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

strong { font-weight: 600; }
em { font-style: italic; }

code, kbd {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.125em 0.375em;
  border-radius: 3px;
  border: 1px solid var(--border);
}

pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: var(--space-6);
  overflow-x: auto;
  line-height: 1.6;
  margin: var(--space-6) 0;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-2);
  font-size: inherit;
}

blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-6);
  margin: var(--space-6) 0;
  color: var(--text-2);
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-8) 0;
}

ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }
li { margin-bottom: 0.25rem; }

table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  margin: var(--space-6) 0;
}
th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: 2px solid var(--border-strong);
  font-weight: 600;
  color: var(--text-2);
}
td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}
tr:last-child td { border-bottom: none; }

/* ── Layout Containers ─────────────────────────────────────── */
.container {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container--narrow {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.container--prose {
  max-width: var(--prose-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* ── Navigation ────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background var(--transition-slow);
}

[data-theme="dark"] .nav { background: rgba(19, 17, 16, 0.92); }

.nav__inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav__logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.03em;
}

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

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav__links a {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: color var(--transition);
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

.nav__links a:hover,
.nav__links a.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}

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

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* Mobile menu */
.nav__hamburger {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 36px;
  height: 36px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: var(--text-2);
}

.nav__hamburger span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: currentColor;
  transition: transform var(--transition);
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.625rem 1.25rem;
  border-radius: 6px;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  cursor: pointer;
  line-height: 1;
}

.btn--primary {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}
.btn--primary:hover {
  background: #A53D0A;
  border-color: #A53D0A;
  color: #FFFFFF;
}

.btn--outline {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border-strong);
}
.btn--outline:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.btn--ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn--ghost:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.btn--sm {
  font-size: 0.8125rem;
  padding: 0.4375rem 0.875rem;
}

.btn--lg {
  font-size: 1rem;
  padding: 0.875rem 1.75rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Tags / Chips ──────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 0.2em 0.6em;
  border-radius: 4px;
  background: var(--bg-alt);
  color: var(--text-3);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: all var(--transition);
  letter-spacing: 0.01em;
}

.tag:hover {
  background: var(--accent-bg);
  color: var(--accent);
  border-color: var(--accent-light);
}

.tags { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.card__body { padding: var(--space-6); }
.card__footer { padding: var(--space-4) var(--space-6); border-top: 1px solid var(--border); }

/* ── Form Elements ─────────────────────────────────────────── */
.form-group { margin-bottom: var(--space-6); }

.form-label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: var(--space-2);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(194, 65, 12, 0.12);
}

.form-textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.6;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-4);
}

/* ── Hero Section ──────────────────────────────────────────── */
.hero {
  padding: var(--space-24) 0 var(--space-16);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -100px;
  right: -100px;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(194, 65, 12, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

.hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.hero__eyebrow::before {
  content: '';
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--accent);
}

.hero__title {
  font-size: clamp(2.25rem, 6vw, 4rem);
  font-weight: 300;
  line-height: 1.1;
  margin-bottom: var(--space-6);
  letter-spacing: -0.03em;
}

.hero__title em {
  font-style: italic;
  color: var(--accent);
}

.hero__subtitle {
  font-size: 1.125rem;
  color: var(--text-2);
  max-width: 560px;
  margin-bottom: var(--space-8);
  line-height: 1.7;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-12);
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--text-3);
}

.hero__meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.hero__layout {
  display: flex;
  align-items: center;
  gap: var(--space-16);
}

.hero__content {
  flex: 1 1 0;
  min-width: 0;
}

.hero__photo-wrap {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
}

.hero__photo-frame {
  width: auto;
  height: auto;
  border-radius: 24px;
  overflow: hidden;
  border: 4px solid var(--border);
  box-shadow: var(--shadow-xl);
  position: relative;
}

.hero__photo-frame::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px;
  box-shadow: inset 0 0 0 2px rgba(194,65,12,0.15);
}

.hero__photo {
  width: auto;
  height: auto;
  max-height: 420px;
  max-width: 320px;
  display: block;
}

@media (max-width: 768px) {
  .hero__layout {
    flex-direction: column-reverse;
    gap: var(--space-8);
  }
  .hero__photo-wrap {
    flex: none;
  }
  .hero__photo-frame {
    width: 160px;
    height: 160px;
  }
}

/* ── Sections ──────────────────────────────────────────────── */
.section { padding: var(--space-16) 0; }
.section--alt { background: var(--bg-alt); }

.section__header {
  margin-bottom: var(--space-12);
}

.section__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-3);
}

.section__title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.02em;
}

/* ── Blog Post Card ────────────────────────────────────────── */
.post-card {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-8) 0;
  border-bottom: 1px solid var(--border);
}

.post-card:first-child { padding-top: 0; }
.post-card:last-child { border-bottom: none; }

.post-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--text-3);
}

.post-card__category {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-decoration: none;
}

.post-card__category:hover { color: var(--link-hover); }

.post-card__title {
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.post-card__title a {
  color: var(--text);
  text-decoration: none;
  transition: color var(--transition);
}

.post-card__title a:hover { color: var(--accent); }

.post-card__excerpt {
  font-size: 0.9375rem;
  color: var(--text-2);
  line-height: 1.65;
}

.post-card--featured {
  background: var(--accent-bg);
  border: 1px solid var(--accent-light);
  border-radius: 10px;
  padding: var(--space-8);
}

/* ── Post List Grid ────────────────────────────────────────── */
.posts-grid {
  display: grid;
  gap: var(--space-6);
}

.posts-grid--2col {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

/* ── Skills Grid ───────────────────────────────────────────── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
}

.skill-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--text-2);
  text-align: center;
  transition: all var(--transition);
}

.skill-item:hover {
  border-color: var(--accent);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.skill-item__icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.375rem;
  color: var(--accent);
  transition: color var(--transition);
}

.skill-item:hover .skill-item__icon {
  color: var(--accent);
}

/* ── Project Cards ─────────────────────────────────────────── */
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: var(--space-8);
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.project-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.project-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.project-card__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
}

.project-card__desc {
  font-size: 0.9375rem;
  color: var(--text-2);
  line-height: 1.65;
}

.project-card__links {
  display: flex;
  gap: var(--space-3);
  margin-top: auto;
}

/* ── Timeline ──────────────────────────────────────────────── */
.timeline {
  position: relative;
  padding-left: var(--space-8);
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.5rem;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: var(--space-8);
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-8) - 4px);
  top: 0.5rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
}

.timeline-item__date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-3);
  letter-spacing: 0.04em;
  margin-bottom: var(--space-1);
}

.timeline-item__role {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 500;
  margin-bottom: var(--space-1);
}

.timeline-item__company {
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  color: var(--accent);
  margin-bottom: var(--space-3);
}

.timeline-item__desc {
  font-size: 0.9375rem;
  color: var(--text-2);
  line-height: 1.65;
}

/* ── Blog Post Page ────────────────────────────────────────── */
.post-hero {
  padding: var(--space-16) 0 var(--space-8);
  border-bottom: 1px solid var(--border);
}

.post-hero__category {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  display: inline-block;
  margin-bottom: var(--space-4);
}

.post-hero__title {
  font-size: clamp(1.75rem, 4.5vw, 3rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin-bottom: var(--space-6);
}

.post-hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--text-3);
  margin-bottom: var(--space-6);
}

.post-hero__cover {
  margin-top: var(--space-8);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.post-hero__cover img {
  width: 100%;
  height: 400px;
  object-fit: cover;
}

/* Post layout: sidebar + content */
.post-layout {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: var(--space-12);
  padding: var(--space-12) 0;
  max-width: 980px;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .post-layout { grid-template-columns: 1fr; }
  .post-toc-sidebar { display: none; }
}

/* Table of Contents */
.post-toc {
  position: sticky;
  top: 80px;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
}

.post-toc__title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: var(--space-4);
}

.post-toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.post-toc__link {
  color: var(--text-3);
  text-decoration: none;
  display: block;
  padding: 0.25rem 0.5rem;
  border-left: 2px solid transparent;
  transition: all var(--transition);
  line-height: 1.4;
}

.post-toc__link:hover,
.post-toc__link.active {
  color: var(--text);
  border-left-color: var(--accent);
}

.post-toc__link--h3 { padding-left: 1.25rem; font-size: 0.75rem; }

/* Prose content */
.prose { font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.8; }

.prose h1 { font-size: 1.875rem; margin: 2rem 0 0.75rem; }
.prose h2 { font-size: 1.5rem; margin: 2.25rem 0 0.75rem; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.prose h3 { font-size: 1.25rem; margin: 1.75rem 0 0.5rem; }
.prose h4 { font-size: 1.125rem; margin: 1.5rem 0 0.5rem; }

.prose h2 .anchor-link,
.prose h3 .anchor-link {
  opacity: 0;
  margin-left: 0.5rem;
  font-size: 0.75em;
  text-decoration: none;
  color: var(--text-4);
  transition: opacity var(--transition);
}

.prose h2:hover .anchor-link,
.prose h3:hover .anchor-link { opacity: 1; }

.prose p { margin: 0 0 1.2rem; }
.prose ul, .prose ol { margin: 0.75rem 0 1.2rem 1.75rem; }
.prose li { margin-bottom: 0.4rem; }
.prose img { border-radius: 8px; margin: 1.5rem 0; border: 1px solid var(--border); }
.prose a { color: var(--link); }
.prose a:hover { color: var(--link-hover); }

/* Post nav */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  padding: var(--space-8) 0;
  border-top: 1px solid var(--border);
  font-family: var(--font-ui);
}

.post-nav__item {
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-2);
  transition: all var(--transition);
}

.post-nav__item:hover {
  border-color: var(--accent);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.post-nav__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-4);
  margin-bottom: var(--space-2);
}

.post-nav__title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

.post-nav__item--next { text-align: right; }

/* Share buttons */
.post-share {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) 0;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: var(--text-3);
  flex-wrap: wrap;
}

/* AI Overview */
.ai-overview {
  margin: var(--space-8) 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--space-6);
  background: var(--bg-alt);
}

.ai-overview__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: var(--space-2);
}

.ai-overview__desc {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--text-3);
  margin-bottom: var(--space-5);
  line-height: 1.5;
}

.ai-overview__btns {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.ai-overview__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-2);
  background: var(--bg);
  border: 1px solid var(--border);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
}

.ai-overview__btn:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--accent-bg);
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: all var(--transition);
  box-shadow: var(--shadow-md);
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Footer ────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: var(--space-12) 0;
  font-family: var(--font-ui);
}

.footer__inner {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 var(--space-6);
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-12);
}

.footer__brand {}
.footer__logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.03em;
  margin-bottom: var(--space-3);
  display: block;
}

.footer__tagline {
  font-size: 0.875rem;
  color: var(--text-3);
  margin-bottom: var(--space-4);
}

.footer__social {
  display: flex;
  gap: var(--space-3);
}

.footer__social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-3);
  text-decoration: none;
  transition: all var(--transition);
}

.footer__social a:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-alt);
}

.footer__col-title {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: var(--space-4);
}

.footer__links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.footer__links a {
  font-size: 0.875rem;
  color: var(--text-2);
  text-decoration: none;
  transition: color var(--transition);
}

.footer__links a:hover { color: var(--text); }

.footer__bottom {
  max-width: var(--wide-width);
  margin: var(--space-8) auto 0;
  padding: var(--space-6) var(--space-6) 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text-4);
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* ── Pagination ────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-8) 0;
  font-family: var(--font-ui);
  font-size: 0.875rem;
}

.pagination__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-2);
  text-decoration: none;
  transition: all var(--transition);
  cursor: pointer;
}

.pagination__btn:hover,
.pagination__btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pagination__btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ── Search Bar ────────────────────────────────────────────── */
.search-bar {
  position: relative;
}

.search-bar__input {
  padding-left: 2.75rem;
}

.search-bar__icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-4);
  pointer-events: none;
}

/* ── Alert / Notification ──────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-radius: 8px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
  margin-bottom: var(--space-4);
}

.alert--success { background: var(--green-bg); color: var(--green); }
.alert--error { background: var(--red-bg); color: var(--red); }

/* ── Loading Spinner ───────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-placeholder {
  display: grid;
  gap: var(--space-4);
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-alt) 25%, var(--border) 50%, var(--bg-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Utility ───────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }
.gap-4 { gap: var(--space-4); }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid { display: grid; }
.hidden { display: none !important; }
.text-accent { color: var(--accent); }
.text-muted { color: var(--text-3); font-family: var(--font-ui); font-size: 0.875rem; }

/* ── Reading Progress ──────────────────────────────────────── */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: var(--accent);
  z-index: 200;
  transition: width 0.1s;
}

/* ── Responsive ────────────────────────────────────────────── */

/* Tablet — 900px */
@media (max-width: 900px) {
  .hero__layout {
    flex-direction: column-reverse;
    gap: var(--space-8);
    text-align: left;
  }
  .hero__photo-wrap { flex: none; }
  .hero__photo { max-height: 300px; max-width: 240px; }
  .skills-grid { grid-template-columns: repeat(3, 1fr); }
  .posts-grid--2col { grid-template-columns: 1fr; }
}

/* Mobile — 768px */
@media (max-width: 768px) {
  .nav__links { display: none; }
  .nav__hamburger { display: flex; }
  .nav__links.open {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: var(--space-6);
    gap: var(--space-4);
    box-shadow: var(--shadow-md);
    z-index: 99;
  }

  .footer__inner { grid-template-columns: 1fr; gap: var(--space-8); }
  .post-nav { grid-template-columns: 1fr; }
  .hero { padding: var(--space-12) 0 var(--space-8); }
  .section { padding: var(--space-12) 0; }
  .hero__layout { gap: var(--space-6); }
  .hero__photo { max-height: 220px; max-width: 180px; }
  .post-content { font-size: 1rem; }
  .post-toc-sidebar { display: none; }
  .post-layout { grid-template-columns: 1fr; }
}

/* Small mobile — 480px */
@media (max-width: 480px) {
  .container, .container--narrow, .container--prose { padding: 0 var(--space-4); }
  h1 { font-size: 2rem; }
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .hero__actions { flex-direction: column; align-items: flex-start; }
  .hero__actions .btn { width: 100%; text-align: center; justify-content: center; }
  .section__header { margin-bottom: var(--space-8); }
}

/* ── Fade-in animation ─────────────────────────────────────── */
.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: none;
}
