/* ==========================================================================
   Google Fonts Import
   ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

/* ==========================================================================
   Loophole Protocol – Custom Color Scheme
   Brand: #CBFF93 (lime green) on #111827 (dark blue-gray)
   ========================================================================== */

[data-md-color-scheme="loophole"] {
  /* -- Typography ---------------------------------------------------------- */
  --md-text-font:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* -- Background scale --------------------------------------------------- */
  --md-default-bg-color: #111827;
  --md-default-bg-color--light: #1a2234;
  --md-default-bg-color--lighter: #1f2937;
  --md-default-bg-color--lightest: #2a3548;

  /* -- Foreground / text scale -------------------------------------------- */
  --md-default-fg-color: rgba(203, 213, 225, 0.87); /* #CBD5E1 body */
  --md-default-fg-color--light: rgba(148, 163, 184, 0.54); /* secondary */
  --md-default-fg-color--lighter: rgba(100, 116, 139, 0.32); /* muted */
  --md-default-fg-color--lightest: rgba(100, 116, 139, 0.12); /* faintest */

  /* -- Primary = lime green brand color ----------------------------------- */
  --md-primary-fg-color: #cbff93;
  --md-primary-fg-color--light: #d8ffb0;
  --md-primary-fg-color--dark: #9acc6a;
  --md-primary-bg-color: #111827;
  --md-primary-bg-color--light: #1a2234;

  /* -- Accent ------------------------------------------------------------- */
  --md-accent-fg-color: #cbff93;
  --md-accent-fg-color--transparent: rgba(203, 255, 147, 0.1);
  --md-accent-bg-color: #111827;
  --md-accent-bg-color--light: #1a2234;

  /* -- Typeset ------------------------------------------------------------- */
  --md-typeset-color: #cbd5e1;
  --md-typeset-a-color: #cbff93;

  /* -- Code blocks --------------------------------------------------------- */
  --md-code-bg-color: #0d1117;
  --md-code-fg-color: #e2e8f0;
  --md-code-hl-color: rgba(203, 255, 147, 0.1);
  --md-code-hl-number-color: #cbff93;
  --md-code-hl-special-color: #f0abfc;
  --md-code-hl-function-color: #93c5fd;
  --md-code-hl-constant-color: #cbff93;
  --md-code-hl-keyword-color: #c4b5fd;
  --md-code-hl-string-color: #86efac;
  --md-code-hl-name-color: #e2e8f0;
  --md-code-hl-operator-color: #f9a8d4;
  --md-code-hl-punctuation-color: #94a3b8;
  --md-code-hl-comment-color: #64748b;
  --md-code-hl-generic-color: #cbff93;
  --md-code-hl-variable-color: #e2e8f0;

  /* -- Footer -------------------------------------------------------------- */
  --md-footer-bg-color: #0d1117;
  --md-footer-bg-color--dark: #090d14;
  --md-footer-fg-color: #cbd5e1;
  --md-footer-fg-color--light: #94a3b8;
  --md-footer-fg-color--lighter: #64748b;

  /* -- Shadows (subtle for dark theme) ------------------------------------- */
  --md-shadow-z1:
    0 0.2rem 0.5rem rgba(0, 0, 0, 0.25), 0 0 0.05rem rgba(0, 0, 0, 0.15);
  --md-shadow-z2:
    0 0.2rem 0.5rem rgba(0, 0, 0, 0.3), 0 0 0.05rem rgba(0, 0, 0, 0.2);
  --md-shadow-z3:
    0 0.2rem 0.5rem rgba(0, 0, 0, 0.35), 0 0 0.05rem rgba(0, 0, 0, 0.25);

  /* -- Admonitions --------------------------------------------------------- */
  --md-admonition-bg-color: #1a2234;
  --md-admonition-fg-color: #cbd5e1;

  /* -- Color for the scrollbar --------------------------------------------- */
  color-scheme: dark;
}

/* Apply Inter font globally */
[data-md-color-scheme="loophole"] body,
[data-md-color-scheme="loophole"] .md-typeset {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
}

/* ==========================================================================
   Typography overrides
   ========================================================================== */

[data-md-color-scheme="loophole"] .md-typeset h1,
[data-md-color-scheme="loophole"] .md-typeset h2,
[data-md-color-scheme="loophole"] .md-typeset h3,
[data-md-color-scheme="loophole"] .md-typeset h4,
[data-md-color-scheme="loophole"] .md-typeset h5,
[data-md-color-scheme="loophole"] .md-typeset h6 {
  color: #e2e8f0;
}

/* ==========================================================================
   Header / navigation bar
   ========================================================================== */

[data-md-color-scheme="loophole"] .md-header {
  background-color: #111827;
  box-shadow: none;
  border-bottom: 1px solid #2a3548;
}

[data-md-color-scheme="loophole"] .md-tabs {
  background-color: #111827;
}

/* Hide the site name text (logo already contains wordmark) */
[data-md-color-scheme="loophole"] .md-header__title {
  display: none;
}

/* Push search bar to the right */
[data-md-color-scheme="loophole"] .md-header__inner {
  display: flex;
  align-items: center;
}

[data-md-color-scheme="loophole"] .md-search {
  margin-left: auto;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

[data-md-color-scheme="loophole"] .md-sidebar {
  background-color: #111827;
}

/* Active nav link */
[data-md-color-scheme="loophole"] .md-nav__link--active {
  color: #cbff93;
}

/* ==========================================================================
   Cards on landing page  (.lh-cards / .lh-card)
   ========================================================================== */

[data-md-color-scheme="loophole"] .lh-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1rem;
  margin: 1rem 0 2rem;
}

