/*
 * RoRvsWild Theme – Rdoc CSS
 *
 * Authors: Antoine Marguerie & Alexis Bernard (rorvswild.com)
 *
 */

:root {
  --page-max-width: 1600px;
  --sidebar-width: 240px;

  --color-primary: oklch(0.5 0.18 29);
  --color-primary-hover: oklch(0.4 0.18 29);
  --color-highlight-background: oklch(0.97 0.03 89);
  --color-topbar: var(--color-primary);
  --color-topbar-text: var(--color-background);
  --color-text: oklch(0.35 0.03 269);
  --color-text-light: oklch(0.45 0.03 269);
  --color-title: oklch(0.2 0.03 269);
  --color-background: oklch(0.99 0.001 269);
  --color-code-background: oklch(0.97 0.002 269);
  --color-th-background: oklch(0.95 0.002 269);
  --color-border: oklch(0.91 0.002 269);

  --font-sans: "Inter", system-ui, sans-serif;
  --font-mono: "Monaspace", ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
}

html {
  line-height: 1.5;
  color: var(--color-text);
  font-weight: normal;
  font-size: 14px;
  font-optical-sizing: auto;
  scroll-padding-top: calc(40px + 1em);
  scroll-behavior: smooth;
  font-feature-settings: 'liga' 1, 'calt' 1;
}

body {
  background: var(--color-background);
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  padding-top: 35px;
}

body > footer {
  display: none; /* quickfix waiting for Ruby to upgrade RDoc and use the latest darkfish.rb */
}

h1 span,
h2 span,
h3 span,
h4 span,
h5 span,
h6 span {
  position: relative;
  display: none;
  padding-left: 1em;
  line-height: 0;
  vertical-align: baseline;
  font-size: 1rem;
}

h1 span { top: -0.28em; }
h2 span { top: -0.28em; }
h3 span { top: -0.1em; }
h4 span { top: -0.1em; }
h5 span { top: 0; }
h6 span { top: 0; }

h2:hover span,
h3:hover span,
h4:hover span,
h5:hover span,
h6:hover span {
  display: inline;
}

img { max-width: 100%; }

:any-link {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 0.02em;
  transition: color 0.3s ease;
}

:any-link:hover { color: var(--color-primary-hover); }

code,
pre {
  font-family: var(--font-mono);
  background-color: var(--color-code-background);
  box-shadow: 0 0 0 1px var(--color-border) inset;
  border-radius: 6px;
  padding: 16px;
  overflow-x: auto;
  font-size: 1rem;
  line-height: 1.5;
  margin: 1em 0;
}

table {
  margin: 0;
  border-spacing: 0;
  border-collapse: collapse;
  font-size: 0.833rem;
}

table tr th, table tr td {
  padding: 0.2em 0.4em;
  border: 1px solid var(--color-border);
}

table tr th { background-color: var(--color-th-background); }

table tr:nth-child(even) td { background-color: var(--color-code-background); }

ul {
  padding: 0;
  list-style: none;
}

main article > ul {
  padding: 0 0 0 16px;
  list-style-type: square;
}

li { padding: 0.25em 0; }

main li > p { margin: 0; }

li li { padding-bottom: 0; }

ul ul {
  margin: 0 0 0 10px;
  padding-left: 0;
}

ul ul li {
  padding-left: 15px;
  position: relative;
  border-left: 1px solid var(--color-border);
}

ul ul li:before {
  position: absolute;
  left: 0;
  top: 18px;
  content: '';
  display: inline-block;
  height: 1px;
  width: 11px;
  background: var(--color-border);
}

ul ul li:last-of-type { border-left: 0; }

ul ul li:last-of-type:after {
  position: absolute;
  left: 0;
  top: 0;
  content: '';
  display: inline-block;
  height:18px;
  width: 1px;
  background: var(--color-border);
}

ol {
  margin: 1em 0 0;
  padding: 0 1em;
}

ol ol { margin: 0; }

