/* ------------ SELF-HOSTED FONTS ------------ */
@font-face {
  font-family: 'Geist Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../assets/fonts/geist-latin-wght-normal.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Geist Mono Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../assets/fonts/geist-mono-latin-wght-normal.woff2') format('woff2-variations');
}

/* ------------ DESIGN TOKENS (single source of truth) ------------ */
:root {
  --md-text-font: "Geist Variable";
  --md-code-font: "Geist Mono Variable";
  --ff-space-1: 0.25rem;
  --ff-space-2: 0.5rem;
  --ff-space-3: 0.75rem;
  --ff-space-4: 1rem;
  --ff-radius-sm: 4px;
  --ff-radius-md: 8px;
  --ff-radius-lg: 12px;
}

/* ------------ GLOBAL STYLES ------------ */

/* Force Geist on body — bypasses Material's --md-text-font-family variable chain */
body {
    font-family: "Geist Variable", -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif !important;
}
code, pre, .md-typeset code {
    font-family: "Geist Mono Variable", SFMono-Regular, Consolas, Menlo, monospace !important;
}

/* Force dark mode */
[data-md-color-scheme="slate"] {
    --ff-bg: #111113;
    --ff-fg: #ffffff;
    --ff-card: #161618;
    --ff-muted: #2a2a2a;
    --ff-muted-fg: #b3b3b3;
    --ff-primary: #4CAF50;
    --ff-primary-hover: #388E3C;
    --ff-primary-strong: #2E7D32;
    --ff-destructive: #FF5252;
    --ff-border: #2a2a2a;
    --ff-ring: #4CAF50;
    --ff-footer-bg: #0c0c0e;

    --md-default-bg-color: var(--ff-bg);
    --md-default-fg-color: var(--ff-fg);
    --md-typeset-color: var(--ff-fg);
    --md-primary-fg-color: var(--ff-bg);
    --md-accent-fg-color: var(--ff-primary);

    /* --- Syntax Highlighting --- */

    /* Targeting YAML keys / HTML tags (often blue) */
    --md-code-hl-nt-color: var(--ff-destructive); /* Red */

    /* Keywords (often blue/purple) */
    --md-code-hl-kw-color: var(--ff-destructive); /* Red */

    /* Built-ins (often blue/cyan) */
    --md-code-hl-bi-color: var(--ff-destructive); /* Red */

    /* Function names (can be blueish) */
    --md-code-hl-nf-color: var(--ff-destructive); /* Red */

    /* Class names (can be blueish) */
    --md-code-hl-nc-color: var(--ff-destructive); /* Red */

    /* Strings (ensure they aren't overridden if desired) */
    /* --md-code-hl-str-color: #your_string_color; */

    /* --- Code Block Scrollbar --- */

    /* Set scrollbar track color */
    --md-scrollbar-track-color: hsla(0, 0%, 0%, 0.1); /* Darker transparent */

    /* Set scrollbar thumb color */
    --md-scrollbar-thumb-color: var(--ff-primary); /* Primary Green */

    /* Set scrollbar thumb color on hover/active */
    --md-scrollbar-thumb-hover-color: var(--ff-primary-strong); /* Darker Menu Green */
}

/* Hide theme switcher */
.md-header__option {
    display: none !important;
}

/* ------------ HEADER STYLING ------------ */

/* Header bar — slightly darker than body, border separates header from tabs (matches landing page) */
.md-header {
    background-color: #0e0e10 !important;
    border-bottom: 1px solid var(--ff-border) !important;
}

/* Tabs bar — match header background, no border */
.md-tabs {
    background-color: #0e0e10 !important;
}

/* Logo size — aligned with landing page (44×44) */
.md-header__button.md-logo img {
    width: 44px !important;
    height: 44px !important;
}

/* Reduce gap between logo and title (landing page uses gap-2.5 = 0.625rem) */
[dir=ltr] .md-header__title {
    margin-left: 0.5rem !important;
}
[dir=rtl] .md-header__title {
    margin-right: 0.5rem !important;
}

/* Site title / brand wordmark — Geist font, semibold, lowercase to match landing page branding. */
.md-header__title,
.md-header__title .md-header__topic,
.md-header__title .md-header__topic .md-ellipsis {
    font-family: "Geist Variable", var(--md-text-font), sans-serif !important;
    font-weight: 600 !important;
    font-style: normal !important;
    letter-spacing: -0.025em !important;
    text-transform: lowercase !important;
    color: var(--md-primary-bg-color) !important;
}

/* Vertically center title text and tighten line-height to match landing page.
   Material's 2.4rem line-height (48px at 125% root) makes the span too tall vs landing page's 35px. */