[data-md-color-scheme="loophole"] .lh-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background-color: #1a2234;
  border: 1px solid #2a3548;
  border-bottom: 1px solid #2a3548;
  border-radius: 0.5rem;
  padding: 1.5rem;
  text-decoration: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

[data-md-color-scheme="loophole"] .lh-card:hover {
  border-color: rgba(203, 255, 147, 0.35);
  border-bottom-color: rgba(203, 255, 147, 0.35);
  box-shadow: 0 0 16px rgba(203, 255, 147, 0.06);
}

[data-md-color-scheme="loophole"] .lh-card strong {
  display: block;
  color: #e2e8f0;
  /* text-transform: uppercase; */
  letter-spacing: 0.04em;
  font-size: 0.85rem;
}

[data-md-color-scheme="loophole"] .lh-card p {
  color: rgba(203, 213, 225, 0.7);
  font-size: 0.85rem;
  margin: 0;
  padding: 0;
}

[data-md-color-scheme="loophole"] .lh-cards--hero .lh-card {
  height: 240px;
  justify-content: center;
  text-align: center;
}

[data-md-color-scheme="loophole"] .md-typeset .lh-cards--hero .lh-card {
  padding-bottom: 1.5rem;
}

[data-md-color-scheme="loophole"] .lh-cards--wide {
  grid-template-columns: repeat(auto-fill, minmax(24rem, 1fr));
}

[data-md-color-scheme="loophole"] .lh-cards--wide .lh-card {
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.5rem;
}

[data-md-color-scheme="loophole"] .lh-card__header {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}

[data-md-color-scheme="loophole"] .lh-card__icon {
  color: #cbff93;
  flex-shrink: 0;
  font-size: 0.65rem;
}

[data-md-color-scheme="loophole"] .md-typeset .lh-cards--wide .lh-card {
  padding-bottom: 1rem;
}

/* Override .md-typeset a specificity (0,2,1) which beats .lh-card (0,2,0) */
[data-md-color-scheme="loophole"] .md-typeset .lh-card {
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #2a3548;
}

[data-md-color-scheme="loophole"] .md-typeset .lh-card:hover {
  border-bottom-color: rgba(203, 255, 147, 0.35);
}

/* ==========================================================================
   Admonitions
   ========================================================================== */

[data-md-color-scheme="loophole"] .md-typeset .admonition,
[data-md-color-scheme="loophole"] .md-typeset details {
  color: #cbd5e1;
}

/* ==========================================================================
   Inline code
   ========================================================================== */

[data-md-color-scheme="loophole"] .md-typeset code {
  background-color: #1a2234;
  color: #cbff93;
  border-radius: 0.25rem;
}

/* ==========================================================================
   Search
   ========================================================================== */

[data-md-color-scheme="loophole"] .md-search__form {
  background-color: #1a2234;
}

[data-md-color-scheme="loophole"] .md-search__output {
  background-color: #111827;
}

[data-md-color-scheme="loophole"] .md-search-result__link:hover {
  background-color: #1a2234;
}

/* ==========================================================================
   Table styling
   ========================================================================== */

[data-md-color-scheme="loophole"] .md-typeset table:not([class]) th {
  background-color: #1a2234;
  color: #e2e8f0;
}

[data-md-color-scheme="loophole"] .md-typeset table:not([class]) td {
  border-color: #2a3548;
}

/* ==========================================================================
   Scrollbar (Webkit)
   ========================================================================== */

[data-md-color-scheme="loophole"] ::-webkit-scrollbar-thumb {
  background-color: #2a3548;
}

[data-md-color-scheme="loophole"] ::-webkit-scrollbar-thumb:hover {
  background-color: #3b4f6a;
}

/* ==========================================================================
   Banner image on index page
   ========================================================================== */

[data-md-color-scheme="loophole"] .lh-banner {
  margin: 1.5rem 0 2.5rem;
}

[data-md-color-scheme="loophole"] .lh-banner img {
  width: 100%;
  border-radius: 24px;
  border: 1px solid hsla(0, 0%, 93.3%, 0.24) !important;
  display: block;
}

/* ==========================================================================
   Logo sizing – ensure the wordmark SVG is legible in the header
   ========================================================================== */

[data-md-color-scheme="loophole"] .md-header__button.md-logo img,
[data-md-color-scheme="loophole"] .md-header__button.md-logo svg {
  height: 2.4rem;
  width: auto;
}

/* ==========================================================================
   Link styling
   ========================================================================== */

[data-md-color-scheme="loophole"] .md-typeset a {
  text-decoration: none;
  border-bottom: 1px solid #cbff93;
  padding-bottom: 2px;
  transition: border-color 0.2s ease;
}

[data-md-color-scheme="loophole"] .md-typeset a:hover {
  border-bottom-color: #d8ffb0; /* lighter shade for hover */
}

/* ==========================================================================
   Heading anchor links
   ========================================================================== */

[data-md-color-scheme="loophole"] .md-typeset .headerlink {
  color: #cbff93;
  text-decoration: none;
  border-bottom: none;
  font-size: 0; /* hide ¶ text node */
}

[data-md-color-scheme="loophole"] .md-typeset .headerlink:hover {
  cursor: pointer;
}

[data-md-color-scheme="loophole"] .md-typeset .headerlink::after {
  content: "#";
  font-size: 0.9rem;
}

[data-md-color-scheme="loophole"] .md-typeset .headerlink svg {
  display: none; /* hide SVG variant if used */
}
