/* ==========================================================================
   Jocelyn Ellyse - Personal Space
   Immersive cosmic 3D experience v2
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ==========================================================================
   CSS Variables
   ========================================================================== */
:root {
  --void: #010108;
  --deep: #0a0815;
  --surface: rgba(15, 12, 30, 0.85);
  --surface-hover: rgba(25, 20, 45, 0.9);
  --surface-solid: rgba(8, 6, 18, 0.95);

  --primary: #8b5cf6;
  --primary-light: #a78bfa;
  --secondary: #ec4899;
  --tertiary: #06b6d4;

  --text: #f4f4f5;
  --text-dim: #a1a1aa;
  --text-muted: #71717a;

  --border: rgba(139, 92, 246, 0.25);
  --border-glow: rgba(139, 92, 246, 0.5);
  --glow: 0 0 30px rgba(139, 92, 246, 0.3);
  --glow-strong: 0 0 40px rgba(139, 92, 246, 0.4), 0 0 80px rgba(139, 92, 246, 0.2);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  font-size: 16px;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #8b5cf6 rgba(139, 92, 246, 0.05);
}

html::-webkit-scrollbar {
  width: 6px;
}

html::-webkit-scrollbar-track {
  background: rgba(139, 92, 246, 0.05);
}

html::-webkit-scrollbar-thumb {
  background: #8b5cf6;
  border-radius: 3px;
}

html::-webkit-scrollbar-thumb:hover {
  background: #a78bfa;
}

body {
  font-family: var(--font-sans);
  background: var(--void);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  line-height: 1.6;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) rgba(139, 92, 246, 0.05);
}

/* Vertical page scrollbar (Webkit) */
body::-webkit-scrollbar {
  width: 6px;
}

body::-webkit-scrollbar-track {
  background: rgba(139, 92, 246, 0.05);
}

body::-webkit-scrollbar-thumb {
  background: #8b5cf6;
  border-radius: 3px;
}

body::-webkit-scrollbar-thumb:hover {
  background: #a78bfa;
}

::selection {
  background: rgba(139, 92, 246, 0.35);
  color: var(--text);
}

::-moz-selection {
  background: rgba(139, 92, 246, 0.35);
  color: var(--text);
}

.post-content hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), var(--secondary), transparent);
  margin: 2.5rem 0;
  opacity: 0.6;
  box-shadow:
    0 0 8px rgba(139, 92, 246, 0.4),
    0 0 20px rgba(139, 92, 246, 0.2),
    0 0 40px rgba(236, 72, 153, 0.1);
  animation: hrFlicker 8s ease-in-out infinite;
}

@keyframes hrFlicker {
  0%, 100% {
    opacity: 0.6;
    box-shadow:
      0 0 8px rgba(139, 92, 246, 0.4),
      0 0 20px rgba(139, 92, 246, 0.2),
      0 0 40px rgba(236, 72, 153, 0.1);
  }
  15% {
    opacity: 0.5;
    box-shadow:
      0 0 6px rgba(139, 92, 246, 0.3),
      0 0 15px rgba(139, 92, 246, 0.15),
      0 0 30px rgba(236, 72, 153, 0.08);
  }
  30% {
    opacity: 0.7;
    box-shadow:
      0 0 12px rgba(139, 92, 246, 0.5),
      0 0 25px rgba(139, 92, 246, 0.25),
      0 0 50px rgba(236, 72, 153, 0.15);
  }
  45% {
    opacity: 0.55;
    box-shadow:
      0 0 7px rgba(139, 92, 246, 0.35),
      0 0 18px rgba(139, 92, 246, 0.18),
      0 0 35px rgba(236, 72, 153, 0.1);
  }
  60% {
    opacity: 0.65;
    box-shadow:
      0 0 10px rgba(139, 92, 246, 0.45),
      0 0 22px rgba(139, 92, 246, 0.22),
      0 0 45px rgba(236, 72, 153, 0.12);
  }
  75% {
    opacity: 0.5;
    box-shadow:
      0 0 5px rgba(139, 92, 246, 0.3),
      0 0 14px rgba(139, 92, 246, 0.14),
      0 0 28px rgba(236, 72, 153, 0.07);
  }
  90% {
    opacity: 0.7;
    box-shadow:
      0 0 11px rgba(139, 92, 246, 0.48),
      0 0 24px rgba(139, 92, 246, 0.24),
      0 0 48px rgba(236, 72, 153, 0.14);
  }
}

/* ==========================================================================
   View Transitions API
   ========================================================================== */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  z-index: 1;
}

::view-transition-new(root) {
  z-index: 9999;
}

/* Prevent default crossfade */
::view-transition-group(root) {
  animation-duration: 0s;
}

/* ==========================================================================
   WebGL Canvas
   ========================================================================== */
#webgl-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ==========================================================================
   Content Layer
   ========================================================================== */
.site-content {
  position: relative;
  z-index: 10;
  padding-bottom: 4rem;
  pointer-events: none;
}

.site-content > * {
  pointer-events: auto;
}

.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 5;
  pointer-events: none;
}

.site-footer * {
  pointer-events: auto;
}

/* Mobile: footer not fixed, reduce padding */
@media (max-width: 768px) {
  .site-content {
    padding-bottom: 0;
  }
}

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1.25rem 2rem;
  background: linear-gradient(to bottom, rgba(1, 1, 8, 0.9), transparent);
  pointer-events: none;
}

.site-header > * {
  pointer-events: auto;
}

.site-header .container {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-title {
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  transition: filter var(--transition);
}

.site-title:hover {
  filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.5));
}

.site-nav {
  display: flex;
  gap: 2rem;
}

.site-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition);
  position: relative;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

.site-nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 1px;
  transition: width var(--transition);
  filter: drop-shadow(0 0 4px rgba(139, 92, 246, 0.4));
}

.site-nav a:hover::after,
.site-nav a[aria-current="page"]::after {
  width: 100%;
}

.site-nav .nav-icon {
  display: flex;
  align-items: center;
  opacity: 0.6;
}

.site-nav .nav-icon:hover {
  opacity: 1;
}

.site-nav .nav-icon::after {
  display: none;
}

/* ==========================================================================
   Home Page
   ========================================================================== */
.home .intro {
  text-align: center;
  padding: 8rem 2rem 4rem;
}

/* JS-animated intro - container is visible, children animate individually */
.home .intro.js-animated {
  opacity: 1;
  transform: none;
}

/* Staggered intro children - hidden until animated */
.home .intro h1,
.home .intro .intro-tagline,
.home .intro .intro-byline {
  opacity: 0;
  transform: translateY(-15px);
}

.loaded:not(.spa-navigating) .home .intro:not(.js-animated) h1 {
  animation: introChildFadeIn 0.5s ease forwards;
  animation-delay: 0.1s;
}

.loaded:not(.spa-navigating) .home .intro:not(.js-animated) .intro-tagline {
  animation: introChildFadeIn 0.5s ease forwards;
  animation-delay: 0.2s;
}

.loaded:not(.spa-navigating) .home .intro:not(.js-animated) .intro-byline {
  animation: introChildFadeIn 0.5s ease forwards;
  animation-delay: 0.3s;
}

/* JS-animated children stay visible */
.home .intro.js-animated h1,
.home .intro.js-animated .intro-tagline,
.home .intro.js-animated .intro-byline {
  opacity: 1;
  transform: none;
}

@keyframes introChildFadeIn {
  from {
    opacity: 0;
    transform: translateY(-15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.home .intro h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--text), var(--primary-light), var(--secondary));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: titleShimmer 8s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.3));
}

@keyframes titleShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.home .intro .intro-tagline {
  color: var(--text-dim);
  font-size: 1rem;
  margin: 0 auto 0.25rem;
  font-style: italic;
  white-space: nowrap;
  min-height: 1.5em;
}

/* Typewriter effect */
.typewriter-active {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 0.9rem;
}

@media (max-width: 500px) {
  .typewriter-active {
    font-size: 0.75rem;
  }
}

@media (max-width: 380px) {
  .typewriter-active {
    font-size: 0.65rem;
  }
}

@media (max-width: 400px) {
  .home .intro .intro-tagline {
    white-space: normal;
  }
}

.typewriter-text {
  /* Text sits inline with caret */
}

.typewriter-caret {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--primary);
  margin-left: 2px;
  vertical-align: text-bottom;
  position: relative;
  top: -1px;
  animation: caretBlink 1s step-end infinite;
}

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

.home .intro .intro-byline {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  max-width: 24rem;
  margin: 0 auto;
}