.md-header__title .md-header__topic {
    top: 0 !important;
    bottom: 0 !important;
    align-items: center !important;
}
.md-header__title .md-header__topic .md-ellipsis {
    line-height: normal !important;
}

/* ------------ CONTENT LINKS ------------ */

/* Make all links green with red hover */
.md-typeset a {
    color: var(--ff-primary) !important;
}

.md-typeset a:hover {
    color: var(--ff-destructive) !important;
}

/* ------------ TYPOGRAPHY SCALE (Geist-optimized) ------------ */

.md-typeset {
    line-height: 1.7;
}

.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4,
.md-typeset h5,
.md-typeset h6 {
    color: var(--ff-fg) !important;
    font-family: var(--md-text-font), sans-serif;
    letter-spacing: -0.02em;
}

.md-typeset h1 {
    font-weight: 700;
    letter-spacing: -0.03em;
}

.md-typeset h2 {
    font-weight: 600;
}

.md-typeset h3,
.md-typeset h4 {
    font-weight: 600;
    letter-spacing: -0.01em;
}

.md-typeset h5,
.md-typeset h6 {
    font-weight: 500;
    letter-spacing: 0;
}

.md-typeset code,
.md-typeset pre code {
    font-family: var(--md-code-font), monospace;
    font-weight: 400;
}

.md-nav__link {
    font-weight: 450;
}

.md-typeset .md-post__meta,
.md-typeset .md-categories {
    font-weight: 400;
    letter-spacing: 0.01em;
}

/* Change Category links to green */
.md-nav__link,
.md-typeset a,
.md-nav__item .md-nav__link--active,
.md-tabs__link--active,
.md-nav--primary .md-nav__link--active,
.md-sidebar--primary .md-nav__link--active,
.md-nav__item--active > .md-nav__link {
    color: var(--ff-primary) !important;
}

/* Change sidebar selected items to green */
.md-sidebar .md-nav__link--active {
    color: var(--ff-primary) !important;
    font-weight: 700;
}

/* Update hover color to white for better visibility */
.md-nav__link:hover,
.md-typeset a:hover,
.md-header__title:hover,
.md-header .md-icon:hover,
.md-tabs__link:hover,
.md-sidebar .md-nav__link:hover,
.md-post__category a:hover,
.md-post__meta .md-post__category a:hover,
.md-footer-nav__link:hover,
.md-footer-copyright a:hover,
.md-source:hover,
.md-source__repository:hover,
.md-search-result__link:hover {
    color: var(--ff-fg) !important;
}

/* Ensure blog category links are green too */
.md-post__category a,
.md-post__category {
    color: var(--ff-primary) !important;
}

.md-post__category a:hover {
    color: var(--ff-fg) !important;
}

/* Active tabs */
.md-tabs__link--active, 
.md-tabs__link--active:hover {
    color: var(--ff-fg) !important; /* Keep active tab white for visibility */
}

/* Ensure all remaining green links */
.md-footer-nav__link,
.md-footer-copyright a,
.md-source,
.md-source__repository,
.md-search-result__link {
    color: var(--ff-primary) !important;
}

.md-footer-nav__link:hover,
.md-footer-copyright a:hover,
.md-source:hover,
.md-source__repository:hover,
.md-search-result__link:hover {
    color: var(--ff-fg) !important;
}

/* Blog post metadata links (including category and date) */
.md-post__meta a,
.md-post__meta .md-post__category,
.md-post__meta .md-post__date,
.md-post__meta .md-post__link {
    color: var(--ff-primary) !important;
}

.md-post__meta a:hover,
.md-post__meta .md-post__category:hover,
.md-post__meta .md-post__link:hover {
    color: var(--ff-fg) !important;
}

/* Blog tags styling */
.md-post-tag {
    background-color: rgba(76, 175, 80, 0.1) !important;
    border: 1px solid var(--ff-primary) !important; 
    color: var(--ff-primary) !important;
}

.md-post-tag:hover {
    background-color: rgba(255, 82, 82, 0.1) !important;
    border-color: var(--ff-destructive) !important;
    color: var(--ff-destructive) !important;
}

/* Clean styling for blog post metadata */
.md-post__meta {
    color: rgba(255, 255, 255, 0.7) !important;
}

/* ------------ EMAIL SUBSCRIPTION FORM ------------ */

/* ------------ FOOTER ADJUSTMENTS ------------ */

/* Hide the default "Made with Material for MkDocs" copyright div */
.md-footer .md-copyright {
  display: none !important;
}

/* --- Reduce vertical space around default footer content --- */

/* Target the first (default) meta block within the footer */
.md-footer > .md-footer-meta:first-of-type {
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
}

