/* ==========================================================================
   Custom look for docs.tuestudyhub.xyz

   Calm, neutral, academic — hierarchy and spacing before color and shadow,
   matching the product feel in docs/design-system.md. Everything derives
   from Material's own color tokens via `color-mix`, so light and dark stay
   consistent without per-scheme overrides. Shape and motion only; no
   template overrides.
   ========================================================================== */

:root {
  --docs-radius-sm: 6px;
  --docs-radius-md: 12px;
  --docs-speed: 150ms;
  --docs-ease: cubic-bezier(0.2, 0, 0, 1);
  --docs-accent: #0f9d77;
}

/* --------------------------------------------------------------------------
   Palette — ChatGPT-style neutrality: flat white light mode, charcoal dark
   mode, a single restrained green accent. Surfaces stay monochrome.

   Light values sit on :root as the base. Dark values are applied twice:
   for the explicit slate scheme and, inside a media query, for the
   "follow the system" palette, which renders dark without ever setting a
   scheme attribute (it only has to avoid matching an explicit light pick).
   -------------------------------------------------------------------------- */

:root {
  --md-primary-fg-color: #ffffff;
  --md-primary-bg-color: #0d0d0d;
  --md-accent-fg-color: var(--docs-accent);
  --md-typeset-a-color: var(--docs-accent);
  --md-code-bg-color: #f7f7f8;
}

/* The compound selector matches the specificity of Material's own
   [scheme=slate][primary=...] link-color rules, which would otherwise win. */
[data-md-color-scheme="slate"],
[data-md-color-scheme="slate"][data-md-color-primary="black"] {
  --md-primary-fg-color: #171717;
  --md-primary-bg-color: #ececec;
  --md-default-bg-color: #212121;
  --md-accent-fg-color: #2fd3a5;
  --md-typeset-a-color: #2fd3a5;
  --md-code-bg-color: #2f2f2f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-md-color-scheme="default"]) {
    --md-primary-fg-color: #171717;
    --md-primary-bg-color: #ececec;
    --md-default-bg-color: #212121;
    --md-accent-fg-color: #2fd3a5;
    --md-typeset-a-color: #2fd3a5;
    --md-code-bg-color: #2f2f2f;
  }
}

html {
  scroll-behavior: smooth;
}

::selection {
  background: color-mix(in srgb, var(--md-accent-fg-color) 25%, transparent);
}

/* --------------------------------------------------------------------------
   Typography — a touch larger reading measure, tighter display headings
   -------------------------------------------------------------------------- */

.md-typeset {
  font-size: 0.84rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}

.md-typeset h1 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.md-typeset h2,
.md-typeset h3,
.md-typeset h4 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.md-typeset blockquote {
  border-left: 2px solid color-mix(in srgb, var(--md-default-fg-color) 20%, transparent);
  color: var(--md-default-fg-color--light);
}

.md-typeset a {
  text-underline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Header — quiet translucent bar with a hairline instead of a drop shadow
   -------------------------------------------------------------------------- */

.md-header,
[data-md-color-primary="black"] .md-header {
  box-shadow: none;
  background-color: color-mix(in srgb, var(--md-primary-fg-color) 90%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid color-mix(in srgb, var(--md-default-fg-color) 10%, transparent);
}

/* --------------------------------------------------------------------------
   Sidebar navigation — soft hover and active pills, calm transitions
   -------------------------------------------------------------------------- */

.md-sidebar .md-nav__link {
  border-radius: var(--docs-radius-sm);
  transition:
    background-color var(--docs-speed) var(--docs-ease),
    color var(--docs-speed) var(--docs-ease);
}

.md-sidebar .md-nav__link:hover {
  background: color-mix(in srgb, var(--md-default-fg-color) 6%, transparent);
}

.md-sidebar .md-nav__link--active {
  background: color-mix(in srgb, var(--md-accent-fg-color) 10%, transparent);
}

/* --------------------------------------------------------------------------
   Code — rounded blocks with a hairline, softly padded inline code
   -------------------------------------------------------------------------- */

.md-typeset code {
  border-radius: 5px;
  padding: 0.1em 0.35em;
}

.md-typeset pre {
  border: 1px solid color-mix(in srgb, var(--md-default-fg-color) 8%, transparent);
  border-radius: var(--docs-radius-md);
}

.md-typeset pre > code {
  padding: 0;
}

.md-clipboard {
  transition: color var(--docs-speed) var(--docs-ease);
}

/* --------------------------------------------------------------------------
   Tables — quiet header band, gentle hover, hairline dividers
   -------------------------------------------------------------------------- */

.md-typeset table:not([class]) th {
  font-weight: 600;
  background: color-mix(in srgb, var(--md-default-fg-color) 5%, transparent);
}

.md-typeset table:not([class]) th,
.md-typeset table:not([class]) td {
  border-color: color-mix(in srgb, var(--md-default-fg-color) 10%, transparent);
}

.md-typeset table:not([class]) tbody tr {
  transition: background-color var(--docs-speed) var(--docs-ease);
}

.md-typeset table:not([class]) tbody tr:hover {
  background: color-mix(in srgb, var(--md-default-fg-color) 4%, transparent);
}

/* --------------------------------------------------------------------------
   Admonitions and collapsible details — tinted by their own accent color
   -------------------------------------------------------------------------- */

.admonition {
  --md-admonition-bg-color: color-mix(
    in srgb,
    var(--md-admonition-fg-color) 7%,
    var(--md-default-bg-color)
  );
  border-radius: var(--docs-radius-md);
  box-shadow: none;
}

/* --------------------------------------------------------------------------
   Tabbed content — round off the panel under the label row
   -------------------------------------------------------------------------- */

.md-typeset .tabbed-content {
  border-radius: 0 0 var(--docs-radius-sm) var(--docs-radius-sm);
}

/* --------------------------------------------------------------------------
   Images — concentric rounding and a faint edge so light diagrams
   survive the dark scheme
   -------------------------------------------------------------------------- */

.md-typeset img {
  border-radius: var(--docs-radius-md);
  outline: 1px solid color-mix(in srgb, var(--md-default-fg-color) 10%, transparent);
  outline-offset: -1px;
}

/* --------------------------------------------------------------------------
   Focus, footer, motion
   -------------------------------------------------------------------------- */

.md-nav__link:focus-visible,
.md-header__button:focus-visible,
.md-footer__link:focus-visible,
.md-top:focus-visible {
  outline: 2px solid var(--md-accent-fg-color);
  outline-offset: 2px;
}

.md-footer {
  border-top: 1px solid color-mix(in srgb, var(--md-default-fg-color) 10%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .md-sidebar .md-nav__link,
  .md-typeset table:not([class]) tbody tr,
  .md-clipboard {
    transition: none;
  }
}