details > summary {
  list-style: none;
  position: relative;
  display: flex;
  width: calc(100% - 0.25rem);
  gap: 4px;
  padding: 0 0 0 0.25rem;
}

details > summary:has(> a) {
  padding: 0;
  width: 100%;
}

details > summary img { max-height: 3em; }

summary::-webkit-details-marker { display: none; }

details > summary::after {
  content: '+';
  font-size: 0.823em;
  font-weight: bold;
  width: 2em;
  height: 2em;
  line-height: 2em;
  border-radius: 50%;
  text-align: center;
  box-shadow: 0 0 0 1px var(--color-border) inset;
  transition: transform 0.2s ease;
  display: inline-block;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  top: 2px;
  margin-left: auto;
}

details[open] > summary::after { content: '-'; }

main {
  padding: 1em;
  width: calc(100% - 2em);
  margin: 0 auto;
}

main img[align=right] { padding-left: 1rem; }

main img[align=left] { padding-right: 1rem; }

main sup {
  vertical-align: super;
  font-size: 0.823em;
}

main h1 {
  font-size: 2.178rem;
  line-height: 3rem;
  margin: 1rem 0 0;
  color: var(--color-title);
  word-break: break-word;
}

main h1 img { max-height: 3em; }

main h1:has(+ h1) { display: none; }

main h1 + p {
  font-size: 1.383em;
  margin-top: 0.5rem;
  color: var(--color-text-light);
}

main h2 {
  margin: 1.5em 0 0.5em;
  font-size: 1.476rem;
  line-height: 2rem;
  padding: 0.5rem 0;
  color: var(--color-title);
  box-shadow: 0 1px 0 0 var(--color-text-light);
}

main h3 {
  margin: 1.5em 0 0.5em;
  font-size: 1.215em;
  color: var(--color-title);
}

main h4 {
  margin: 1.5em 0 0;
  font-size: 1em;
  text-transform: uppercase;
  color: var(--color-title);
  letter-spacing: 0.05em;
}

main h5 {
  margin: 1em 0 0;
  font-size: 1em;
  color: var(--color-title);
}

main h6 {
  margin: 1em 0 0;
  font-size: 0.823rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-title);
}

main h4 + p,
main h5 + p, 
main h6 + p {
  margin-top: 0;
}

main p {
  line-height: 1.5em;
  font-weight: 400;
}

main pre {
  margin: 1em 0;
  padding: 1em 1.5em;
  font-size: 0.823rem;
}

main hr {
  margin: 1.5em 0;
  border: 2px solid var(--color-border);
}

main blockquote {
  margin: 0 2em 1.2em 1.2em;
  padding-left: 0.5em;
  border-left: 2px solid var(--color-border);
}

main dl { margin: 1em 0; }

main dt {
  margin: 1em 0 0;
  font-weight: bold;
  color: var(--color-title);
}

main dd,
main dd p {
  margin: 0;
  color: var(--color-text-light);
}

main dd p + p { margin-top: 0.5em; }

main header h2 { margin-top: 2em; }

main header h3 {
  margin: 2em 0 1.5em;
  padding-top: 1em;
  border-width: 0;
  border-top: 1px solid var(--color-border);
  font-size: 120%;
}

.topbar {
  width: 100%;
  padding: 0.5em 1rem;
  z-index: 100;
  position: fixed;
  top: 0;
  background-color: var(--color-topbar);
}

.topbar .width-limiter {
  max-width: var(--page-max-width);
  margin: 0 auto;
  display: flex;
  gap: 8px;
}

.topbar .width-limiter > a:any-link {
  text-decoration: none;
  font-weight: 700;
  color: var(--color-topbar-text);
}

.topbar .width-limiter > a:any-link:hover { color: var(--color-topbar-text); }

.topbar .width-limiter > a.logo { display: inline-flex; }

.topbar .width-limiter > a.logo svg {
  height: 24px;
  width: 24px;
  fill: currentcolor;
  overflow: visible;
}