/* Target the inner grid of the first meta block */
.md-footer > .md-footer-meta:first-of-type > .md-footer-meta__inner {
  padding-top: 0;
  padding-bottom: 0;
  align-items: center !important; /* Override vertical stretching */
}

/* Remove margins from the social icons container itself */
.md-footer .md-social {
  margin: 0 !important; 
  padding: 0 !important; /* Ensure no padding */
  line-height: 1 !important; /* Reduce line height */
  min-height: unset !important; /* Override default min-height */
  height: auto !important; /* Allow height to shrink */
}

/* Ensure links have no extra padding/margin */
.md-footer .md-social .md-social__link {
  margin: 0 !important; /* Only keep minimal horizontal spacing */
  padding: 0 !important;
  display: inline-flex !important; /* Use flex to center content */
  align-items: center; /* Vertically center SVG */
  justify-content: center; /* Horizontally center SVG */
  height: auto !important; /* Override fixed height */
  width: auto !important; /* Override fixed width */
  min-height: unset !important; /* Override min-height */
  min-width: unset !important; /* Override min-width */
  line-height: 1 !important; /* Collapse line height */
  vertical-align: middle; /* Keep vertical align */
}

/* Optional: slightly smaller icons */
.md-footer .md-social .md-social__link svg {
  height: 1rem !important; /* Reiterate size with !important */
  width: 1rem !important;
  display: block; /* Prevent extra space below SVG */
}

/* Adjust spacing for injected form if needed */
.md-footer > .md-footer-meta:last-of-type {
  margin-top: 0 !important;
  padding-top: 0 !important; /* Keep a small padding, or set to 0 */
  border-top: none !important; /* Remove the border we added earlier */
}

/* Sticky Footer Implementation - Keep this if you want the footer sticky */
.md-footer {
  position: fixed !important;
  bottom: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 100 !important; /* Ensure it stays on top */
  background-color: var(--ff-footer-bg) !important; /* Slightly darker than page background */
  box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
}

/* Add padding to main content to avoid overlap with fixed footer */
.md-main {
  padding-bottom: 85px !important; /* Adjust this based on final footer height */
}

/* ------------ TASK 7.1: BLOG LAYOUT + SIDEBAR VISIBILITY ------------
 * Material uses 76.1875em for "desktop" = sidebar visible. With browser zoom,
 * em scales so the same viewport can fall below that and the sidebar becomes
 * a drawer. We add a pixel-based fallback so the sidebar stays visible when
 * zoomed (e.g. 125% on a 1280px laptop).
 * Breakpoints: desktop ≥960px (px) or ≥76.1875em = sidebar visible;
 *   below 960px = drawer (hamburger). */

/* Pixel-based: show sidebar from 960px up so zoomed-in users still see it */
@media screen and (min-width: 960px) {
  .md-sidebar--primary {
    transform: none !important;
    position: relative !important;
    min-width: 13.5rem;
  }
  .md-sidebar--primary[hidden] {
    display: block !important; /* override theme's hidden when drawer closed */
  }
  .md-content {
    max-width: 50rem;
  }
}

/* Desktop (theme default em breakpoint): same proportions when already in desktop mode */
@media screen and (min-width: 76.1875em) {
  .md-sidebar--primary {
    min-width: 13.5rem;
  }
  .md-content {
    max-width: 50rem;
  }
}

.md-footer-meta__inner {
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 0.5rem 0.2rem 0.5rem 0.2rem !important; /* Increased top padding from 0.1rem */
  display: block !important;
  text-align: center !important;
}

/* Force center the subscribe form */
.md-footer-subscribe {
  position: relative;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 auto !important; /* Remove bottom margin */
  display: flex !important;
  justify-content: center !important;
}

/* Thank you message styling */
#thank-you-message {
  text-align: center !important;
  padding: 0.5rem 0 !important;
}

#thank-you-message p {
  font-size: 0.9rem !important;
  color: var(--ff-fg) !important;
  margin: 0 !important;
  padding: 0.5rem 0 !important;
}

/* Constrain form width on wider screens and center it */
.md-footer-subscribe__form {
  width: 100% !important;
  max-width: 860px !important;
  margin: 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  box-sizing: border-box !important;
  align-items: stretch !important;
}

.md-footer-subscribe__input-container {
  width: 100% !important;
  display: flex !important;
  height: 40px !important;
  align-items: stretch !important;
  margin-bottom: 0 !important; /* Added */
}

.md-footer-subscribe__label {
  color: var(--ff-fg);
  font-size: 0.9rem;
  margin-right: 1rem;
  display: flex;
  align-items: center;
}

.md-footer-subscribe__input {
  flex: 1;
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  padding: 0 1rem;
  border: none;
  border-radius: var(--ff-radius-sm) 0 0 var(--ff-radius-sm);
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--ff-fg);
  font-size: 0.9rem;
  min-width: 300px;
  box-sizing: border-box;
  line-height: 40px !important;
}

