/* 
 * High Agency / Safety Researcher Theme
 * Aesthetic: Technical, Minimal, Precision, Dark Mode
 */

:root {
  /* Core Palette - Deep, Technical Dark Mode */
  --bg-color: #050505;
  --bg-secondary: #0a0a0a;
  --bg-tertiary: #111111;
  
  --text-primary: #ededed;
  --text-secondary: #a1a1aa;
  --text-muted: #52525b;
  
  --accent-color: #3cc894; /* Existing branding */
  --accent-dim: rgba(60, 200, 148, 0.1);
  --accent-hover: #4cd9a4;
  
  --border-color: #27272a;
  --border-light: #3f3f46;
  
  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-ocr: 'Space Mono', monospace; /* Technical/OCR style for header */

  /* FONT OPTIONS - Uncomment the one you want:
   * --font-serif: 'Source Serif 4', Georgia, serif;  ← LIKED THIS ONE! Clean, newspaper vibe
   * --font-serif: 'Literata', Georgia, serif;        ← Warm, ebook reader feel
   * --font-serif: 'Crimson Pro', Georgia, serif;     ← Classic literary
   * --font-serif: 'Spectral', Georgia, serif;        ← Luxury editorial
   * --font-serif: 'EB Garamond', Georgia, serif;     ← Old-world book
   */
  --font-serif: 'Source Serif 4', Georgia, serif;
  
  /* Spacing & Layout */
  --max-width: 1100px; /* Wider for dashboard feel */
  --header-height: 70px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* ===== GLOBAL RESETS & BASE ===== */

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  position: relative;
}

/* BACKGROUND TEXTURE COMBO: NOISE + GRID */

/* Layer 1: The Noise (Paper feel) */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Layer 2: The Grid (Technical feel) */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.04; /* Low opacity for subtle lines */
  background-size: 40px 40px;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.4) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.4) 1px, transparent 1px);
}

/* Remove default Cactus max-width constraint for a more modern layout */
body.max-width {
  max-width: 100%;
  padding: 0;
  margin: 0;
}

.content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1.5rem 2rem 1.5rem; /* Reduced top padding */
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

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

/* Typography Overrides */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; line-height: 1.2; }
h2 { font-size: 1.75rem; border-bottom: none; }
h3 { font-size: 1.25rem; }

p {
  color: var(--text-secondary);
  font-size: 1.05rem;
  margin-bottom: 1.5rem;
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ===== HEADER & NAV ===== */

#header {
  height: var(--header-height);
  width: 100%;
  max-width: 100%; /* Override theme limit */
  display: flex;
  align-items: center;
  justify-content: center; /* Center content in wrapper */
  border-bottom: 1px solid var(--border-color);
  background: rgba(5, 5, 5, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 1.5rem;
}

/* Create a wrapper for header content to match site width */
#header-inner {
  width: 100%;
  max-width: var(--max-width);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#logo {
  font-family: var(--font-ocr);
  font-weight: 400;
  font-size: 1rem;
  color: #fff;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  text-decoration: none;
  padding: 0.9rem 0;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

#nav ul {
  display: flex;
  list-style: none;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

#nav li {
  margin: 0;
}

#nav a {
  font-family: var(--font-ocr);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.5rem 0;
  position: relative;
}

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

#nav a:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0%;
  height: 1px;
  background: var(--accent-color);
  transition: width 0.2s ease;
}

#nav a:hover:after {
  width: 100%;
}

/* Hide mobile icon on desktop */
#nav .icon { display: none; }

/* Mobile Navigation Base */
#nav {
  position: relative;
}

/* ===== HERO SECTION ===== */

.hero {
  padding: 0.5rem 0 1.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  position: relative;
}

.hero-content {
  max-width: 100%; /* Allow full width for animation text */
}

.hero-label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-color);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.5rem;
  display: block;
}

.hero-title {
  font-size: 3.5rem;
  line-height: 1.1;
  margin: 0 0 1.5rem 0;
  /* More raw, less gradient */
  color: var(--text-primary);
  letter-spacing: -0.03em;
  min-height: 1.1em; /* Prevent layout shift during typing */
  white-space: nowrap; /* Keep text on single line */
}

