/*
  docc.css
  Understudy website

  Created by Yousef Mohamed youseef.elserwey@gmail.com.
  Copyright © 2026 Yousef Mohamed. MIT License.

  The second layer of the DocC theme, from the approved "DocC page styles" board. Each catalog's
  theme-settings.json sets the colours, fonts and corners; the site build adds this file to every
  DocC page for what the settings can't reach: the fonts themselves, the top bar that links back
  to the landing page, the product colour of each module and the asides. It restyles DocC's own
  pages and changes none of their structure.
*/

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("/fonts/inter-latin-variable.woff2") format("woff2");
}

@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url("/fonts/jetbrains-mono-latin-variable.woff2") format("woff2");
}

/* Product colour per module: the page's module, set by docc.js from the address. Links and
   buttons stay Cue on every module, so a reader always knows what is clickable. */

:root {
    --us-product-day: #0369a1;
    --us-product-night: #38bdf8;
    --us-pass-day: #15803d;
    --us-pass-night: #4ade80;
    --us-fail-day: #b91c1c;
    --us-fail-night: #f87171;
    --us-cue-day: #0369a1;
    --us-cue-night: #38bdf8;
    --us-spotlight-day: #b45309;
    --us-spotlight-night: #fbbf24;
}

:root[data-module="understudyhttp"] {
    --us-product-day: #0f766e;
    --us-product-night: #2dd4bf;
}

:root[data-module="understudysamples"] {
    --us-product-day: #6d28d9;
    --us-product-night: #a78bfa;
}

/* DocC names the scheme the reader chose on body: light, dark or auto. */
:root {
    --us-product: var(--us-product-day);
    --us-pass: var(--us-pass-day);
    --us-fail: var(--us-fail-day);
    --us-cue: var(--us-cue-day);
    --us-spotlight: var(--us-spotlight-day);
}

body[data-color-scheme="dark"] {
    --us-product: var(--us-product-night);
    --us-pass: var(--us-pass-night);
    --us-fail: var(--us-fail-night);
    --us-cue: var(--us-cue-night);
    --us-spotlight: var(--us-spotlight-night);
}

@media (prefers-color-scheme: dark) {
    body[data-color-scheme="auto"] {
        --us-product: var(--us-product-night);
        --us-pass: var(--us-pass-night);
        --us-fail: var(--us-fail-night);
        --us-cue: var(--us-cue-night);
        --us-spotlight: var(--us-spotlight-night);
    }
}

/* The navigator marks the open page with its module's colour. */
.navigator-card .navigator-card-item.active .leaf-link,
.navigator-card .navigator-card-item.is-active .leaf-link {
    box-shadow: inset 3px 0 0 var(--us-product);
}

/* The module intro band's rule takes the module's colour (theme-settings.json sets it per
   catalog; the combined site has one settings file, so this sets it per page). */
.documentation-hero {
    --color-documentation-intro-accent: var(--us-product);
}

/* Only a module's own page keeps the dark intro band, with light text on it. An article, a
   symbol or a tutorial opens on the page colour, its kind label in Spotlight. */

:root[data-module-page] .documentation-hero {
    --color-documentation-intro-title: #f1f5f9;
    --color-documentation-intro-abstract: #cbd5e1;
    --color-documentation-intro-eyebrow: #fbbf24;
    --color-documentation-intro-figure: #f1f5f9;
    color: #f1f5f9;
}

:root[data-module-page] .documentation-hero a {
    color: #38bdf8;
}

:root:not([data-module-page]) .documentation-hero {
    background: var(--color-fill);
    color: var(--color-text);
}

:root:not([data-module-page]) .documentation-hero .background-icon,
:root:not([data-module-page]) .documentation-hero::before,
:root:not([data-module-page]) .documentation-hero::after {
    display: none;
}

:root:not([data-module-page]) .documentation-hero .eyebrow {
    color: var(--color-eyebrow);
}

:root:not([data-module-page]) .documentation-hero .abstract,
:root:not([data-module-page]) .documentation-hero .breadcrumbs,
:root:not([data-module-page]) .documentation-hero .breadcrumbs a {
    color: var(--color-figure-gray-secondary, var(--color-text));
}

/* Headings in the site's type: heavy and tight, as on the landing page. */

main.main h1,
main.main .topictitle h1.title {
    font-weight: 800;
    letter-spacing: -0.025em;
}

main.main h2,
main.main .container h2.title,
main.main .section-title h3.contenttable-title {
    font-weight: 800;
    letter-spacing: -0.015em;
}

main.main h3,
main.main h4 {
    font-weight: 800;
    letter-spacing: -0.015em;
}

/* Asides: the word carries the colour, the box stays neutral. Note uses Cue, Important
   Spotlight, Tip and Warning the identity's pass and fail colours. Only DocC's content asides
   carry a kind; the navigator is an aside too, and keeps its own look. */

main .aside:is(.note, .tip, .experiment, .important, .warning, .deprecated) {
    border: 1px solid var(--color-grid, rgb(128 128 128 / 25%));
    border-radius: 12px;
    background: var(--color-fill);
    box-shadow: none;
}

main .aside .label {
    font-weight: 700;
}

main .aside.note .label {
    color: var(--us-cue);
}

main .aside.tip .label,
main .aside.experiment .label {
    color: var(--us-pass);
}

main .aside.important .label {
    color: var(--us-spotlight);
}

main .aside.warning .label,
main .aside.deprecated .label {
    color: var(--us-fail);
}
