/* ============================================
   Klein Blue Bento — Personal Website
   Design System & Core Styles
   ============================================ */

:root {
  /* Klein Blue Palette */
  --klein: #002FA7;
  --klein-light: #1E4EC7;
  --klein-lighter: #3D6FE0;
  --klein-pale: #D0D8FF;
  --klein-bg: #EEF2FF;

  /* Neutrals */
  --text-primary: #0A0F1F;
  --text-secondary: #5A6080;
  --text-tertiary: #9CA0B8;
  --bg-primary: #F7F8FC;
  --bg-card: #FFFFFF;
  --border: #E8EAF0;

  /* Spacing */
  --space-xs: 8px;
  --space-sm: 12px;
  --space-md: 20px;
  --space-lg: 32px;
  --space-xl: 48px;
  --space-2xl: 64px;

  /* Radius */
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,47,167,0.06);
  --shadow-md: 0 4px 16px rgba(0,47,167,0.08);
  --shadow-lg: 0 8px 32px rgba(0,47,167,0.10);
  --shadow-xl: 0 16px 48px rgba(0,47,167,0.12);

  /* Glass */
  --glass-bg: rgba(255,255,255,0.72);
  --glass-border: rgba(255,255,255,0.4);
  --glass-blur: 20px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --font-serif: 'Cormorant Garamond', 'Georgia', serif;

  /* Typography — Sizes & Spacing */
  --font-size-body: 16px;
  --font-size-sm: 0.85rem;
  --font-size-xs: 0.78rem;
  --font-size-h1: clamp(2.5rem, 5vw, 4rem);
  --font-size-h2: clamp(1.75rem, 3vw, 2.5rem);
  --font-size-h3: clamp(1.25rem, 2vw, 1.75rem);
  --font-size-h4: 1.25rem;
  --line-height-body: 1.6;
  --line-height-heading: 1.2;
  --heading-weight: 700;
  --heading-spacing: -0.02em;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
}

/* Dark Mode */
[data-theme="dark"] {
  --text-primary: #EAECF2;
  --text-secondary: #A0A5C0;
  --text-tertiary: #6A6F88;
  --bg-primary: #0A0D1A;
  --bg-card: rgba(20,24,45,0.85);
  --border: #1E2240;
  --glass-bg: rgba(20,24,45,0.75);
  --glass-border: rgba(255,255,255,0.06);
  --klein-bg: #0E1228;
  --klein-pale: #1A2050;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-xl: 0 16px 48px rgba(0,0,0,0.45);
}

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

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

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-body);
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: var(--line-height-body);
  min-height: 100vh;
  transition: background var(--duration-normal) var(--ease-out),
              color var(--duration-normal) var(--ease-out);
}

a {
  color: var(--klein);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}
a:hover { color: var(--klein-light); }

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

/* ============================================
   Typography
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--heading-weight);
  line-height: var(--line-height-heading);
  letter-spacing: var(--heading-spacing);
}

h1 { font-size: var(--font-size-h1); }
h2 { font-size: var(--font-size-h2); }
h3 { font-size: var(--font-size-h3); }
h4 { font-size: var(--font-size-h4); }

.serif { font-family: var(--font-serif); }
.mono { font-family: var(--font-mono); }

.gradient-text {
  background: linear-gradient(135deg, var(--klein), var(--klein-lighter));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================
   Layout
   ============================================ */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

main {
  flex: 1;
  padding-top: 80px;
}

/* ============================================
   Navigation — Glass Morphism
   ============================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: var(--space-sm) 0;
  transition: all var(--duration-normal) var(--ease-out);
}

.nav.scrolled {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.nav-logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--klein);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.nav-logo .dot {
  width: 10px;
  height: 10px;
  background: var(--klein);
  border-radius: 50%;
  display: inline-block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  list-style: none;
}

.nav-links a {
  padding: 8px 16px;
  border-radius: 100px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--klein);
  background: var(--klein-bg);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.btn-theme {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--duration-fast) var(--ease-out);
  color: var(--text-primary);
}

.btn-theme:hover {
  border-color: var(--klein);
  color: var(--klein);
  box-shadow: var(--shadow-md);
}

.nav-mobile-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 8px;
}

.nav-mobile-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--duration-fast) var(--ease-out);
}

.nav-mobile-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.nav-mobile-toggle.active span:nth-child(2) {
  opacity: 0;
}
.nav-mobile-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ============================================
   Bento Grid System
   ============================================ */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(200px, auto);
  gap: var(--space-md);
}

