/*
 * Minimal styles for rails-docs. Intended to evolve into the design system
 * once that work begins; for now, content-first typographic defaults.
 */

/*
 * Color palette + type scale mirror guides.rubyonrails.org. Brand red
 * #C81418, gray scale, dark-mode tokens, fonts (InterVariable for body,
 * Calibre for display headings, IBM Plex Mono for code), and the
 * heading sizes all come from rails/guides/assets/stylesrc/style.scss
 * + _main.scss so the API site and the guides site read as one product.
 *
 * Font binaries copied from rails-website/assets/fonts (the canonical
 * source rubyonrails.org serves) into app/assets/fonts/. Propshaft
 * fingerprints them at build time; @font-face URLs use plain filenames
 * and propshaft rewrites to the digested asset path.
 */

/* --------------------------------------------------------------------------
 * Fonts
 * -------------------------------------------------------------------------- */

@font-face {
  font-family: InterVariable;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/InterVariable-286b035b.woff2") format("woff2");
}
@font-face {
  font-family: InterVariable;
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/InterVariable-Italic-2289a606.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/IBMPlexMono-Text-5c5db1c6.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/IBMPlexMono-TextItalic-9cb547c9.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/IBMPlexMono-Medium-959804ef.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: italic;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/IBMPlexMono-MediumItalic-547e013c.woff2") format("woff2");
}

@font-face {
  font-family: Calibre;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/calibre-regular-46236793.woff2") format("woff2");
}
@font-face {
  font-family: Calibre;
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/calibre-regular-italic-386c3d0f.woff2") format("woff2");
}
@font-face {
  font-family: Calibre;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/calibre-semibold-bc983797.woff2") format("woff2");
}
@font-face {
  font-family: Calibre;
  font-style: italic;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/calibre-semibold-italic-6bc3d1b7.woff2") format("woff2");
}
@font-face {
  font-family: Calibre;
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/calibre-bold-cd002e0e.woff2") format("woff2");
}

:root {
  --rf-brand: #C81418;
  --rf-brand-light: #d8181c;
  --rf-brand-lighter: #e83d40;
  --rf-brand-lightest: #f17072;
  --rf-brand-dark: #831114;
  --rf-brand-darker: #6a0e10;

  --gray-100: #FAF9F8;
  --gray-200: #F5F3F1;
  --gray-300: #EBEBEA;
  --gray-400: #DCDCD8;
  --gray-500: #A9A9A8;
  --gray-600: #666666;
  --gray-700: #3A3939;
  --gray-800: #343434;
  --gray-850: #2E2E2E;
  --gray-900: #292929;
  --gray-1000: #181818;

  --color-text: var(--gray-900);
  --color-muted: var(--gray-600);
  --color-link: var(--rf-brand);
  --color-link-hover: var(--rf-brand-dark);
  --color-border: var(--gray-300);
  --color-bg: #fff;
  --color-bg-soft: var(--gray-100);
  --color-code-bg: var(--gray-200);

  /* Type stack — InterVariable for prose, Calibre for display headings,
   * IBM Plex Mono for code, all matching rails/guides. System-font
   * fallbacks cover the brief window before the webfonts swap in. */
  --font-body: InterVariable, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: Calibre, InterVariable, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --max-width: 64rem;
  --radius: 8px;
  --header-h: 4rem;        /* sticky-header height; module-nav clears it */
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-text: #E5E5E5;
    --color-muted: var(--gray-500);
    --color-link: var(--rf-brand-lightest);
    --color-link-hover: var(--rf-brand-lighter);
    --color-border: var(--gray-850);
    --color-bg: var(--gray-1000);
    --color-bg-soft: var(--gray-900);
    --color-code-bg: var(--gray-900);
  }
}

[data-theme="light"] {
  --color-text: var(--gray-900);
  --color-muted: var(--gray-600);
  --color-link: var(--rf-brand);
  --color-link-hover: var(--rf-brand-dark);
  --color-border: var(--gray-300);
  --color-bg: #fff;
  --color-bg-soft: var(--gray-100);
  --color-code-bg: var(--gray-200);
}

[data-theme="dark"] {
  --color-text: #E5E5E5;
  --color-muted: var(--gray-500);
  --color-link: var(--rf-brand-lightest);
  --color-link-hover: var(--rf-brand-lighter);
  --color-border: var(--gray-850);
  --color-bg: var(--gray-1000);
  --color-bg-soft: var(--gray-900);
  --color-code-bg: var(--gray-900);
}

