/* ===================================================
   jGibbonEngine — Dark Theme Stylesheet
   =================================================== */

:root {
  /* Color palette */
  --bg-primary:    #0d1117;
  --bg-surface:    #161b22;
  --bg-elevated:   #1c2128;
  --border:        #30363d;
  --border-subtle: #21262d;

  /* Brand colors */
  --orange:        #f97316;
  --orange-light:  #fb923c;
  --orange-dim:    rgba(249, 115, 22, 0.15);
  --amber:         #fbbf24;
  --green:         #22c55e;
  --green-dim:     rgba(34, 197, 94, 0.15);
  --blue:          #60a5fa;
  --blue-dim:      rgba(96, 165, 250, 0.15);

  /* Text */
  --text:          #e6edf3;
  --text-muted:    #8b949e;
  --text-subtle:   #6e7681;

  /* Spacing & layout */
  --radius:        0.5rem;
  --radius-lg:     1rem;
  --max-width:     1200px;
  --nav-height:    64px;

  /* Shadows */
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:     0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.6);

  /* Transitions */
  --transition:    0.2s ease;
}

/* ===================================================
   Reset & Base
   =================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background-color: var(--bg-primary);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

img { max-width: 100%; height: auto; }

a {
  color: var(--orange);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--orange-light); }

h1, h2, h3, h4, h5, h6 {
  font-family: 'Space Grotesk', sans-serif;
  line-height: 1.2;
  color: var(--text);
}

code, pre, .mono {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

pre {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
}

code {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 0.25rem;
  padding: 0.15em 0.4em;
  font-size: 0.875em;
  color: var(--orange-light);
}

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

/* Rouge syntax highlighting — token colors */
.highlight .k  { color: #ff79c6; }
.highlight .kd { color: #ff79c6; }
.highlight .s  { color: #f1fa8c; }
.highlight .s1 { color: #f1fa8c; }
.highlight .s2 { color: #f1fa8c; }
.highlight .c  { color: var(--text-subtle); font-style: italic; }
.highlight .c1 { color: var(--text-subtle); font-style: italic; }
.highlight .n  { color: var(--text); }
.highlight .nb { color: var(--blue); }
.highlight .nc { color: var(--amber); }
.highlight .nf { color: var(--green); }
.highlight .o  { color: #ff79c6; }
.highlight .mi { color: var(--blue); }
.highlight .p  { color: var(--text-muted); }

/* --- Unified Code Block Fix --- */

/* 1. Outermost container: Single source of truth for spacing (block code only) */
div.highlighter-rouge {
  display: block;
  margin-bottom: 1.5rem !important;
}

/* 2. Unified appearance: Border and background only on this layer */
.highlighter-rouge .highlight {
  background-color: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  padding: 0 !important;
  overflow: hidden !important;
  margin-bottom: 0 !important;
}

/* 3. Table Layout: Ensure it fills the container without gaps */
.rouge-table {
  border-spacing: 0 !important;
  border-collapse: collapse !important;
  width: 100% !important;
  margin: 0 !important;
}

/* 4. Line Number Column: Shrink to fit numbers and add a divider */
.rouge-gutter.gl {
  width: 1% !important;
  white-space: nowrap !important;
  border-right: 1px solid var(--border) !important;
  vertical-align: top !important;
}

/* 5. Line Number Styling: Right-aligned, subtle color, and not selectable */
.lineno {
  text-align: right !important;
  padding: 20px 12px 20px 24px !important;
  color: rgba(230, 237, 243, 0.4) !important;
  user-select: none !important;
  width: min-content !important;
  background-color: transparent !important;
  border: none !important;
  margin: 0 !important;
  font-family: "JetBrains Mono", "Fira Code", monospace !important;
  font-size: 14px !important;
  line-height: 1.6 !important;
}

/* 6. Code Area Styling: Ensure perfect vertical alignment with line numbers */
.rouge-code {
  vertical-align: top !important;
}

.rouge-code pre {
  padding: 20px 24px !important;
  background-color: transparent !important;
  border: none !important;
  margin: 0 !important;
  overflow: auto !important;
  font-family: "JetBrains Mono", "Fira Code", monospace !important;
  font-size: 14px !important;
  line-height: 1.6 !important;
}

/* ===================================================
   Navigation
   =================================================== */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(13, 17, 23, 0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.125rem;
  flex-shrink: 0;
}
.nav-brand:hover { color: var(--orange); }

.nav-mascot { width: 36px; height: 36px; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin-left: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition), background var(--transition);
}
.nav-link:hover, .nav-link.active {
  color: var(--text);
  background: var(--bg-surface);
}
.ext-icon { font-size: 0.7em; opacity: 0.7; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  margin-left: auto;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: var(--transition);
}

/* ===================================================
   Hero Section
   =================================================== */

.hero {
  position: relative;
  overflow: hidden;
  padding: 6rem 1.5rem 5rem;
  text-align: center;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(249,115,22,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 80%, rgba(34,197,94,0.08) 0%, transparent 50%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 780px;
  margin: 0 auto;
}

.hero-mascot {
  width: 120px;
  height: 120px;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 24px rgba(249,115,22,0.5));
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.hero-badge {
  display: inline-block;
  background: var(--orange-dim);
  border: 1px solid var(--orange);
  color: var(--orange);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25rem 0.875rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
}

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #ffffff 0%, var(--orange) 50%, var(--amber) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-tagline {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text-muted);
  max-width: 560px;
  margin: 0 auto 2.5rem;
  line-height: 1.7;
}

.hero-ctas {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.875rem;
}

/* ===================================================
   Buttons
   =================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.375rem;
  border-radius: var(--radius);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--orange);
  color: #0d1117;
  border-color: var(--orange);
}
.btn-primary:hover {
  background: var(--orange-light);
  border-color: var(--orange-light);
  color: #0d1117;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(249,115,22,0.4);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover {
  background: var(--bg-surface);
  border-color: var(--text-subtle);
  color: var(--text);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { color: var(--text); background: var(--bg-surface); }

.btn-sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.875rem;
}

/* ===================================================
   Sections
   =================================================== */

section { padding: 5rem 1.5rem; }

.section-container {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.section-label {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 1rem;
}

.section-subtitle {
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 580px;
  margin: 0 auto;
  line-height: 1.7;
}

/* Divider */
.section-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 0;
}

/* ===================================================
   Overview / Stats
   =================================================== */

.overview {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 2rem;
  text-align: center;
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--orange);
  display: block;
  line-height: 1;
  margin-bottom: 0.375rem;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ===================================================
   Feature Cards
   =================================================== */

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.feature-card:hover {
  border-color: var(--orange);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(249,115,22,0.12);
}

.feature-icon {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: block;
}

.feature-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.625rem;
  color: var(--text);
}

.feature-desc {
  font-size: 0.9375rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ===================================================
   Getting Started
   =================================================== */

.getting-started { background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-surface) 100%); }

.gs-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  margin-bottom: 3rem;
}

.gs-step {
  position: relative;
  padding: 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background: var(--orange-dim);
  border: 1px solid var(--orange);
  border-radius: 50%;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--orange);
  margin-bottom: 1rem;
}

.step-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.step-body {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.step-body code {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  white-space: pre;
  overflow-x: auto;
  color: var(--text);
}

/* ===================================================
   Community Section
   =================================================== */

.community { background: var(--bg-surface); }

.community-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.community-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  text-align: center;
  transition: border-color var(--transition), transform var(--transition);
}
.community-card:hover { border-color: var(--orange); transform: translateY(-2px); }

.community-icon { font-size: 2.5rem; margin-bottom: 1rem; display: block; }
.community-card h3 { font-size: 1.1rem; margin-bottom: 0.625rem; }
.community-card p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 1.25rem; }