.bento-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.bento-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--klein-pale);
  transform: translateY(-2px);
}

.bento-card.featured {
  border: 1.5px solid var(--klein-pale);
  background: linear-gradient(135deg, var(--bg-card), var(--klein-bg));
}

/* Bento size utilities */
.bento-col-2 { grid-column: span 2; }
.bento-col-3 { grid-column: span 3; }
.bento-col-4 { grid-column: span 4; }
.bento-row-2 { grid-row: span 2; }
.bento-row-3 { grid-row: span 3; }

/* ============================================
   Cards & Components
   ============================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: var(--space-lg);
  box-shadow: var(--shadow-sm);
  transition: all var(--duration-normal) var(--ease-out);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 12px 24px;
  border-radius: 100px;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-spring);
  font-family: var(--font-sans);
  text-decoration: none;
}

.btn-primary {
  background: var(--klein);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0,47,167,0.3);
}
.btn-primary:hover {
  background: var(--klein-light);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0,47,167,0.4);
  color: #fff;
}

.btn-success {
  background: #10b981;
  color: #fff;
  box-shadow: 0 4px 16px rgba(16,185,129,0.3);
}
.btn-success:hover {
  background: #059669;
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--klein);
  color: var(--klein);
}
.btn-outline:hover {
  background: var(--klein);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--klein-bg);
  color: var(--klein);
}

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-lg { padding: 16px 32px; font-size: 1.05rem; }

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--klein-bg);
  color: var(--klein);
  white-space: nowrap;
}

.tag-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.tag-clickable {
  cursor: pointer;
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out);
}

.tag-clickable:hover {
  background: var(--klein);
  color: #fff;
  transform: translateY(-1px);
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--klein);
  color: #fff;
}

/* Avatar */
.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg-card);
  box-shadow: var(--shadow-sm);
}
.avatar-lg { width: 120px; height: 120px; }
.avatar-sm { width: 40px; height: 40px; }

/* ============================================
   Blog Post Layout with Sidebar TOC
   ============================================ */
.post-layout {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: var(--space-xl);
  align-items: start;
  max-width: 960px;
  margin: 0 auto;
}

.post-sidebar {
  position: sticky;
  top: 100px;
}

.post-body {
  min-width: 0;
}

/* TOC Sidebar */
.toc-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
}

.toc-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 2px solid var(--border);
  padding-left: var(--space-md);
}

.toc-link {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 4px 0;
  line-height: 1.5;
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
  display: block;
}

.toc-link:hover {
  color: var(--klein);
}

.toc-link.toc-active {
  color: var(--klein);
  font-weight: 600;
}

.toc-level-2 {
  font-weight: 500;
}

.toc-level-3 {
  padding-left: var(--space-md);
  font-size: 0.8rem;
  font-weight: 400;
}

/* Post body headings */
.post-body-content h2 {
  font-size: 1.5rem;
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
  padding-top: var(--space-sm);
  scroll-margin-top: 100px;
}

.post-body-content h3 {
  font-size: 1.2rem;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
  scroll-margin-top: 100px;
}

.post-body-content p {
  margin-bottom: var(--space-md);
}

.post-body-content ul,
.post-body-content ol {
  margin-bottom: var(--space-md);
  padding-left: var(--space-lg);
}

.post-body-content li {
  margin-bottom: 6px;
}

.post-body-content code {
  background: var(--klein-bg);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--klein);
}

/* ============================================
   Divider
   ============================================ */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: var(--space-md) 0;
}

/* Section headers */
.section-header {
  margin-bottom: var(--space-xl);
  text-align: center;
  width: 100%;
  max-width: 1136px;
  min-height: 60px;
  margin-left: auto;
  margin-right: auto;
  font-size: 16px;
  line-height: 26px;
  letter-spacing: normal;
  color: var(--text-primary);
}