/* Diff page */
.diff__header {
  margin-bottom: 1.5rem;
}

.diff__subtitle {
  color: var(--color-muted);
  font-size: 0.95rem;
}

.diff__status {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
}

.diff__status--added { border-color: #1f7a3a; }
.diff__status--removed { border-color: var(--rf-brand); }

.diff__section { margin: 2rem 0; }

.diff-lines {
  background: var(--color-code-bg);
  padding: 0.75rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre;
  overflow-x: auto;
}

.diff-line {
  display: block;
}

.diff-line--unchanged {
  color: var(--color-text);
}

.diff-line--added {
  background: rgba(31, 122, 58, 0.15);
  color: var(--color-text);
}

.diff-line--removed {
  background: rgba(200, 20, 24, 0.12);
  color: var(--color-text);
}

/* "Available in: …" strip on entity pages */
.availability {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.5rem 0 1rem;
  font-size: 0.85rem;
}

.availability__label {
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem;
}

.availability__chip {
  font-family: var(--font-mono);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.15em 0.5em;
  color: var(--color-link);
}

.availability__chip--current {
  background: var(--color-link);
  color: var(--color-bg);
  border-color: var(--color-link);
}

/* Since / removed / deprecated badges on entity pages */
.badge {
  display: inline-block;
  font-size: 0.8rem;
  padding: 0.15em 0.6em;
  border-radius: 999px;
  margin-right: 0.5em;
  margin-top: 0.25em;
  font-weight: 500;
  border: 1px solid transparent;
}

.badge a { color: inherit; text-decoration: underline; }

.badge--since {
  background: rgba(0, 240, 255, 0.12);
  color: var(--gray-900);
  border-color: rgba(0, 240, 255, 0.45);
}

.badge--removed {
  background: rgba(255, 214, 0, 0.18);
  color: var(--gray-900);
  border-color: rgba(255, 214, 0, 0.55);
}

.badge--deprecated {
  background: rgba(200, 20, 24, 0.12);
  color: var(--rf-brand-dark);
  border-color: rgba(200, 20, 24, 0.4);
}

.badge--private {
  background: var(--gray-200);
  color: var(--gray-700);
  border-color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}

[data-theme="dark"] .badge--since { color: #cffaff; }
[data-theme="dark"] .badge--removed { color: #fff5b3; }
[data-theme="dark"] .badge--deprecated { color: var(--rf-brand-lightest); }
[data-theme="dark"] .badge--private {
  background: var(--gray-850);
  color: var(--gray-400);
  border-color: var(--gray-700);
}

.badge-note {
  margin: 0.25em 0 0;
  font-size: 0.9rem;
  color: var(--color-muted);
}

/* ⌘K command palette */
.palette {
  border: none;
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  width: min(40rem, 90vw);
  max-height: 70vh;
  padding: 0;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25);
}

.palette::backdrop { background: rgba(0, 0, 0, 0.4); }

.palette__inner { padding: 0.75rem; }

.palette__input {
  width: 100%;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg);
  color: var(--color-text);
}

.palette__input:focus {
  outline: none;
  border-color: var(--color-link);
  box-shadow: 0 0 0 2px rgba(200, 20, 24, 0.15);
}

.palette__results {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  max-height: 50vh;
  overflow-y: auto;
}

.palette__item {
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0 0.5rem;
}

.palette__item--active,
.palette__item:hover { background: var(--color-bg-soft); }

.palette__fqn { background: transparent; padding: 0; }
.palette__kind {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--color-muted);
  align-self: center;
}

.palette__summary {
  grid-column: 1 / -1;
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.palette__empty,
.palette__hint {
  margin: 0.5rem 0.75rem;
  font-size: 0.85rem;
}

.palette__hint kbd {
  font-family: var(--font-mono);
  font-size: 0.8em;
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  padding: 0 0.4em;
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 1rem;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background: var(--color-bg-soft);
}

* { box-sizing: border-box; }

/* Body type scale matches guides.rubyonrails.org: 16px Inter at
 * line-height 1.4, with common ligatures and oldstyle figures for
 * prose, and the variable font when the browser supports it. */
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.4;
  color: var(--color-text);
  background: var(--color-bg);
  font-feature-settings: "liga" 1;
}

