/* ============================================
   Brew Scripts - Site Stylesheet
   Dark theme, matches CodeCraftedApps design
   Accent: Amber/golden (Homebrew/crafted theme)
   ============================================ */

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

:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d27;
  --bg-card: #1e2130;
  --bg-card-hover: #252839;
  --text-primary: #e8e9ed;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --accent: #f59e0b;
  --accent-hover: #d97706;
  --accent-glow: rgba(245, 158, 11, 0.15);
  --accent-soft: rgba(245, 158, 11, 0.1);
  --border: #2a2d3a;
  --border-hover: #f59e0b;
  --radius: 12px;
  --radius-sm: 8px;
  --max-width: 1100px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
  /* Spacing scale */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
}

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--border) var(--bg-primary);
}

/* --- Scrollbar (Webkit) --- */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}

/* Very faint background image — barely visible watermark effect */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('../BrewBackgroundSite.png') center / cover no-repeat;
  opacity: 0.03;
  z-index: 0;
  pointer-events: none;
}

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

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

/* Focus styles for keyboard navigation */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

img {
  max-width: 100%;
  display: block;
}

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

main {
  flex: 1;
}

/* --- Header / Nav --- */
.site-header {
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(15, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.site-logo span {
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 22px;
  align-items: center;
}

.site-nav a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  transition: color 0.2s ease;
}

.site-nav a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.site-nav a:hover::after,
.site-nav a.active::after {
  width: 100%;
}

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

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease;
}

.nav-toggle:hover {
  border-color: var(--accent);
}

/* --- Hero Section --- */
.hero {
  padding: 80px 0 60px;
  text-align: center;
  background: linear-gradient(to bottom, var(--accent-glow), transparent);
  /* To swap in a real banner image:
     background: linear-gradient(to bottom, rgba(15,17,23,0.55), var(--bg-primary)),
                 url('../images/hero-banner.jpg') center/cover no-repeat; */
}

.hero h1 {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 16px;
}

.hero h1 span {
  color: var(--accent);
}

.hero .tagline {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 620px;
  margin: 0 auto 12px;
  line-height: 1.5;
}

.hero .sub-tagline {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.hero-badges {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #0f1117;
  border: none;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #0f1117;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

/* --- Section --- */
.section {
  padding: 60px 0;
}

.section-pt0 {
  padding-top: 0;
}

.section-pb20 {
  padding-bottom: 20px;
}

.load-error {
  color: var(--text-muted);
}

.text-center {
  text-align: center;
}

.error-code {
  font-size: 4rem;
  margin-bottom: 8px;
}

.error-section {
  text-align: center;
  padding: 48px 0;
}

.error-message {
  margin-bottom: 24px;
}

.error-link {
  font-size: 1rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 36px;
}

/* --- Features Grid --- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 20px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.feature-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-2px);
}

.feature-card .feature-icon {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
  flex-grow: 1;
}

/* --- Scripts Library (dynamic cards) --- */
.scripts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 16px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-2px);
}

.card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.card-type {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 20px;
  flex-shrink: 0;
}

.badge-script {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-docs {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
}

.badge-file {
  background: rgba(156, 163, 175, 0.12);
  color: #9ca3af;
}

.card-filename {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.card h3 a {
  color: var(--text-primary);
  transition: color 0.2s ease;
}

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

.card .card-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.55;
  margin: 0;
  flex-grow: 1;
}

.card .meta {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-family: var(--font-mono);
  margin: 0;
}

.card-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.card .btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
  text-decoration: none;
}

.card .btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.card .btn-download {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(245, 158, 11, 0.2);
}

.card .btn-download:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Disclaimer Banner --- */
.disclaimer {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: var(--radius);
  padding: 24px 28px;
}

.disclaimer-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}

.disclaimer-content h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #f87171;
  margin-bottom: 6px;
}

.disclaimer-content p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.6;
  margin: 0;
}