/* Typewriter Animation Styles */
.refusal-text {
  color: #a1a1aa; /* Muted gray for AI refusal */
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.8em; /* Slightly smaller for refusal */
}

.real-text {
  color: var(--text-primary); /* Bright white for real text */
}

.cursor {
  display: inline-block;
  width: 10px;
  height: 1em;
  background-color: transparent;
  border-bottom: 3px solid var(--accent-color);
  animation: blink 1s step-end infinite;
  margin-left: 2px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.hero-desc {
  font-family: var(--font-ocr);
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 650px;
  line-height: 1.7;
}

.hero-actions {
  margin-top: 2rem;
  display: flex;
  gap: 1rem;
}

 .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.25s ease;
  cursor: pointer;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent-color);
  color: #000000 !important;
  font-weight: 600;
  border-color: transparent;
  box-shadow: 0 0 0 rgba(0,0,0,0);
}

.btn-primary:hover {
  background: var(--accent-hover);
  background-image: none !important;
  color: #000000 !important; /* Keep text black on hover */
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(60, 200, 148, 0.35);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

.btn-secondary:hover {
  border-color: var(--border-light);
  background: rgba(255, 255, 255, 0.05);
  background-image: none !important; /* Override theme's pink underline */
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45);
}

/* ===== BENTO GRID / DASHBOARD LAYOUT ===== */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.section-title {
  font-family: var(--font-mono);
  text-transform: uppercase;
  font-size: 1rem;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0;
}

.view-all {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-color);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-bottom: 4rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
}

/* SPOTLIGHT CARD EFFECT */
/* We'll rely on JS to update --mouse-x and --mouse-y, 
   but have a nice fallback if JS fails */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* The "Glow" gradient that follows mouse (set via inline style in JS) */
.card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    600px circle at var(--mouse-x) var(--mouse-y),
    rgba(255, 255, 255, 0.13),
    transparent 55%
  );
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
  z-index: 1;
}

.card:hover::after {
  opacity: 0.7;
}

.card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: 0 14px 45px rgba(0, 0, 0, 0.35);
}

.card-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: space-between;
  position: relative;
  z-index: 2;
}

.card-title {
  font-size: 1.25rem;
  margin: 0 0 0.75rem 0;
  line-height: 1.4;
  position: relative;
  z-index: 2;
}

.card-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  flex-grow: 1;
  position: relative;
  z-index: 2;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: auto;
  position: relative;
  z-index: 2;
}

.tag-pill {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.2rem 0.6rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 99px;
  color: var(--text-secondary);
}

/* ===== LIST PAGE HEADERS ===== */
.archive-header {
  margin-top: 4rem;
  margin-bottom: 4rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

/* ===== STAGGERED ENTRANCE ANIMATION ===== */

@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.staggered-grid .card {
  opacity: 0; /* Start hidden */
  animation: slideUpFade 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Stagger delays for up to 10 items */
.staggered-grid .card:nth-child(1) { animation-delay: 0.05s; }
.staggered-grid .card:nth-child(2) { animation-delay: 0.1s; }
.staggered-grid .card:nth-child(3) { animation-delay: 0.15s; }
.staggered-grid .card:nth-child(4) { animation-delay: 0.2s; }
.staggered-grid .card:nth-child(5) { animation-delay: 0.25s; }
.staggered-grid .card:nth-child(6) { animation-delay: 0.3s; }
.staggered-grid .card:nth-child(7) { animation-delay: 0.35s; }
.staggered-grid .card:nth-child(8) { animation-delay: 0.4s; }
.staggered-grid .card:nth-child(9) { animation-delay: 0.45s; }
.staggered-grid .card:nth-child(10) { animation-delay: 0.5s; }

/* ===== ENHANCED CARD HOVER ===== */

.card-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.card-arrow {
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--accent-color);
  font-family: var(--font-mono);
  font-weight: bold;
}

.card:hover .card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* Make the whole card react more viscerally */
.card:active {
  transform: scale(0.98);
  border-color: var(--accent-color);
}

/* ===== FOOTER ===== */

#footer {
  margin-top: 3rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
  clear: both;
  width: 100%;
  position: relative;
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

#footer .footer-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===== ABOUT PAGE (Research Log Style) ===== */

.about-container {
  max-width: 750px;
  margin: 0 auto;
  padding: 3rem 0;
}

/* Header */
.about-header {
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.about-name {
  font-family: var(--font-sans);
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
}

.about-role {
  font-family: var(--font-sans);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--accent-color);
  margin: 0 0 0.5rem 0;
}

.about-degree {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin: 0 0 0.5rem 0;
  font-weight: 400;
}

.about-institution {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-secondary); /* More visible now */
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.about-institution .separator {
  color: var(--border-light);
}

.about-location-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.about-age {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0.3rem 0 0;
}

.location-dot {
  width: 6px;
  height: 6px;
  background: var(--accent-color);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-color);
}

