:root {
  --bg-base: #08080a;
  --bg-surface: #111115;
  --bg-card: rgba(10, 10, 14, 0.8);
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-active: rgba(255, 255, 255, 0.12);
  
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  
  /* Monochromatic Accents */
  --accent: #e4e4e7;
  --accent-glow: rgba(255, 255, 255, 0.08);
  --accent-gradient: linear-gradient(90deg, #52525b 0%, #a1a1aa 50%, #ffffff 100%);
  
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  
  --max-width: 1120px;
  --content-width: 680px;
  --radius: 14px;
  --transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   1. Reset & Base Styles
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.7;
  font-size: 1.05rem;
  -webkit-font-smoothing: antialiased;
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Hide Reading Time Globally */
.feed-reading-time,
.post-reading-time,
.post-card-reading-time {
  display: none !important;
}

/* ==========================================================================
   2. Monochromatic Ultra-Subtle Animated Background
   ========================================================================== */
.ambient-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background-color: var(--bg-base);
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(160px);
  will-change: transform, opacity;
  pointer-events: none;
}

.orb-primary {
  top: -20%;
  left: 15%;
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.035) 0%, rgba(255, 255, 255, 0) 70%);
  animation: breatheSlow 28s ease-in-out infinite alternate;
}

.orb-secondary {
  top: 35%;
  right: -10%;
  width: 800px;
  height: 800px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.025) 0%, rgba(255, 255, 255, 0) 70%);
  animation: driftSlow 36s ease-in-out infinite alternate;
}

.orb-tertiary {
  bottom: -20%;
  left: -10%;
  width: 750px;
  height: 750px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0) 70%);
  animation: pulseSlow 32s ease-in-out infinite alternate;
}

.ambient-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  opacity: 0.35;
  mask-image: radial-gradient(circle at 50% 30%, black 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, black 0%, transparent 75%);
}

@keyframes breatheSlow {
  0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.3; }
  50% { transform: translate3d(80px, 50px, 0) scale(1.15); opacity: 0.7; }
  100% { transform: translate3d(-40px, 90px, 0) scale(0.95); opacity: 0.4; }
}

@keyframes driftSlow {
  0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.5; }
  50% { transform: translate3d(-90px, -60px, 0) scale(1.1); opacity: 0.2; }
  100% { transform: translate3d(50px, 40px, 0) scale(0.9); opacity: 0.6; }
}

@keyframes pulseSlow {
  0% { transform: translate3d(0, 0, 0) scale(0.9); opacity: 0.2; }
  50% { transform: translate3d(100px, -50px, 0) scale(1.2); opacity: 0.6; }
  100% { transform: translate3d(-60px, -80px, 0) scale(1); opacity: 0.3; }
}

/* Reading Progress Bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--accent-gradient);
  z-index: 100;
  width: 0%;
  transition: width 0.1s ease-out;
}

/* ==========================================================================
   3. Glass Header & Navigation Drawer
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: rgba(8, 8, 10, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.site-logo .logo-text {
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  background: var(--text-primary);
  -webkit-background-clip: text;
  background-clip: text;
}

.site-nav ul {
  display: flex;
  gap: 1.5rem;
  list-style: none;
}

.site-nav a {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
}

.site-nav a:hover,
.site-nav .nav-current a {
  color: var(--text-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.icon-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.mobile-menu-toggle {
  display: none;
}

.mobile-menu-toggle .icon-close {
  display: none;
}

.mobile-menu-toggle.is-active .icon-hamburger {
  display: none;
}

.mobile-menu-toggle.is-active .icon-close {
  display: block;
}

/* Mobile Drawer */
.mobile-drawer {
  display: none;
  position: fixed;
  top: 72px;
  left: 0;
  width: 100vw;
  height: calc(100vh - 72px);
  background: rgba(8, 8, 10, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 2rem 1.5rem;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 89;
}

.mobile-drawer.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.mobile-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.mobile-nav a {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}

@media (max-width: 820px) {
  .desktop-only { display: none !important; }
  .mobile-menu-toggle { display: flex; }
  .mobile-drawer { display: flex; }
}

/* ==========================================================================
   4. Social Stream Feed (Instagram / Threads Style Layout & Controls)
   ========================================================================== */
.feed-container {
  max-width: 620px;
  margin: 2.5rem auto 1rem auto;
  padding: 0 1rem;
}

.post-feed {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.feed-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  overflow: hidden;
  transition: var(--transition);
}

.feed-card:hover {
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
}

/* Feed Author Header & Header Actions */
.feed-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 1.1rem 1.25rem;
}

.feed-author-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.feed-author-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-subtle);
}

.feed-author-avatar-placeholder {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.feed-author-meta {
  display: flex;
  flex-direction: column;
}

.feed-author-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  line-height: 1.2;
}

.feed-card-date {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.feed-header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.feed-share-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.feed-share-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

/* Media Carousel & Embed Optimizations */
.feed-media-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}

.feed-media-slider {
  display: flex;
  width: 100%;
  height: 100%;
  position: relative;
}

.feed-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  pointer-events: none;
}

.feed-slide.active {
  opacity: 1;
  pointer-events: auto;
}

.feed-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  -webkit-user-drag: none;
}