.section-header p {
  margin-left: auto;
  margin-right: auto;
  font-size: 16px;
  line-height: 26px;
  letter-spacing: normal;
  color: var(--text-secondary);
  max-width: 600px;
  min-height: 60px;
  text-align: center;
}

.section-header .label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--klein);
  margin-bottom: var(--space-xs);
  text-align: center;
}

.section-header h2 {
  margin-bottom: var(--space-sm);
  font-size: 40px;
  line-height: 48px;
  letter-spacing: -1px;
  text-align: center;
  color: var(--text-primary);
  padding: 0;
}

/* ============================================
   Hero Section
   ============================================ */
.hero {
  padding: var(--space-2xl) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-lg);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 16px;
  border-radius: 100px;
  background: var(--klein-bg);
  color: var(--klein);
  font-size: 0.85rem;
  font-weight: 600;
}

.hero-badge .pulse {
  width: 8px;
  height: 8px;
  background: #22C55E;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.hero h1 {
  max-width: 800px;
  line-height: 1.1;
}

.hero p {
  color: var(--text-secondary);
  font-size: 1.2rem;
  max-width: 560px;
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: center;
}

/* ============================================
   Project Card
   ============================================ */
.project-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: all var(--duration-normal) var(--ease-out);
}

.project-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.project-card .thumb {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  background: var(--klein-bg);
}

.project-card .meta {
  padding: var(--space-md);
}

.project-card .meta h3 {
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.project-card .meta p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.project-card .tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: var(--space-sm);
}

/* ============================================
   Blog Card
   ============================================ */
.blog-card {
  padding: var(--space-lg);
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  transition: all var(--duration-normal) var(--ease-out);
}

.blog-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--klein-pale);
}

.blog-card .date {
  font-size: 0.82rem;
  color: var(--text-tertiary);
  margin-bottom: var(--space-xs);
}

.blog-card h3 {
  font-size: 1.2rem;
  margin-bottom: var(--space-xs);
  line-height: 1.4;
}

.blog-card p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
}

/* ============================================
   Inspiration Log
   ============================================ */
.log-entry {
  padding: var(--space-lg);
  border-left: 2px solid var(--border);
  margin-left: var(--space-lg);
  position: relative;
  transition: border-color var(--duration-fast) var(--ease-out);
}

.log-entry:hover {
  border-left-color: var(--klein);
}

.log-entry::before {
  content: '';
  position: absolute;
  left: -6px;
  top: 28px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  transition: background var(--duration-fast) var(--ease-out);
}

.log-entry:hover::before {
  background: var(--klein);
}

.log-entry .log-date {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  margin-bottom: 4px;
}

.log-entry .log-mood {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.log-entry .log-text {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-primary);
}

/* ============================================
   Tool Link Card
   ============================================ */
.tool-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all var(--duration-fast) var(--ease-out);
}

.tool-card:hover {
  border-color: var(--klein-pale);
  box-shadow: var(--shadow-md);
}

.tool-card .tool-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--klein-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.tool-card .tool-info h4 {
  font-size: 1rem;
  margin-bottom: 2px;
}

.tool-card .tool-info p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.tool-card .tool-info .tool-url {
  font-size: 0.78rem;
  color: var(--klein);
  font-family: var(--font-mono);
  margin-top: 4px;
}

/* ============================================
   Download Card
   ============================================ */
.download-card {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: all var(--duration-fast) var(--ease-out);
}

.download-card:hover {
  border-color: var(--klein-pale);
  box-shadow: var(--shadow-md);
}

.download-card .file-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  background: var(--klein-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.download-card .file-info { flex: 1; }
.download-card .file-info h4 { font-size: 0.95rem; margin-bottom: 2px; }
.download-card .file-info p { font-size: 0.82rem; color: var(--text-secondary); }

/* ============================================
   Contact Form
   ============================================ */
.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: all var(--duration-fast) var(--ease-out);
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--klein);
  box-shadow: 0 0 0 3px var(--klein-bg);
}

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

