/* Warm, editorial look: ivory/clay palette, serif headings, sans body. */

:root {
  --rl-serif: "Source Serif 4", "Noto Serif JP", Georgia, serif;
  --md-text-font: "Inter", "Noto Sans JP";
  --md-code-font: "JetBrains Mono", "Noto Sans JP";

  --rl-bg: #faf9f5;
  --rl-surface: #f0eee6;
  --rl-border: #e8e6dc;
  --rl-fg: #141413;
  --rl-fg-muted: #5e5d59;
  --rl-accent: #c96442;
  --rl-accent-strong: #ae5630;
}

[data-md-color-scheme="slate"] {
  --rl-bg: #262624;
  --rl-surface: #30302e;
  --rl-border: #3e3e38;
  --rl-fg: #faf9f5;
  --rl-fg-muted: #b7b5a9;
  --rl-accent: #d97757;
  --rl-accent-strong: #e8957a;
}

[data-md-color-scheme="default"],
[data-md-color-scheme="slate"] {
  --md-default-bg-color: var(--rl-bg);
  --md-default-bg-color--light: color-mix(in srgb, var(--rl-bg) 88%, transparent);
  --md-default-fg-color: var(--rl-fg);
  --md-default-fg-color--light: var(--rl-fg-muted);
  --md-default-fg-color--lighter: color-mix(in srgb, var(--rl-fg) 40%, transparent);
  --md-default-fg-color--lightest: var(--rl-border);
  --md-typeset-color: var(--rl-fg);
  --md-primary-fg-color: var(--rl-accent);
  --md-primary-fg-color--light: var(--rl-accent);
  --md-primary-fg-color--dark: var(--rl-accent-strong);
  --md-primary-bg-color: var(--rl-bg);
  --md-accent-fg-color: var(--rl-accent-strong);
  --md-accent-fg-color--transparent: color-mix(in srgb, var(--rl-accent) 10%, transparent);
  --md-typeset-a-color: var(--rl-accent);
  --md-code-bg-color: var(--rl-surface);
  --md-code-fg-color: var(--rl-fg);
  --md-footer-bg-color: var(--rl-bg);
  --md-footer-bg-color--dark: var(--rl-bg);
  --md-footer-fg-color: var(--rl-fg);
  --md-footer-fg-color--light: var(--rl-fg-muted);
  --md-footer-fg-color--lighter: var(--rl-fg-muted);
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Header and tabs sit on the page background, separated by a hairline. */
.md-header,
.md-tabs {
  background-color: var(--md-default-bg-color--light);
  color: var(--rl-fg);
}

.md-header {
  border-bottom: 1px solid var(--rl-border);
  box-shadow: none;
}

.md-header__topic:first-child,
.md-nav__title {
  font-family: var(--rl-serif);
  font-weight: 500;
}

.md-header__topic:first-child {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

/* Body text */
.md-typeset {
  font-size: 0.8rem;
  line-height: 1.75;
  letter-spacing: 0;
}

html[lang="ja"] .md-typeset {
  line-height: 1.9;
  letter-spacing: 0.02em;
}

/* Headings: serif, regular weight, slightly tight. */
.md-typeset h1,
.md-typeset h2,
.md-typeset h3 {
  font-family: var(--rl-serif);
  font-weight: 500;
  color: var(--rl-fg);
  letter-spacing: -0.015em;
}

.md-typeset h1 {
  font-size: 2.1em;
  line-height: 1.2;
  margin-bottom: 0.9em;
}

.md-typeset h2 {
  font-size: 1.45em;
  margin-top: 2em;
}

.md-typeset h3 {
  font-size: 1.15em;
}

.md-typeset h4,
.md-typeset h5,
.md-typeset h6 {
  font-weight: 600;
  color: var(--rl-fg);
}

html[lang="ja"] .md-typeset h1,
html[lang="ja"] .md-typeset h2,
html[lang="ja"] .md-typeset h3 {
  letter-spacing: 0.01em;
}

/* Links: accent color with an underline on hover. */
.md-typeset a {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--rl-accent) 35%, transparent);
  text-underline-offset: 0.2em;
}

