/* d4c.dev fonts not covered by theme.font: headings, tabs and Japanese. */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@500&family=Poppins:wght@600;700&family=BIZ+UDPGothic:wght@400;700&display=swap");

/*
 * Colours of d4c.dev (repo d4c, src/app/globals.css: ground #f7f8fa, text
 * #24282e, accent #2f6bff, link #1f5ad6), applied through the theme's
 * documented custom palette: mkdocs.yml sets primary/accent to "custom" on
 * the default scheme and these variables fill them in. No template is
 * overridden.
 */
[data-md-color-scheme="default"] {
  --md-default-bg-color: #f7f8fa;
  --md-default-fg-color: #24282e;
  --md-default-fg-color--light: rgba(36, 40, 46, 0.72);
  --md-default-fg-color--lighter: rgba(36, 40, 46, 0.5);
  --md-default-fg-color--lightest: rgba(36, 40, 46, 0.14);

  /* Header and footer: the menus' white, text in the soft black. */
  --md-primary-fg-color: #ffffff;
  --md-primary-fg-color--light: #f7f8fa;
  --md-primary-fg-color--dark: #e9ebef;
  --md-primary-bg-color: #24282e;
  --md-primary-bg-color--light: rgba(36, 40, 46, 0.72);

  --md-accent-fg-color: #2f6bff;
  --md-accent-fg-color--transparent: rgba(47, 107, 255, 0.1);

  --md-typeset-a-color: #1f5ad6;

  /* d4c.dev's --fill (text at 5%) on the ground, as a solid colour. */
  --md-code-bg-color: #eceef1;
  --md-code-fg-color: #24282e;
}

/*
 * Fonts: Inter for text, headings (h1 included, at the theme's weights) and
 * the tabs (500), JetBrains Mono for code (set in theme.font), as on d4c.dev;
 * Poppins for the site title only; BIZ UDPGothic for every Japanese character. The rules below follow docs.6umi.net's 6umi.css with
 * d4c's faces; only the colours differ.
 */
/* The root size stays 20px at every width (the theme raises it to 22px and 24px
   on wide screens), so the header and the tab row stay 48px, as on d4c.dev. */
html:root {
  font-size: 125%;
}

:root:root {
  --md-text-font: "Inter", "BIZ UDPGothic";
  --md-code-font: "JetBrains Mono", "BIZ UDPGothic";
}

