/* ==========================================================================
   metafrontieR pkgdown — extra.css
   Custom styles layered on top of Bootstrap 5 / Flatly
   ========================================================================== */

/* ---------- CSS Variables ------------------------------------------------- */
:root {
  --mfr-green-dark:   #1a6b4e;
  --mfr-green-mid:    #2d8f65;
  --mfr-green-light:  #e8f5ef;
  --mfr-accent:       #f0a500;
  --mfr-code-bg:      #f6f8fa;
  --mfr-border:       #dee2e6;
  --mfr-shadow:       0 4px 24px rgba(26, 107, 78, 0.10);
  --mfr-radius:       0.6rem;
}

/* ---------- Global body --------------------------------------------------- */
body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  color: var(--bs-body-color, #1c1c1e);
}

/* ---------- Navbar --------------------------------------------------------- */
.navbar {
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  border-bottom: 2px solid var(--mfr-green-dark);
}

.navbar-brand img {
  border-radius: 6px;
}

/* ---------- Hero / Home page ---------------------------------------------- */
.jumbotron, .homepage-hero {
  background: linear-gradient(135deg, var(--mfr-green-dark) 0%, var(--mfr-green-mid) 100%);
  color: #fff;
  border-radius: var(--mfr-radius);
  padding: 3rem 2.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--mfr-shadow);
}

/* Home page title badge strip */
#pkgdown-sidebar .list-unstyled li a {
  transition: color 0.2s;
}

/* ---------- Headings ------------------------------------------------------- */
h1, h2, h3, .h1, .h2, .h3 {
  font-weight: 700;
  letter-spacing: -0.01em;
}

h2.hasAnchor, h3.hasAnchor {
  border-left: 4px solid var(--mfr-green-mid);
  padding-left: 0.75rem;
  margin-left: -0.75rem;
}

/* ---------- Sidebar (reference + articles) -------------------------------- */
.sidebar {
  background: var(--mfr-green-light);
  border-radius: var(--mfr-radius);
  padding: 1.25rem 1rem;
  border: 1px solid var(--mfr-border);
}

.sidebar h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mfr-green-dark);
  font-weight: 700;
  border-bottom: 1px solid var(--mfr-border);
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
}

/* ---------- Code blocks ---------------------------------------------------- */
div.sourceCode {
  background: var(--mfr-code-bg);
  border: 1px solid var(--mfr-border);
  border-radius: var(--mfr-radius);
  box-shadow: inset 0 1px 4px rgba(0,0,0,.05);
  margin-bottom: 1.5rem;
}

div.sourceCode pre {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  margin: 0;
  padding: 1rem;
}

/* Inline code */
code:not([class]) {
  background: var(--mfr-green-light);
  color: var(--mfr-green-dark);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.88em;
}

/* ---------- Reference page tiles ------------------------------------------ */
.ref-index .ref-description {
  color: #555;
  font-size: 0.92rem;
}

/* ---------- Tables --------------------------------------------------------- */
table.table {
  border-radius: var(--mfr-radius);
  overflow: hidden;
  font-size: 0.9rem;
}

table.table thead th {
  background: var(--mfr-green-dark);
  color: #fff;
  font-weight: 600;
  border: none;
}

table.table tbody tr:hover {
  background: var(--mfr-green-light);
  transition: background 0.15s;
}

/* ---------- Badges --------------------------------------------------------- */
.badge-version {
  background: var(--mfr-green-dark) !important;
  font-size: 0.75rem;
  border-radius: 4px;
}