@supports (font-variant-ligatures: common-ligatures) {
  body {
    font-feature-settings: normal;
    font-variant-ligatures: common-ligatures;
  }
}

@supports (font-variant-numeric: oldstyle-nums) {
  body {
    font-variant-numeric: oldstyle-nums;
  }
}

/* Heading type scale (guides _main.scss). h1/h2 use Calibre; h3-h5
 * stay on the body face but step down in size and weight. Headings
 * always use lining figures + kerning so numerals don't sit lower
 * than caps in the visual rhythm. */
h1, h2, h3, h4, h5, h6 {
  font-feature-settings: "kern" 1, "lnum" 1;
  margin-top: 1.5em;
  margin-bottom: 0.5em;
}

@supports (font-variant-numeric: lining-nums) {
  h1, h2, h3, h4, h5, h6, ol, ol > li {
    font-feature-settings: normal;
    font-variant-numeric: lining-nums;
  }
}

h1 {
  color: var(--rf-brand);
  font-family: var(--font-display);
  font-size: 3rem;       /* 48px */
  font-weight: 700;
  line-height: 1;
  margin-top: 0;
}

h2 {
  font-family: var(--font-display);
  font-size: 2.25rem;    /* Calibre runs smaller than Inter at the same px */
  font-weight: 700;
  line-height: 1.1;
}

h2 a, h2 a:link, h2 a:visited { color: var(--rf-brand); }

h2 code {
  font-size: 2rem;
  font-weight: 400;
}

h3 {
  font-size: 1.5rem;     /* 24px */
  font-weight: 600;
}

h3 code {
  font-size: 1.5rem;
  font-weight: 400;
}

h4 {
  font-size: 1.125rem;
  font-weight: 600;
}

h4 code {
  font-size: 1.125rem;
  font-weight: 400;
}

h5 {
  font-size: 0.9375rem;
  font-weight: 600;
}

h5 code {
  font-size: 0.9375rem;
  font-weight: 400;
}

h1 a, h1 a:link, h2 a, h2 a:link, h3 a, h3 a:link,
h4 a, h4 a:link, h5 a, h5 a:link {
  text-decoration: none;
}

h1 a:hover, h2 a:hover, h3 a:hover, h4 a:hover, h5 a:hover {
  text-decoration: underline;
}

a {
  color: var(--color-link);
  text-decoration: none;
}

a:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-code-bg);
  padding: 0.1em 0.3em;
  border-radius: 4px;
}

pre code {
  background: none;
  padding: 0;
}

.muted { color: var(--color-muted); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;                          /* above .module-nav (10) */
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);          /* opaque so scrolled content doesn't bleed through */
}

.site-header__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

/* Logo + "API Guides" wordmark, mirroring the rails/guides header
 * lockup. Logo sits left, wordmark in Calibre to match guides type. */
.site-header__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--color-text);
  text-decoration: none;
}

.site-header__brand:hover { text-decoration: none; color: var(--rf-brand); }

.site-header__logo {
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
}

.site-header__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1;
  letter-spacing: -0.01em;
}

/* App shell — left module-nav rail + main column. Sidebar is fixed
 * to the viewport so it doesn't scroll with content; main content
 * gets a left margin to clear it. Toggling `body.module-nav--collapsed`
 * hides the rail and removes the offset. */
.site-shell {
  display: block;
}

.site-main {
  max-width: var(--max-width);
  margin: 0 auto 0 18rem;   /* left offset clears the fixed module-nav */
  padding: 2rem 1.5rem 4rem;
}

@media (max-width: 60rem) {
  .site-main { margin-left: auto; }
}

body.module-nav--collapsed .site-main {
  margin-left: auto;
}

/* Module-nav (left rail). Starts beneath the sticky header (--header-h)
 * so the logo and search are unobstructed; spans down to the bottom
 * of the viewport with its own internal scroll. */
.module-nav {
  position: fixed;
  top: var(--header-h, 4rem);
  left: 0;
  bottom: 0;
  width: 16.5rem;
  border-right: 1px solid var(--color-border);
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  z-index: 10;
}

body.module-nav--collapsed .module-nav { display: none; }