.md-footer-subscribe__input:focus {
  outline: none;
  box-shadow: none;
}

.md-footer-subscribe__input::placeholder {
  color: rgba(255, 255, 255, 0.3);
  opacity: 1; /* Ensure the color isn't overridden by browser default opacity */
}

.md-footer-subscribe__button {
  height: 100%;
  padding: 0 1.5rem;
  border: 1px solid var(--ff-primary) !important; /* Added border */
  border-radius: var(--ff-radius-sm) !important; /* Changed from 0 4px 4px 0 */
  background-color: transparent !important; /* Changed from #4CAF50 */
  color: var(--ff-primary) !important; /* Changed from #ffffff */
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s; /* Added color/border transitions */
  white-space: nowrap;
  box-sizing: border-box;
}

.md-footer-subscribe__button:hover {
  background-color: var(--ff-primary-hover) !important; /* Keep dark green background */
  color: var(--ff-fg) !important; /* Added white text color */
  border-color: var(--ff-primary-hover) !important; /* Added border color match */
}

.md-footer-subscribe__message {
  font-size: 0.8rem;
  position: absolute;
  top: -1.5rem;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.md-footer-subscribe__message.success {
  color: var(--ff-primary);
}

.md-footer-subscribe__message.error {
  color: var(--ff-destructive);
}

/* Mobile adjustments for consent checkbox */
@media (max-width: 76.1875em) {
  .md-footer-subscribe__input-container {
    flex-direction: column !important;
    height: auto !important;
    gap: 8px !important;
    margin-bottom: 8px !important;
  }
   
  .md-footer-subscribe__input {
    width: 100% !important;
    border-radius: 4px !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    line-height: 40px !important;
    padding: 0 1rem !important;
    margin: 0 !important;
    font-size: 16px !important;
    -webkit-appearance: none !important;
  }
   
  .md-footer-subscribe__button {
    width: 100% !important;
    border-radius: 4px !important;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    line-height: 40px !important;
    padding: 0 1rem !important;
    margin: 0 !important;
    font-size: 16px !important;
  }
  
  .md-footer-subscribe__consent {
    margin-top: 0.1rem !important; /* Reduced top margin */
    padding: 0 !important;
    width: 100% !important;
    text-align: left !important;
    font-size: 0.65rem !important;
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    margin-bottom: 0 !important;
  }
  
  /* Reduce top margin for the wrapper on mobile */
  .md-footer-subscribe__consent-social-wrapper {
    margin-top: 0.1rem !important; /* Reduced from 0.5em (general rule) */
  }
}

/* Center the copyright */
.md-footer-copyright {
  width: 100% !important;
  text-align: center !important;
  margin: 0 0 0 0 !important; 
  padding-bottom: 0 !important; /* Ensure no extra padding */
  white-space: normal; /* Allow wrapping */
}

/* Update homepage button alignment */
.md-typeset .md-button {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  margin-right: 1rem;
}

.md-typeset p + .md-button {
  margin-top: 2rem;
}

/* Button styling */
.md-button {
    color: var(--ff-primary) !important;
    border: 1px solid var(--ff-primary) !important;
    background-color: transparent !important;
    padding: 0.5em 1em;
    text-decoration: none;
    display: inline-block;
    border-radius: var(--ff-radius-sm);
}

.md-button:hover {
  color: var(--ff-fg) !important;
  background-color: var(--ff-primary-hover) !important;
  border-color: var(--ff-primary-hover) !important;
}

.md-button--primary {
    color: var(--ff-primary) !important;
    background-color: transparent !important;
    border: 1px solid var(--ff-primary) !important;
}

.md-button--primary:hover {
  background-color: var(--ff-primary-hover) !important;
  border-color: var(--ff-primary-hover) !important;
  color: var(--ff-fg) !important;
}

/* Button container styling */
.button-container {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.button-container .md-button {
  margin: 0.5rem; /* Changed from margin: 0 to add space around buttons */
}

/* Increase menu bar font size */
.md-tabs__link {
  font-size: 1rem !important; /* Increased from default */
}

/* ------------ NAVIGATION FONT SIZES ------------ */

/* Main navigation (left sidebar) */
.md-nav--primary .md-nav__link {
  font-size: 0.8rem !important; /* Reduced from 0.85rem */
}

.md-nav--primary .md-nav__title {
  font-size: 0.9rem !important;
  text-transform: lowercase;
}

/* Table of contents (right sidebar) */
.md-nav--secondary .md-nav__link {
  font-size: 0.8rem !important; /* Reduced from 0.9rem */
}

/* Category headers in navigation */
.md-nav__item--section > .md-nav__link[for] {
  font-size: 0.95rem !important; /* Reduced from 1.1rem */
  font-weight: 500 !important;
}

/* Blog categories and metadata in sidebar */
.md-nav__item .md-nav__link,
.metadata-item,
.post-metadata span,
.sidebar-category
{
  font-size: 0.8rem !important; /* Reduced from 0.85rem */
}

/* Table of contents title */
.md-nav--secondary .md-nav__title {
  font-size: 0.8rem !important;
}

/* Brand separator dot (D1 destructive-red) — inherits title font-size */
.site-dot {
  color: var(--ff-destructive) !important;
  font-weight: bold !important;
}

/* Consent checkbox styling */
.md-footer-subscribe__consent {
  margin-top: 0.8rem !important; /* Reduced from 1.2rem */
  width: 100% !important;
  text-align: left !important;
  font-size: 0.7rem !important;
  color: rgba(255, 255, 255, 0.6) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  flex-wrap: nowrap !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  margin-bottom: 0 !important;
}

.md-footer-subscribe__consent input[type="checkbox"] {
  margin-right: 0.5rem !important;
  min-width: 16px !important; /* Make checkbox bigger */
  width: 16px !important; /* Make checkbox bigger */
  height: 16px !important; /* Make checkbox bigger */
  cursor: pointer !important;
  flex-shrink: 0 !important; /* Prevent checkbox from shrinking */
}

.md-footer-subscribe__consent label {
  cursor: pointer !important;
  flex: 0 1 auto !important; /* Don't stretch the label too wide */
  white-space: nowrap !important; /* Keep text on one line */
  overflow: visible !important; /* Allow text to be visible */
  line-height: 1.2 !important;
  text-align: left !important; /* Left-align the text */
}

/* Style the checked state of the consent checkbox */
.md-footer-subscribe__consent input[type="checkbox"]:checked {
  accent-color: var(--ff-primary);
}

/* Center the copyright */
.md-footer-copyright {
  width: 100% !important;
  text-align: center !important;
  margin: 0 0 0 0 !important; 
  padding-bottom: 0 !important; /* Ensure no extra padding */
  white-space: normal; /* Allow wrapping */
}

/* Turnstile widget styling */
.md-footer-turnstile {
  margin-top: 0.5rem;
  transition: opacity 0.3s ease, height 0.3s ease;
  height: auto;
  opacity: 1;
  overflow: hidden;
}

.md-footer-turnstile[style*="display: none"] {
  height: 0;
  opacity: 0;
  margin: 0;
}

/* Make sure the message area has a consistent height to prevent layout shifts */
.md-footer-message {
  min-height: 1.5rem;
  margin: 0.5rem 0;
  font-size: 0.8rem;
}

.md-footer-message.error {
  color: var(--ff-destructive);
}

.md-footer-message.success {
  color: var(--ff-primary);
}

.md-footer-message.info {
  color: var(--ff-primary);
}

/* Clean up any old styles to avoid conflicts */
.md-sidebar--primary .md-sidebar__inner {
  position: sticky !important;
  top: 72px !important; /* Match header height */
  height: calc(100vh - 72px) !important; /* Viewport height minus header */
  overflow-y: auto !important;
  scrollbar-width: thin !important;
}

/* ------------ AUTHOR STYLING ------------ */

/* ONLY essential styling for the sidebar author avatar */
.md-sidebar__inner .md-profile .md-author--long img,
.md-sidebar__inner .md-author img,
.md-sidebar__inner .md-author__avatar {
  border-radius: 50% !important;
  object-fit: cover !important;
}

/* Hover colors for nav items */
.md-tabs__link:hover,
.md-nav__link:hover {
    color: var(--ff-fg) !important;
}

/* Nav arrow icon color */
.md-nav__icon svg {
    fill: white;
}

/* Site title in header — consolidated into .md-header__title block above */


/* ------------ SIDEBAR SCROLLBAR STYLING ------------ */

/* Set scrollbar color for Firefox */
.md-sidebar--primary .md-sidebar__scrollwrap {
  scrollbar-color: var(--ff-primary) var(--ff-bg);
}

/* Set scrollbar styles for Webkit browsers (Chrome, Safari) */
.md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar {
  width: 8px;
}

.md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar-track {
  background: var(--ff-bg);
}

.md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar-thumb {
  background-color: var(--ff-primary);
  border-radius: var(--ff-radius-sm);
  border: 2px solid var(--ff-bg);
}

.md-sidebar--primary .md-sidebar__scrollwrap::-webkit-scrollbar-thumb:hover {
  background-color: var(--ff-primary-hover);
}


/* More specific scrollbar styling for Webkit browsers (Chrome, Safari, Edge) */
/* Targets scrollbars specifically within code blocks */
pre ::-webkit-scrollbar {
  height: 8px; /* Adjust height */
  width: 8px;  /* Adjust width */
}

pre ::-webkit-scrollbar-track {
  background-color: hsla(0, 0%, 0%, 0.1);
  border-radius: var(--ff-radius-sm);
}

pre ::-webkit-scrollbar-thumb {
  background-color: var(--ff-primary);
  border-radius: var(--ff-radius-sm);
}

pre ::-webkit-scrollbar-thumb:hover {
  background-color: var(--ff-primary-strong);
}

pre {
  scrollbar-width: thin;
  scrollbar-color: var(--ff-primary) hsla(0, 0%, 0%, 0.1);
}

/* Illustration Gallery for side-by-side images */
.illustration-gallery {
  display: flex;          /* Enable flexbox layout */
  flex-wrap: nowrap;       /* Force items onto a single line */
  gap: 1em;               /* Space between images */
  margin: 2em 0;          /* Vertical margin for the container */
  overflow-x: auto;       /* Add horizontal scroll on very small screens */
}

/* Updated styles for individual illustrations within the gallery */
.illustration-image {
  /* flex: 1; - Replaced */
  flex-grow: 1;           /* Allow items to grow */
  flex-shrink: 1;         /* Allow items to shrink */
  flex-basis: 0;          /* Start with no assumed width */
  width: calc(25% - 0.75em); /* Distribute width (100%/4) minus gap space (3 gaps * 1em / 4 items) */
  min-width: 150px;       /* Prevent shrinking too much on small screens */
  border-radius: 8px;
  height: auto;
  object-fit: contain;
}

/* Responsive adjustments for illustration gallery */
@media screen and (max-width: 959px) { /* Adjust breakpoint as needed */
  .illustration-gallery {
    flex-wrap: wrap;        /* Allow wrapping */
    justify-content: center; /* Center items when wrapped */
    overflow-x: visible;    /* Remove horizontal scroll */
  }

  .illustration-image {
    /* Adjust width for 2 columns, considering gap */
    width: calc(50% - 0.5em); 
    min-width: 180px;       /* Adjust min-width if needed for 2-column layout */
  }
}

/* Add top margin to the subscription form container */
.md-footer-subscribe {
  margin-top: 1em;
}

/* Layout for Consent Checkbox and Social Icons wrapper */
.md-footer-subscribe__consent-social-wrapper {
  display: flex;
  /* justify-content: space-between; Pushes consent left, social right */
  justify-content: flex-start; /* Align items to the start */
  align-items: baseline;
  margin-top: 0.5em; /* Added back margin for vertical space */
  width: 100%; /* Ensure wrapper takes full width of its container (the form) */
}

/* Ensure consent checkbox has no extra top margin inside the wrapper */
.md-footer-subscribe__consent-social-wrapper .md-footer-subscribe__consent {
  margin-top: 0 !important; /* Added */
}

/* Ensure social icons have no extra top margin inside the wrapper */
.md-footer-subscribe__consent-social-wrapper .md-social {
  margin-top: 0 !important; /* Added */
  margin-left: auto; /* Push social icons to the right within the wrapper */
}

/* Optional: Ensure social icons don't have extra margins */
.md-footer-subscribe__consent-social-wrapper .md-social__link {
  margin: 0 0.3em;
}

/* Hide the duplicate social icons block rendered directly by the theme footer */
.md-footer-meta__inner > .md-social {
  display: none !important;
}

/* Add top margin to the subscription form container WHEN VISIBLE */
#subscription-container:not(.hidden-by-subscription) {
  margin-top: 1em;
}

/* Remove bottom margin from the input/button line */
.md-footer-subscribe__input-container {
  margin-bottom: 0 !important; /* Added */
}

/* Add this block for styling blog post charts */
.blog-chart {
  display: block; /* Needed for margin auto */
  margin-top: 1.5em;  /* Space above the image */
  margin-bottom: 1.5em; /* Space below the image */
  margin-left: auto;
  margin-right: auto;
  max-width: 100%; /* Responsive */
  width: 650px;  /* Adjust this width as desired */
  /* padding: 10px; Removed padding as filter/border-radius is applied directly to img */
  border-radius: 20px; /* Increased rounding */
  /* Since the image bg isn't transparent, we add padding */
  /* No explicit background-color needed, will show image bg */
  filter: brightness(0.85); /* Slightly dim the image to reduce starkness */
}

/* Optional: Style for captions if you add them later */
.blog-chart + em {
    display: block;
    text-align: center;
    /* margin-top: -1em; Adjust if needed now padding is removed */
    margin-top: 0.5em; /* Add space after dimmed image */
    margin-bottom: 1.5em;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.7); /* Adjust color to match theme */
}

