/* ============================= */
/*  CSS Variables & Base Styles  */
/* ============================= */
:root {
  /* Light mode colors */
  --bg-color: #f3f4f6;
  --text-color: #1f2937;
  --header-bg: #ffffff;
  /* Solid white for less transparency */
  --header-text: #111827;
  --nav-hover-bg: #f3f4f6;
  /* --content-bg: transparent; */
  /* Changed for glass effect */
  --card-bg: rgba(255, 255, 255, 0.65);
  --pre-bg: rgba(255, 255, 255, 0.5);
  /* Glassy pre */
  --pre-text: #1f2937;
  --bullet-color: #6366f1;
  /* Indigo */
  --accent-color: #4f46e5;
  --copy-btn-bg: rgba(255, 255, 255, 0.8);
  --copy-btn-text: #4b5563;
  --code-border: rgba(99, 102, 241, 0.2);
  --glass-border: 1px solid rgba(255, 255, 255, 0.4);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
  --blur: blur(12px);
}

/* Dark mode overrides */
body.dark-mode {
  --bg-color: #0f172a;
  /* Slate 900 */
  --text-color: #e2e8f0;
  /* Slate 200 */
  --header-bg: #070b14;
  /* Solid dark/slate for dark mode */
  --header-text: #f1f5f9;
  --nav-hover-bg: rgba(255, 255, 255, 0.1);
  --content-bg: transparent;
  --card-bg: rgba(30, 41, 59, 0.6);
  /* Slate 800 glassy */
  --pre-bg: rgba(36, 49, 80, 0.6);
  --pre-text: #e2e8f0;
  --bullet-color: #38bdf8;
  /* Sky 400 */
  --accent-color: #0ea5e9;
  --copy-btn-bg: rgba(30, 41, 59, 0.8);
  --copy-btn-text: #e2e8f0;
  --code-border: rgba(56, 189, 248, 0.2);
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Global base styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-padding-top: 60px;
  /* header height */
}

body {
  background: var(--bg-color);
  background-image:
    radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
    radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
    radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
  color: var(--text-color);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
  padding-top: 60px;
  min-height: 100vh;
}

body.dark-mode {
  background-image:
    radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
    radial-gradient(at 50% 0%, hsla(225, 39%, 25%, 1) 0, transparent 50%),
    radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
}

body:not(.dark-mode) {
  background-image:
    radial-gradient(at 0% 0%, hsla(253, 16%, 90%, 1) 0, transparent 50%),
    radial-gradient(at 50% 0%, hsla(225, 39%, 90%, 1) 0, transparent 50%),
    radial-gradient(at 100% 0%, hsla(339, 49%, 90%, 1) 0, transparent 50%);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

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

/* ===================== */
/* Header / Navbar Styles */
/* ===================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 1000;
  background: var(--header-bg);
  backdrop-filter: none;
  /* Removed blur for consistency with solid background request */
  -webkit-backdrop-filter: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--header-text);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  height: 60px;
  display: flex;
  align-items: center;
  transition: background 0.3s, color 0.3s;
}

.nav-container {
  max-width: 100%;
  /* Full width */
  margin: 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  width: 100%;
}

.brand {
  margin-right: auto;
  /* Pushes nav and controls to the right */
}

/* Nav Controls Container (Theme + Hamburger) */
.nav-controls {
  display: flex;
  align-items: center;
}

.brand a {
  color: var(--header-text);
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
}

.menu-toggle {
  display: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--header-text);
  margin-left: 15px;
  /* Spacing from theme toggle */
}

nav .nav-menu {
  list-style: none;
  display: flex;
  align-items: center;
}

nav .nav-menu li {
  position: relative;
}

nav .nav-menu a {
  display: block;
  padding: 15px 20px;
  transition: background 0.2s;
}

nav .nav-menu a:hover {
  background: var(--nav-hover-bg);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--header-bg);
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  overflow: hidden;
  min-width: 180px;
  z-index: 1000;
}

.dropdown-menu li a {
  padding: 12px 20px;
  white-space: nowrap;
}

.dropdown:hover .dropdown-menu {
  display: block;
}