.feed-iframe-wrapper {
  width: 100%;
  height: 100%;
}

.feed-iframe-wrapper iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Carousel Navigation Arrows */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  z-index: 10;
  transition: background 0.2s ease, opacity 0.2s ease;
  opacity: 0.85;
}

.carousel-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  opacity: 1;
}

.prev-btn { left: 12px; }
.next-btn { right: 12px; }

/* Carousel Dots */
.carousel-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  z-index: 10;
}

.carousel-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  transition: background 0.2s ease, transform 0.2s ease;
}

.carousel-dot.active {
  background: #ffffff;
  transform: scale(1.25);
}

/* Feed Content */
.feed-card-content {
  padding: 1rem 1.25rem 1.25rem 1.25rem;
}

.feed-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  margin-bottom: 0.35rem;
  color: var(--text-primary);
}

.feed-card-excerpt {
  color: var(--text-secondary);
  font-size: 0.925rem;
  line-height: 1.55;
}

.feed-status-text {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-primary);
  font-weight: 400;
  letter-spacing: -0.01em;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 4.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pagination a {
  color: var(--text-secondary);
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  transition: var(--transition);
}

.pagination a:hover {
  color: var(--text-primary);
  border-color: var(--border-active);
  background: var(--bg-card);
}

@media (max-width: 640px) {
  .feed-container {
    margin: 1rem auto 0.5rem auto;
    padding: 0 0.5rem;
  }
  .feed-card { border-radius: 12px; }
  .pagination { margin-top: 3rem; }
}

/* ==========================================================================
   5. Expanded Lightbox Modal Overlay
   ========================================================================== */
.lightbox-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 1.5rem;
  touch-action: pan-y;
  user-select: none;
}

.lightbox-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox-content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90vw;
  max-height: 85vh;
}

.lightbox-img {
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.8);
  animation: zoomInLightbox 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes zoomInLightbox {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lightbox-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 1.75rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1010;
  transition: background 0.2s ease;
}

.lightbox-close:hover { background: rgba(255, 255, 255, 0.25); }

.lightbox-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  z-index: 1010;
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox-btn:hover { background: rgba(255, 255, 255, 0.25); transform: translateY(-50%) scale(1.05); }

.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }

.lightbox-counter {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.5);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1010;
}

@media (max-width: 640px) {
  .lightbox-prev { left: 0.5rem; width: 38px; height: 38px; }
  .lightbox-next { right: 0.5rem; width: 38px; height: 38px; }
}

/* ==========================================================================
   6. Single Post & Page Templates
   ========================================================================== */
.post-single {
  max-width: var(--content-width);
  padding-top: 3.5rem;
  padding-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .post-single { padding-top: 2rem; }
  .post-title { font-size: 2rem !important; }
}

.post-meta-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.tag-badge {
  background: var(--accent-glow);
  color: var(--accent);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.75rem;
  border: 1px solid var(--border-subtle);
}

.meta-dot { color: var(--text-muted); }

.post-title {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.post-excerpt {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin-top: 1rem;
  line-height: 1.5;
}

.post-author-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 2rem;
  margin-bottom: 2.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
}

.author-avatar { width: 40px; height: 40px; border-radius: 50%; }
.author-name { font-weight: 600; font-size: 0.95rem; }

.post-feature-image { margin: 2.5rem 0; }
.post-feature-image img { border-radius: var(--radius); border: 1px solid var(--border-subtle); }
.post-feature-image figcaption { text-align: center; font-size: 0.85rem; color: var(--text-muted); margin-top: 0.5rem; }

/* ==========================================================================
   7. Content Typography & Clean Footer
   ========================================================================== */
.gh-content p, .gh-content ul, .gh-content ol { margin-bottom: 1.75rem; color: #e4e4e7; }
.gh-content h2 { font-size: 1.8rem; font-weight: 700; letter-spacing: -0.02em; margin: 3rem 0 1rem 0; }
.gh-content h3 { font-size: 1.4rem; font-weight: 600; margin: 2rem 0 0.75rem 0; }
.gh-content a { color: var(--text-primary); text-decoration: underline; text-underline-offset: 4px; }
.gh-content blockquote { border-left: 2px solid var(--text-primary); padding-left: 1.25rem; font-style: italic; color: var(--text-secondary); margin: 2rem 0; }
.gh-content code { font-family: var(--font-mono); background: var(--bg-surface); border: 1px solid var(--border-subtle); padding: 0.2em 0.4em; border-radius: 5px; font-size: 0.875em; color: var(--text-primary); }
.gh-content pre { background: var(--bg-surface); border: 1px solid var(--border-subtle); padding: 1.25rem; border-radius: var(--radius); overflow-x: auto; margin: 2rem 0; }
.gh-content pre code { background: none; border: none; padding: 0; color: #e4e4e7; }

.kg-card { margin: 2rem 0; }
.kg-image-card img { border-radius: var(--radius); width: 100%; }

.kg-width-wide {
  position: relative;
  width: 100vw;
  max-width: 960px;
  left: 50%;
  transform: translateX(-50%);
}

.kg-width-full {
  position: relative;
  width: 100vw;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
}

.kg-width-full img { border-radius: 0; }

.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 2.25rem 0;
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-title {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}