.md-typeset a:hover {
  text-decoration-color: currentcolor;
}

.md-typeset .headerlink {
  text-decoration: none;
}

/* Navigation */
.md-tabs__link {
  font-size: 0.72rem;
  opacity: 1;
  color: var(--rl-fg-muted);
}

.md-tabs__item--active .md-tabs__link,
.md-tabs__link:hover {
  color: var(--rl-fg);
}

.md-nav__link--active,
.md-nav__item .md-nav__link--active > .md-ellipsis {
  color: var(--rl-accent);
  font-weight: 500;
}

/* Code */
.md-typeset code {
  border-radius: 0.3rem;
  font-size: 0.86em;
}

.md-typeset pre > code {
  border: 1px solid var(--rl-border);
  border-radius: 0.6rem;
}

/* Tables */
.md-typeset table:not([class]) {
  border: 1px solid var(--rl-border);
  border-radius: 0.6rem;
  box-shadow: none;
  font-size: 0.72rem;
}

.md-typeset table:not([class]) th {
  background-color: var(--rl-surface);
  font-weight: 600;
}

.md-typeset table:not([class]) td,
.md-typeset table:not([class]) th {
  border-color: var(--rl-border);
}

/* Admonitions */
.md-typeset .admonition,
.md-typeset details {
  border-radius: 0.6rem;
  border-width: 1px;
  box-shadow: none;
  font-size: 0.75rem;
}

/* Language switcher (top right): icon plus the current language's name. */
.md-header__button.rl-lang__button {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.3rem;
  width: auto;
  height: 1.7rem;
  margin: 0 0.2rem;
  padding: 0 0.6rem 0 0.45rem;
  white-space: nowrap;
  border: 1px solid var(--rl-border);
  border-radius: 999px;
}

.rl-lang__button svg {
  display: block;
  width: 0.9rem;
  height: 0.9rem;
}

.rl-lang__name {
  font-size: 0.68rem;
  font-weight: 500;
}

.md-select__inner {
  border-radius: 0.6rem;
}

.md-select__link {
  font-size: 0.72rem;
}

/* Footer */
.md-footer,
.md-footer-meta {
  background-color: var(--rl-bg);
  color: var(--rl-fg-muted);
}

.md-footer-meta {
  border-top: 1px solid var(--rl-border);
}

/* Status badges: <span class="status status--verified">…</span> (see reference/status-labels.md).
   Each color is mixed into the page background, so the pill stays readable in both schemes. */
.md-typeset .status {
  --rl-status: var(--rl-fg-muted);
  display: inline-block;
  padding: 0.05em 0.6em;
  border: 1px solid color-mix(in srgb, var(--rl-status) 45%, transparent);
  border-radius: 999px;
  background-color: color-mix(in srgb, var(--rl-status) 14%, var(--rl-bg));
  color: color-mix(in srgb, var(--rl-status) 75%, var(--rl-fg));
  font-size: 0.72em;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.01em;
  vertical-align: 0.1em;
  white-space: nowrap;
}

.md-typeset .status--verified {
  --rl-status: #4d8a52;
}

.md-typeset .status--mock {
  --rl-status: #4f7fae;
}

.md-typeset .status--dev {
  --rl-status: var(--rl-accent);
}

.md-typeset .status--design {
  --rl-status: var(--rl-fg-muted);
}

[data-md-color-scheme="slate"] .md-typeset .status--verified {
  --rl-status: #7cbf80;
}

[data-md-color-scheme="slate"] .md-typeset .status--mock {
  --rl-status: #86b1dc;
}

/* Tutorial gallery (tutorials/index.md): <div class="grid cards gallery" markdown>.
   The thumbnail fills the card's width on a surface tint; the tag row is small and muted. */
.md-typeset .gallery > ul > li > p:first-child,
.md-typeset .gallery > ol > li > p:first-child {
  margin: 0 0 0.6em;
}

.md-typeset .gallery img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 0.3rem;
  background-color: var(--rl-surface);
}

.md-typeset .gallery-tags {
  color: var(--rl-fg-muted);
  font-size: 0.8em;
}