.topbar .width-limiter > a.logo:hover svg .path-1 { transform: translateY(-1px); }
.topbar .width-limiter > a.logo:hover svg .path-2 { transform: translateY(1px); }
.topbar .width-limiter > a.logo:hover svg .path-3 { transform: translateX(1px); }
.topbar .width-limiter > a.logo:hover svg .path-4 { transform: translateX(-1px); }

#navigation-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  color: var(--color-topbar-text);
  font-size: 1.44rem;
}

#navigation-toggle span { margin-top: -4px; }

nav {
  border-right: 1px solid var(--color-border);
  position: fixed;
  top: 35px;
  bottom: 0;
  width: 100%;
  max-width: var(--sidebar-width);
  background: var(--color-background);
  overflow-y: auto;
  z-index: 10;
  display: flex;
  flex-direction: column;
  font-size: 0.823rem;
  line-height: 1.5rem;
}

nav a:any-link {
  color: var(--color-text);
  text-decoration-color: inherit;
}

nav[hidden] { display: none; }

nav footer {
  padding: 1em 1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.678rem;
}

nav footer a:any-link {
  font-weight: 700;
}

.nav-section { margin-top: 1rem; }

.nav-section h3 { padding: 0 1rem; }

.nav-section ul { 
  margin-top: 0;
  overflow: hidden;
}

.nav-section > ul > li {
  padding: 0.25em 0.75rem;
}

.nav-section li.active > a,
.nav-section li.active > details > summary > a,
.nav-section li:has(li.active) > details > summary > a {
  text-decoration: none;
  background-color: var(--color-highlight-background);
  border-radius: 3px;
  font-weight: 700;
}

.nav-section li a,
.nav-section li > span {
  padding: 0 0.25rem;
  display: inline-block;
  word-break: break-word;
}

nav h2 {
  margin: 0 0 0.5em;
  padding: 0.5em 0;
  font-size: 1.215em;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}

nav h3,
#table-of-contents-navigation {
  margin: 0;
  padding: 0.5em 0;
  font-size: 0.678rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

nav dl,
nav p {
  padding: 0;
  list-style: none;
  margin: 0.5em 0 0;
}

nav.contextual { display: none }

#validator-badges {
  margin: 1em 1em 2em;
  font-size: smaller;
}

.search-button {
  background-color: var(--color-background);
  border: none;
  border-radius: 4px;
  color:var(--color-text-light);
  box-shadow: 0 0 0 1px var(--color-border);
  display: flex;
  gap: 4px;
  align-items: center;
  cursor: text;
}

.search-button svg {
  width: 12px;
  height: 12px;
  opacity: 0.8;
}

.search-button:hover,
.search-button:focus {
  color:var(--color-text);
}

.search-dialog {
  background-color: var(--color-background);
  width: calc(100% - 4em);
  max-width: 1000px;
  max-height: calc(100svh - 80px);
  margin: 0 auto;
  padding: 0;
  top: 40px;
  border: 0;
  border-radius: 8px;
  box-shadow: 
    0 0 0 1px var(--color-border), 
    0 0 24px 8px oklch(0.02 0.05 269 /1);
  overflow: hidden;
}

.search-dialog::backdrop {
  background-color: oklch(0.1 0.02 269 /0.9);
  backdrop-filter: blur(4px);
}

.search-dialog[open] { display: flex; }

.search-dialog form {
 overflow: hidden; 
 display: flex;
 flex-direction: column;
 flex: 1;
}

#search-section {
  padding: 1em 1em 0;
  background-color: var(--color-background);
  border-bottom: 1px solid var(--color-border);
}

#search-field-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  padding: 1rem;
}

.search-dialog form:has(li) #search-field-wrapper { box-shadow: 0 1px 0 0 var(--color-border); }

