/*
 * Heatwave YARD modern overlay.
 * Loaded after css/style.css and css/common.css so the rules below win
 * by source-order when specificity ties. Targets only the default YARD
 * markup so it remains compatible with future YARD upgrades.
 */

:root {
  --hw-bg:        #ffffff;
  --hw-bg-soft:   #f5f7fa;
  --hw-bg-code:   #f1f3f5;
  --hw-fg:        #1a1d21;
  --hw-fg-muted:  #5b6470;
  --hw-fg-soft:   #8a93a0;
  --hw-border:    #e5e8ec;
  --hw-link:      #0f5a99;
  --hw-link-hov:  #0a4a82;
  --hw-accent:    #c9303a;       /* WarmlyYours red */
  --hw-tag-bg:    #e8eef4;
  --hw-tag-fg:    #2d4a66;
  --hw-tag-deprecated-bg: #fff4e6;
  --hw-tag-deprecated-fg: #b85c00;
  --hw-shadow-sm: 0 1px 2px rgba(15, 30, 60, 0.04);
  --hw-shadow-md: 0 4px 12px rgba(15, 30, 60, 0.06);
  --hw-radius:    8px;
  --hw-radius-sm: 4px;

  --hw-font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter",
                  Roboto, "Helvetica Neue", Arial, sans-serif;
  --hw-font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas,
                  "Liberation Mono", monospace;
}

/* Dark mode — auto, with optional override via [data-hw-theme] on <html>. */
@media (prefers-color-scheme: dark) {
  :root {
    --hw-bg:        #11141a;
    --hw-bg-soft:   #181c24;
    --hw-bg-code:   #1c2230;
    --hw-fg:        #e6e9ef;
    --hw-fg-muted:  #a3acb9;
    --hw-fg-soft:   #6c7684;
    --hw-border:    #232a36;
    --hw-link:      #6fb3ff;
    --hw-link-hov:  #93c5ff;
    --hw-accent:    #ff5c66;
    --hw-tag-bg:    #1d2735;
    --hw-tag-fg:    #9bb5d6;
    --hw-tag-deprecated-bg: #3a2a14;
    --hw-tag-deprecated-fg: #ffb766;
    --hw-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --hw-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  }
}
[data-hw-theme="light"] {
  --hw-bg:        #ffffff;
  --hw-bg-soft:   #f5f7fa;
  --hw-bg-code:   #f1f3f5;
  --hw-fg:        #1a1d21;
  --hw-fg-muted:  #5b6470;
  --hw-fg-soft:   #8a93a0;
  --hw-border:    #e5e8ec;
  --hw-link:      #0f5a99;
  --hw-link-hov:  #0a4a82;
  --hw-accent:    #c9303a;
  --hw-tag-bg:    #e8eef4;
  --hw-tag-fg:    #2d4a66;
  --hw-tag-deprecated-bg: #fff4e6;
  --hw-tag-deprecated-fg: #b85c00;
}
[data-hw-theme="dark"] {
  --hw-bg:        #11141a;
  --hw-bg-soft:   #181c24;
  --hw-bg-code:   #1c2230;
  --hw-fg:        #e6e9ef;
  --hw-fg-muted:  #a3acb9;
  --hw-fg-soft:   #6c7684;
  --hw-border:    #232a36;
  --hw-link:      #6fb3ff;
  --hw-link-hov:  #93c5ff;
  --hw-accent:    #ff5c66;
  --hw-tag-bg:    #1d2735;
  --hw-tag-fg:    #9bb5d6;
  --hw-tag-deprecated-bg: #3a2a14;
  --hw-tag-deprecated-fg: #ffb766;
}

/* ── Page chrome ──────────────────────────────────────────── */