/* Add padding to account for sticky footer */
.md-sidebar--secondary .md-sidebar__inner {
  padding-bottom: 6rem; /* Adjust as needed based on actual footer height */
}

/* Hide auto-generated title on directory page */
.md-content article h1:first-child { display: none; }

/* No results message */
.no-results-container {
  text-align: center;
  padding: 60px 20px;
  color: var(--ff-muted-fg);
  grid-column: 1 / -1;
}
.no-results-container h3 {
  color: var(--ff-fg);
  margin: 0 0 12px 0;
  font-size: 24px;
}
.no-results-container p {
  color: var(--ff-muted-fg);
  margin: 0 0 24px 0;
}
.clear-btn {
  background: var(--ff-primary);
  color: var(--ff-fg);
  border: none;
  padding: 10px 20px;
  border-radius: var(--ff-radius-md);
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease;
}
.clear-btn:hover {
  background: var(--ff-primary-hover);
}
.suggestions {
  margin-top: 24px;
  padding: 16px;
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid var(--ff-border);
  border-radius: var(--ff-radius-md);
  text-align: left;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}
.suggestions p {
  margin: 8px 0;
  font-size: 14px;
  color: var(--ff-muted-fg);
}
.suggestions strong {
  color: var(--ff-primary);
}

/* ---- Directory filters & cards ---- */
#dir-filters { 
  display: grid; 
  grid-template-columns: 2fr 1fr; 
  grid-template-rows: auto auto;
  gap: 12px; 
  margin: 20px 0 24px; 
  align-items: end;
}