/* ============================================
   Footer
   ============================================ */
.footer {
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--border);
  margin-top: var(--space-2xl);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.footer-inner > p {
  order: 1;
}

.footer-links {
  order: 2;
}

.footer-social {
  order: 3;
}

.footer p {
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  gap: var(--space-md);
}

.footer-links a {
  color: var(--text-tertiary);
  font-size: 0.85rem;
}
.footer-links a:hover { color: var(--klein); }

.footer-social {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-tertiary);
  font-size: 1rem;
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
}

.footer-social a:hover {
  color: var(--klein);
  border-color: var(--klein-pale);
  background: var(--klein-bg);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* SVG social icons */
.icon-svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.animate-in {
  animation: fadeInUp var(--duration-slow) var(--ease-out) forwards;
  opacity: 0;
}

.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }
.animate-delay-5 { animation-delay: 0.5s; }

/* Page transition */
.page {
  display: none;
  animation: fadeIn var(--duration-normal) var(--ease-out);
}

.page.active {
  display: block;
}

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ============================================
   Utilities
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  .nav-links a {
    padding: 6px 12px;
    font-size: 0.82rem;
  }
}

@media (max-width: 768px) {
  .bento-grid {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }
  .bento-col-2, .bento-col-3, .bento-col-4 {
    grid-column: span 1;
  }
  .bento-row-2, .bento-row-3 {
    grid-row: span 1;
  }
  .grid-2, .grid-3 {
    grid-template-columns: 1fr;
  }
  .nav-mobile-toggle {
    display: flex;
  }
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--bg-card);
    flex-direction: column;
    padding: 80px var(--space-lg) var(--space-lg);
    gap: var(--space-xs);
    box-shadow: var(--shadow-xl);
    transition: right var(--duration-normal) var(--ease-out);
    border-left: 1px solid var(--border);
    overflow-y: auto;
  }
  .nav-links.open {
    right: 0;
  }
  .nav-links a {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
  }
  .hero {
    padding: var(--space-xl) 0;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
  .footer-inner > p { order: 1; }
  .footer-links { order: 2; }
  .footer-social { order: 3; }
  .container {
    padding: 0 var(--space-md);
  }
  main {
    padding-top: 70px;
  }
  .log-entry {
    margin-left: var(--space-md);
  }

  /* Post layout: sidebar on top */
  .post-layout {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  .post-sidebar {
    position: static;
    order: 1;
  }
  .post-body {
    order: -1;
  }
  .toc-nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-xs);
    border-left: none;
    padding-left: 0;
  }
  .toc-link {
    padding: 4px 10px;
    background: var(--klein-bg);
    border-radius: 100px;
    font-size: 0.78rem;
  }
  .toc-link.toc-active {
    background: var(--klein);
    color: #fff;
  }
  .toc-level-3 {
    padding-left: 10px;
  }
}

/* ============================================
   Tags Page
   ============================================ */
.tags-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: var(--space-lg);
  max-width: 960px;
  margin: 0 auto;
}

.tag-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--duration-fast) var(--ease-out);
}

.tag-card:hover {
  border-color: var(--klein-pale);
  box-shadow: var(--shadow-sm);
}

.tag-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.tag-lg {
  font-size: 0.9rem;
  padding: 6px 16px;
}

.tag-count {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-left: auto;
}

.tag-post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tag-post-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.88rem;
  transition: all var(--duration-fast) var(--ease-out);
}

.tag-post-link:hover {
  background: var(--klein-bg);
  color: var(--klein);
}

.tag-post-title {
  font-weight: 500;
}

.tag-post-date {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  margin-left: var(--space-md);
}

@media (max-width: 768px) {
  .tags-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
}

/* ============================================
   Print Styles
   ============================================ */
/* ============================================
   Floating Social Sidebar
   ============================================ */

.social-float {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  animation: socialFloatIn 0.6s var(--ease-spring) 0.3s both;
}

@keyframes socialFloatIn {
  from {
    opacity: 0;
    transform: translateY(-50%) translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
}

/* Toggle Button */
.social-float-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: var(--shadow-md);
}