#search-field {
  width: 100%;
  padding: 0.5em 1em 0.5em 2em;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: 4px;
  font-size: 0.823em;
  outline: none;
  transition: border-color 0.3s ease;
  background-color: var(--color-background);
}

#search-field:focus { border-color: var(--color-primary); }

#search-field::placeholder {
  color: var(--color-text);
  opacity: 0.6;
}

#search-field-wrapper svg {
  position: absolute;
  stroke: var(--color-text-light);
  width: 16px;
  height: 16px;
  left: 24px;
  opacity: 0.6;
}

#search-results {
  color: var(--color-text);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  flex: 1;
  margin: 0;
}

#search-results .search-match { font-weight: normal; }

#search-results .search-selected {
  background: var(--color-code-background);
  border-bottom: 1px solid transparent;
  box-shadow: 0 0 0 1px var(--color-border) inset;
}

#search-results li {
  list-style: none;
  border-bottom: 1px solid var(--color-border);
  padding: 0.5em 1rem;
}

#search-results li:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

#search-results li p {
  padding: 0;
  margin: 0;
}

#search-results .search-namespace { font-weight: bold; }

#search-results li em {
  background: var(--color-highlight-background);
  font-style: normal;
}

#search-results pre {
  font-size: 0.823em;
  margin: 0.5rem 0;
}

.hide { display: none !important; }
.initially-hidden { display: none; }

pre,
code {
  --color-constant: oklch(0.5 0.18 269);
  --color-keyword: var(--color-primary);
  --color-ivar: oklch(0.5 0.18 59);
  --color-operator: oklch(0.5 0.18 269);
  --color-identifier: var(--color-title);
  --color-node: oklch(0.5 0.18 149);
  --color-comment: oklch(0.6 0.03 269);
  --color-regexp: oklch(0.5 0.18 299);
  --color-value: var(--color-operator);
  --color-string: oklch(0.5 0.18 149);
}

code {
  background-color: var(--color-code-background);
  padding: 0em 0.4em;
  border-radius: 3px;
  font-size: 0.937em;
  line-height: 1em;
  text-transform: initial;
}

.ruby-constant   { color: var(--color-constant); }
.ruby-keyword    { color: var(--color-keyword); }
.ruby-ivar       { color: var(--color-ivar); }
.ruby-operator   { color: var(--color-operator); }
.ruby-identifier { color: var(--color-identifier); }
.ruby-node       { color: var(--color-node); }
.ruby-comment    { color: var(--color-comment); }
.ruby-regexp     { color: var(--color-regexp); }
.ruby-value      { color: var(--color-value); }
.ruby-string     { color: var(--color-string); }

em {
  text-decoration-color: var(--color-border);
  text-decoration-line: underline;
  text-decoration-style: dotted;
}

.note-list {
  padding: 1em 1em 2em;
  box-shadow: 0 0 0 1px var(--color-border) inset;
}

.constants-list > dl {
  margin: 1em 0 2em;
  border: 0;
}

.constants-list > dl dt {
  margin-bottom: 0.75em;
  padding-left: 0;
  font-family: var(--font-mono);
}

.c > dl dt a { color: inherit; }

.constants-list > dl dd {
  margin: 0 0 2em 0;
  padding: 0;
}

.method-source-code {
  max-height: 0;
  overflow: auto;
  transition-duration: 200ms;
  transition-delay: 0ms;
  transition-property: all;
  transition-timing-function: ease-in-out;
}

.method-source-code.active-menu { max-height: none; }

.method-description .method-calls-super {
  color: var(--color-text);
  font-weight: bold;
}

.method-detail { margin: 1.5rem 0 0; }

.method-detail + .method-detail {
  margin: 1.5rem 0 0;
  border-top: 1px solid var(--color-border);
  padding-top: 1.5em;
}

.method-heading {
  position: relative;
  font-family: var(--font-mono);
  font-size: 1.138rem;
  font-weight: bold;
  color: var(--color-text);
}

.method-heading span { background-color: var(--color-code-background); }