/* ==========================================================================
   Fallback / Static Experience
   ========================================================================== */
.static-experience #webgl-canvas,
.reduced-motion #webgl-canvas {
  display: none;
}

/* Static cosmic background for no-WebGL */
.static-experience body::before,
.reduced-motion body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(139, 92, 246, 0.15), transparent 60%),
    radial-gradient(ellipse 60% 40% at 20% 80%, rgba(236, 72, 153, 0.1), transparent 50%),
    radial-gradient(ellipse 50% 50% at 80% 60%, rgba(6, 182, 212, 0.08), transparent 50%),
    var(--void);
  pointer-events: none;
}

.reduced-motion .post-item {
  transform: none !important;
}

/* No-JS fallback: show content immediately */
.static-experience .post-item,
.static-experience .post-header,
.static-experience .post-content,
.static-experience .post-footer,
.static-experience .page-container,
.static-experience .home .intro {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}

.reduced-motion .post-header,
.reduced-motion .post-content,
.reduced-motion .post-footer,
.reduced-motion .page-container,
.reduced-motion .home .intro {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}

/* ==========================================================================
   Constellation Text
   ========================================================================== */
.constellation-container {
  position: fixed;
  top: 15%;
  left: 0;
  width: 100%;
  height: 200px;
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

.constellation-container.fading {
  opacity: 0;
}

.constellation-star {
  position: absolute;
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 50%;
  opacity: 0;
  box-shadow:
    0 0 6px 2px rgba(255, 255, 255, 0.8),
    0 0 12px 4px rgba(139, 92, 246, 0.6);
  animation: starTwinkleIn 0.8s ease forwards;
}

@keyframes starTwinkleIn {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  50% {
    opacity: 1;
    transform: scale(1.5);
  }
  100% {
    opacity: 0.9;
    transform: scale(1);
  }
}

.constellation-line {
  position: absolute;
  height: 1px;
  background: linear-gradient(90deg,
    rgba(139, 92, 246, 0.6),
    rgba(139, 92, 246, 0.2)
  );
  transform-origin: left center;
  opacity: 0;
  animation: lineDrawIn 0.6s ease forwards;
}

@keyframes lineDrawIn {
  0% {
    opacity: 0;
    clip-path: inset(0 100% 0 0);
  }
  100% {
    opacity: 0.5;
    clip-path: inset(0 0 0 0);
  }
}

/* ==========================================================================
   Flying Icons
   ========================================================================== */
.flying-icon {
  position: fixed;
  z-index: 4;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.flying-icon-body {
  width: 28px;
  height: 28px;
  color: rgba(139, 92, 246, 0.7);
  filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.5));
  transition: color 0.3s;
}

.flying-icon-body svg {
  width: 100%;
  height: 100%;
}

.flying-icon-trail {
  position: absolute;
  right: 100%;
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg,
    transparent,
    rgba(139, 92, 246, 0.4)
  );
  border-radius: 1px;
  margin-right: 4px;
}

.flying-icon-trail:nth-child(1) {
  opacity: 0.8;
  width: 50px;
}

.flying-icon-trail:nth-child(2) {
  opacity: 0.5;
  width: 35px;
  margin-right: 58px;
}

.flying-icon-trail:nth-child(3) {
  opacity: 0.25;
  width: 25px;
  margin-right: 97px;
}

/* Different icon colors */
.flying-icon:nth-child(6n+1) .flying-icon-body {
  color: rgba(139, 92, 246, 0.8);
}

.flying-icon:nth-child(6n+2) .flying-icon-body {
  color: rgba(236, 72, 153, 0.8);
}

.flying-icon:nth-child(6n+3) .flying-icon-body {
  color: rgba(6, 182, 212, 0.8);
}

.flying-icon:nth-child(6n+4) .flying-icon-body {
  color: rgba(250, 204, 21, 0.8);
}

.flying-icon:nth-child(6n+5) .flying-icon-body {
  color: rgba(34, 197, 94, 0.8);
}

.flying-icon:nth-child(6n+6) .flying-icon-body {
  color: rgba(251, 146, 60, 0.8);
}

.flying-icon:nth-child(6n+1) .flying-icon-trail {
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.4));
}

.flying-icon:nth-child(6n+2) .flying-icon-trail {
  background: linear-gradient(90deg, transparent, rgba(236, 72, 153, 0.4));
}

.flying-icon:nth-child(6n+3) .flying-icon-trail {
  background: linear-gradient(90deg, transparent, rgba(6, 182, 212, 0.4));
}

.flying-icon:nth-child(6n+4) .flying-icon-trail {
  background: linear-gradient(90deg, transparent, rgba(250, 204, 21, 0.4));
}

.flying-icon:nth-child(6n+5) .flying-icon-trail {
  background: linear-gradient(90deg, transparent, rgba(34, 197, 94, 0.4));
}

.flying-icon:nth-child(6n+6) .flying-icon-trail {
  background: linear-gradient(90deg, transparent, rgba(251, 146, 60, 0.4));
}

/* Hide extras on mobile */
@media (max-width: 768px) {
  .constellation-container {
    top: 10%;
  }

  .flying-icon:nth-child(n+4) {
    display: none;
  }
}

/* ==========================================================================
   Posts List - Enhanced 3D Cards
   ========================================================================== */
.posts {
  padding: 2rem;
  max-width: 48rem;
  margin: 0 auto;
  text-align: center;
}

.posts h2 {
  font-size: 0.75rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(10px);
}

.loaded:not(.spa-navigating) .posts h2:not(.js-animated) {
  animation: recentFadeIn 0.5s ease forwards;
  animation-delay: 0.05s;
}

.posts h2.js-animated {
  opacity: 1;
  transform: none;
}

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

.post-list {
  list-style: none;
  display: grid;
  gap: 1.25rem;
  perspective: 1200px;
  /* Prevent card animations from affecting layout above */
  contain: layout style;
}

.post-item {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 12px;
  transition:
    transform 0.2s ease-out,
    box-shadow 0.2s ease-out,
    background 0.2s ease-out;
  backdrop-filter: blur(12px);
  transform-style: preserve-3d;
  will-change: transform;
  position: relative;
  text-align: left;
  z-index: 0;
  /* Hidden until JS animates in */
  opacity: 0;
  transform: translateY(30px);
}

/* Animated gradient border for post items */
.post-item::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 13px;
  padding: 1px;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--primary), var(--secondary));
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: gradientBorderFlow 8s ease-in-out infinite;
  opacity: 0.5;
  z-index: -1;
  pointer-events: none;
}

/* Animate in on page load (not during SPA navigation or after JS animation) */
.loaded:not(.spa-navigating) .post-item:not(.js-animated) {
  animation: cardFadeIn 0.6s ease forwards;
}

.loaded:not(.spa-navigating) .post-item:not(.js-animated):nth-child(1) { animation-delay: 0.1s; }
.loaded:not(.spa-navigating) .post-item:not(.js-animated):nth-child(2) { animation-delay: 0.2s; }
.loaded:not(.spa-navigating) .post-item:not(.js-animated):nth-child(3) { animation-delay: 0.3s; }
.loaded:not(.spa-navigating) .post-item:not(.js-animated):nth-child(4) { animation-delay: 0.4s; }
.loaded:not(.spa-navigating) .post-item:not(.js-animated):nth-child(5) { animation-delay: 0.5s; }
.loaded:not(.spa-navigating) .post-item:not(.js-animated):nth-child(6) { animation-delay: 0.6s; }

/* JS-animated cards should stay visible */
.post-item.js-animated {
  opacity: 1;
  transform: none;
}

@keyframes cardFadeIn {
  from {
    opacity: 0;
    transform: translateY(30px) rotateX(-10deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0);
  }
}

.post-item:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.25), 0 0 60px rgba(139, 92, 246, 0.1), inset 0 0 20px rgba(139, 92, 246, 0.05);
}

/* Card shine effect on hover */
.post-item::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 12px;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 50%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.post-item:hover::after {
  opacity: 1;
}

.post-item h3 {
  margin-bottom: 0.5rem;
}

.post-item h3 a {
  color: var(--text);
  text-decoration: none;
  font-size: 1.15rem;
  font-weight: 600;
  transition: color var(--transition);
}

.post-item h3 a:hover {
  color: var(--primary-light);
}

.post-item-subtitle {
  font-family: var(--font-mono);
  font-size: 0.8em;
  font-weight: 400;
  color: var(--primary-light);
  opacity: 0.7;
  margin-left: 0.5em;
}