.social-float-toggle:hover {
  color: var(--klein);
  border-color: var(--klein-light);
  background: var(--klein-bg);
  box-shadow: var(--shadow-lg);
  transform: scale(1.08);
}

.social-float.open .social-float-toggle {
  transform: rotate(45deg);
  color: var(--klein);
  border-color: var(--klein-light);
  background: var(--klein-bg);
}

/* Social Links Container */
.social-float-list {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.4s var(--ease-out);
}

.social-float.open .social-float-list {
  max-height: 300px;
  opacity: 1;
}

/* Individual Social Link */
.social-float-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  color: var(--text-secondary);
  text-decoration: none;
  transition: all var(--duration-normal) var(--ease-out);
  box-shadow: var(--shadow-sm);
  animation: socialLinkIn 0.4s var(--ease-spring) both;
}

.social-float-link:nth-child(1) { animation-delay: 0.05s; }
.social-float-link:nth-child(2) { animation-delay: 0.10s; }
.social-float-link:nth-child(3) { animation-delay: 0.15s; }
.social-float-link:nth-child(4) { animation-delay: 0.20s; }
.social-float-link:nth-child(5) { animation-delay: 0.25s; }

@keyframes socialLinkIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.social-float-link:hover {
  color: var(--klein);
  border-color: var(--klein-pale);
  background: var(--klein-bg);
  transform: translateX(-4px) scale(1.08);
  box-shadow: var(--shadow-lg);
}

/* Tooltip */
.social-float-link::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 56px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-primary);
  color: var(--bg-primary);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  font-family: var(--font-sans);
}

.social-float-link::before {
  content: '';
  position: absolute;
  right: 48px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 5px solid var(--text-primary);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.social-float-link:hover::after,
.social-float-link:hover::before {
  opacity: 1;
}

/* SVG icon inside links */
.social-float-link .icon-svg {
  width: 20px;
  height: 20px;
}

@media (max-width: 768px) {
  .social-float {
    display: none;
  }
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
  .nav, .footer, .btn-theme { display: none; }
  body { background: #fff; color: #000; }
}

/* ============================================
   Search Overlay
   ============================================ */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(10, 15, 31, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 160px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-normal) var(--ease-out);
}

.search-overlay.open {
  opacity: 1;
  visibility: visible;
}

.search-dialog {
  width: 100%;
  max-width: 600px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  transform: translateY(-8px);
  transition: transform var(--duration-normal) var(--ease-out);
}

.search-overlay.open .search-dialog {
  transform: translateY(0);
}

.search-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  color: var(--text-tertiary);
}

.search-header svg {
  flex-shrink: 0;
  color: var(--text-tertiary);
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 1.1rem;
  font-family: var(--font-sans);
  color: var(--text-primary);
  outline: none;
  padding: 4px 0;
}

.search-input::placeholder {
  color: var(--text-tertiary);
}

.search-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: all var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}

.search-close:hover {
  background: var(--klein-bg);
  color: var(--klein);
}

.search-hint {
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.92rem;
}

.search-results {
  max-height: 360px;
  overflow-y: auto;
  padding: var(--space-sm);
}

.search-results::-webkit-scrollbar {
  width: 4px;
}

.search-results::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: 12px 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
  color: inherit;
}

.search-result-item:hover {
  background: var(--klein-bg);
}

.search-result-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--klein-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  color: var(--klein);
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-meta {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.search-result-tag {
  font-size: 0.72rem;
  padding: 3px 10px;
  border-radius: 100px;
  background: var(--klein-bg);
  color: var(--klein);
  white-space: nowrap;
  font-weight: 600;
  flex-shrink: 0;
}

.search-empty {
  padding: var(--space-xl);
  text-align: center;
  color: var(--text-tertiary);
  font-size: 0.92rem;
}

.search-highlight {
  color: var(--klein);
  font-weight: 700;
}

@media (max-width: 768px) {
  .search-overlay {
    padding: 100px var(--space-md) 0;
  }
  .search-dialog {
    max-width: 100%;
  }
}