.method-heading :any-link {
  text-decoration: none;
  color: inherit;
}

.toggle-source {
  font-size: 0.823rem;
  font-weight: 400;
  line-height: 1rem;
  background: var(--color-code-background);
  box-shadow: 0 0 0 1px var(--color-border);
  color: var(--color-text);
  border-radius: 2px;
  border: none;
  cursor: pointer;
}

.toggle-source:hover {
  box-shadow: 0 0 0 1px var(--color-text-light);
  color: var(--color-title);
}

* + .toggle-source { margin-top: 1rem; }

pre + .toggle-source { margin-top: 0.5rem; }

.method-description,
.aliases {
  color: var(--color-text-light);
  margin-top: 1em;
}

.aliases {
  cursor: default;
  font-size: 0.823em;
  font-style: italic;
  padding-top: 4px;
}

.method-description p { margin: 0; }

.method-description p + p { margin-top: 1em; }

.method-description ul { 
  margin-left: 1.5em;
  list-style-type: square;
}

main .mixin-from {
  font-size: 0.823em;
  font-style: italic;
  margin-bottom: 0.75em;
}
 
#attribute-method-details .method-detail:hover {
  background-color: transparent;
  cursor: default;
}

.attribute-access-type {
  text-transform: uppercase;
  padding: 0 1em;
}

@media (max-width: 480px) {
  main {
    margin: 1em auto;
    padding: 0 1em;
    max-width: 100%;
  }

  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}

@media (min-width: 800px) {
  main {
    margin: 0 auto;
    width: 100%;
    padding: 0;
    position: relative;
    grid-column: 2/ span 1;
    display: grid;
    grid-template-columns: 1fr var(--sidebar-width);
    gap: 32px;
  }

  main > article {
    position: relative;
    overflow: hidden;
    padding: 0 1rem 3rem;
    width: 100%;
    grid-column: 1 / span 1;
  }

  nav.contextual {
    width: var(--sidebar-width);
    grid-column: 2 / span 1;
    position: sticky;
    max-height: calc(100svh - 40px);
    left: auto;
    right: 0;
    border: 0;
    overflow-y: auto;
    background: transparent;
    display: flex;
    align-self: start;
  }
}

@media (min-width: 1024px) {
  html { font-size: 16px; }

  body > .wrapper {
    display: grid;
    grid-template-columns: var(--sidebar-width) auto;
    gap: 1rem;
    width: 100%;
    max-width: var(--page-max-width);
    margin: 0 auto;
    position: relative;
  }

  #navigation-toggle { display: none }

  nav { top: 40px; }

  nav[hidden] { display: block; }
}

@media (min-width: 1200px) {
  :root { --sidebar-width: 300px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-primary: oklch(0.85 0.09 29);
    --color-primary-hover: oklch(87.78296875% 0.07 29);

    --color-highlight-background: oklch(0.27 0.04 89);

    --color-topbar: oklch(0.5 0.18 29);
    --color-topbar-text: oklch(0.99 0.001 269);

    --color-text: oklch(0.84 0.02 269);
    --color-text-light: oklch(0.74 0.02 269);
    --color-title: oklch(0.91 0.02 269);
    --color-background: oklch(0.19 0.01 269);
    --color-code-background: oklch(0.25 0.01 269);
    --color-th-background: oklch(0.41 0.01 269);
    --color-border: oklch(0.27 0.01 269);
  }

  pre,
  code {
    --color-constant: oklch(0.85 0.09 260);
    --color-keyword: var(--color-primary);
    --color-ivar: oklch(0.85 0.09 59);
    --color-operator: oklch(0.85 0.04 269);
    --color-identifier: var(--color-title);
    --color-node: oklch(0.85 0.09 149);
    --color-comment: oklch(0.65 0.02 269);
    --color-regexp: oklch(0.85 0.09 299);
    --color-value: var(--color-operator);
    --color-string: oklch(0.85 0.09 149);
  }
}