.post-item h3 a:hover .post-item-subtitle {
  opacity: 1;
}

.post-item time {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.post-excerpt {
  margin-top: 0.75rem;
  color: var(--text-dim);
  font-size: 0.95rem;
}

.view-archive {
  display: inline-block;
  margin-top: 2rem;
  margin-bottom: 5rem;
  padding: 0.75rem 1.5rem;
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: var(--surface);
  transition: all var(--transition);
  position: relative;
  z-index: 0;
}

/* Animated gradient border for view archive button */
.view-archive::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: calc(0.5rem + 1px);
  padding: 1px;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--primary), var(--secondary));
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: gradientBorderFlow 8s ease-in-out infinite;
  opacity: 0.5;
  z-index: -1;
  pointer-events: none;
  transition: opacity var(--transition);
}

.view-archive:hover {
  color: var(--text);
  background: var(--surface-hover);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.view-archive:hover::before {
  opacity: 0.8;
}

/* ==========================================================================
   Post Page - Dark Container
   ========================================================================== */
.post {
  max-width: 48rem;
  margin: 0 auto;
  padding: 6rem 2rem 4rem;
}

/* Dark backdrop container with animated gradient border */
.post-header,
.post-content,
.post-footer {
  position: relative;
  background: var(--surface-solid);
  border: none;
  border-radius: 16px;
  padding: 2rem;
  backdrop-filter: blur(20px);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
  /* Hidden until JS animates in */
  opacity: 0;
  transform: translateY(20px);
}

/* Animated gradient border pseudo-element */
.post-header::before,
.post-content::before,
.post-footer::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 17px;
  padding: 1px;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--primary), var(--secondary));
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: gradientBorderFlow 8s ease-in-out infinite;
  opacity: 0.5;
  z-index: -1;
}

@keyframes gradientBorderFlow {
  0%, 100% { background-position: 0% 50%; }
  25% { background-position: 50% 100%; }
  50% { background-position: 100% 50%; }
  75% { background-position: 50% 0%; }
}

/* Fade-in animation */
.loaded .post-header,
.loaded .post-content,
.loaded .post-footer {
  animation: postFadeIn 0.5s ease forwards;
  animation-delay: 0.1s;
}

.loaded .post-content {
  animation-delay: 0.2s;
}

.loaded .post-footer {
  animation-delay: 0.3s;
}

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

.post-header {
  margin-bottom: 1.5rem;
  border-bottom: none;
  position: relative;
  overflow: visible;
}

.post-content {
  margin-bottom: 1.5rem;
}

.post-footer {
  border-top: none;
  margin-top: 0;
  padding-top: 1.5rem;
}

.post-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.25rem;
  color: var(--text);
  position: relative;
  z-index: 1;
}

.post-subtitle {
  font-size: clamp(0.95rem, 2vw, 1.15rem);
  font-family: var(--font-mono);
  font-weight: 400;
  letter-spacing: 0.02em;
  color: transparent;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary), var(--tertiary));
  background-size: 200% 200%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: subtitleShimmer 8s ease-in-out infinite;
  filter: drop-shadow(0 0 8px rgba(139, 92, 246, 0.35));
  margin-bottom: 1rem;
  line-height: 1.4;
}

.post-meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
}

.post-tags {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  position: relative;
  z-index: 1;
}

.tag {
  padding: 0.25rem 0.75rem;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid var(--border);
  border-radius: 9999px;
  font-size: 0.75rem;
  color: var(--primary-light);
  font-family: var(--font-mono);
  transition: all var(--transition);
}

.tag:hover {
  background: rgba(139, 92, 246, 0.3);
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
  color: var(--text);
}

/* Post content typography */
.post-content {
  font-size: 1.0625rem;
  line-height: 1.75;
  /* Prevent word animations from affecting layout outside */
  contain: layout style;
}

.post-content h2 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: var(--text);
  padding-bottom: 0.5rem;
  border-bottom: none;
  text-shadow: 0 0 20px rgba(139, 92, 246, 0.2);
  position: relative;
}

.post-content h2::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--primary));
  background-size: 200% 100%;
  opacity: 0.6;
  box-shadow:
    0 0 6px rgba(139, 92, 246, 0.4),
    0 0 15px rgba(139, 92, 246, 0.2),
    0 0 30px rgba(236, 72, 153, 0.1);
  animation: headingBorderFlicker 6s ease-in-out infinite;
}

@keyframes headingBorderFlicker {
  0%, 100% {
    opacity: 0.6;
    background-position: 0% 50%;
    box-shadow:
      0 0 6px rgba(139, 92, 246, 0.4),
      0 0 15px rgba(139, 92, 246, 0.2),
      0 0 30px rgba(236, 72, 153, 0.1);
  }
  12% {
    opacity: 0.5;
    box-shadow:
      0 0 4px rgba(139, 92, 246, 0.3),
      0 0 10px rgba(139, 92, 246, 0.15),
      0 0 20px rgba(236, 72, 153, 0.08);
  }
  25% {
    opacity: 0.7;
    background-position: 50% 50%;
    box-shadow:
      0 0 8px rgba(139, 92, 246, 0.5),
      0 0 18px rgba(139, 92, 246, 0.25),
      0 0 35px rgba(236, 72, 153, 0.12);
  }
  38% {
    opacity: 0.55;
    box-shadow:
      0 0 5px rgba(139, 92, 246, 0.35),
      0 0 12px rgba(139, 92, 246, 0.18),
      0 0 25px rgba(236, 72, 153, 0.09);
  }
  50% {
    opacity: 0.65;
    background-position: 100% 50%;
    box-shadow:
      0 0 7px rgba(139, 92, 246, 0.45),
      0 0 16px rgba(139, 92, 246, 0.22),
      0 0 32px rgba(236, 72, 153, 0.11);
  }
  62% {
    opacity: 0.5;
    box-shadow:
      0 0 4px rgba(139, 92, 246, 0.3),
      0 0 11px rgba(139, 92, 246, 0.14),
      0 0 22px rgba(236, 72, 153, 0.07);
  }
  75% {
    opacity: 0.7;
    background-position: 50% 50%;
    box-shadow:
      0 0 9px rgba(139, 92, 246, 0.5),
      0 0 20px rgba(139, 92, 246, 0.26),
      0 0 38px rgba(236, 72, 153, 0.13);
  }
  88% {
    opacity: 0.55;
    box-shadow:
      0 0 5px rgba(139, 92, 246, 0.35),
      0 0 13px rgba(139, 92, 246, 0.17),
      0 0 26px rgba(236, 72, 153, 0.09);
  }
}

.post-content h3 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
  color: var(--text);
  text-shadow: 0 0 15px rgba(139, 92, 246, 0.15);
}

.post-content p {
  margin-bottom: 1.5rem;
  color: #c4c4cc;
}

.post-content strong {
  color: var(--text);
  font-weight: 600;
  text-shadow: 0 0 8px rgba(244, 244, 245, 0.15);
}

.post-content em {
  font-style: italic;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: italicShimmer 6s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(139, 92, 246, 0.3));
  padding: 0 0.15em;
  margin: 0 -0.15em;
  display: inline;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.post-content strong em,
.post-content em strong {
  font-style: italic;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: italicShimmer 6s ease-in-out infinite;
  filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.45));
  padding: 0 0.15em;
  margin: 0 -0.15em;
  display: inline;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.post-content strong.glow {
  font-style: normal;
  font-weight: 700;
  color: transparent;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: italicShimmer 6s ease-in-out infinite;
  filter: drop-shadow(0 0 14px rgba(139, 92, 246, 0.6)) drop-shadow(0 0 30px rgba(236, 72, 153, 0.3));
  text-shadow: none;
  padding: 0 0.15em;
  margin: 0 -0.15em;
  display: inline;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

@keyframes italicShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes subtitleShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 200% 50%; }
}


.post-content a {
  color: var(--primary-light);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition), color var(--transition), filter var(--transition);
}

.post-content a:hover {
  color: var(--text);
  border-bottom-color: var(--primary);
  filter: drop-shadow(0 0 4px rgba(139, 92, 246, 0.4));
}

.post-content ul,
.post-content ol {
  margin-bottom: 1.5rem;
  padding-left: 1.5rem;
  color: #c4c4cc;
}

.post-content li {
  margin-bottom: 0.5rem;
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(139, 92, 246, 0.15);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  color: var(--tertiary);
}

.post-content pre {
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 0;
}

/* Standalone pre without highlighter-rouge wrapper */
.post-content > pre {
  margin-bottom: 1.5rem;
}