/* =============== */
/* Main content area */
/* =============== */
main#content {
  max-width: 1200px;
  margin: 0 auto;
  background: var(--content-bg);
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Landing Page Styles */
.landing-page {
  width: 100%;
}

/* Hero Section */
/* Hero Section */
.hero-section {
  text-align: center;
  padding: 80px 30px 60px;
  background: transparent;
  color: var(--text-color);
  margin-bottom: 50px;
  position: relative;
  overflow: hidden;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 20px;
  background: linear-gradient(135deg, var(--bullet-color) 0%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  letter-spacing: -0.05em;
}

.hero-subtitle {
  font-size: 1.5rem;
  margin-bottom: 15px;
  color: var(--text-color);
  opacity: 0.9;
  font-weight: 500;
}

.hero-description {
  font-size: 1.1rem;
  color: var(--text-color);
  opacity: 0.8;
  max-width: 700px;
  margin: 0 auto 40px;
}

/* Search Bar Styles */
.hero-search-container {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

.hero-search-input {
  width: 100%;
  padding: 16px 50px 16px 24px;
  border-radius: 50px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  color: var(--text-color);
  font-size: 1.1rem;
  outline: none;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

body:not(.dark-mode) .hero-search-input {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

.hero-search-input:focus {
  background: rgba(255, 255, 255, 0.15);
  box-shadow: 0 0 0 3px var(--bullet-color);
  border-color: transparent;
}

body:not(.dark-mode) .hero-search-input:focus {
  background: #fff;
  box-shadow: 0 0 0 3px var(--bullet-color);
}


.search-icon {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  opacity: 0.6;
  pointer-events: none;
}

/* Hello World Section */
.hello-world-section {
  padding: 0 30px 50px;
}

.section-header {
  text-align: center;
  margin-bottom: 40px;
}

.section-header h2 {
  font-size: 2.5rem;
  margin-bottom: 15px;
  color: var(--text-color);
  font-weight: 600;
}

.section-description {
  font-size: 1.1rem;
  color: var(--text-color);
  opacity: 0.8;
  max-width: 600px;
  margin: 0 auto;
}

/* Code Grid */
.code-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 25px;
  margin-top: 30px;
}

/* Code Card */
/* Code Card */
.code-card {
  background: var(--card-bg);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.code-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
  border-color: var(--bullet-color);
}

.code-card-header {
  background: rgba(0, 0, 0, 0.1);
  color: var(--text-color);
  padding: 12px 20px;
  font-weight: 600;
  font-size: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.language-name {
  color: var(--bullet-color);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.code-card pre {
  margin: 0;
  border-radius: 0;
  border: none;
  padding: 20px;
  background: transparent !important;
  /* Let Prism handle it or transparent */
  max-height: 400px;
  overflow-y: auto;
  font-family: 'Fira Code', 'Consolas', monospace;
}

.code-card pre code {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Dark mode adjustments */
.dark-mode .code-card {
  border-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .code-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* Welcome class for backward compatibility */
.welcome {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-color);
}

.welcome h1 {
  margin-bottom: 15px;
  font-size: 2.2rem;
  color: var(--text-color);
}

.welcome p {
  font-size: 1.1rem;
  color: var(--text-color);
  opacity: 0.8;
}

/* Contact Form Section */
.contact-section {
  padding: 0 30px 60px;
  max-width: 700px;
  margin: 0 auto;
}

.contact-form-container {
  background: var(--content-bg);
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-color);
  font-size: 0.95rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  padding: 12px 16px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--pre-bg);
  color: var(--text-color);
  transition: all 0.3s ease;
  width: 100%;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--bullet-color);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23333' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.form-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-color);
  opacity: 0.6;
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
  font-family: inherit;
}

.submit-btn {
  padding: 14px 32px;
  background: var(--header-bg);
  color: var(--header-text);
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  align-self: flex-start;
  min-width: 150px;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  background: var(--nav-hover-bg);
}

.submit-btn:active {
  transform: translateY(0);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.form-status {
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 10px;
  font-size: 0.95rem;
  display: none;
}

.form-status.success {
  display: block;
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.form-status.error {
  display: block;
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.dark-mode .contact-form-container {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dark-mode .form-group input,
.dark-mode .form-group textarea,
.dark-mode .form-group select {
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--pre-bg);
}

.dark-mode .form-group input:focus,
.dark-mode .form-group textarea:focus,
.dark-mode .form-group select:focus {
  border-color: var(--bullet-color);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

.dark-mode .form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
}

.dark-mode .form-status.success {
  background: #1e4620;
  color: #a8d5ba;
  border-color: #2d5a3d;
}

.dark-mode .form-status.error {
  background: #4a1f24;
  color: #f5a8b0;
  border-color: #5a2a2f;
}

.hidden {
  display: none !important;
}

/* Contact Page Specific Styles */
.contact-page {
  width: 100%;
}

.setup-instructions {
  max-width: 700px;
  margin: 30px auto 0;
  padding: 0 30px;
}

.setup-instructions details {
  background: var(--pre-bg);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.setup-instructions summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-color);
  font-size: 1rem;
  user-select: none;
}

.setup-instructions summary:hover {
  color: var(--bullet-color);
}

.instructions-content {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.instructions-content h4 {
  margin-bottom: 15px;
  color: var(--text-color);
  font-size: 1.1rem;
}

.instructions-content ol {
  margin-left: 20px;
  margin-bottom: 15px;
  color: var(--text-color);
  line-height: 1.8;
}

.instructions-content li {
  margin-bottom: 8px;
}

.instructions-content code {
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.9em;
}

.instructions-content a {
  color: var(--bullet-color);
  text-decoration: underline;
}

.dark-mode .setup-instructions details {
  border-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .instructions-content {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .instructions-content code {
  background: rgba(255, 255, 255, 0.1);
}

.contact-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 25px;
  margin-top: 50px;
  padding: 0 30px;
}

.info-card {
  background: var(--pre-bg);
  padding: 30px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.info-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.info-card h3 {
  font-size: 1.3rem;
  margin-bottom: 12px;
  color: var(--text-color);
  font-weight: 600;
}

.info-card p {
  color: var(--text-color);
  opacity: 0.8;
  font-size: 0.95rem;
  line-height: 1.6;
}

.dark-mode .info-card {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.dark-mode .info-card:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1.2rem;
  }

  .hero-description {
    font-size: 1rem;
  }

  .section-header h2 {
    font-size: 2rem;
  }

  .code-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .hello-world-section {
    padding: 0 20px 40px;
  }

  .hero-section {
    padding: 40px 20px 30px;
  }

  .contact-section {
    padding: 0 20px 40px;
  }

  .contact-form-container {
    padding: 30px 20px;
  }

  .contact-info {
    grid-template-columns: 1fr;
    padding: 0 20px;
    gap: 20px;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 1.1rem;
  }
}

/* Headings inside content */
h1,
h2,
h3,
h4,
summary {
  color: var(--text-color);
}

section {
  margin-bottom: 2em;
}

section h2 summary {
  font-size: 1.4rem;
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 2px solid #e0e0e0;
  color: var(--text-color);
}

/* ================= */
/* Code Block / Pre   */
/* ================= */
pre {
  position: relative;
  background: var(--pre-bg);
  color: var(--pre-text);
  padding: 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 24px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

pre:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: rgba(0, 0, 0, 0.2);
}

pre code {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 0.95rem;
  line-height: 1.5;
  display: block;
}

.dark-mode pre {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.dark-mode pre:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Copy button - simplified and modern */
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.95rem;
  cursor: pointer;
  opacity: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  user-select: none;
  line-height: 1;
}

pre:hover .copy-btn,
code:hover .copy-btn {
  opacity: 1;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-1px) scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  border-color: rgba(0, 0, 0, 0.12);
}

.copy-btn:active {
  transform: translateY(0) scale(1);
}

.copy-btn.copied {
  background: #10b981;
  color: white;
  border-color: #10b981;
  opacity: 1;
  animation: copySuccess 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark-mode .copy-btn {
  background: rgba(30, 30, 30, 0.95);
  border-color: rgba(255, 255, 255, 0.15);
  color: #e0e0e0;
}

.dark-mode .copy-btn:hover {
  background: rgba(45, 45, 45, 1);
  border-color: rgba(255, 255, 255, 0.25);
}

.dark-mode .copy-btn.copied {
  background: #059669;
  border-color: #059669;
}

@keyframes copySuccess {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.15);
  }
}

/* ============================ */
/* Responsive / Mobile Overrides */
/* ============================ */
@media (max-width: 768px) {
  nav .nav-menu {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    /* Fix: Opaque background for readability */
    background: var(--bg-color);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    flex-direction: column;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding-bottom: 10px;
  }

  .dark-mode nav .nav-menu {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  }

  nav .nav-menu.show {
    display: flex;
  }

  nav .nav-menu li {
    width: 100%;
  }

  nav .nav-menu li a {
    padding: 15px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
  }

  .dropdown-menu {
    position: static;
    box-shadow: none;
    background: rgba(0, 0, 0, 0.03);
    display: none;
    /* Managed by JS/class now */
    padding-left: 20px;
    width: 100%;
  }

  .dark-mode .dropdown-menu {
    background: rgba(3, 3, 3, 0.03);
  }

  /* Show dropdown when active class is present (toggled by JS) */
  .dropdown.active .dropdown-menu {
    display: block;
  }

  /* Fix: Prevent hover from conflicting on mobile if needed, though usually fine */
  .dropdown:hover .dropdown-menu {
    display: none;
    /* Disable hover effect on mobile, rely on click */
  }

  .dropdown.active:hover .dropdown-menu {
    display: block;
    /* Keep visible if active */
  }

  .menu-toggle {
    display: block;
    font-size: 1.8rem;
  }

  .nav-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    /* Side by side spacing */
    margin-left: auto;
    /* Push to right */
  }

  /* Reset layout for mobile */
  .brand {
    margin-right: 0;
    /* Let flexbox handle spacing */
    flex-grow: 1;
    /* Brand takes available space to push controls right if needed, or just auto */
  }

  .nav-container {
    padding: 0 15px;
    justify-content: space-between;
    /* Ensure brand left, controls right */
  }

  /* DARK MODE: Solid, opaque background for mobile menu */
  .dark-mode nav .nav-menu {
    background: #1e293b;
    /* Solid slate color, no transparency */
    border-bottom: 1px solid rgba(0, 0, 0, 0.021);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  }

  /* LIGHT MODE: Solid background */
  nav .nav-menu {
    background: #ffffff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  }

  .brand a {
    font-size: 1.3rem;
    /* Slightly smaller font for mobile title */
  }
}

/* Standalone code blocks (not inside pre) */
code:not(pre code) {
  display: block;
  position: relative;
  padding: 14px 16px;
  background: var(--pre-bg);
  color: var(--pre-text);
  border-radius: 8px;
  font-size: 0.9rem;
  white-space: pre-wrap;
  line-height: 1.5;
  margin-bottom: 16px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  transition: all 0.3s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

code:not(pre code):hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: rgba(0, 0, 0, 0.2);
}

.dark-mode code:not(pre code) {
  background: var(--pre-bg);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.dark-mode code:not(pre code):hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ==================== */
/* details & summary ONLY */
/* ==================== */

/* DETAILS CONTAINER */
details {
  margin: 12px 0;
  padding: 0;
  border: 1px solid #ccc;
  border-radius: 10px;
  background: #fafafa;
  overflow: hidden;
  transition: border-color 0.3s ease;
}

/* BORDER COLOR ON OPEN */
details[open] {
  border-color: #888;
}

/* SUMMARY BAR */
summary {
  cursor: pointer;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  background: #f0f0f0;
  list-style: none;
  outline: none;
  user-select: none;
  transition: background 0.25s ease, color 0.25s ease;
}

/* REMOVE DEFAULT TRIANGLE */
summary::-webkit-details-marker {
  display: none;
}

/* CUSTOM ARROW */
summary::before {
  content: "▸";
  font-size: 1rem;
  margin-right: 8px;
  transition: transform 0.25s ease;
}

/* ROTATE ARROW WHEN OPEN */
details[open] summary::before {
  transform: rotate(90deg);
}

/* HOVER EFFECT */
summary:hover {
  background: #e6e6e6;
}

/* CONTENT INSIDE DETAILS */
details>*:not(summary) {
  padding: 12px 16px;
  animation: fadeSlide 0.25s ease;
}

/* DARK MODE WRAPPER (adjust if you use another class) */
.dark-mode details {
  border-color: #555;
  background: #2a2a2a;
}

.dark-mode details[open] {
  border-color: #888;
}

/* SUMMARY BAR */
.dark-mode summary {
  background: #333;
  color: #eee;
}

.dark-mode summary:hover {
  background: #3c3c3c;
}

/* ARROW COLOR */
.dark-mode summary::before {
  color: #ccc;
}

/* CONTENT BLOCK */
.dark-mode details>*:not(summary) {
  background: #1e1e1e;
  color: #ddd;
}

/* CODE BLOCK INSIDE DARK MODE */
.dark-mode code {
  background: #111;
  border-radius: 8px;
  color: #f5f5f5;
}

/* ANIMATION */
@keyframes fadeSlide {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}




.expand-collapse-bar {
  margin: 10px 0 20px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  /* align buttons to the right */
}

.expand-collapse-bar button {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
}

.expand-collapse-bar button[data-action="expand-all"] {
  background: #38a169;
  color: #fff;
}

.expand-collapse-bar button[data-action="collapse-all"] {
  background: #e53e3e;
  color: #fff;
}

/* Search Dropdown */
.search-results-dropdown {
  position: relative;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px;
  margin-top: 8px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: none;
  z-index: 2000;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.search-result-item {
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.2s;
}

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

.search-result-item:last-child {
  border-bottom: none;
}

.result-text {
  font-weight: 500;
  color: var(--text-color);
}

.result-category {
  font-size: 0.8rem;
  opacity: 0.6;
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ============================ */
/* References Section Buttons   */
/* ============================ */
/* 
   Target links inside lists that immediately follow an h2 inside a details element.
   This specific structure is used for the "References" sections.
*/
details h2+ul {
  list-style: none;
  /* Remove default bullets if any */
  padding-left: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

details h2+ul li,
details h2+ul ol {
  margin: 0;
  padding: 0;
  display: contents;
  /* Let the links participate in the flex container if possible, or just be wrappers */
}

/* Handle both standard li > a and the custom ol > a seen in some files */
details h2+ul li a,
details h2+ul ol a {
  display: inline-block;
  padding: 8px 16px;
  background-color: var(--card-bg);
  border: 1px solid var(--bullet-color);
  /* Use the accent color for border */
  border-radius: 6px;
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Hover state */
details h2+ul li a:hover,
details h2+ul ol a:hover {
  background-color: var(--bullet-color);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  text-decoration: none;
}

/* Add a link icon */
details h2+ul li a::before,
details h2+ul ol a::before {
  content: "🔗";
  margin-right: 6px;
  font-size: 0.9em;
  display: inline-block;
}

/* Dark mode adjustments */
.dark-mode details h2+ul li a,
.dark-mode details h2+ul ol a {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--text-color);
}

.dark-mode details h2+ul li a:hover,
.dark-mode details h2+ul ol a:hover {
  background-color: var(--bullet-color);
  border-color: var(--bullet-color);
  color: #fff;
}

/* Link Button Styling (details > button > a) */
details button {
  background: var(--card-bg);
  border: 1px solid var(--bullet-color);
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  margin: 5px;
  transition: all 0.2s ease;
  font-family: inherit;
}

details button a {
  display: block;
  padding: 8px 16px;
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  width: 100%;
  height: 100%;
}

details button:hover {
  background-color: var(--bullet-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

details button:hover a {
  color: #fff;
}

/* Add a link icon for button > a links as well */
details button a::before {
  content: "🔗";
  margin-right: 6px;
  font-size: 0.9em;
  display: inline-block;
}

/* Dark mode for buttons */
.dark-mode details button {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.dark-mode details button a {
  color: var(--text-color);
}

.dark-mode details button:hover {
  background-color: var(--bullet-color);
  border-color: var(--bullet-color);
}

.dark-mode details button:hover a {
  color: #fff;
}