.disclaimer-content code {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.disclaimer-content a {
  color: #f87171;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --- Brew Info Callout --- */
.brew-info {
  background: var(--accent-soft);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.brew-info p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
  margin-bottom: 12px;
}

.brew-info strong {
  color: var(--text-primary);
}

.brew-info-links {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.brew-info-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent);
  border: 1px solid rgba(245, 158, 11, 0.2);
  transition: all 0.2s ease;
}

.brew-info-links a:hover {
  background: rgba(245, 158, 11, 0.2);
  color: var(--accent);
  transform: translateY(-1px);
}

/* --- Instructions Grid --- */
.instructions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr));
  gap: 20px;
}

.instruction-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.instruction-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.instruction-card > p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.instruction-number {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(245, 158, 11, 0.2);
  margin-bottom: 12px;
}

/* --- Requirements List --- */
.requirements-list {
  max-width: 650px;
}

.requirement-item {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.93rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

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

.req-icon {
  color: var(--accent);
  font-size: 0.5rem;
  flex-shrink: 0;
  margin-top: 2px;
}

/* --- Code Block --- */
.code-block {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.7;
  overflow-wrap: break-word;
  word-break: break-word;
  margin: 16px 0;
  flex-grow: 1;
}

.code-block .comment {
  color: var(--text-muted);
}

.code-block .command {
  color: var(--accent);
  word-break: break-all;
}

/* --- Loading State --- */
.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
  font-size: 0.9rem;
}

/* --- About Section --- */
.about-content {
  max-width: 700px;
}

.about-content p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 16px;
}

/* --- Page Header (for sub-pages) --- */
.page-header {
  padding: 60px 0 40px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, var(--accent-glow), transparent);
  /* To swap in a real banner image:
     background: linear-gradient(to bottom, rgba(15,17,23,0.6), var(--bg-primary)),
                 url('../images/page-banner.jpg') center/cover no-repeat; */
}

.page-header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* --- Legal / Content Pages --- */
.content-section {
  padding: 48px 0;
}

.content-body {
  max-width: 750px;
}

.content-body h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 36px;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
}

.content-body h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 10px;
}

.content-body p {
  color: var(--text-secondary);
  font-size: 0.93rem;
  line-height: 1.75;
  margin-bottom: 14px;
}

.content-body ul,
.content-body ol {
  color: var(--text-secondary);
  font-size: 0.93rem;
  line-height: 1.75;
  margin-bottom: 14px;
  padding-left: 24px;
}

.content-body li {
  margin-bottom: 6px;
}

.content-body a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* --- Footer --- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 32px 0;
  margin-top: 40px;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-copyright {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.8rem;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--text-secondary);
}

/* --- Skip Link --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--accent);
  color: var(--bg-primary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  z-index: 200;
  transition: top 0.2s ease;
}

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

/* --- Back to Top --- */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease, background 0.2s ease, border-color 0.2s ease;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  padding: 12px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.breadcrumbs a {
  color: var(--text-muted);
  transition: color 0.2s ease;
}

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

.breadcrumbs .separator {
  margin: 0 8px;
  opacity: 0.5;
}

/* --- Scroll Reveal --- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Noise Texture Overlay --- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* --- Richer Footer --- */
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.footer-brand .site-logo {
  margin-bottom: 8px;
}

.footer-brand .footer-tagline {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.6;
  max-width: 280px;
}