.md-header__title {
  font-family: "Poppins", "BIZ UDPGothic", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/*
 * Header band as the folded band on d4c.dev (repo d4c, src/app/globals.css
 * .page-head): navy across the full width, with hero.jpg faint over it (in
 * blues: its luminosity over the accent); the header's text and buttons are
 * light on it. The picture is d4c.dev's own: this site is served under
 * d4c.dev/docs/, so nothing is committed here.
 */
.md-header {
  isolation: isolate;
  background-color: #0f2150; /* --title-solid */
  color: #f0f0f0;
}
.md-header::before {
  content: "";
  position: absolute;
  /* Drawn 8px past every edge and clipped back, so the blur does not fade the edges */
  inset: -8px;
  clip-path: inset(8px);
  z-index: -1;
  pointer-events: none;
  background:
    url("https://d4c.dev/hero.jpg") right 38% / cover,
    #2f6bff;
  background-blend-mode: luminosity;
  filter: blur(2px) brightness(1.05) contrast(1.5) saturate(0.2); /* --title-photo-filter-folded */
  opacity: 0.12; /* --title-photo-opacity-folded */
}
/* The title lifted off the band, as on d4c.dev (--title-shadow). */
.md-header__title {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 2px 8px rgba(0, 0, 0, 0.7), 0 0 24px rgba(0, 0, 0, 0.85);
}
/* On the band: every header button in the light text colour; the search
   field a faint light plate with light text. */
.md-header .md-header__button.md-icon {
  color: #f0f0f0;
}
.md-header .md-search__button {
  background-color: rgba(240, 240, 240, 0.15);
  color: #f0f0f0;
}

/* No mark: the header and the drawer show the name only. */
.md-header__button.md-logo,
.md-nav__button.md-logo {
  display: none !important;
}

/* "d4c.dev > 開発記録" in the header (build.py link_header): links like the
   d4c.dev title (repo d4c, globals.css .page-title a), no change on hover. */
.md-header__topic a.d4c-crumb,
.md-header__topic a.d4c-crumb:is(:hover, :focus) {
  color: inherit;
}
.md-header__topic .d4c-crumb-sep {
  margin: 0 0.4em;
  opacity: 0.5;
}

/*
 * Page history appended by gitrep, and the home page's Recent changes in the
 * same style (gitrep src/gitrep/cli.py: add_history, recent_changes): small,
 * quiet, below a hairline.
 */
.md-typeset .gitrep-history {
  margin-top: 3em;
  padding-top: 0.8em;
  border-top: 1px solid var(--md-default-fg-color--lightest);
  color: var(--md-default-fg-color--light);
  font-size: 0.75em;
}

.md-typeset .gitrep-history p {
  margin: 0 0 0.4em;
}

.md-typeset .gitrep-history ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.md-typeset .gitrep-history li {
  margin: 0;
}

/* The current heading in "On this page" in the accent, like the current
 * page in the sidebar. */
.md-nav--secondary .md-nav__link--active {
  color: var(--md-accent-fg-color);
}

/* The tabs as d4c.dev's top links (repo d4c, globals.css .nav-tab): 14px at
 * weight 500, text at 60%, the current and a hovered one in the full text
 * colour, the current one underlined in the text colour. No accent. */
.md-tabs__link {
  color: rgba(36, 40, 46, 0.6);
  font-weight: 500;
  opacity: 1;
}

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

.md-tabs__item--active {
  border-bottom-color: var(--md-default-fg-color);
}

/*
 * "Continue reading" under each excerpt, as a d4c.dev button: a frame in the
 * text colour that fills on hover, text in the mono face, corners 4px.
 */
.md-post--excerpt .md-post__action > a {
  display: inline-block;
  padding: 0.4em 1.2em;
  border: 1px solid var(--md-default-fg-color);
  border-radius: 4px;
  color: var(--md-default-fg-color);
  font-family: var(--md-code-font-family);
  font-size: 0.8em;
  text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}

.md-post--excerpt .md-post__action > a:is(:hover, :focus) {
  background-color: var(--md-default-fg-color);
  color: var(--md-default-bg-color);
}

/*
 * Post titles in a listing read as headings, marked with a document icon
 * (post.svg, through a mask so it takes the text colour). Pages in the
 * sidebar below a tab get the same icon, so a page and a post look alike
 * wherever they are listed. Same selectors as 6umi.css; re-check them when
 * upgrading zensical.
 */
.md-post--excerpt .md-post__content > h2 > a.toclink {
  color: var(--md-default-fg-color);
}

.md-post--excerpt .md-post__content > h2 > a.toclink::before,
.md-nav--primary .md-nav[data-md-level]:not([data-md-level="0"])
  > .md-nav__list > .md-nav__item:not(.md-nav__item--nested)
  > .md-nav__link:not(.md-nav__container) > .md-ellipsis::before {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-right: 0.35em;
  vertical-align: -0.1em;
  background-color: currentColor;
  -webkit-mask: url("post.svg") no-repeat center / contain;
  mask: url("post.svg") no-repeat center / contain;
}

/* Pictures in a page: a faint edge and a soft shadow on the light ground. */
.md-typeset p > img {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 3px;
  box-shadow: 0 2px 8px rgba(36, 40, 46, 0.12);
}

/* Section headings in a page: an accent edge on the left, no fill. Only
 * the page's own h2s, not the post titles in a listing. */
.md-content__inner.md-typeset > h2,
.md-content__inner > header.md-typeset > h2 {
  padding-left: 0.6em;
  border-left: 3px solid var(--md-accent-fg-color);
}

/* The date above each post in a listing: small, in the text face, in the
 * accent. */
.md-post--excerpt .md-post__meta time {
  color: var(--md-accent-fg-color);
  font-family: var(--md-text-font-family);
  font-size: 0.55rem;
  letter-spacing: 0.025em;
}

/* Diagrams in the link colour on the code ground, not the accent fill. The
 * theme sets these on `:root > *`, so the same selector is needed to win. */
:root > * {
  --md-mermaid-node-fg-color: var(--md-typeset-a-color);
  --md-mermaid-node-bg-color: var(--md-code-bg-color);
}

/*
 * Code on the near-white ground. Blocks and inline code share one ground,
 * d4c.dev's --fill (text at 5%), set above as --md-code-bg-color: a white
 * block with a hairline (first try) read as a stark box on the page. Inline
 * code keeps a hairline so a short word still reads as code in prose. Not
 * inverted: dark chips scattered through Japanese prose read as noise.
 */
.md-typeset :not(pre) > code {
  box-shadow: inset 0 0 0 1px rgba(36, 40, 46, 0.12);
}

.md-typeset pre > code {
  border-radius: 6px;
}

/* The copy button sits on the block's ground, not on a white patch. */
.md-typeset .md-code__nav {
  background-color: var(--md-code-bg-color);
}
