/* ── DOL Dark Theme for rustdoc ────────────────────────
   Overrides the ayu theme CSS variables to match the
   DOL landing page dark theme (v2 — refined palette).
   Applied via cargo doc --extend-css in the Pages workflow.
   ──────────────────────────────────────────────────── */

:root[data-theme="ayu"] {
  /* ── Backgrounds ─────────────────────────────── */
  --main-background-color: #0a0e14;
  --sidebar-background-color: #11161e;
  --code-block-background-color: #0d121a;
  --button-background-color: #11161e;
  --search-tab-button-selected-background: #11161e !important;
  --table-alt-row-background-color: #0d121a;
  --codeblock-link-background: #0d121a;

  /* ── Text colors ────────────────────────────── */
  --main-color: #e3e9f1;
  --headings-border-bottom-color: #1f2a37;
  --border-color: #1f2a37;
  --right-side-color: #8a95a5;
  --code-attribute-color: #8a95a5;
  --toggles-color: #8a95a5;

  /* ── Links ──────────────────────────────────── */
  --link-color: #57a6ff;
  --sidebar-link-color: #57a6ff;
  --type-link-color: #ffa0a5;
  --trait-link-color: #57a6ff;
  --assoc-item-link-color: #d4973c;
  --function-link-color: #3ecf8e;
  --macro-link-color: #a37acc;
  --keyword-link-color: #57a6ff;
  --attribute-link-color: #57a6ff;
  --mod-link-color: #57a6ff;
  --sidebar-current-link-background-color: rgba(87, 166, 255, 0.08);

  /* ── Code highlighting ──────────────────────── */
  --code-highlight-kw-color: #ff7b72;
  --code-highlight-kw-2-color: #ff7b72;
  --code-highlight-lifetime-color: #d4973c;
  --code-highlight-prelude-color: #79c0ff;
  --code-highlight-prelude-val-color: #ffa657;
  --code-highlight-number-color: #79c0ff;
  --code-highlight-string-color: #a5d6ff;
  --code-highlight-literal-color: #ffa657;
  --code-highlight-attribute-color: #c9d1d9;
  --code-highlight-self-color: #57a6ff;
  --code-highlight-macro-color: #a37acc;
  --code-highlight-question-mark-color: #ff9011;
  --code-highlight-comment-color: #636d7d;
  --code-highlight-doc-comment-color: #7ee787;

  /* ── Scrollbar ──────────────────────────────── */
  --scrollbar-track-background-color: #11161e;
  --scrollbar-thumb-background-color: #1f2a37;
  --scrollbar-color: #1f2a37 #11161e;

  /* ── Sidebar ────────────────────────────────── */
  --sidebar-border-color: #1f2a37;
  --sidebar-background-color-hover: rgba(255, 255, 255, 0.04);
  --src-sidebar-background-selected: #0d121a;
  --src-sidebar-background-hover: rgba(255, 255, 255, 0.04);

  /* ── Search ─────────────────────────────────── */
  --search-color: #e3e9f1;
  --search-input-focused-border-color: #57a6ff;
  --search-result-link-focus-background-color: #0d121a;
  --search-result-border-color: #1f2a37;
  --search-results-alias-color: #e3e9f1;
  --search-results-grey-color: #8a95a5;
  --search-tab-button-not-selected-background: #11161e;
  --search-tab-button-not-selected-border-top-color: #1f2a37;
  --search-tab-title-count-color: #8a95a5;
  --search-error-code-background-color: #0d121a;

  /* ── Settings & buttons ─────────────────────── */
  --settings-input-color: #57a6ff;
  --settings-input-border-color: #8a95a5;
  --settings-button-color: #e3e9f1;
  --settings-button-border-focus: #57a6ff;
  --settings-menu-filter: invert(70%) sepia(40%) saturate(500%) hue-rotate(180deg);
  --settings-menu-hover-filter: invert(100%);

  /* ── Code blocks ────────────────────────────── */
  --src-line-numbers-span-color: #8a95a5;
  --src-line-number-highlighted-background-color: rgba(210, 168, 255, 0.06);

  /* ── Targets & highlights ───────────────────── */
  --target-background-color: rgba(210, 168, 255, 0.06);
  --target-border-color: #d2a8ff;

  /* ── Stab / stability ───────────────────────── */
  --stab-background-color: #181f2a;
  --stab-code-color: #e3e9f1;

  /* ── Crate search ───────────────────────────── */
  --crate-search-hover-border: #57a6ff;

  /* ── Misc ────────────────────────────────────── */
  --copy-path-img-filter: invert(60%);
  --copy-path-img-hover-filter: invert(100%);
  --code-example-button-color: #8a95a5;
  --code-example-button-hover-color: #e3e9f1;
  --codeblock-error-hover-color: #f14c4c;
  --codeblock-error-color: rgba(241, 76, 76, 0.5);
  --codeblock-ignore-hover-color: #d4973c;
  --codeblock-ignore-color: rgba(212, 151, 60, 0.6);
  --warning-border-color: #d4973c;
  --kbd-color: #e3e9f1;
  --kbd-background: #0d121a;
  --kbd-box-shadow-color: #1f2a37;
  --toggle-filter: invert(100%);
  --mobile-sidebar-menu-filter: invert(100%);
  --rust-logo-filter: drop-shadow(1px 0 0px #fff) drop-shadow(0 1px 0 #fff) drop-shadow(-1px 0 0 #fff) drop-shadow(0 -1px 0 #fff);
  --scrape-example-toggle-line-background: #1f2a37;
  --scrape-example-toggle-line-hover-background: #8a95a5;
  --scrape-example-code-line-highlight: rgba(210, 168, 255, 0.06);
  --scrape-example-code-line-highlight-focus: rgba(210, 168, 255, 0.12);
  --scrape-example-help-border-color: #8a95a5;
  --scrape-example-help-color: #e3e9f1;
  --scrape-example-help-hover-border-color: #57a6ff;
  --scrape-example-help-hover-color: #57a6ff;
  --scrape-example-code-wrapper-background-start: rgba(10, 14, 20, 1);
  --scrape-example-code-wrapper-background-end: rgba(10, 14, 20, 0);
  --sidebar-resizer-hover: #57a6ff;
  --sidebar-resizer-active: #57a6ff;
}

/* ── Heading colors for ayu theme ────────────────── */
:root[data-theme="ayu"] h1,
:root[data-theme="ayu"] h2,
:root[data-theme="ayu"] h3,
:root[data-theme="ayu"] h4,
:root[data-theme="ayu"] h5,
:root[data-theme="ayu"] h6 {
  color: #e3e9f1;
}

/* ── Code text in docs ───────────────────────────── */
:root[data-theme="ayu"] .docblock code {
  color: #ffa657;
}
:root[data-theme="ayu"] .docblock a>code {
  color: #57a6ff !important;
}

/* ── Code blocks ─────────────────────────────────── */
:root[data-theme="ayu"] .code-header,
:root[data-theme="ayu"] .docblock pre>code,
:root[data-theme="ayu"] pre,
:root[data-theme="ayu"] pre>code,
:root[data-theme="ayu"] .item-info code,
:root[data-theme="ayu"] .rustdoc.source .example-wrap {
  color: #c9d1d9;
}

/* ── Sidebar current/hover ───────────────────────── */
:root[data-theme="ayu"] .sidebar .current,
:root[data-theme="ayu"] .sidebar .current a,
:root[data-theme="ayu"] .sidebar a:hover,
:root[data-theme="ayu"] #src-sidebar div.files>a:hover,
:root[data-theme="ayu"] details.dir-entry summary:hover,
:root[data-theme="ayu"] #src-sidebar div.files>a:focus,
:root[data-theme="ayu"] details.dir-entry summary:focus,
:root[data-theme="ayu"] #src-sidebar div.files>a.selected {
  color: #f0f6fc;
}

/* ── Search results ──────────────────────────────── */
:root[data-theme="ayu"] .search-results a:hover,
:root[data-theme="ayu"] .search-results a:focus {
  color: #e3e9f1 !important;
  background-color: #0d121a;
}
:root[data-theme="ayu"] .search-results a {
  color: #57a6ff;
}
:root[data-theme="ayu"] .search-results a div.desc {
  color: #8a95a5;
}

/* ── Search tabs ─────────────────────────────────── */
:root[data-theme="ayu"] #search-tabs>button.selected {
  border-bottom: 1px solid #57a6ff !important;
  border-top: none;
}
:root[data-theme="ayu"] #search-tabs>button:not(.selected) {
  border: none;
  background-color: transparent !important;
}
:root[data-theme="ayu"] #search-tabs>button:hover {
  border-bottom: 1px solid rgba(87, 166, 255, 0.3);
}
