/* ============================================================
   dupont — chess-themed styling for the docs site.
   Board palette from the project screenshot: muted purple dark
   squares, warm cream light squares, on a dark frame.
   Type is a large, playful Comic Sans stack.
   ============================================================ */

/* Comic Neue is a free Comic Sans look-alike. We load it as a fallback so the
   playful look holds even on machines without Comic Sans MS installed. */
@import url("https://fonts.googleapis.com/css2?family=Comic+Neue:wght@400;700&display=swap");

/* A playful handwriting-style stack: use the reader's Comic Sans MS if present,
   fall back to Comic Neue (loaded above), then any casual system face. */
:root {
  --dupont-font-text: "Comic Sans MS", "Comic Neue", "Chalkboard SE", "Comic Sans", cursive;
  --dupont-font-code: "Comic Neue", "Comic Sans MS", ui-monospace, monospace;
}

/* Apply the playful font everywhere Material uses its text and code faces. */
:root {
  --md-text-font: var(--dupont-font-text);
  --md-code-font: var(--dupont-font-code);
}

body,
.md-typeset,
.md-header,
.md-nav,
.md-tabs {
  font-family: var(--dupont-font-text);
}

:root {
  --chess-dark-square: #7a74c4;   /* purple board square */
  --chess-light-square: #ecece4;  /* warm cream board square */
  --chess-accent: #8b84e4;        /* brighter purple accent */
  --chess-accent-soft: #b4afe8;   /* lighter purple for hover/links */
  --chess-ink: #15131f;           /* near-black board frame */
}

/* Force a single dark scheme (do not follow the OS setting). */
[data-md-color-scheme="slate"] {
  --md-primary-fg-color: #211d33;
  --md-primary-fg-color--light: #2d2846;
  --md-primary-fg-color--dark: #15131f;
  --md-accent-fg-color: var(--chess-accent);
  --md-default-bg-color: #141220;
  --md-typeset-a-color: var(--chess-accent-soft);
}

/* ---- Backstop: hide the per-page (right-hand) table of contents.
   The left navigation is the only index. ---- */
.md-sidebar--secondary,
.md-nav--secondary {
  display: none !important;
}

/* ---- Larger, more readable, playful text across the whole site.
   Comic Sans runs a little small per point size, so sizes are bumped up. ---- */
.md-typeset {
  font-size: 1.02rem;
  line-height: 1.8;
}

/* Scale the base rem up, so spacing and all relative sizes grow with it. */
@media screen and (min-width: 76.25em) {
  html {
    font-size: 138%;
  }
}

html {
  font-size: 130%;
}

/* Left navigation: larger, easy to read. */
.md-nav {
  font-size: 0.85rem;
}