@keyframes codeBlockBorderFlicker {
  0%, 100% { opacity: 0.6; }
  15% { opacity: 0.45; }
  35% { opacity: 0.7; }
  55% { opacity: 0.5; }
  75% { opacity: 0.65; }
}

.post-content pre code {
  background: none;
  padding: 0;
  color: var(--text);
}

/* Language label for code blocks */
.post-content div[class*="language-"].highlighter-rouge {
  position: relative;
  margin-bottom: 1.5rem;
}

/* Animated gradient border for code blocks - on wrapper to avoid overflow issues */
.post-content div[class*="language-"].highlighter-rouge::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 9px;
  padding: 1px;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--primary), var(--secondary));
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: gradientBorderFlow 8s ease-in-out infinite, codeBlockBorderFlicker 6s ease-in-out infinite;
  opacity: 0.6;
  z-index: 0;
  pointer-events: none;
}

.post-content div[class*="language-"].highlighter-rouge::before {
  position: absolute;
  top: 0;
  left: 1rem;
  transform: translateY(-50%);
  padding: 0.1rem 0.45rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  /* Gradient border technique: solid inner bg + gradient outer bg with background-origin */
  background:
    linear-gradient(rgba(10, 10, 20, 0.95), rgba(10, 10, 20, 0.95)) padding-box,
    linear-gradient(135deg, var(--primary), var(--secondary), var(--primary), var(--secondary)) border-box;
  background-size: 100% 100%, 300% 300%;
  border: 1px solid transparent;
  border-radius: 4px;
  z-index: 10;
  box-shadow:
    0 0 6px rgba(139, 92, 246, 0.2),
    0 0 12px rgba(139, 92, 246, 0.1),
    0 0 20px rgba(236, 72, 153, 0.05);
  animation: langLabelGradient 8s ease-in-out infinite, langLabelGlow 6s ease-in-out infinite;
}

@keyframes langLabelGradient {
  0%, 100% { background-position: 0 0, 0% 50%; }
  25% { background-position: 0 0, 50% 100%; }
  50% { background-position: 0 0, 100% 50%; }
  75% { background-position: 0 0, 50% 0%; }
}

@keyframes langLabelGlow {
  0%, 100% {
    box-shadow:
      0 0 6px rgba(139, 92, 246, 0.2),
      0 0 12px rgba(139, 92, 246, 0.1),
      0 0 20px rgba(236, 72, 153, 0.05);
  }
  15% {
    box-shadow:
      0 0 4px rgba(139, 92, 246, 0.15),
      0 0 8px rgba(139, 92, 246, 0.06);
  }
  35% {
    box-shadow:
      0 0 8px rgba(139, 92, 246, 0.25),
      0 0 16px rgba(139, 92, 246, 0.12),
      0 0 24px rgba(236, 72, 153, 0.08);
  }
  55% {
    box-shadow:
      0 0 5px rgba(139, 92, 246, 0.18),
      0 0 10px rgba(139, 92, 246, 0.08);
  }
  75% {
    box-shadow:
      0 0 7px rgba(139, 92, 246, 0.22),
      0 0 14px rgba(139, 92, 246, 0.1),
      0 0 22px rgba(236, 72, 153, 0.06);
  }
}

/* Copy button for code blocks */
.code-copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.35rem;
  background: rgba(30, 30, 50, 0.8);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  cursor: pointer;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.2s, transform 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s;
  z-index: 2;
}

.code-copy-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

.post-content div[class*="language-"].highlighter-rouge:hover .code-copy-btn,
.post-content .highlight:hover .code-copy-btn {
  opacity: 1;
  transform: scale(1);
}

.code-copy-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  color: var(--primary-light);
  border-color: var(--primary);
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.3);
}

.code-copy-btn:active {
  transform: scale(0.85);
}

.code-copy-btn.copied {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
  border-color: #22c55e;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.4);
}

.code-copy-btn.copied svg {
  animation: copyPop 0.3s ease-out;
}