#dir-filters #q { grid-column: 1; grid-row: 1; }
#dir-filters #platform { grid-column: 2; grid-row: 1; }
#dir-filters #frequency { grid-column: 1; grid-row: 2; }
#dir-filters #suggest-button { grid-column: 2; grid-row: 2; }

@media screen and (min-width: 768px) {
  #dir-filters {
    grid-template-columns: 2fr 1.5fr 1.5fr 1.5fr;
    grid-template-rows: auto;
  }
  
  #dir-filters #q { grid-column: 1; grid-row: 1; }
  #dir-filters #platform { grid-column: 2; grid-row: 1; }
  #dir-filters #frequency { grid-column: 3; grid-row: 1; }
  #dir-filters #suggest-button { grid-column: 4; grid-row: 1; }
}

#suggest-button {
  background: var(--ff-primary) !important;
  color: var(--ff-fg) !important;
  border: 1px solid var(--ff-primary);
  border-radius: var(--ff-radius-md);
  padding: 7px 12px;
  text-decoration: none;
  white-space: nowrap;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

#suggest-button:hover {
  background: var(--ff-primary-hover) !important;
  border-color: var(--ff-primary-hover);
}

#dir-filters input, #dir-filters select { 
  background: var(--ff-muted); 
  color: var(--ff-fg); 
  border: 1px solid var(--ff-primary); 
  border-radius: var(--ff-radius-md); 
  padding: 10px 16px 10px 12px; 
  font-size: 14px;
  transition: border-color 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