html, body {
  background: var(--hw-bg);
  color: var(--hw-fg);
  font-family: var(--hw-font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Default style.css hardcodes #main { background: #fff } and various
   sub-containers — pull all of them onto the theme variables so dark
   mode is actually dark. */
#main, #content, #content > .docstring, .docstring, .tags,
#header, #search, .summary_signature, .method_details_list,
#nav, .nav_wrap, p, li, dt, dd {
  color: var(--hw-fg);
}
#main {
  background: var(--hw-bg);
}
#nav, .nav_wrap {
  background: var(--hw-bg-soft);
  border-right: 1px solid var(--hw-border);
}
#nav a {
  color: var(--hw-link);
}
.nav_wrap input[type="text"], #search_field {
  background: var(--hw-bg);
  color: var(--hw-fg);
  border: 1px solid var(--hw-border);
  border-radius: var(--hw-radius-sm);
  padding: 0.3em 0.5em;
}

/* Floating Table of Contents box (rendered by markdown TOC) */
#toc {
  background: var(--hw-bg-soft);
  border: 1px solid var(--hw-border);
  box-shadow: var(--hw-shadow-md);
  border-radius: var(--hw-radius);
  color: var(--hw-fg);
}
#toc.hidden, #toc.hidden:hover {
  background: var(--hw-bg-soft);
}
#toc a {
  color: var(--hw-link);
}

a, a:link, a:visited {
  color: var(--hw-link);
  text-decoration: none;
}
a:hover {
  color: var(--hw-link-hov);
  text-decoration: underline;
}

/* ── Header / nav ─────────────────────────────────────────── */

#header {
  background: var(--hw-bg-soft);
  border-bottom: 1px solid var(--hw-border);
  box-shadow: var(--hw-shadow-sm);
  padding: 0.5em 1em;
}
#header .title,
#header a,
.summary_toggle {
  color: var(--hw-fg);
  font-weight: 500;
}
#search a {
  color: var(--hw-fg-muted);
  background: transparent;
  border: 1px solid var(--hw-border);
  border-radius: var(--hw-radius-sm);
  padding: 0.25em 0.65em;
  font-size: 0.85em;
  margin-left: 0.35em;
}
#search a:hover {
  color: var(--hw-fg);
  border-color: var(--hw-link);
  background: var(--hw-bg);
}
#full_list_link, #toggleSidebar {
  filter: none;
}

/* ── Sidebar / file list ──────────────────────────────────── */

#menu, #footer {
  color: var(--hw-fg-muted);
}
#menu a {
  color: var(--hw-link);
}

/* The full-list iframe (file_list.html, class_list.html, method_list.html).
   full_list.css hardcodes #fff / #fafafa / #f0f0f0 backgrounds across
   `.fixed_header`, `#full_list_nav`, `#full_list li.odd|.even`,
   `#search input`, etc. Pull every one onto theme variables. */
body {
  background: var(--hw-bg-soft);
}
.fixed_header {
  background: var(--hw-bg-soft) !important;
  border-bottom: 1px solid var(--hw-border);
  /* default full_list.css hardcodes height: 70px which clipped #search
     when we moved it back into flow. Let it grow with its content. */
  height: auto !important;
  padding-bottom: 18px;
}
#full_list_header {
  background: var(--hw-bg-soft);
  color: var(--hw-fg);
  border-color: var(--hw-border);
}
#full_list_nav {
  color: var(--hw-fg-muted);
}
#full_list_nav a, #nav a, .nav_wrap a {
  color: var(--hw-link);
}
#full_list_nav a:hover {
  color: var(--hw-link-hov);
  background: transparent;
}
/* Default `#search { position: absolute; right: 5px; top: 9px }`
   stacks the search box on top of the file list when the iframe is
   too narrow for the tabs row. Pull it back into the document flow
   inside .fixed_header so it stacks below the tabs cleanly, and
   bump #full_list margin-top to clear the taller header. */