@media (max-width: 60rem) {
  .module-nav { display: none; }
  body.module-nav--collapsed .module-nav { display: flex; }
  body.module-nav--collapsed .site-main { margin-left: 0; }
  /* On mobile the toggle inverts: nav is hidden by default, shows on toggle */
}

.module-nav__header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.module-nav__title {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text);
}

.module-nav__filter {
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  background: var(--color-bg-soft);
  color: var(--color-text);
}

.module-nav__filter:focus {
  outline: none;
  border-color: var(--color-link);
  box-shadow: 0 0 0 2px rgba(200, 20, 24, 0.15);
}

.module-nav__body {
  flex: 1;
  overflow-y: auto;
  padding: 0.25rem 0;
}

/* Each framework is an expandable group. Closed by default unless
 * the controller marks it active; the framework matching the current
 * page opens automatically. */
.module-nav__group {
  border-bottom: 1px solid var(--color-border);
}

.module-nav__group:last-child { border-bottom: none; }

.module-nav__group-summary {
  list-style: none;
  cursor: pointer;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

/* Style the disclosure marker — flip on open. */
.module-nav__group-summary::-webkit-details-marker { display: none; }
.module-nav__group-summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.5rem;
  font-size: 0.7rem;
  transition: transform 100ms ease;
  color: var(--color-muted);
}

.module-nav__group[open] > .module-nav__group-summary::before {
  transform: rotate(90deg);
}

.module-nav__group-summary:hover {
  background: var(--color-bg-soft);
  color: var(--color-link);
}

.module-nav__group-name { flex: 1; }
.module-nav__group-count { font-size: 0.75rem; }

.module-nav__list {
  list-style: none;
  margin: 0;
  padding: 0 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.module-nav__item { margin: 0; }

.module-nav__link {
  display: block;
  padding: 0.15rem 1rem;
  color: var(--color-text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 2px solid transparent;
}

.module-nav__link:hover {
  background: var(--color-bg-soft);
  color: var(--color-link);
  text-decoration: none;
  border-left-color: var(--color-link);
}

/* Active trail: the current entity's row reverses to brand red with
 * white text; every namespace ancestor on the way down gets a soft
 * 10% red wash so the user can see the path at a glance. */
.module-nav__item--active > .module-nav__link {
  background: var(--rf-brand);
  color: #fff;
  border-left-color: var(--rf-brand-darker);
  font-weight: 500;
}

.module-nav__item--active > .module-nav__link:hover {
  background: var(--rf-brand-dark);
  color: #fff;
}

.module-nav__item--upstream > .module-nav__link {
  background: rgba(200, 20, 24, 0.1);
  border-left-color: rgba(200, 20, 24, 0.4);
}

[data-theme="dark"] .module-nav__item--active > .module-nav__link {
  background: var(--rf-brand-light);
  color: #fff;
  border-left-color: var(--rf-brand);
}

[data-theme="dark"] .module-nav__item--upstream > .module-nav__link {
  background: rgba(232, 61, 64, 0.18);
  border-left-color: rgba(232, 61, 64, 0.5);
}

.module-nav__empty {
  padding: 1rem;
  font-size: 0.85rem;
  text-align: center;
}

/* Toggle button — fixed bottom-left so it's always reachable. */
.module-nav-toggle {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  z-index: 11;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.module-nav-toggle:hover {
  background: var(--color-bg-soft);
  border-color: var(--color-link);
  color: var(--color-link);
}

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 1.5rem;
  text-align: center;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.home h1 { margin-top: 0; }
.home__lede { font-size: 1.15rem; color: var(--color-muted); }

.version-list {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.version-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--color-border);
}

.version-list__link { font-weight: 500; margin-right: 0.5rem; }
.version-list__meta { color: var(--color-muted); font-size: 0.9rem; }

.entity__breadcrumb {
  font-family: var(--font-mono);
  color: var(--color-muted);
  font-size: 0.9rem;
  margin: 0 0 0.25rem;
}

/* GitHub-style anchor copy link on headings */
.anchor-link {
  display: inline-block;
  margin-left: 0.35em;
  font-weight: normal;
  text-decoration: none;
  color: var(--color-muted);
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
}

h1:hover > .anchor-link,
h2:hover > .anchor-link,
h3:hover > .anchor-link,
h4:hover > .anchor-link,
.anchor-link:focus {
  opacity: 1;
}

.anchor-link:hover {
  color: var(--color-link);
  text-decoration: none;
}

.anchor-link--copied {
  opacity: 1;
  color: var(--color-link);
}

.anchor-link--copied::after {
  content: " copied";
  font-size: 0.75rem;
}

.entity__name {
  margin: 0 0 0.5rem;
  font-size: 2rem;
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.entity__kind {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.15em 0.5em;
}

.entity__version {
  color: var(--color-muted);
  font-size: 0.95rem;
  margin-top: 0;
}

.entity__doc { margin: 2rem 0; }

.entity__source {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.9rem;
}

.entity__body section h2 {
  margin-top: 2rem;
  font-size: 1.25rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.25rem;
}

.method-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.25rem 1rem;
}

.method-list li {
  padding: 0.15rem 0;
}

.method-list__scope {
  color: var(--color-muted);
  font-family: var(--font-mono);
}

.method-group {
  margin-bottom: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg-soft);
}

.method-group summary {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-weight: 500;
}

.method-group summary code {
  background: transparent;
  padding: 0;
}

.method-group__count {
  color: var(--color-muted);
  font-weight: normal;
  font-size: 0.9em;
}

.method-group__hint {
  display: block;
  font-size: 0.85em;
  font-weight: normal;
  margin-top: 0.15rem;
}

.method-group summary h2,
.method-group summary h3 {
  display: inline;
  margin: 0;
  font-size: 1rem;
}

.method-group .method-list {
  padding: 0 0.75rem 0.75rem;
}

.entity__private-methods { margin-top: 1.5rem; }

/* Breadcrumbs */
.breadcrumbs {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--color-muted);
  margin-bottom: 0.25rem;
}