@keyframes copyPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Rouge supported languages - comprehensive list */
.post-content div.language-abap::before { content: "abap"; }
.post-content div.language-actionscript::before,
.post-content div.language-as::before,
.post-content div.language-as3::before { content: "actionscript"; }
.post-content div.language-apache::before { content: "apache"; }
.post-content div.language-apiblueprint::before,
.post-content div.language-apib::before { content: "apib"; }
.post-content div.language-applescript::before { content: "applescript"; }
.post-content div.language-awk::before { content: "awk"; }
.post-content div.language-biml::before { content: "biml"; }
.post-content div.language-brainfuck::before { content: "brainfuck"; }
.post-content div.language-bsl::before { content: "bsl"; }
.post-content div.language-c::before { content: "c"; }
.post-content div.language-ceylon::before { content: "ceylon"; }
.post-content div.language-cfscript::before,
.post-content div.language-cfc::before { content: "cfscript"; }
.post-content div.language-clojure::before,
.post-content div.language-clj::before,
.post-content div.language-cljs::before { content: "clojure"; }
.post-content div.language-cmake::before { content: "cmake"; }
.post-content div.language-coffeescript::before,
.post-content div.language-coffee::before { content: "coffee"; }
.post-content div.language-common_lisp::before,
.post-content div.language-common-lisp::before,
.post-content div.language-cl::before,
.post-content div.language-elisp::before,
.post-content div.language-emacs-lisp::before { content: "lisp"; }
.post-content div.language-conf::before,
.post-content div.language-config::before,
.post-content div.language-configuration::before { content: "conf"; }
.post-content div.language-console::before,
.post-content div.language-terminal::before,
.post-content div.language-shell_session::before,
.post-content div.language-shell-session::before { content: "console"; }
.post-content div.language-coq::before { content: "coq"; }
.post-content div.language-cpp::before,
.post-content div.language-c\+\+::before { content: "c++"; }
.post-content div.language-crystal::before,
.post-content div.language-cr::before { content: "crystal"; }
.post-content div.language-csharp::before,
.post-content div.language-cs::before,
.post-content div.language-c\#::before { content: "c#"; }
.post-content div.language-css::before { content: "css"; }
.post-content div.language-d::before,
.post-content div.language-dlang::before { content: "d"; }
.post-content div.language-dart::before { content: "dart"; }
.post-content div.language-diff::before,
.post-content div.language-patch::before,
.post-content div.language-udiff::before { content: "diff"; }
.post-content div.language-digdag::before { content: "digdag"; }
.post-content div.language-docker::before,
.post-content div.language-dockerfile::before { content: "docker"; }
.post-content div.language-dot::before { content: "dot"; }
.post-content div.language-eiffel::before { content: "eiffel"; }
.post-content div.language-elixir::before,
.post-content div.language-exs::before { content: "elixir"; }
.post-content div.language-elm::before { content: "elm"; }
.post-content div.language-erb::before,
.post-content div.language-eruby::before,
.post-content div.language-rhtml::before { content: "erb"; }
.post-content div.language-erlang::before,
.post-content div.language-erl::before { content: "erlang"; }
.post-content div.language-escape::before,
.post-content div.language-esc::before { content: "escape"; }
.post-content div.language-factor::before { content: "factor"; }
.post-content div.language-fortran::before { content: "fortran"; }
.post-content div.language-fsharp::before { content: "f#"; }
.post-content div.language-gherkin::before,
.post-content div.language-cucumber::before,
.post-content div.language-behat::before { content: "gherkin"; }
.post-content div.language-glsl::before { content: "glsl"; }
.post-content div.language-go::before,
.post-content div.language-golang::before { content: "go"; }
.post-content div.language-gradle::before { content: "gradle"; }
.post-content div.language-graphql::before { content: "graphql"; }
.post-content div.language-groovy::before { content: "groovy"; }
.post-content div.language-hack::before,
.post-content div.language-hh::before { content: "hack"; }
.post-content div.language-haml::before { content: "haml"; }
.post-content div.language-handlebars::before,
.post-content div.language-hbs::before,
.post-content div.language-mustache::before { content: "hbs"; }
.post-content div.language-haskell::before,
.post-content div.language-hs::before { content: "haskell"; }
.post-content div.language-hcl::before { content: "hcl"; }
.post-content div.language-html::before { content: "html"; }
.post-content div.language-http::before { content: "http"; }
.post-content div.language-hylang::before,
.post-content div.language-hy::before { content: "hy"; }
.post-content div.language-idlang::before { content: "idl"; }
.post-content div.language-igorpro::before { content: "igor"; }
.post-content div.language-ini::before { content: "ini"; }
.post-content div.language-io::before { content: "io"; }
.post-content div.language-irb::before,
.post-content div.language-pry::before { content: "irb"; }
.post-content div.language-java::before { content: "java"; }
.post-content div.language-javascript::before,
.post-content div.language-js::before { content: "javascript"; }
.post-content div.language-jinja::before,
.post-content div.language-django::before { content: "jinja"; }
.post-content div.language-json::before { content: "json"; }
.post-content div.language-json-doc::before { content: "json"; }
.post-content div.language-jsonnet::before { content: "jsonnet"; }
.post-content div.language-jsp::before { content: "jsp"; }
.post-content div.language-jsx::before,
.post-content div.language-react::before { content: "jsx"; }
.post-content div.language-julia::before,
.post-content div.language-jl::before { content: "julia"; }
.post-content div.language-kotlin::before { content: "kotlin"; }
.post-content div.language-lasso::before,
.post-content div.language-lassoscript::before { content: "lasso"; }
.post-content div.language-liquid::before { content: "liquid"; }
.post-content div.language-literate_coffeescript::before,
.post-content div.language-litcoffee::before { content: "litcoffee"; }
.post-content div.language-literate_haskell::before,
.post-content div.language-lithaskell::before,
.post-content div.language-lhaskell::before,
.post-content div.language-lhs::before { content: "lhs"; }
.post-content div.language-llvm::before { content: "llvm"; }
.post-content div.language-lua::before { content: "lua"; }
.post-content div.language-m68k::before { content: "m68k"; }
.post-content div.language-magik::before { content: "magik"; }
.post-content div.language-make::before,
.post-content div.language-makefile::before,
.post-content div.language-mf::before,
.post-content div.language-gnumake::before,
.post-content div.language-bsdmake::before { content: "make"; }
.post-content div.language-markdown::before,
.post-content div.language-md::before,
.post-content div.language-mkd::before { content: "markdown"; }
.post-content div.language-mathematica::before,
.post-content div.language-wl::before { content: "mathematica"; }
.post-content div.language-matlab::before,
.post-content div.language-m::before { content: "matlab"; }
.post-content div.language-moonscript::before,
.post-content div.language-moon::before { content: "moon"; }
.post-content div.language-mosel::before { content: "mosel"; }
.post-content div.language-mxml::before { content: "mxml"; }
.post-content div.language-nasm::before { content: "nasm"; }
.post-content div.language-nginx::before { content: "nginx"; }
.post-content div.language-nim::before,
.post-content div.language-nimrod::before { content: "nim"; }
.post-content div.language-nix::before,
.post-content div.language-nixos::before { content: "nix"; }
.post-content div.language-objective_c::before,
.post-content div.language-objc::before,
.post-content div.language-obj-c::before,
.post-content div.language-obj_c::before,
.post-content div.language-objectivec::before { content: "objc"; }
.post-content div.language-ocaml::before { content: "ocaml"; }
.post-content div.language-pascal::before { content: "pascal"; }
.post-content div.language-perl::before,
.post-content div.language-pl::before { content: "perl"; }
.post-content div.language-php::before,
.post-content div.language-php3::before,
.post-content div.language-php4::before,
.post-content div.language-php5::before { content: "php"; }
.post-content div.language-plaintext::before,
.post-content div.language-text::before { content: "text"; }
.post-content div.language-plist::before { content: "plist"; }
.post-content div.language-powershell::before,
.post-content div.language-posh::before,
.post-content div.language-microsoftshell::before,
.post-content div.language-msshell::before { content: "powershell"; }
.post-content div.language-praat::before { content: "praat"; }
.post-content div.language-prolog::before { content: "prolog"; }
.post-content div.language-prometheus::before { content: "prometheus"; }
.post-content div.language-properties::before { content: "properties"; }
.post-content div.language-protobuf::before,
.post-content div.language-proto::before { content: "protobuf"; }
.post-content div.language-puppet::before,
.post-content div.language-pp::before { content: "puppet"; }
.post-content div.language-python::before,
.post-content div.language-py::before { content: "python"; }
.post-content div.language-q::before,
.post-content div.language-kdb\+::before { content: "q"; }
.post-content div.language-qml::before { content: "qml"; }
.post-content div.language-r::before,
.post-content div.language-s::before { content: "r"; }
.post-content div.language-racket::before { content: "racket"; }
.post-content div.language-ruby::before,
.post-content div.language-rb::before { content: "ruby"; }
.post-content div.language-rust::before,
.post-content div.language-rs::before { content: "rust"; }
.post-content div.language-sass::before { content: "sass"; }
.post-content div.language-scala::before { content: "scala"; }
.post-content div.language-scheme::before { content: "scheme"; }
.post-content div.language-scss::before { content: "scss"; }
.post-content div.language-sed::before { content: "sed"; }
.post-content div.language-shell::before,
.post-content div.language-bash::before,
.post-content div.language-zsh::before,
.post-content div.language-ksh::before,
.post-content div.language-sh::before { content: "bash"; }
.post-content div.language-sieve::before { content: "sieve"; }
.post-content div.language-slim::before { content: "slim"; }
.post-content div.language-smalltalk::before,
.post-content div.language-st::before,
.post-content div.language-squeak::before { content: "smalltalk"; }
.post-content div.language-smarty::before { content: "smarty"; }
.post-content div.language-sml::before,
.post-content div.language-ml::before { content: "sml"; }
.post-content div.language-sqf::before { content: "sqf"; }
.post-content div.language-sql::before { content: "sql"; }
.post-content div.language-supercollider::before { content: "supercollider"; }
.post-content div.language-swift::before { content: "swift"; }
.post-content div.language-tap::before { content: "tap"; }
.post-content div.language-tcl::before { content: "tcl"; }
.post-content div.language-terraform::before,
.post-content div.language-tf::before { content: "terraform"; }
.post-content div.language-tex::before,
.post-content div.language-latex::before { content: "tex"; }
.post-content div.language-toml::before { content: "toml"; }
.post-content div.language-tsx::before { content: "tsx"; }
.post-content div.language-tulip::before { content: "tulip"; }
.post-content div.language-turtle::before { content: "turtle"; }
.post-content div.language-twig::before { content: "twig"; }
.post-content div.language-typescript::before,
.post-content div.language-ts::before { content: "typescript"; }
.post-content div.language-vala::before { content: "vala"; }
.post-content div.language-vb::before,
.post-content div.language-visualbasic::before { content: "visualbasic"; }
.post-content div.language-verilog::before { content: "verilog"; }
.post-content div.language-vhdl::before { content: "vhdl"; }
.post-content div.language-viml::before,
.post-content div.language-vim::before,
.post-content div.language-vimscript::before,
.post-content div.language-ex::before { content: "vim"; }
.post-content div.language-vue::before,
.post-content div.language-vuejs::before { content: "vue"; }
.post-content div.language-wgsl::before { content: "wgsl"; }
.post-content div.language-wollok::before { content: "wollok"; }
.post-content div.language-xml::before { content: "xml"; }
.post-content div.language-xojo::before,
.post-content div.language-realbasic::before { content: "xojo"; }
.post-content div.language-yaml::before,
.post-content div.language-yml::before { content: "yaml"; }

/* Custom scrollbar for code blocks */
.post-content pre::-webkit-scrollbar {
  height: 6px;
}

.post-content pre::-webkit-scrollbar-track {
  background: rgba(139, 92, 246, 0.05);
  border-radius: 3px;
  margin: 0 0.5rem;
}

.post-content pre::-webkit-scrollbar-thumb {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
  animation: scrollThumbPulse 3s ease-in-out infinite;
}

.post-content pre::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(90deg, var(--primary-light), var(--secondary));
  box-shadow: 0 0 14px rgba(139, 92, 246, 0.6), 0 0 30px rgba(236, 72, 153, 0.3);
}

@keyframes scrollThumbPulse {
  0%, 100% { box-shadow: 0 0 6px rgba(139, 92, 246, 0.3); }
  50% { box-shadow: 0 0 12px rgba(139, 92, 246, 0.6), 0 0 20px rgba(236, 72, 153, 0.2); }
}

/* Firefox scrollbar */
.post-content pre {
  scrollbar-width: thin;
  scrollbar-color: var(--primary) rgba(139, 92, 246, 0.05);
  scroll-behavior: smooth;
}

.post-content blockquote {
  border-left: 3px solid var(--primary);
  margin: 2rem 0;
  padding: 1rem 1.5rem;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.05));
  border-radius: 0 8px 8px 0;
  color: var(--primary-light);
  font-style: italic;
  box-shadow: inset 0 0 20px rgba(139, 92, 246, 0.08);
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.post-footer nav a {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color var(--transition);
}