#search {
  position: static !important;
  padding: 0 12px 8px;
  background-color: transparent;
}
#search input[type="text"], #search input {
  background: var(--hw-bg);
  color: var(--hw-fg);
  border: 1px solid var(--hw-border);
  border-radius: var(--hw-radius-sm);
  padding: 0.25em 0.5em;
  width: calc(100% - 1.2em);
  box-sizing: border-box;
}
#full_list {
  /* clears the taller fixed_header (h1 + tabs + search input
     stacked; ~175-185px) — overrides default's `margin-top: 80px`
     which was sized for the absolute-positioned search. */
  margin-top: 195px !important;
}
#full_list, #full_list ul {
  background: var(--hw-bg-soft);
  color: var(--hw-fg);
  font-family: var(--hw-font-sans);
}
#full_list li {
  border-bottom: 1px solid var(--hw-border);
  background: transparent;
}
#full_list li.odd, #full_list li.even {
  background: transparent;
}
#full_list li:hover {
  background: var(--hw-bg);
}
#full_list li.collapsed > .item:before {
  color: var(--hw-fg-soft);
}
#full_list li.clicked > .item,
#full_list li.clicked > .item:hover {
  background: var(--hw-link);
  color: #fff;
}
#full_list li.clicked > .item a,
#full_list li.clicked .object_link a {
  color: #fff;
}
#noresults {
  background: var(--hw-bg-soft);
  color: var(--hw-fg-muted);
}

/* ── Headings ─────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 {
  color: var(--hw-fg);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}
h1 { font-size: 1.85em; border-bottom: 2px solid var(--hw-border); padding-bottom: 0.35em; }
h2 { font-size: 1.4em; border-bottom: 1px solid var(--hw-border); padding-bottom: 0.25em; }
h3 { font-size: 1.15em; }
h4, h5, h6 { font-size: 1em; }

/* ── Code blocks ──────────────────────────────────────────── */

code, tt, pre, .source_code {
  font-family: var(--hw-font-mono);
  font-size: 0.92em;
}
/* All inline code, including in headings. The default style.css scopes
   `tt` / `code` styling to specific selectors with hardcoded light
   backgrounds — we cover the same ground here. */
p code, li code, td code, dt code, dd code,
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code,
.docstring code, .docstring tt, .summary_desc code, .summary_desc tt {
  background: var(--hw-bg-code);
  border: 1px solid var(--hw-border);
  border-radius: var(--hw-radius-sm);
  padding: 0.08em 0.4em;
  color: var(--hw-fg);
}
pre {
  background: var(--hw-bg-code);
  border: 1px solid var(--hw-border);
  border-radius: var(--hw-radius);
  padding: 1em 1.2em;
  overflow-x: auto;
  line-height: 1.55;
  position: relative;
}
pre code {
  background: transparent;
  border: 0;
  padding: 0;
}

/* Copy button injected by yard-modern.js */
.hw-copy-btn {
  position: absolute;
  top: 0.5em;
  right: 0.5em;
  background: var(--hw-bg);
  color: var(--hw-fg-muted);
  border: 1px solid var(--hw-border);
  border-radius: var(--hw-radius-sm);
  padding: 0.2em 0.55em;
  font-size: 0.75em;
  font-family: var(--hw-font-sans);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}
pre:hover .hw-copy-btn {
  opacity: 1;
}
.hw-copy-btn:hover {
  background: var(--hw-link);
  color: #fff;
  border-color: var(--hw-link);
}
.hw-copy-btn[data-copied="1"] {
  background: var(--hw-link);
  color: #fff;
  border-color: var(--hw-link);
  opacity: 1;
}

/* Highlight.js / Rouge default-class compatibility */
.highlight, pre.code {
  background: var(--hw-bg-code) !important;
  color: var(--hw-fg);
}

/* ── Tables ───────────────────────────────────────────────── */

/* Default style.css scopes table rules under `#filecontents` and
   `.docstring` (ID selector → high specificity). Match that scope so
   our theme variables actually win — generic `table` rules don't. */
#filecontents table, .docstring table {
  border-collapse: collapse;
  border-spacing: 0;
  margin: 1em 0;
  font-size: 0.95em;
}
#filecontents table th, #filecontents table td,
.docstring table th, .docstring table td {
  border: 1px solid var(--hw-border);
  padding: 0.55em 0.85em;
  text-align: left;
  color: var(--hw-fg);
}
#filecontents table th, .docstring table th {
  background: var(--hw-bg-soft);
  font-weight: 600;
  color: var(--hw-fg);
}
#filecontents table tr:nth-child(odd) td,
.docstring table tr:nth-child(odd) td {
  background: var(--hw-bg);
}
#filecontents table tr:nth-child(even) td,
.docstring table tr:nth-child(even) td {
  background: var(--hw-bg-soft);
}