/* Headings larger and bolder for a friendly, chunky feel. */
.md-typeset h1 {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.md-typeset h2 {
  font-size: 1.75rem;
  font-weight: 700;
}

.md-typeset h3 {
  font-size: 1.35rem;
  font-weight: 700;
}

/* Readable table and code text. */
.md-typeset table:not([class]) {
  font-size: 0.95rem;
}

.md-typeset code {
  font-size: 0.9em;
}

/* ---- Header: a thin board-pattern strip under the top bar, so the
   whole site reads as "chess" at a glance. ---- */
.md-header {
  box-shadow: 0 2px 0 0 var(--chess-accent);
}

.md-header::after {
  content: "";
  display: block;
  height: 6px;
  background-image:
    linear-gradient(45deg, var(--chess-dark-square) 25%, transparent 25%),
    linear-gradient(-45deg, var(--chess-dark-square) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--chess-dark-square) 75%),
    linear-gradient(-45deg, transparent 75%, var(--chess-dark-square) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  background-color: var(--chess-light-square);
  opacity: 0.9;
}

/* ---- Page titles: purple underline, like a highlighted square. ---- */
.md-typeset h1 {
  color: #eceaf6;
  border-bottom: 2px solid var(--chess-accent);
  padding-bottom: 0.3rem;
}

.md-typeset h2 {
  color: #d6d2f0;
}

.md-typeset h3 {
  color: #c3bde8;
}

/* ---- Tables styled like a board frame. ---- */
.md-typeset table:not([class]) {
  border: 1px solid #3a3458;
  border-radius: 6px;
  overflow: hidden;
}

.md-typeset table:not([class]) th {
  background-color: var(--chess-dark-square);
  color: #f6f6fb;
  font-weight: 600;
}

.md-typeset table:not([class]) tr:nth-child(even) {
  background-color: rgba(122, 116, 196, 0.12);
}

/* ---- Inline code and code blocks: purple on dark. ---- */
.md-typeset code {
  color: var(--chess-accent-soft);
  background-color: rgba(139, 132, 228, 0.12);
}

/* ---- Links hover in brighter purple, like selecting a move. ---- */
.md-typeset a:hover {
  color: var(--chess-accent);
}

/* ---- Mermaid diagrams: center them, give room, and scale them up so
   they are easy to read. ---- */
.md-typeset .mermaid {
  display: flex;
  justify-content: center;
  margin: 1.6rem 0;
}

.md-typeset .mermaid svg {
  width: 100% !important;
  max-width: 920px !important;
  height: auto !important;
}

/* ---- Admonitions picked up the accent too. ---- */
.md-typeset .admonition {
  border-left-color: var(--chess-accent);
}

/* ============================================================
   Chess theming — pieces and board motifs across the whole site,
   so it reads as "chess" everywhere, not just the logo.
   ============================================================ */

/* ---- A chess piece in front of every section heading (H2).
   The pieces cycle down the page: ♟ ♞ ♝ ♜ ♛ ♚, then repeat. ---- */
.md-typeset h2 {
  position: relative;
}

.md-typeset h2::before {
  margin-right: 0.5rem;
  color: var(--chess-accent-soft);
  font-size: 1.1em;
  line-height: 1;
}

.md-typeset h2:nth-of-type(6n + 1)::before { content: "\265F"; }  /* pawn */
.md-typeset h2:nth-of-type(6n + 2)::before { content: "\265E"; }  /* knight */
.md-typeset h2:nth-of-type(6n + 3)::before { content: "\265D"; }  /* bishop */
.md-typeset h2:nth-of-type(6n + 4)::before { content: "\265C"; }  /* rook */
.md-typeset h2:nth-of-type(6n + 5)::before { content: "\265B"; }  /* queen */
.md-typeset h2:nth-of-type(6n + 6)::before { content: "\265A"; }  /* king */

/* ---- Chess-pawn bullets for unordered lists. ---- */
.md-typeset ul li::marker {
  content: "\265F  ";
  color: var(--chess-accent);
}

/* ---- Left-nav section labels: a small knight before each group,
   so the three sections (Start Here / Under The Hood / Reference)
   read as chess-themed headers. ---- */
.md-nav__item--section > .md-nav__link,
.md-nav__title {
  color: var(--chess-accent-soft);
}

.md-nav__item--section > .md-nav__link::before {
  content: "\265E  ";
  color: var(--chess-accent);
}

/* ---- Page icons (from each page's front-matter `icon:`) get the
   accent color where Material renders them in the title. ---- */
.md-typeset h1 .twemoji svg,
.md-content__inner .md-icon svg {
  fill: var(--chess-accent-soft);
}

/* ---- A board-pattern strip above the footer, mirroring the header,
   so the page is framed top and bottom like a board edge. ---- */
.md-footer-meta {
  position: relative;
}

.md-footer-meta::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background-image:
    linear-gradient(45deg, var(--chess-dark-square) 25%, transparent 25%),
    linear-gradient(-45deg, var(--chess-dark-square) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--chess-dark-square) 75%),
    linear-gradient(-45deg, transparent 75%, var(--chess-dark-square) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  background-color: var(--chess-light-square);
  opacity: 0.85;
}

/* ---- A decorative row of pieces under the H1 on the home page,
   added via the title underline area for a welcoming touch. ---- */
.md-typeset h1::after {
  content: "\2659  \2658  \2657  \2656  \2655  \2654";
  display: block;
  margin-top: 0.35rem;
  font-size: 0.9rem;
  letter-spacing: 0.35rem;
  color: var(--chess-accent);
  opacity: 0.55;
  border: 0;
}