.post-footer nav a:hover {
  color: var(--primary-light);
}

.post-footer nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.post-footer-top {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-family: var(--font-mono);
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
}

.post-footer-top:hover {
  color: var(--primary-light);
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

/* Post Pagination */
.post-pagination {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: none;
}

.post-pagination::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--primary), var(--secondary));
  background-size: 300% 100%;
  animation: gradientBorderFlow 8s ease-in-out infinite;
  opacity: 0.6;
}

.pagination-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  transition: all var(--transition);
  overflow: hidden;
}

.pagination-link:hover {
  background: var(--surface-hover);
  border-color: var(--border-glow);
  box-shadow: var(--glow);
  transform: translateY(-2px);
}

.pagination-link:hover .pagination-arrow {
  color: var(--primary);
}

.pagination-prev {
  text-align: left;
}

.pagination-next {
  text-align: right;
  flex-direction: row;
  justify-content: flex-end;
}

.pagination-disabled {
  opacity: 0;
  pointer-events: none;
}

.pagination-arrow {
  font-size: 1.5rem;
  color: var(--text-muted);
  transition: color var(--transition), transform var(--transition);
  flex-shrink: 0;
}

.pagination-prev:hover .pagination-arrow {
  transform: translateX(-4px);
}

.pagination-next:hover .pagination-arrow {
  transform: translateX(4px);
}

.pagination-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.pagination-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.pagination-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pagination-link:hover .pagination-title {
  color: var(--primary-light);
}

@media (max-width: 640px) {
  .post-pagination {
    grid-template-columns: 1fr;
  }

  .pagination-disabled {
    display: none;
  }
}

/* ==========================================================================
   Post Top Navigation
   ========================================================================== */
.post-nav-top {
  position: relative;
  background: var(--surface-solid);
  border: none;
  border-radius: 16px;
  padding: 1rem 1.5rem;
  backdrop-filter: blur(20px);
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
  margin-bottom: 1.5rem;
  opacity: 0;
  transform: translateY(20px);
}

/* Animated gradient border */
.post-nav-top::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 17px;
  padding: 1px;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--primary), var(--secondary));
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: gradientBorderFlow 8s ease-in-out infinite;
  opacity: 0.5;
  z-index: -1;
}

.loaded:not(.spa-navigating) .post-nav-top:not(.js-animated) {
  animation: postFadeIn 0.5s ease forwards;
  animation-delay: 0.05s;
}

.post-nav-top-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
}

.post-nav-top-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-nav-top-link:hover {
  color: var(--primary-light);
}

.post-nav-top-prev {
  text-align: left;
}

.post-nav-top-back {
  text-align: center;
  color: var(--primary-light);
  font-weight: 600;
}

.post-nav-top-next {
  text-align: right;
}

/* Sticky bar */
.post-nav-sticky {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--surface-solid);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.post-nav-sticky.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.post-nav-sticky-inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 2rem;
}

.post-nav-sticky-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.post-nav-sticky-right {
  display: flex;
  align-items: center;
}

.post-nav-sticky-right .site-nav {
  display: flex;
  gap: 1.5rem;
}

.post-nav-sticky-right .site-nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: color var(--transition);
  position: relative;
}

.post-nav-sticky-right .site-nav a:hover {
  color: var(--text);
}

.post-nav-sticky-right .site-nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--primary);
  transition: width var(--transition);
}

.post-nav-sticky-right .site-nav a:hover::after {
  width: 100%;
}

.post-nav-sticky-right .site-nav .nav-icon {
  display: flex;
  align-items: center;
}

.post-nav-sticky-link {
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  transition: color var(--transition);
}

.post-nav-sticky-link:hover {
  color: var(--primary-light);
}

.post-nav-sticky-posts {
  color: var(--primary);
  font-weight: 600;
}

.post-nav-sticky-disabled {
  opacity: 0.3;
  pointer-events: none;
}

.post-nav-sticky-top {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  padding: 0.25rem 0.75rem;
  cursor: pointer;
  transition: all var(--transition);
}

.post-nav-sticky-top:hover {
  color: var(--primary-light);
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
}

/* Hide site header when sticky bar is active */
.site-header.header-hidden {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Smoothly restore site header */
.site-header {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Kill header transitions during SPA navigation to prevent stale state flashes */
.spa-navigating .site-header {
  transition: none !important;
}

/* FPS monitor repositions into sticky bar area */
.fps-monitor.fps-in-sticky {
  top: 0.45rem;
  transition: top 0.3s ease;
}

@media (max-width: 768px) {
  .post-nav-top {
    padding: 0.75rem 1rem;
    border-radius: 12px;
  }

  .post-nav-top-inner {
    grid-template-columns: 1fr auto 1fr;
    gap: 0.5rem;
  }

  .post-nav-top-link {
    font-size: 0.75rem;
  }

  .post-nav-sticky-inner {
    padding: 0.5rem 1rem;
  }

  .post-nav-sticky-left {
    gap: 0.75rem;
  }

  .post-nav-sticky-link {
    font-size: 0.75rem;
  }

  .post-nav-sticky-right .site-nav {
    gap: 1rem;
  }

  .post-nav-sticky-right .site-nav a {
    font-size: 0.75rem;
  }
}

/* ==========================================================================
   Flying Words Animation
   ========================================================================== */
.flying-word {
  display: inline-block;
  opacity: 0;
}

/* ==========================================================================
   Page Layout
   ========================================================================== */
.page {
  max-width: 48rem;
  margin: 0 auto;
  padding: 6rem 2rem 4rem;
}

.page-container {
  position: relative;
  background: var(--surface-solid);
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 2.5rem;
  backdrop-filter: blur(20px);
  box-shadow:
    0 0 60px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  z-index: 0;
  /* Hidden until loaded */
  opacity: 0;
  transform: translateY(20px);
}

/* Animated gradient border for page container */
.page-container::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 17px;
  padding: 1px;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--primary), var(--secondary));
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: gradientBorderFlow 8s ease-in-out infinite;
  opacity: 0.5;
  z-index: -1;
  pointer-events: none;
}

.loaded:not(.spa-navigating) .page-container:not(.js-animated) {
  animation: postFadeIn 0.5s ease forwards;
  animation-delay: 0.1s;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, var(--text), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-content p {
  margin-bottom: 1rem;
  color: var(--text-dim);
  line-height: 1.8;
}

.page-content a {
  color: var(--primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition);
}

.page-content a:hover {
  border-bottom-color: var(--primary);
}

.page-content strong em,
.page-content em strong {
  font-style: normal;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary-light), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% 200%;
  animation: italicShimmer 6s ease-in-out infinite;
  filter: drop-shadow(0 0 14px rgba(139, 92, 246, 0.6)) drop-shadow(0 0 30px rgba(236, 72, 153, 0.3));
  padding: 0 0.15em;
  margin: 0 -0.15em;
  display: inline;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.connect-heading {
  margin-top: 3rem;
}

/* ==========================================================================
   Archive Page
   ========================================================================== */
.archive {
  max-width: 50rem;
  margin: 0 auto;
  padding: 6rem 2rem 4rem;
  opacity: 0;
  transform: translateY(20px);
}

.loaded:not(.spa-navigating) .archive:not(.js-animated) {
  animation: postFadeIn 0.5s ease forwards;
  animation-delay: 0.1s;
}

.archive-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2rem;
  background: linear-gradient(135deg, var(--text), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.archive-nav {
  display: flex;
  gap: 1rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.archive-year-link {
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.5rem;
  background: var(--surface);
  transition: all var(--transition);
  position: relative;
  z-index: 0;
}

/* Animated gradient border for archive year links */
.archive-year-link::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: calc(0.5rem + 1px);
  padding: 1px;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--primary), var(--secondary));
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: gradientBorderFlow 8s ease-in-out infinite;
  opacity: 0.5;
  z-index: -1;
  pointer-events: none;
  transition: opacity var(--transition);
}

.archive-year-link:hover {
  color: var(--primary-light);
  background: var(--surface-hover);
}

.archive-year-link:hover::before {
  opacity: 0.8;
}

.archive-year {
  margin-bottom: 3rem;
}

.archive-year-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--primary-light);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: none;
  position: relative;
}