/* ── Blockquotes / callouts ───────────────────────────────── */

blockquote {
  border-left: 3px solid var(--hw-link);
  background: var(--hw-bg-soft);
  padding: 0.7em 1em;
  margin: 1em 0;
  border-radius: 0 var(--hw-radius-sm) var(--hw-radius-sm) 0;
  color: var(--hw-fg-muted);
}

/* ── Method blocks ────────────────────────────────────────── */

.method_details, .method_details_list {
  border: 1px solid var(--hw-border);
  border-radius: var(--hw-radius);
  background: var(--hw-bg-soft);
  margin: 1em 0;
  padding: 0.5em 1em 1em;
}
.method_details h3 {
  color: var(--hw-fg);
  font-family: var(--hw-font-mono);
  font-size: 1.05em;
  margin-top: 0.3em;
}
.method_details .signature {
  background: var(--hw-bg);
  border: 1px solid var(--hw-border);
  border-radius: var(--hw-radius-sm);
  padding: 0.5em 0.8em;
  font-family: var(--hw-font-mono);
  color: var(--hw-fg);
}
.method_details .signature .overload + .overload {
  margin-top: 0.4em;
}

/* ── Tags (param / return / raise / see) ──────────────────── */

.tags ul {
  list-style: none;
  padding-left: 0;
}
.tags ul li {
  padding: 0.4em 0;
  border-bottom: 1px solid var(--hw-border);
}
.tags ul li:last-child { border-bottom: none; }
.tags .name {
  font-family: var(--hw-font-mono);
  background: var(--hw-tag-bg);
  color: var(--hw-tag-fg);
  border-radius: var(--hw-radius-sm);
  padding: 0.05em 0.45em;
  font-weight: 600;
}
.tags .types,
.tags p { color: var(--hw-fg-muted); }

.deprecated, .note.deprecated {
  background: var(--hw-tag-deprecated-bg);
  color: var(--hw-tag-deprecated-fg);
  border: 1px solid var(--hw-tag-deprecated-fg);
  border-radius: var(--hw-radius-sm);
  padding: 0.5em 0.8em;
  margin: 0.6em 0;
}

.note {
  background: var(--hw-bg-soft);
  border: 1px solid var(--hw-border);
  border-radius: var(--hw-radius-sm);
  padding: 0.5em 0.8em;
  margin: 0.6em 0;
  color: var(--hw-fg-muted);
}

/* ── Theme toggle button (injected by yard-modern.js) ────── */

.hw-theme-toggle {
  position: fixed;
  top: 0.55em;
  right: 0.6em;
  z-index: 1000;
  background: var(--hw-bg);
  color: var(--hw-fg-muted);
  border: 1px solid var(--hw-border);
  border-radius: 999px;
  padding: 0.3em 0.65em;
  font-size: 0.8em;
  font-family: var(--hw-font-sans);
  cursor: pointer;
  box-shadow: var(--hw-shadow-sm);
  transition: background 0.15s, color 0.15s;
}
.hw-theme-toggle:hover {
  background: var(--hw-link);
  color: #fff;
  border-color: var(--hw-link);
}

/* ── Mobile improvements ──────────────────────────────────── */

@media (max-width: 768px) {
  body { font-size: 14px; }
  #header { padding: 0.5em 0.8em; }
  #content { padding: 1em 0.8em; }
  pre { font-size: 0.85em; padding: 0.8em; }
  .hw-theme-toggle { top: 0.4em; right: 0.4em; }
}

/* ── File / docstring layout ──────────────────────────────── */

#filecontents {
  max-width: 920px;
  line-height: 1.65;
}
#filecontents img {
  max-width: 100%;
  border-radius: var(--hw-radius-sm);
}

/* Reduce visual noise on the index/listing pages. */
#listing dt {
  font-family: var(--hw-font-mono);
  font-weight: 600;
}
#listing dd {
  color: var(--hw-fg-muted);
  margin-bottom: 0.7em;
}
