/* ===== Theme Color Overrides ===== */
:root {
  --primary: rgb(160, 163, 168);
  --secondary: rgb(130, 133, 138);
  --content: rgb(80, 82, 86);
  --code-block-bg: rgb(65, 68, 78);
}
:root[data-theme="dark"] {
  --primary: rgb(190, 193, 198);
  --secondary: rgb(165, 168, 173);
  --content: rgb(210, 212, 215);
  --code-block-bg: rgb(58, 62, 75);
}

/* ===== Header Above Canvas ===== */
.header {
  position: relative;
  z-index: 100;
}

/* ===== Tech Background ===== */
#bg-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 0;
  pointer-events: none;
  background: #030014;
}

/* Grid overlay */
#bg-canvas::before {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
  background-image:
    linear-gradient(rgba(0,255,249,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,249,0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

/* Scanline effect */
.scanline {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
}

/* Ambient glow orbs */
body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.15;
  z-index: 0;
  pointer-events: none;
  animation: orbFloat 15s ease-in-out infinite;
}
body::before {
  width: 600px; height: 600px;
  background: #00f0ff;
  top: -200px; left: -200px;
}
body::after {
  width: 500px; height: 500px;
  background: #bd00ff;
  bottom: -200px; right: -200px;
  animation-delay: -7s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(80px, 60px) scale(1.1); }
  50% { transform: translate(40px, 120px) scale(0.95); }
  75% { transform: translate(-40px, 60px) scale(1.05); }
}

/* ===== Layout ===== */
#content {
  position: relative;
  z-index: 10;
}

/* ===== Header / Nav ===== */
.top-nav {
  background: rgba(3, 0, 20, 0.85) !important;
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 240, 249, 0.15);
  box-shadow: 0 0 30px rgba(0, 240, 249, 0.05);
}

.top-nav a {
  color: rgba(255,255,255,0.75) !important;
  transition: all 0.3s ease;
  position: relative;
}
.top-nav a:hover, .top-nav a.active {
  color: #00f0ff !important;
  text-shadow: 0 0 10px rgba(0,240,249,0.8), 0 0 20px rgba(0,240,249,0.4);
}
.top-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 0;
  width: 0; height: 2px;
  background: linear-gradient(90deg, #00f0ff, #bd00ff);
  transition: width 0.3s ease;
  box-shadow: 0 0 8px #00f0ff;
}
.top-nav a:hover::after, .top-nav a.active::after {
  width: 100%;
}

/* ===== Hero Section ===== */
/* .home-hero {
  min-height: 80vh;
  ...
} */

.home-hero {
  min-height: auto !important;
  padding: 2rem 0 0.75rem !important;
}