.archive-year-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--primary));
  background-size: 200% 100%;
  opacity: 0.6;
  box-shadow:
    0 0 6px rgba(139, 92, 246, 0.4),
    0 0 15px rgba(139, 92, 246, 0.2),
    0 0 30px rgba(236, 72, 153, 0.1);
  animation: headingBorderFlicker 6s ease-in-out infinite;
}

.archive-month {
  margin-bottom: 2rem;
}

.archive-month-title {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.archive-posts {
  list-style: none;
}

.archive-post {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: none;
  position: relative;
}

.archive-post::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--primary), var(--secondary), transparent);
  background-size: 200% 100%;
  opacity: 0.25;
  box-shadow:
    0 0 4px rgba(139, 92, 246, 0.2),
    0 0 10px rgba(139, 92, 246, 0.1);
  animation: archivePostFlicker 8s ease-in-out infinite;
}

.archive-post:last-child::after {
  display: none;
}

@keyframes archivePostFlicker {
  0%, 100% {
    opacity: 0.25;
    background-position: 0% 50%;
    box-shadow:
      0 0 4px rgba(139, 92, 246, 0.2),
      0 0 10px rgba(139, 92, 246, 0.1);
  }
  20% {
    opacity: 0.2;
    box-shadow:
      0 0 3px rgba(139, 92, 246, 0.15),
      0 0 8px rgba(139, 92, 246, 0.08);
  }
  40% {
    opacity: 0.35;
    background-position: 50% 50%;
    box-shadow:
      0 0 5px rgba(139, 92, 246, 0.25),
      0 0 12px rgba(139, 92, 246, 0.12);
  }
  60% {
    opacity: 0.2;
    box-shadow:
      0 0 3px rgba(139, 92, 246, 0.15),
      0 0 7px rgba(139, 92, 246, 0.07);
  }
  80% {
    opacity: 0.3;
    background-position: 100% 50%;
    box-shadow:
      0 0 5px rgba(139, 92, 246, 0.22),
      0 0 11px rgba(139, 92, 246, 0.1);
  }
}

.archive-date {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  min-width: 4rem;
}

.archive-link {
  color: var(--text);
  text-decoration: none;
  transition: color var(--transition);
}

.archive-link:hover {
  color: var(--primary-light);
}

/* ==========================================================================
   Navigation Loading State
   ========================================================================== */
.navigating {
  cursor: wait;
}

.navigating * {
  pointer-events: none !important;
}

.navigating::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(1, 1, 8, 0.3);
  z-index: 9999;
  animation: fadeIn 0.15s ease;
}

.navigating::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg,
    transparent,
    var(--primary),
    var(--secondary),
    var(--primary),
    transparent
  );
  z-index: 10000;
  animation: loadingSlide 0.8s ease-in-out infinite;
}

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

@keyframes loadingSlide {
  0% {
    left: -30%;
    width: 30%;
  }
  50% {
    width: 40%;
  }
  100% {
    left: 100%;
    width: 30%;
  }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  padding: 2rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid rgba(139, 92, 246, 0.1);
}

.rss-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 1rem;
  color: var(--text-muted);
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.2s, color 0.2s;
}

.rss-link:hover {
  opacity: 1;
  color: var(--primary);
}

.rss-link svg {
  flex-shrink: 0;
}


/* ==========================================================================
   Accessibility
   ========================================================================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1rem 2rem;
  background: var(--primary);
  color: var(--text);
  text-decoration: none;
  border-radius: 8px;
  z-index: 10000;
  transition: top var(--transition);
}

.skip-link:focus {
  top: 10px;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }

  .flying-word {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
  /* Non-sticky header - scrolls with content */
  .site-header {
    position: relative;
    padding: 1rem;
    padding-bottom: 0.15rem;
    margin-bottom: 0.1rem;
    background: transparent;
    pointer-events: auto;
  }

  .site-header .container {
    flex-direction: column;
    gap: 0.75rem;
  }

  .site-nav {
    gap: 1.5rem;
  }

  .site-nav a {
    font-size: 1.15rem;
  }

  .site-title {
    display: none;
  }

  /* Non-sticky footer - scrolls with content */
  .site-footer {
    position: relative;
  }

  /* Hide the special post sticky nav on mobile - use regular nav only */
  .post-nav-sticky {
    display: none !important;
  }

  /* Adjust page padding since header is no longer fixed */
  .home .intro {
    padding: 2rem 1rem 2rem;
  }

  .home .intro h1 {
    font-size: 1.75rem;
  }

  .post,
  .page {
    padding: 2rem 1rem 2rem;
  }

  .archive,
  .search-page {
    padding: 2rem 1rem 2rem;
  }

  .post-header,
  .post-content,
  .post-footer,
  .page-container {
    padding: 1.5rem;
    border-radius: 12px;
  }

  .post-title {
    font-size: 1.5rem;
  }

  .posts {
    padding: 1rem;
    text-align: center;
  }

  .post-item {
    padding: 1.25rem;
    text-align: left;
  }

  .post-item-subtitle {
    display: block;
    margin-left: 0;
    margin-top: 0.25rem;
  }

  /* Simple animations on mobile - no fancy rotates or zooms */
  .post-item {
    transform: none;
  }

  .loaded:not(.spa-navigating) .post-item:not(.js-animated) {
    animation: mobileFadeIn 0.3s ease forwards;
  }

  .loaded:not(.spa-navigating) .post-item:not(.js-animated):nth-child(1) { animation-delay: 0.05s; }
  .loaded:not(.spa-navigating) .post-item:not(.js-animated):nth-child(2) { animation-delay: 0.1s; }
  .loaded:not(.spa-navigating) .post-item:not(.js-animated):nth-child(3) { animation-delay: 0.15s; }
  .loaded:not(.spa-navigating) .post-item:not(.js-animated):nth-child(4) { animation-delay: 0.2s; }
  .loaded:not(.spa-navigating) .post-item:not(.js-animated):nth-child(5) { animation-delay: 0.25s; }
  .loaded:not(.spa-navigating) .post-item:not(.js-animated):nth-child(6) { animation-delay: 0.3s; }
}

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

/* Very narrow screens - reduce nav font size */
@media (max-width: 399px) {
  .site-nav a {
    font-size: 0.7rem;
  }
}

/* Touch device optimizations */
@media (hover: none) {
  .post-item:hover {
    transform: none !important;
  }

  .post-item:active {
    transform: scale(0.98) !important;
    transition: transform 0.1s;
  }
}

/* ==========================================================================
   About Page Specific
   ========================================================================== */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

@media (min-width: 640px) {
  .about-grid {
    grid-template-columns: auto 1fr;
  }
}

.about-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid var(--border);
  box-shadow: var(--glow);
  object-fit: cover;
}

.about-links {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.about-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: all var(--transition);
}

@media (max-width: 480px) {
  .about-links {
    gap: 0.5rem;
  }
  .about-link {
    padding: 0.4rem 0.6rem;
    font-size: 0.8rem;
    gap: 0.35rem;
  }
  .about-link svg {
    width: 14px;
    height: 14px;
  }
}

.about-link:hover {
  background: rgba(139, 92, 246, 0.25);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.about-link svg {
  width: 18px;
  height: 18px;
}

/* Skills section */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.skill-tag {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  min-height: 2.5rem;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
  text-align: center;
  transition: all var(--transition);
}

.skill-tag:hover {
  background: rgba(139, 92, 246, 0.2);
  color: var(--text);
  transform: translateY(-2px);
}

/* ==========================================================================
   FPS Monitor
   ========================================================================== */
.fps-monitor {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
  font-family: var(--font-mono);
}

.fps-monitor.dragging {
  user-select: none;
}

/* Minimized link state */
.fps-link {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.3rem 0.5rem;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
}

.fps-link:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.7);
}

/* Expanded panel state */
.fps-panel {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--border);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  transition: border-color 0.3s;
  cursor: grab;
}

.fps-panel:active {
  cursor: grabbing;
}

.fps-panel-header {
  display: none;
}

.fps-close {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 16px;
  height: 16px;
  border: none;
  background: rgba(60, 60, 70, 0.95);
  color: var(--text-muted);
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
  opacity: 0;
}

.fps-panel:hover .fps-close {
  opacity: 1;
}

.fps-close:hover {
  background: rgba(80, 80, 90, 0.95);
  color: var(--text);
}

.fps-graph {
  width: 100px;
  height: 32px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
}

.fps-counter {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.3s;
}