#dir-filters select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='%234CAF50' viewBox='0 0 16 16'%3e%3cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
}
#dir-filters input:focus, #dir-filters select:focus {
  outline: none;
  border-color: var(--ff-primary-hover);
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.2);
}

/* Directory controls: visible focus for keyboard (accessibility baseline) */
#dir-filters input:focus-visible,
#dir-filters select:focus-visible {
  outline: 2px solid var(--ff-ring);
  outline-offset: 2px;
  border-color: var(--ff-primary);
}

#suggest-button:focus {
  outline: none;
}
#suggest-button:focus-visible {
  outline: 2px solid var(--ff-ring);
  outline-offset: 2px;
}

.clear-btn:focus {
  outline: none;
}
.clear-btn:focus-visible {
  outline: 2px solid var(--ff-ring);
  outline-offset: 2px;
}

.dir-item > summary:focus {
  outline: none;
}
.dir-item > summary:focus-visible {
  outline: 2px solid var(--ff-ring);
  outline-offset: 2px;
}

.dir-more > summary:focus {
  outline: none;
}
.dir-more > summary:focus-visible {
  outline: 2px solid var(--ff-ring);
  outline-offset: 2px;
}

@media (max-width: 768px) {
  #dir-filters { 
    grid-template-columns: 1fr 1fr 1fr; 
    gap: 8px; 
  }
}
/* Legacy styles - replaced by newer ones below */
@media (min-width: 1000px) { .dir-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; } }