/* ---------- Callout blocks (pkgdown 2.x notes / tips) --------------------- */
.callout {
  border-radius: var(--mfr-radius);
  border-left: 5px solid;
}
.callout-note   { border-color: #17a2b8; background: #e8f8fb; }
.callout-tip    { border-color: var(--mfr-green-mid); background: var(--mfr-green-light); }
.callout-warning{ border-color: #f0a500; background: #fdf5e0; }
.callout-danger { border-color: #dc3545; background: #fde8ea; }

/* ---------- Cards ---------------------------------------------------------- */
.card {
  border: 1px solid var(--mfr-border);
  border-radius: var(--mfr-radius);
  box-shadow: var(--mfr-shadow);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 8px 32px rgba(26, 107, 78, 0.15);
}

.card-header {
  background: linear-gradient(90deg, var(--mfr-green-dark), var(--mfr-green-mid));
  color: #fff;
  font-weight: 600;
  border-radius: var(--mfr-radius) var(--mfr-radius) 0 0 !important;
}

/* ---------- Link colours --------------------------------------------------- */
a { color: var(--mfr-green-dark); }
a:hover { color: var(--mfr-green-mid); text-decoration: underline; }

/* Navbar links */
.navbar-nav .nav-link {
  font-weight: 500;
  transition: color 0.15s;
}

/* ---------- Footer --------------------------------------------------------- */
footer {
  background: var(--bs-tertiary-bg, #f4f4f4);
  border-top: 2px solid var(--mfr-border);
  padding: 1.5rem 0;
  font-size: 0.85rem;
  color: var(--bs-secondary-color, #666);
}

/* ---------- Scroll-to-top / anchor micro-animation ----------------------- */
.hasAnchor:target {
  scroll-margin-top: 80px;
}

/* ---------- Responsive tweaks --------------------------------------------- */
@media (max-width: 768px) {
  h2.hasAnchor, h3.hasAnchor {
    padding-left: 0.5rem;
    margin-left: -0.5rem;
  }
}

/* ---------- Dark Mode Overrides ------------------------------------------- */
[data-bs-theme="dark"] {
  --mfr-green-dark:   #6ad9ab; 
  --mfr-green-mid:    #2d8f65;
  --mfr-green-light:  #14241d;
  --mfr-border:       #3d4542;
  --mfr-code-bg:      #181a1b;
  --mfr-shadow:       0 4px 24px rgba(0, 0, 0, 0.7);
}

[data-bs-theme="dark"] .ref-index .ref-description,
[data-bs-theme="dark"] .text-muted {
  color: #adb5bd !important;
}

[data-bs-theme="dark"] a {
  color: #6ad9ab;
}

[data-bs-theme="dark"] a:hover {
  color: #8beac3;
}

/* Base Pandoc/downlit syntax highlighting for Dark Theme */
[data-bs-theme="dark"] pre code,
[data-bs-theme="dark"] div.sourceCode {
  color: #e5e7eb;
}

[data-bs-theme="dark"] pre code span.al { color: #fca5a5; } /* Alert */
[data-bs-theme="dark"] pre code span.an { color: #9ca3af; } /* Annotation */
[data-bs-theme="dark"] pre code span.at { color: #93c5fd; } /* Attribute */
[data-bs-theme="dark"] pre code span.bn { color: #fcd34d; } /* BaseN */
[data-bs-theme="dark"] pre code span.bu { color: #e5e7eb; } /* BuiltIn */
[data-bs-theme="dark"] pre code span.cf { color: #c084fc; } /* ControlFlow */
[data-bs-theme="dark"] pre code span.ch { color: #86efac; } /* Char */
[data-bs-theme="dark"] pre code span.cn { color: #c084fc; } /* Constant */
[data-bs-theme="dark"] pre code span.co { color: #9ca3af; font-style: italic; } /* Comment */
[data-bs-theme="dark"] pre code span.cv { color: #9ca3af; font-style: italic; } /* CommentVar */
[data-bs-theme="dark"] pre code span.do { color: #9ca3af; font-style: italic; } /* Documentation */
[data-bs-theme="dark"] pre code span.dt { color: #67e8f9; } /* DataType */
[data-bs-theme="dark"] pre code span.dv { color: #fcd34d; } /* DecVal */
[data-bs-theme="dark"] pre code span.er { color: #f87171; font-weight: bold; } /* Error */
[data-bs-theme="dark"] pre code span.ex { color: #e5e7eb; } /* Extension */
[data-bs-theme="dark"] pre code span.fl { color: #fcd34d; } /* Float */
[data-bs-theme="dark"] pre code span.fu { color: #60a5fa; } /* Function */
[data-bs-theme="dark"] pre code span.im { color: #e5e7eb; } /* Import */
[data-bs-theme="dark"] pre code span.in { color: #9ca3af; } /* Information */
[data-bs-theme="dark"] pre code span.kw { color: #c084fc; font-weight: bold; } /* Keyword */
[data-bs-theme="dark"] pre code span.op { color: #cbd5e1; } /* Operator */
[data-bs-theme="dark"] pre code span.ot { color: #818cf8; } /* Other */
[data-bs-theme="dark"] pre code span.pp { color: #c084fc; } /* Preprocessor */
[data-bs-theme="dark"] pre code span.re { color: #e5e7eb; } /* RegionMarker */
[data-bs-theme="dark"] pre code span.sc { color: #fcd34d; } /* SpecialChar */
[data-bs-theme="dark"] pre code span.ss { color: #86efac; } /* SpecialString */
[data-bs-theme="dark"] pre code span.st { color: #86efac; } /* String */
[data-bs-theme="dark"] pre code span.va { color: #cbd5e1; } /* Variable */
[data-bs-theme="dark"] pre code span.vs { color: #86efac; } /* VerbatimString */
[data-bs-theme="dark"] pre code span.wa { color: #f87171; font-style: italic; } /* Warning */