.about-socials {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.social-link {
  color: var(--text-muted);
  font-size: 1.25rem;
  transition: color 0.2s ease, transform 0.2s ease;
}

.social-link:hover {
  color: var(--accent-color);
  transform: translateY(-2px);
}

/* Sections */
.about-section {
  margin-bottom: 4rem;
}

.about-section-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

/* Prose / Mission */
.about-prose {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.about-prose p {
  margin-bottom: 1.5rem;
}

.about-prose strong {
  color: var(--accent-color);
  font-weight: 500;
}

/* Research Grid */
.research-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.research-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.research-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.research-card-title {
  font-family: var(--font-sans);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.5rem 0;
}

.research-card-desc {
  font-family: var(--font-serif);
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* Philosophy Quote */
.about-quote {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.8;
  color: var(--text-secondary);
  border-left: 3px solid var(--accent-color);
  padding-left: 1.5rem;
  margin: 0;
  font-style: normal;
}

.about-quote p {
  margin-bottom: 1rem;
}

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

.about-quote strong {
  color: var(--accent-color);
  font-weight: 500;
}

/* Hobbies Grid - uses same base card styles */
.hobbies-grid {
  margin-top: 0.5rem;
}

.hobby-card {
  background: var(--bg-tertiary);
}

/* Contact Section */
.about-contact {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.contact-text {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.contact-link {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.contact-link:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  transform: translateY(-2px);
}

/* About Page Mobile */
@media (max-width: 768px) {
  .about-container {
    padding: 2rem 0;
  }
  
  .about-name {
    font-size: 2rem;
  }
  
  .about-role {
    font-size: 1.15rem;
  }
  
  .about-degree {
    font-size: 1rem;
  }

  .about-age {
    font-size: 0.7rem;
  }
  
  .about-institution {
    font-size: 0.8rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  .about-institution .separator {
    display: none;
  }
  
  .about-prose {
    font-size: 1.1rem;
  }
  
  .research-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .research-card {
    padding: 1.25rem;
  }
  
  .about-quote {
    font-size: 1rem;
    padding-left: 1rem;
  }
  
  .contact-links {
    flex-direction: column;
    align-items: center;
  }
  
  .contact-link {
    width: 100%;
    justify-content: center;
  }
}

/* ===== MERMAID OVERRIDES ===== */
.mermaid .node rect, 
.mermaid .node circle, 
.mermaid .node polygon {
  fill: var(--bg-secondary) !important;
  stroke: var(--border-light) !important;
}
.mermaid .edgePath .path {
  stroke: var(--text-muted) !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hero-title { 
    font-size: 1.75rem; 
    white-space: normal; /* Allow wrapping on mobile */
    min-height: 2.5em; /* Accommodate potential two lines */
  }
  .refusal-text {
    font-size: 0.7em; /* Smaller refusal on mobile */
  }
  .hero-desc {
    font-size: 0.9rem;
    line-height: 1.6;
  }
  .hero-actions {
    flex-direction: column;
    gap: 0.75rem;
  }
  .btn {
    width: 100%;
    justify-content: center;
  }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  
  #nav {
    position: static;
  }
  
  #nav ul { 
    display: none; 
  }
  
  #nav ul.responsive {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 60px; /* Match mobile header height */
    left: 0;
    right: 0;
    width: 100%;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0; /* Remove container padding; use link padding for consistent alignment */
    gap: 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 99;
  }
  
  #nav ul.responsive li {
    border-bottom: 1px solid var(--border-color);
  }
  
  #nav ul.responsive li:last-child {
    border-bottom: none;
  }
  
  #nav ul.responsive a {
    display: block;
    padding: 1rem 1.5rem; /* Uniform left padding for all items */
    font-size: 1rem;
    color: var(--text-primary);
  }
  
  #nav .icon { 
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
  }
  
  #nav .icon a {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
  }
  
  #nav .icon:hover,
  #nav .icon a:hover {
    color: var(--text-primary);
  }
}