.home-hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: radial-gradient(ellipse at 50% 50%, rgba(0,240,249,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.home-hero .hero-title {
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 900;
  background: linear-gradient(135deg, #00f0ff 0%, #bd00ff 50%, #00f0ff 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 5s ease infinite;
  letter-spacing: -2px;
  line-height: 1.1;
  text-shadow: none;
  filter: drop-shadow(0 0 30px rgba(0,240,249,0.3));
}

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

.home-hero .hero-subtitle {
  font-size: clamp(1rem, 3vw, 1.4rem);
  color: rgba(255,255,255,0.6);
  margin-top: 20px;
  letter-spacing: 4px;
  text-transform: uppercase;
}

.home-hero .hero-tags {
  display: flex;
  gap: 12px;
  margin-top: 30px;
  flex-wrap: wrap;
  justify-content: center;
}

.home-hero .hero-tag {
  padding: 6px 16px;
  border: 1px solid rgba(0,240,249,0.3);
  border-radius: 20px;
  font-size: 0.8rem;
  color: #00f0ff;
  background: rgba(0,240,249,0.05);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
  cursor: default;
}
.home-hero .hero-tag:hover {
  background: rgba(0,240,249,0.15);
  border-color: #00f0ff;
  box-shadow: 0 0 15px rgba(0,240,249,0.3);
  transform: translateY(-2px);
}

/* ===== Post Cards ===== */
.post-entry {
  background: rgba(3, 0, 20, 0.6) !important;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(0,240,249,0.1) !important;
  border-radius: 16px !important;
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  overflow: hidden;
  position: relative;
}

.post-entry::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, #00f0ff, #bd00ff, #00f0ff);
  background-size: 200% 100%;
  animation: borderGlow 3s linear infinite;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.post-entry:hover::before { opacity: 1; }

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

.post-entry:hover {
  transform: translateY(-5px);
  border-color: rgba(0,240,249,0.3) !important;
  box-shadow: 0 10px 40px rgba(0,240,249,0.1), 0 0 60px rgba(189,0,255,0.05) !important;
  background: rgba(3, 0, 40, 0.8) !important;
}

.post-entry h2, .post-entry h2 a {
  color: rgba(255,255,255,0.9) !important;
  transition: color 0.3s;
}
.post-entry:hover h2, .post-entry:hover h2 a {
  color: #00f0ff !important;
  text-shadow: 0 0 20px rgba(0,240,249,0.5);
}

/* ===== Post Meta ===== */
.post-meta {
  color: rgba(255,255,255,0.4) !important;
  font-size: 0.85rem;
}
.post-meta a { color: rgba(0,240,249,0.6) !important; }

/* ===== Single Post ===== */
.page-body {
  background: rgba(3, 0, 20, 0.7);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(0,240,249,0.1);
  border-radius: 20px;
  padding: 60px !important;
  margin: 40px auto;
  max-width: 900px;
}

/* ===== Page Titles ===== */
.page-heading {
  font-size: 2.5rem;
  color: #fff !important;
  text-align: center;
  margin-bottom: 40px;
  position: relative;
  display: inline-block;
  width: 100%;
}
.page-heading::after {
  content: '';
  display: block;
  width: 80px;
  height: 3px;
  background: linear-gradient(90deg, #00f0ff, #bd00ff);
  margin: 16px auto 0;
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(0,240,249,0.5);
}

/* ===== Code Blocks ===== */
pre, code {
  background: rgba(0,240,249,0.05) !important;
  border: 1px solid rgba(0,240,249,0.1) !important;
  border-radius: 8px !important;
  color: #00f0ff !important;
}
pre {
  background: rgba(0,0,0,0.4) !important;
  box-shadow: inset 0 0 30px rgba(0,240,249,0.03);
}

/* ===== Footer ===== */
footer {
  background: rgba(3, 0, 20, 0.9) !important;
  border-top: 1px solid rgba(0,240,249,0.1) !important;
  color: rgba(255,255,255,0.4) !important;
  position: relative;
  z-index: 10;
}

/* Responsive merged into main mobile block */


/* ============================================
   MOBILE OPTIMIZATION (< 768px)
   ============================================ */

@media screen and (max-width: 768px) {

  /* ---- REMOVE ALL GLOW EFFECTS ON MOBILE (prevents ghosting/overlap) ---- */
  h1, h2, h3, h4,
  .post-title, .entry-header h2,
  .post-content h2, .post-content h3,
  .md-content h2, .md-content h3 {
    text-shadow: none !important;
    filter: none !important;
  }
  .home-hero .hero-title {
    filter: none !important;
    text-shadow: none !important;
  }
  .header-nav a:hover,
  .header-nav a.active,
  .entry-header h2 a:hover,
  article:hover .entry-hint-parent {
    text-shadow: none !important;
  }
  article.first-entry:hover,
  article.post-entry:hover {
    box-shadow: none !important;
    transform: none !important;
  }
  .post-tags a:hover {
    box-shadow: none !important;
  }

  /* ---- Canvas & Background: disable for perf ---- */
  #bg-canvas { display: none !important; }
  body::before, body::after {
    animation: none !important;
    opacity: 0.08 !important;
    filter: blur(80px) !important;
  }
  body::before { width: 300px !important; height: 300px !important; top: -100px !important; left: -100px !important; }
  body::after { width: 250px !important; height: 250px !important; bottom: -100px !important; right: -100px !important; }

  /* ---- Base Typography ---- */
  :root {
    --base-font-size: 15px !important;
    --base-content-font-size: 15px !important;
  }

  html {
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
  }

  /* ---- Header / Nav ---- */
  .header {
    padding: 0 16px !important;
    min-height: 56px !important;
    height: auto !important;
  }

  .header-nav {
    gap: 4px !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    white-space: nowrap !important;
    justify-content: flex-start !important;
    padding-bottom: 2px;
  }
  .header-nav::-webkit-scrollbar { display: none !important; }
  .header-nav a {
    font-size: 0.82rem !important;
    padding: 6px 8px !important;
    letter-spacing: 0 !important;
  }
  .logo { flex-shrink: 0 !important; }
  .logo a { font-size: 1.1rem !important; }
  .logo-switches { flex-shrink: 0 !important; }

  /* ---- Hero (homepage) ---- */
  /* .home-hero {
    min-height: 60vh !important;
    padding: 50px 20px !important;
  } */
  .home-hero .hero-title {
    font-size: clamp(1.8rem, 10vw, 3rem) !important;
    letter-spacing: -1px !important;
  }
  .home-hero .hero-subtitle {
    font-size: 0.75rem !important;
    letter-spacing: 3px !important;
  }
  .home-hero .hero-tags {
    gap: 8px !important;
    margin-top: 20px !important;
  }
  .home-hero .hero-tag {
    font-size: 0.72rem !important;
    padding: 4px 12px !important;
  }

  /* ---- Profile Mode ---- */
  .profile {
    flex-direction: column !important;
    text-align: center !important;
    padding: 30px 20px !important;
  }
  .profile img {
    width: 100px !important;
    height: 100px !important;
    transform: scale(1) !important;
    margin: 0 auto !important;
  }
  .profile .details { margin-top: 16px !important; }

  /* ---- Post Entry Cards ---- */
  .post-entry {
    margin-bottom: 16px !important;
    border-radius: 12px !important;
  }
  article.first-entry {
    min-height: 200px !important;
    padding: 24px 20px !important;
  }
  .entry-header { margin-bottom: 12px !important; }
  .entry-header h2 { font-size: 1.1rem !important; line-height: 1.4 !important; }

  /* ---- Single Post Article ---- */
  .post-single {
    padding: 24px 16px !important;
    margin: 16px 10px !important;
    border-radius: 16px !important;
    width: calc(100% - 20px) !important;
    max-width: 100% !important;
  }

  /* ---- Article Typography ---- */
  .post-title {
    font-size: 1.5rem !important;
    line-height: 1.35 !important;
    word-break: normal !important;
  }
  .post-content, .md-content {
    font-size: 15px !important;
    line-height: 1.75 !important;
  }
  .post-content h2, .md-content h2 {
    font-size: 1.15rem !important;
    border-left: 3px solid #bd00ff;
    padding-left: 10px !important;
    margin: 24px 0 12px !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }
  .post-content h3, .md-content h3 {
    font-size: 1rem !important;
    border-left: 2px solid #bd00ff;
    padding-left: 8px !important;
    margin: 18px 0 10px !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
  }
  .post-content h4, .md-content h4 {
    font-size: 0.95rem !important;
    margin: 14px 0 8px !important;
    word-break: normal !important;
  }
  .post-content p { margin: 12px 0 !important; }

  /* ---- Tables: horizontal scroll ---- */
  .post-content table, .md-content table {
    display: block !important;
    overflow-x: auto !important;
    white-space: nowrap !important;
    font-size: 0.82rem !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* ---- Blockquote ---- */
  .post-content blockquote, .md-content blockquote {
    padding: 10px 14px !important;
    margin: 16px 0 !important;
    font-size: 0.9rem !important;
  }

  /* ---- Code Blocks ---- */
  .post-content pre, .md-content pre {
    font-size: 0.78rem !important;
    line-height: 1.5 !important;
    overflow-x: auto !important;
    white-space: pre !important;
    word-break: normal !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .post-content code, .md-content code {
    font-size: 0.82em !important;
    padding: 1px 6px !important;
    word-break: normal !important;
  }
  pre code { font-size: 0.78rem !important; }

  /* ---- Page Heading ---- */
  .page-heading {
    font-size: 1.6rem !important;
    margin-bottom: 24px !important;
  }
  h1.page-heading::after {
    width: 60px !important;
    height: 2px !important;
    margin-top: 12px !important;
  }

  /* ---- TOC ---- */
  .toc {
    font-size: 0.82rem !important;
    padding: 12px 14px !important;
    margin: 0 0 20px 0 !important;
    overflow-x: auto !important;
  }
  .toc li { line-height: 1.6 !important; }

  /* ---- Breadcrumbs ---- */
  .breadcrumbs {
    font-size: 0.78rem !important;
    padding: 8px 16px !important;
    margin-bottom: 16px !important;
  }

  /* ---- Post Meta / Tags ---- */
  .post-meta {
    font-size: 0.78rem !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }
  .post-tags { flex-wrap: wrap !important; gap: 6px !important; }
  .post-tags a { font-size: 0.72rem !important; padding: 2px 8px !important; }

  /* ---- Share Buttons ---- */
  .share-buttons {
    flex-wrap: wrap !important;
    gap: 8px !important;
    justify-content: center !important;
  }

  /* ---- Search Box ---- */
  .search-box input {
    font-size: 15px !important;
    padding: 8px 12px !important;
  }

  /* ---- Footer ---- */
  footer { padding: 24px 16px !important; font-size: 0.82rem !important; }
  .footer {
    padding: 24px 16px !important;
    flex-direction: column !important;
    gap: 12px !important;
    text-align: center !important;
  }

  /* ---- ACP Index ---- */
  .terms-tags { gap: 8px !important; }
  .terms-tags a { font-size: 0.82rem !important; padding: 4px 12px !important; }

  /* ---- Archive ---- */
  .archive-month { flex-direction: column !important; gap: 4px !important; }
  .archive-year { margin-top: 12px !important; }
  .archive-entry { padding: 8px 0 !important; }

  /* ---- Top Link ---- */
  .top-link {
    width: 36px !important;
    height: 36px !important;
    bottom: 20px !important;
    right: 20px !important;
  }

  /* ---- Disable hover glow on touch ---- */
  article.post-entry:active,
  .post-tags a:active,
  .hero-tag:active {
    transform: none !important;
    box-shadow: none !important;
  }
}

/* ---- Extra small screens (< 480px) ---- */
@media screen and (max-width: 480px) {
  .home-hero .hero-title { font-size: clamp(1.5rem, 12vw, 2.5rem) !important; }
  .post-title { font-size: 1.3rem !important; }
  .post-single {
    padding: 20px 12px !important;
    margin: 12px 6px !important;
    width: calc(100% - 12px) !important;
  }
  .header-nav a { font-size: 0.78rem !important; padding: 6px 6px !important; }
  .logo a { font-size: 1rem !important; }
  .page-heading { font-size: 1.4rem !important; }
}

/* ---- Tablet (769px - 1024px) ---- */
/* @media screen and (min-width: 769px) and (max-width: 1024px) {
  .home-hero { min-height: 65vh; padding: 60px 40px; }
  .home-hero .hero-title { font-size: clamp(2rem, 7vw, 4rem); }
  .post-single { padding: 40px 36px !important; margin: 30px 20px !important; }
  .post-content, .md-content { font-size: 15px !important; }
  .post-content pre, .md-content pre { font-size: 0.85rem !important; }
} */

/* ---- Mobile smooth scroll + tap highlight ---- */
@media screen and (max-width: 768px) {
  html { scroll-behavior: smooth; }
  * { -webkit-tap-highlight-color: transparent; }
}

/* ---- Print ---- */
@media print {
  #bg-canvas, .scanline, body::before, body::after { display: none !important; }
  body { background: white !important; color: black !important; }
  .post-single { background: white !important; border: 1px solid #ccc !important; }
}

/* ===== Quick Links ===== */
.quick-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 1.25rem auto 0;
  max-width: 640px;
}
.quick-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  transition: border-color 0.2s, color 0.2s, transform 0.15s, box-shadow 0.15s;
}
.quick-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.quick-link .ql-svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ===== Content Color Fix ===== */
.post-content, .md-content {
  color: var(--text-primary) !important;
}
.post-content p, .md-content p,
.post-content li, .md-content li,
.post-content td, .md-content td {
  color: var(--text-primary) !important;
}