.breadcrumbs ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.breadcrumbs li:not(:last-child)::after {
  content: "::";
  margin-left: 0.25rem;
  color: var(--color-muted);
}

.breadcrumbs a { color: var(--color-link); }
.breadcrumbs [aria-current="page"] { color: var(--color-text); }

/* Layout (body + outline aside) */
.entity__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 14rem;
  gap: 2rem;
  margin-top: 1.5rem;
}

@media (max-width: 60rem) {
  .entity__layout { grid-template-columns: 1fr; }
  .entity__outline { order: -1; }
}

.entity__body { min-width: 0; }

.entity__doc h1, .entity__doc h2, .entity__doc h3 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.entity__doc h2 { font-size: 1.15rem; }
.entity__doc h3 { font-size: 1rem; }
.entity__doc pre {
  background: var(--color-code-bg);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.5;
}
.entity__doc :not(pre) > code {
  white-space: nowrap;
}

/* Sticky right rail. The whole aside (outline + Support/License block)
 * sticks as one unit so the two children don't overlap on scroll. On
 * very tall pages where the rail is taller than the viewport,
 * max-height + overflow keep the rail scrollable on its own. */
.entity__outline {
  position: sticky;
  top: 1rem;
  align-self: start;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

@media (max-width: 60rem) {
  .entity__outline {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

/* Outline */
.outline {
  font-size: 0.9rem;
  border-left: 1px solid var(--color-border);
  padding-left: 1rem;
}

.outline__title,
.sidebar-block__title {
  /* Shared rail-section caption — keep these in lockstep so the right
   * rail's typography reads as one continuous strip. */
  margin: 0 0 0.5rem;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
}

.outline__title { margin-top: 0; }

.outline ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.outline li { margin: 0.25rem 0; }

/* Sidebar block — used for the curated Support + License block beneath
 * the page outline. Matches the outline's typographic treatment so the
 * whole right rail reads as one continuous strip. */
.sidebar-block {
  margin-top: 2rem;
  padding-left: 1rem;
  border-left: 1px solid var(--color-border);
  font-size: 0.9rem;
  color: var(--color-muted);
}

.sidebar-block__title--license { margin-top: 1.25rem; }

.sidebar-block__list {
  list-style: none;
  padding: 0;
  margin: 0 0 0.5rem;
}

.sidebar-block__list li { margin: 0 0 0.5rem; line-height: 1.4; }

.sidebar-block__text { margin: 0; line-height: 1.4; }

/* Version switcher */
.version-switcher {
  margin-left: auto;
  font-size: 0.9rem;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.version-switcher select {
  font-family: inherit;
  font-size: inherit;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}

.version-switcher--single {
  font-family: var(--font-mono);
  background: var(--color-code-bg);
  padding: 0.15em 0.5em;
  border-radius: 4px;
}

/* Module list (for Includes/Extends/Namespace). Long FQNs like
 * ActionCable::Channel::NonInferrableChannelError would overflow the
 * grid cell and bleed into the next column; truncate with ellipsis
 * and rely on the link's title attribute (added in entity_link) for
 * the full name on hover. */
.entity__module-list,
.entity__simple-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  gap: 0.25rem 1rem;
}

.entity__module-list > li,
.entity__simple-list > li {
  min-width: 0;          /* allow the cell to shrink below content width */
}

.entity__module-list > li > a,
.entity__simple-list > li > a,
.entity__module-list > li > code,
.entity__simple-list > li > code {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Signature block on method pages */
.signature {
  background: var(--color-code-bg);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  margin: 1rem 0;
  overflow-x: auto;
}

.signature--call-seq { white-space: pre; }

/* Params list on method pages */
.param-list dt {
  margin-top: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
}

.param-list__kind {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0 0.4em;
  font-family: var(--font-body);
}

.param-list__default { color: var(--color-muted); }
.param-list dd { margin: 0.25rem 0 0 1rem; color: var(--color-muted); }

/* Source code block on method pages */
.entity__source-code summary {
  cursor: pointer;
  color: var(--color-muted);
  margin: 1rem 0 0.5rem;
}

.entity__source-code pre {
  background: var(--color-code-bg);
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  white-space: pre;
}

.entity__back {
  margin-top: 2rem;
  font-size: 0.95rem;
  color: var(--color-muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip-to-main keyboard affordance — invisible until focused. */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--color-bg);
  color: var(--color-link);
  border: 2px solid var(--color-link);
  font-weight: 600;
  z-index: 100;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 0.5rem;
  outline: none;
}

/* Default visible Tab outline. Components that paint their own focus
 * indicator (palette__input, site-header__search input, anchor-link)
 * suppress this with `outline: none` paired with their custom paint. */
:focus-visible {
  outline: 2px solid var(--color-link);
  outline-offset: 2px;
}

/* Honor user motion preferences across all animations and transitions. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Search box in site header */
.site-header__search {
  flex: 1;
  max-width: 22rem;
  margin: 0;
}

.site-header__search input {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
}

.site-header__search input:focus {
  outline: none;
  border-color: var(--color-link);
  box-shadow: 0 0 0 2px rgba(204, 0, 0, 0.15);
}

/* Search results page */
.search-page__form {
  margin: 1rem 0 2rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-page__input {
  flex: 1;
  min-width: 18rem;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.search-page__submit {
  padding: 0.5rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  background: var(--color-bg-soft);
  border-radius: var(--radius);
  cursor: pointer;
}

.search-page__count {
  margin: 1rem 0;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.search-layout {
  display: grid;
  grid-template-columns: 14rem 1fr;
  gap: 2rem;
  margin-top: 1.5rem;
}

@media (max-width: 768px) {
  .search-layout { grid-template-columns: 1fr; }
}

.search-facets h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  margin: 1.25rem 0 0.5rem;
  border: none;
  padding: 0;
}

.search-facets ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.search-facets li { padding: 0.15rem 0; font-size: 0.95rem; }

.search-facets a.active {
  font-weight: 600;
  color: var(--color-link);
}

.search-facets__chip {
  display: inline-block;
  font-size: 0.8rem;
  padding: 0.15em 0.6em;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  margin-right: 0.4em;
  color: var(--color-muted);
}

.search-facets__chip--remove { color: var(--color-link); cursor: pointer; }
.search-facets__chip--remove:hover { background: var(--color-bg-soft); text-decoration: none; }

.search-results {
  list-style: none;
  padding: 0;
  margin: 0;
}

.search-result {
  padding: 1rem 0;
  border-bottom: 1px solid var(--color-border);
}

.search-result__breadcrumb {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--color-muted);
  margin: 0;
}

.search-result__name {
  font-size: 1.1rem;
  margin: 0.25rem 0;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.search-result__kind {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
}

.search-result__summary {
  margin: 0.25rem 0;
  color: var(--color-text);
}

.search-result__meta {
  font-size: 0.85rem;
  margin: 0.25rem 0 0;
}