/* =========================================
   THE "ADDICTIVE READING" EXPERIENCE
   Aesthetic: Academic Journal meets Cyberpunk
   ========================================= */

:root {
  --font-serif: 'Newsreader', serif;
}

/* 1. THE FOCUS COLUMN */
/* Articles get a narrow, distraction-free column */
article.post .content {
  max-width: 700px !important; /* The Golden Ratio for reading */
  margin: 0 auto;
  padding: 0 1.5rem 6rem;
}

/* 2. TYPOGRAPHY THAT FEELS GOOD */
article.post .content p, 
article.post .content ul, 
article.post .content ol {
  font-family: var(--font-serif);
  font-size: 1.25rem; /* Large, confident text */
  line-height: 1.75;  /* Luxurious breathing room */
  color: #d4d4d8;     /* Soft white, easy on eyes */
  font-weight: 400;
  letter-spacing: 0.01em;
  margin-bottom: 1.5rem;
}

/* The "Highlight" Effect for emphasis */
article.post .content strong {
  font-weight: 600;
  color: var(--accent-color); /* Green pops against the text */
}

/* 3. HEADINGS INSIDE POSTS */
article.post .content h2, 
article.post .content h3 {
  font-family: var(--font-sans); /* Keep headings technical/modern */
  color: #fff;
  margin-top: 2rem;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
  position: relative;
  /* Offset for sticky header + breathing room when clicking TOC links */
  scroll-margin-top: calc(var(--header-height) + 2rem);
}

article.post .content h2 {
  font-size: 1.8rem;
  border-bottom: none; /* Remove border to avoid double-lines with HR */
  padding-bottom: 0;
}

article.post .content hr {
  border: 0;
  border-top: 1px dashed var(--border-color); /* Dotted/Dashed line for technical feel */
  margin: 3rem 0 2rem 0;
  opacity: 0.5;
}

article.post .content h2::before {
  content: "#";
  color: var(--accent-color);
  margin-right: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8em;
  opacity: 0.5;
}

/* 4. "JEWELRY" - BLOCKQUOTES */
article.post .content blockquote {
  border-left: 3px solid var(--accent-color);
  background: linear-gradient(90deg, rgba(60, 200, 148, 0.05), transparent);
  padding: 1.5rem 2rem;
  margin: 3rem 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.35rem;
  color: #fff;
  box-shadow: inset 10px 0 20px -10px rgba(0,0,0,0.5);
}

/* 5. "JEWELRY" - CODE BLOCKS */
article.post .content pre {
  background: #0d0d0d !important;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin: 2.5rem -2rem; /* Pulls code slightly wider than text for impact */
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.5);
  overflow-x: auto;
}

article.post .content code {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent-color);
  background: rgba(60, 200, 148, 0.1);
  padding: 0.2em 0.4em;
  border-radius: 4px;
}

article.post .content pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

/* 6. POST HEADER METADATA */
article.post header .posttitle {
  font-family: var(--font-sans);
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  text-align: center; /* Editorial center align */
  background: linear-gradient(to bottom right, #fff, #a1a1aa);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

article.post header .meta {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 2rem;
}

/* Mobile adjustments for the "wide code" effect */
@media (max-width: 768px) {
  article.post .content {
    padding: 0 1rem 4rem;
  }
  article.post .content pre {
    margin: 2rem 0;
    border-radius: var(--radius-sm);
  }
  article.post header .posttitle {
    font-size: 2.2rem;
    text-align: left;
  }
  article.post header .meta {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
  }
}

/* ===== POST LAYOUT (Grid with Sidebar) ===== */

.post-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 4rem;
  margin-top: 3rem;
}

/* Mobile: Stack them, hide TOC or put at top */
@media (max-width: 1100px) {
  .post-layout {
    grid-template-columns: 1fr;
  }
  .post-sidebar {
    display: none; /* Hide TOC on mobile for now to clean up mess */
  }
}

/* Sidebar Styles */
.post-sidebar {
  position: relative;
}

.toc-container {
  position: sticky;
  top: calc(var(--header-height) + 2rem);
  padding: 1.5rem;
  border-left: 1px solid var(--border-color);
  background: transparent;
  max-height: calc(100vh - var(--header-height) - 4rem);
  overflow-y: auto;
  padding-right: 1rem;
}

.toc-header {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: block;
}

#toc nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

#toc nav li {
  margin-bottom: 0.5rem;
}