/* Tier-based colors */
.fps-monitor[data-tier="superUltra"] .fps-panel {
  border-color: rgba(240, 171, 252, 0.4);
  box-shadow: 0 0 15px rgba(240, 171, 252, 0.2);
}
.fps-monitor[data-tier="superUltra"] .fps-link,
.fps-monitor[data-tier="superUltra"] .fps-counter {
  color: #f0abfc;
  text-shadow: 0 0 10px rgba(240, 171, 252, 0.5);
}

.fps-monitor[data-tier="ultra"] .fps-panel {
  border-color: rgba(192, 132, 252, 0.4);
}
.fps-monitor[data-tier="ultra"] .fps-link,
.fps-monitor[data-tier="ultra"] .fps-counter {
  color: #c084fc;
}

.fps-monitor[data-tier="high"] .fps-panel {
  border-color: rgba(34, 211, 238, 0.3);
}
.fps-monitor[data-tier="high"] .fps-link,
.fps-monitor[data-tier="high"] .fps-counter {
  color: #22d3ee;
}

.fps-monitor[data-tier="medium"] .fps-panel {
  border-color: rgba(74, 222, 128, 0.3);
}
.fps-monitor[data-tier="medium"] .fps-link,
.fps-monitor[data-tier="medium"] .fps-counter {
  color: #4ade80;
}

.fps-monitor[data-tier="low"] .fps-panel {
  border-color: rgba(251, 191, 36, 0.3);
}
.fps-monitor[data-tier="low"] .fps-link,
.fps-monitor[data-tier="low"] .fps-counter {
  color: #fbbf24;
}

.fps-monitor[data-tier="potato"] .fps-panel {
  border-color: rgba(248, 113, 113, 0.3);
  animation: potatoPulse 1s ease-in-out infinite;
}
.fps-monitor[data-tier="potato"] .fps-link,
.fps-monitor[data-tier="potato"] .fps-counter {
  color: #f87171;
}

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

/* Hide unless screen is wide enough */
@media (max-width: 1349px) {
  .fps-monitor {
    display: none;
  }
}

/* Hide when reduced motion preferred */
@media (prefers-reduced-motion: reduce) {
  .fps-monitor {
    display: none;
  }
}

/* ==========================================================================
   Syntax Highlighting (Rouge - Monokai)
   ========================================================================== */
.highlight .c, .highlight .ch, .highlight .cd, .highlight .cpf,
.highlight .cm, .highlight .c1 { color: #75715e; font-style: italic; }
.highlight .cp, .highlight .cs { color: #75715e; font-weight: bold; }
.highlight .err { color: #960050; }
.highlight .gi { color: #a6e22e; }
.highlight .gd { color: #f92672; }
.highlight .k, .highlight .kv, .highlight .kc, .highlight .kd,
.highlight .kp, .highlight .kr, .highlight .kt { color: #66d9ef; font-weight: bold; }
.highlight .kn, .highlight .ow, .highlight .o { color: #f92672; font-weight: bold; }
.highlight .mf, .highlight .mh, .highlight .il, .highlight .mi,
.highlight .mo, .highlight .m, .highlight .mb, .highlight .mx { color: #ae81ff; }
.highlight .se { color: #ae81ff; }
.highlight .sa { color: #66d9ef; font-weight: bold; }
.highlight .sb, .highlight .sc, .highlight .sd, .highlight .s2,
.highlight .sh, .highlight .si, .highlight .sx, .highlight .sr,
.highlight .s1, .highlight .ss, .highlight .s, .highlight .dl { color: #e6db74; }
.highlight .na { color: #a6e22e; }
.highlight .nc, .highlight .nd, .highlight .ne,
.highlight .nf, .highlight .fm { color: #a6e22e; font-weight: bold; }
.highlight .no { color: #66d9ef; }
.highlight .bp, .highlight .nb, .highlight .ni, .highlight .nn,
.highlight .vc, .highlight .vg, .highlight .vi, .highlight .nv,
.highlight .vm, .highlight .w { color: #f8f8f2; }
.highlight .nl { color: #f8f8f2; font-weight: bold; }
.highlight .nt { color: #f92672; }

/* ==========================================================================
   Back to Top Button
   ========================================================================== */
.back-to-top {
  display: none;
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 80;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease, border-color var(--transition), color var(--transition);
}

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

.back-to-top:hover {
  border-color: var(--primary);
  color: var(--primary-light);
  box-shadow: 0 0 15px rgba(139, 92, 246, 0.4), inset 0 0 10px rgba(139, 92, 246, 0.1);
}

@media (max-width: 768px) {
  .back-to-top {
    display: flex;
    bottom: 1rem;
    right: auto;
    left: 1rem;
    width: 36px;
    height: 36px;
  }
}

/* ==========================================================================
   Search Page
   ========================================================================== */
.search-page {
  max-width: 50rem;
  margin: 0 auto;
  padding: 6rem 2rem 4rem;
  min-height: calc(100vh - 6rem);
  opacity: 0;
  transform: translateY(20px);
}

.loaded:not(.spa-navigating) .search-page:not(.js-animated) {
  animation: postFadeIn 0.5s ease forwards;
  animation-delay: 0.1s;
}

.search-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  background: linear-gradient(135deg, var(--text), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.search-input-wrap {
  position: relative;
  margin-bottom: 1rem;
}

/* Animated gradient border for search input */
.search-input-wrap::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 13px;
  padding: 1px;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--primary), var(--secondary));
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: gradientBorderFlow 8s ease-in-out infinite;
  opacity: 0.5;
  z-index: -1;
  pointer-events: none;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  z-index: 1;
}

.search-input {
  width: 100%;
  padding: 0.85rem 1rem 0.85rem 2.75rem;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  backdrop-filter: blur(12px);
  transition: box-shadow var(--transition);
  outline: none;
}

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

.search-input:focus {
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.3), 0 0 60px rgba(139, 92, 246, 0.1);
}

.search-input-wrap:focus-within::before {
  opacity: 0.8;
}

/* Filter chips */
.search-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid var(--border);
  border-radius: 9999px;
  color: var(--primary-light);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition), color var(--transition);
}

.filter-chip:hover {
  background: rgba(139, 92, 246, 0.3);
  border-color: var(--primary);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
  color: var(--text);
}

.filter-chip-x {
  font-size: 1rem;
  line-height: 1;
  opacity: 0.6;
  padding: 0 0.1rem;
  margin-left: 0.1rem;
  border-radius: 50%;
  transition: opacity var(--transition), background var(--transition), color var(--transition);
}

.filter-chip:hover .filter-chip-x {
  opacity: 1;
}

.filter-chip-x:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.filter-chip-clear {
  background: rgba(236, 72, 153, 0.1);
  border-color: rgba(236, 72, 153, 0.25);
  color: var(--secondary);
}

.filter-chip-clear:hover {
  background: rgba(236, 72, 153, 0.25);
  border-color: var(--secondary);
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.3);
}

@keyframes chipAppear {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Count */
.search-count {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  transition: opacity 0.3s ease;
}

.search-count-empty {
  color: var(--secondary);
}

/* Results - uses .post-item for cards */
.search-results {
  display: grid;
  gap: 1rem;
}

.search-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  animation: emptyPulse 2s ease-in-out infinite;
}

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

/* Pagination */
.search-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 12px;
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 0;
}

/* Animated gradient border for search pagination */
.search-pagination::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 13px;
  padding: 1px;
  background: linear-gradient(135deg, var(--primary), var(--secondary), var(--primary), var(--secondary));
  background-size: 300% 300%;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: gradientBorderFlow 8s ease-in-out infinite;
  opacity: 0.5;
  z-index: -1;
  pointer-events: none;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.page-num,
.page-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
  transition: all var(--transition);
}

.page-num:hover,
.page-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-hover);
}

.page-num--active {
  color: var(--text);
  border-color: var(--primary);
  background: rgba(139, 92, 246, 0.2);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.3);
  transform: scale(1.1);
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.page-size-selector {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.page-size-option {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  transition: color var(--transition);
}

.page-size-option:hover {
  color: var(--text);
}

.page-size-active {
  color: var(--primary-light);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.page-size-dot {
  color: var(--text-muted);
  opacity: 0.4;
}

/* Post item tags on index cards */
.post-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

/* Date links */
.post-date-link {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition);
}

.post-date-link:hover {
  color: var(--primary-light);
}

/* Tag links (make <a> tags look like spans) */
a.tag {
  text-decoration: none;
  cursor: pointer;
}

@media (max-width: 768px) {
  .search-page {
    padding: 5rem 1rem 3rem;
  }

  .search-pagination {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }

  .pagination-pages {
    justify-content: center;
  }

  .page-size-selector {
    justify-content: center;
  }
}