/* Directory lists */
.dir-content ul { margin: 8px 12px; padding-left: 18px; }
.dir-content li { margin: 4px 0; }
/* Removed - padding defined in main summary rule */

/* Directory card container: single green border */
.dir-item { border: 1px solid var(--ff-primary); border-radius: var(--ff-radius-md); overflow: hidden; margin: 4px 0; transition: border-color 0.2s ease; }
.dir-item:hover { border-color: var(--ff-primary-hover); }
.dir-item:focus-within { border-color: var(--ff-primary); outline: none; }
.dir-item > summary { 
  border: none; 
  border-radius: var(--ff-radius-md) var(--ff-radius-md) 0 0; 
  background: var(--ff-card); 
  display: flex; 
  align-items: center; 
  gap: 0; 
  padding: 12px 15px;
  margin: 0 !important;
  list-style: none !important;
}
.dir-content { border: none; border-top: 1px solid var(--ff-border); border-bottom-left-radius: var(--ff-radius-md); border-bottom-right-radius: var(--ff-radius-md); }

/* Remove default left icon from details summary (blue circle) */
.md-typeset .dir-item > summary::before { display: none !important; }
.md-typeset .dir-more > summary::before { display: none !important; }

/* Color the right chevron arrow to green */
.md-typeset .dir-item > summary::after { color: var(--ff-primary) !important; }
.md-typeset .dir-more > summary::after { color: var(--ff-primary) !important; }

/* Override MkDocs default spacing for details */
.md-typeset .dir-item { margin: 4px 0 !important; }
.md-typeset .dir-item > summary { 
  margin: 0 !important; 
  padding-left: 15px !important; 
  text-indent: 0 !important;
}

/* Optional thumbnail/logo in summary */
.dir-thumb { width: 60px; height: 60px; border-radius: var(--ff-radius-lg); object-fit: cover; border: 1px solid var(--ff-border); flex: 0 0 60px; margin-right: 15px; }
.dir-thumb--square { border-radius: var(--ff-radius-lg); }

/* Directory card content */
.dir-content { padding: 8px 12px 0; border: 1px solid var(--ff-border); border-top: none; border-bottom-left-radius: var(--ff-radius-md); border-bottom-right-radius: var(--ff-radius-md); background: var(--ff-card); }

/* Ensure last element in card content has no bottom margin */
.dir-content > :last-child { margin-bottom: 3px !important; }
.dir-item > summary { background: var(--ff-card); color: var(--ff-fg); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.dir-item > summary b { color: var(--ff-fg); }
.dir-item > summary::marker { content: ''; }
#dir-filters input::placeholder { color: var(--ff-muted-fg); }

/* Directory meta and more */
.dir-meta { display: grid; grid-template-columns: 120px 1fr; gap: 4px 12px; margin: 6px 12px 8px; }
.dir-meta dt { font-weight: 700; color: var(--ff-fg); }
.dir-meta dd { margin: 0; }
.dir-more { margin: 4px 3px 0; background: transparent; }
.dir-more > summary { cursor: pointer; color: var(--ff-primary); margin-bottom: 6px; background: transparent; }
.dir-more[open] { margin-bottom: 0; }
.dir-more[open] > summary { margin-bottom: 4px; }

/* Specific spacing for More details as last element */
.dir-content > .dir-more:last-child { margin: 4px 6px 3px; }
.dir-content > .dir-more:last-child[open] { margin-bottom: 3px; }

/* Closed summary formatting */
.dir-item > summary { display: flex; align-items: center; gap: 15px; }
.dir-item > summary > span:first-of-type { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.dir-item > summary .dir-tags { opacity: 0.85; font-weight: 400; font-size: 0.85em; }

/* Key-Value (definition list) inside directory cards */
.dir-kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 6px 12px 8px; }
.dir-kv dt { font-weight: 700; color: var(--ff-fg); margin: 0; }
.dir-kv dd { margin: 0; }
.dir-kv span { opacity: 0.7; margin: 0 6px; }

/* Remove extra left gutter inside details content */
.dir-content { padding: 10px 12px; border: 1px solid var(--ff-border); border-top: none; border-bottom-left-radius: var(--ff-radius-md); border-bottom-right-radius: var(--ff-radius-md); background: var(--ff-card); }
.dir-item { margin: 8px 0; }

/* Tighter bullets inside 'More details' */
.dir-more ul { margin: 6px 0 0 14px !important; padding-left: 14px !important; }
.dir-more li { margin: 2px 0 !important; }

/* Recolor admonition (notes) borders only */
.md-typeset .admonition, .md-typeset details { border-color: var(--ff-primary) !important; }
.md-typeset .admonition > .admonition-title, .md-typeset details > summary { border-color: var(--ff-primary) !important; }