/* ===================================================
   Page Layout (inner pages)
   =================================================== */

.page-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

.page-hero {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-subtle);
}

.page-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 0.625rem;
}

.page-description {
  font-size: 1.0625rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.page-content {
  font-size: 1rem;
  line-height: 1.8;
}

.page-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}
.page-content h3 { font-size: 1.2rem; margin-top: 1.75rem; margin-bottom: 0.625rem; }
.page-content p  { margin-bottom: 1rem; color: var(--text-muted); }
.page-content p strong { color: var(--text); }
.page-content ul, .page-content ol { padding-left: 1.5rem; margin-bottom: 1rem; color: var(--text-muted); }
.page-content li { margin-bottom: 0.375rem; }
.page-content blockquote {
  border-left: 3px solid var(--orange);
  padding: 0.5rem 0 0.5rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--text-muted);
  font-style: italic;
}

/* ===================================================
   Index cards for sections
   =================================================== */

.index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

.index-card {
  display: block;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  color: var(--text);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.index-card:hover {
  border-color: var(--orange);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(249,115,22,0.1);
  color: var(--text);
}

.index-card-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 0.5rem;
}
.index-card h3 { font-size: 1.05rem; margin-bottom: 0.5rem; }
.index-card p { font-size: 0.9rem; color: var(--text-muted); margin: 0; }

/* ===================================================
   Callout / Info boxes
   =================================================== */

.callout {
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-left: 3px solid;
  font-size: 0.9375rem;
}
.callout-info  { background: var(--blue-dim);  border-color: var(--blue);  color: var(--blue); }
.callout-warn  { background: rgba(251,191,36,0.1); border-color: var(--amber); color: var(--amber); }
.callout-tip   { background: var(--green-dim); border-color: var(--green); color: var(--green); }
.callout p     { color: inherit; margin: 0; }

/* ===================================================
   Footer
   =================================================== */

.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
}

.footer-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3rem;
  align-items: start;
}

.footer-brand {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}
.footer-mascot { width: 44px; height: 44px; flex-shrink: 0; }
.footer-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 1.125rem; margin-bottom: 0.25rem; }
.footer-tagline { font-size: 0.875rem; color: var(--text-muted); }

.footer-links {
  display: flex;
  gap: 3rem;
}

.footer-col h4 {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 0.875rem;
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 0.5rem; }
.footer-col a { font-size: 0.875rem; color: var(--text-muted); }
.footer-col a:hover { color: var(--text); }

.footer-bottom {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
  color: var(--text-subtle);
}

/* ===================================================
   Responsive
   =================================================== */

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem;
    gap: 0.125rem;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: flex; }
  .site-nav { position: relative; }

  .footer-container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .footer-links {
    flex-wrap: wrap;
    gap: 2rem;
  }

  .hero { padding: 4rem 1.25rem 3.5rem; }
  section { padding: 3.5rem 1.25rem; }
}

@media (max-width: 480px) {
  .hero-ctas { flex-direction: column; align-items: center; }
  .features-grid { grid-template-columns: 1fr; }
  .gs-steps { grid-template-columns: 1fr; }
}

/* ===================================================
   Scroll animations
   =================================================== */

.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}