.footer-column h4 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.footer-column a {
  display: block;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 3px 0;
  transition: color 0.2s ease;
}

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

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.footer-bottom p {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .hero {
    padding: 50px 0 40px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero .tagline {
    font-size: 1.05rem;
  }

  .section {
    padding: 40px 0;
  }

  .features-grid,
  .scripts-grid,
  .instructions-grid {
    grid-template-columns: 1fr !important;
    gap: 16px;
  }

  .card,
  .feature-card,
  .instruction-card {
    width: 100%;
    padding: 24px;
  }

  .page-header {
    padding: 40px 0 28px;
  }

  .page-header h1 {
    font-size: 1.75rem;
  }

  /* Mobile nav — frosted glass dropdown */
  .nav-toggle {
    display: block;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(15, 17, 23, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 16px 24px;
    gap: 16px;
  }

  .site-nav.open {
    display: flex;
  }

  .code-block {
    padding: 16px 18px;
    font-size: 0.78rem;
  }

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

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    text-align: center;
  }

  .footer-brand .footer-tagline {
    max-width: 100%;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .footer-content {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .hero h1 {
    font-size: 1.65rem;
  }

  .card,
  .feature-card,
  .instruction-card {
    padding: 22px;
  }

  .code-block {
    padding: 16px;
    font-size: 0.75rem;
  }

  .card .btn {
    flex: 1;
    justify-content: center;
  }
}

/* --- Content with Table of Contents --- */
.content-with-toc {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 48px;
  align-items: start;
}

.toc {
  position: sticky;
  top: 88px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.toc h3 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li {
  margin-bottom: 6px;
}

.toc-list a {
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.5;
  transition: color 0.2s ease;
  text-decoration: none;
}

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

/* --- FAQ Accordion --- */
.faq-item {
  border-bottom: 1px solid var(--border);
}

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

.faq-question {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  list-style: none;
  transition: color 0.2s ease;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-question::before {
  content: '+';
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.faq-item[open] .faq-question::before {
  content: '\2212';
  background: var(--accent-soft);
  border-color: var(--accent);
}

.faq-question:hover {
  color: var(--accent);
}

.faq-answer {
  padding: 0 0 20px 36px;
  color: var(--text-secondary);
  font-size: 0.93rem;
  line-height: 1.75;
}

.faq-answer p {
  margin-bottom: 10px;
}

.faq-answer p:last-child {
  margin-bottom: 0;
}

.faq-answer code {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.faq-answer a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.faq-category {
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 40px;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent-soft);
  letter-spacing: -0.01em;
}

.faq-category:first-child {
  margin-top: 0;
}

/* --- Hub / Index Page Grid --- */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 20px;
}

.hub-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  text-decoration: none;
  color: inherit;
  transition: all 0.25s ease;
}

.hub-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  box-shadow: 0 0 20px var(--accent-glow);
  transform: translateY(-2px);
  color: inherit;
}

.hub-card .hub-icon {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.hub-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.hub-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.55;
  flex-grow: 1;
  margin-bottom: 16px;
}

.hub-card .hub-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

/* --- Callout Boxes --- */
.callout {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 20px 0;
}

.callout-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 2px;
}

.callout-content p {
  margin: 0;
}

.callout-warning {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.callout-warning .callout-icon { color: #f87171; }

.callout-tip {
  background: var(--accent-soft);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.callout-tip .callout-icon { color: var(--accent); }

.callout-info {
  background: rgba(59, 130, 246, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.callout-info .callout-icon { color: #60a5fa; }

/* --- Content Body Enhancements --- */
.content-body code {
  background: rgba(245, 158, 11, 0.12);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
}

.content-body pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.7;
  overflow-x: auto;
  margin: 16px 0;
}

.content-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

.content-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.9rem;
}

.content-body th,
.content-body td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}

.content-body th {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.content-body tbody tr:hover {
  background: var(--bg-card);
}

/* --- Contact Form --- */
.contact-form {
  max-width: 500px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

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

.form-submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #0f1117;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-sans);
}

.form-submit:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--accent-glow);
}

/* --- Script Detail Page --- */
.script-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.script-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

.script-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* --- Responsive additions --- */
@media (max-width: 768px) {
  .content-with-toc {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .toc {
    position: static;
    order: -1;
  }

  .hub-grid {
    grid-template-columns: 1fr !important;
  }

  .faq-question {
    font-size: 0.93rem;
  }
}

/* --- Print Stylesheet --- */
@media print {
  .site-header,
  .site-footer,
  .nav-toggle,
  .back-to-top,
  .skip-link,
  body::after {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  .content-body {
    max-width: 100%;
  }

  .hero,
  .page-header {
    background: none !important;
  }

  .page-header {
    border-bottom: 1px solid #ccc;
  }
}

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

  .reveal {
    opacity: 1;
    transform: none;
  }

  html {
    scroll-behavior: auto;
  }
}