#toc nav a {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  display: block;
  line-height: 1.4;
  transition: color 0.2s ease;
}

#toc nav a:hover {
  color: var(--accent-color);
}

/* Indent child items */
#toc nav ul ul {
  padding-left: 1rem;
  margin-top: 0.5rem;
  border-left: 1px solid var(--border-color);
}

/* Fix Content Width in Grid */
article.post {
  min-width: 0; /* Prevent grid blowout */
}

/* Restore max-width constraint for the reading column within the grid */
article.post .content {
  max-width: 100% !important; /* Let grid control width, but keep internal padding */
  padding: 0 0 4rem 0; 
  margin: 0;
}

/* Header Spacing Fix */
article.post header {
  margin-top: 2rem;
  text-align: left; /* Align title left to match reading flow */
}

article.post header .posttitle {
  text-align: left;
  font-size: 2.75rem;
}

article.post header .meta {
  justify-content: flex-start;
  border-bottom: none;
  margin-bottom: 2rem;
}


/* ===== TAGS GRAPH VISUALIZATION ===== */
.tag-graph-container {
  width: 100%;
  height: 600px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  margin-bottom: 4rem;
}

#graph-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  color: var(--accent-color);
  font-size: 0.9rem;
  animation: blink 1s infinite;
}

/* Remove old tag cards CSS */

/* ===== COMPACT ARCHIVE HEADER ===== */
.archive-header-compact {
  padding: 0.25rem 0 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.archive-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}

/* ===== COMPREHENSIVE MOBILE FIXES ===== */
@media (max-width: 768px) {
  
  /* Global Content Padding */
  .content {
    padding: 0.5rem 1rem 1.5rem 1rem; /* Reduced top padding */
  }
  
  
  /* Archive/List Pages */
  .archive-header {
    margin-top: 2rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
  }
  
  .archive-header-compact {
    padding: 0.25rem 0 0.25rem;
    margin-bottom: 1rem;
  }
  
  .archive-title {
    font-size: 1.25rem;
  }
  
  /* Section Headers */
  .section-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
  }
  
  .section-title {
    font-size: 0.85rem;
  }
  
  .view-all {
    font-size: 0.75rem;
  }
  
  /* Cards */
  .card {
    padding: 1.25rem;
  }
  
  .card-title {
    font-size: 1.1rem;
  }
  
  .card-desc {
    font-size: 0.9rem;
    margin-bottom: 1rem;
  }
  
  .card-meta {
    font-size: 0.7rem;
  }
  
  .tag-pill {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
  }
  
  /* Tags Page */
  #tag-cloud {
    padding: 2rem 0;
  }
  
  .tag-cloud-tags {
    gap: 0.75rem;
    justify-content: flex-start;
  }
  
  .tag-cloud-tags a {
    font-size: 0.85rem !important;
    padding: 0.4rem 0.8rem;
  }
  
  /* Post/Article Pages */
  article.post header .posttitle {
    font-size: 1.75rem;
    line-height: 1.2;
  }
  
  article.post header .meta {
    font-size: 0.75rem;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
  }
  
  article.post .content p,
  article.post .content ul,
  article.post .content ol {
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 1.5rem;
  }
  
  article.post .content h2 {
    font-size: 1.4rem;
    margin-top: 3rem;
  }
  
  article.post .content h3 {
    font-size: 1.15rem;
  }
  
  article.post .content blockquote {
    font-size: 1.1rem;
    padding: 1rem 1.25rem;
    margin: 2rem 0;
  }
  
  article.post .content code {
    font-size: 0.8rem;
  }
  
  /* Footer */
  #footer {
    margin-top: 4rem;
    padding: 2rem 0;
    font-size: 0.75rem;
  }
  
  /* Header */
  #header {
    height: 60px;
    padding: 0 1rem;
  }
  
  #logo {
    font-size: 0.9rem;
  }
}