/* Self-hosted Poppins (latin subset). theme.font is false in mkdocs.yml, so no
   request goes to the Google Fonts CDN — these woff2 files ship with the site. */
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/poppins-v24-latin-regular.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/poppins-v24-latin-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/poppins-v24-latin-500.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("fonts/poppins-v24-latin-600.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/poppins-v24-latin-700.woff2") format("woff2");
}

/* Use Poppins for body text and headings; keep the default monospace for code. */
:root {
  --md-text-font-family: "Poppins", -apple-system, BlinkMacSystemFont, Helvetica,
    Arial, sans-serif;
}

/* Force a balanced 2×2 for the four home cards (Material's auto-fit otherwise
   lands them as an awkward 3+1). Collapses to a single column on narrow screens. */
@media screen and (min-width: 45em) {
  .md-typeset .grid.cards.two-col {
    grid-template-columns: 1fr 1fr;
  }
}

/* Scorecard tables: emphasise the "after" column. */
.md-typeset table td strong {
  color: var(--md-primary-fg-color);
}

/* "leaves the building" vs "stays local" markers in the going-local table.
   Orange vs teal is colour-blind-safe (unlike red/green); the darker light-mode
   hues are swapped for lighter ones under the slate (dark) scheme so both stay
   legible. */
.md-typeset .tag-leaves,
.md-typeset .tag-stays {
  font-weight: 700;
  font-size: 0.82em;
  letter-spacing: 0.02em;
}
.md-typeset .tag-leaves { color: #c2410c; }
.md-typeset .tag-stays  { color: #00695c; }
[data-md-color-scheme="slate"] .md-typeset .tag-leaves { color: #fb923c; }
[data-md-color-scheme="slate"] .md-typeset .tag-stays  { color: #4db6ac; }

/* Inline-SVG process figures (chapter 7). Orange/teal, colour-blind safe (no
   red/green), theme-aware. Ink and panel fills come from Material's own theme vars
   so they track light/dark; the accent hues mirror the tag colours above. SVG
   children reference these via fill/stroke="var(--fig-…)".
   AUTHORING GOTCHA: never leave a blank line *inside* an inline <svg> (or between
   its child elements). A blank line ends the md_in_html HTML block, so Markdown
   reparses the rest as prose and silently drops every shape element (<rect>/<line>/
   <path>), leaving only the <text>. Keep the SVG body one contiguous block. */
.md-typeset svg.figsvg {
  --fig-ink: var(--md-default-fg-color);
  --fig-muted: var(--md-default-fg-color--light);
  --fig-line: var(--md-default-fg-color--lighter);
  --fig-panel: var(--md-code-bg-color);
  --fig-teal: #00695c;
  --fig-teal-bg: #e0f2f1;
  --fig-orange: #c2410c;
  --fig-orange-bg: #fdece3;
  font-family: var(--md-text-font-family, system-ui, -apple-system, sans-serif);
}
[data-md-color-scheme="slate"] .md-typeset svg.figsvg {
  --fig-teal: #4db6ac;
  --fig-teal-bg: rgba(77, 182, 172, 0.16);
  --fig-orange: #fb923c;
  --fig-orange-bg: rgba(251, 146, 60, 0.16);
}
/* Tight, unfussy spacing for the inline-SVG figures: trim the default figure
   margins and keep the caption close to the graphic. Material sets
   `figure{width:fit-content}`, which makes a width:100% SVG shrink to its
   intrinsic size instead of filling the column; md_in_html also wraps the SVG in
   a <p>. Override both so the SVG figures span the full content width. */
.md-typeset figure:has(svg.figsvg) {
  width: 100%;
  margin: 0.6em auto;
}
.md-typeset figure:has(svg.figsvg) > p {
  margin: 0;
}
.md-typeset svg.figsvg {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
}
.md-typeset figure:has(svg.figsvg) figcaption {
  margin-top: 0.35em;
  max-width: 44rem;
  font-size: 0.8rem;
}

/* AI-assisted-content notice. A small "AI-assisted content" pill (javascripts/extra.js)
   sits to the right of each case-study chapter heading and opens a linkable pop-up note
   (#ai-note, a pure-CSS `:target` modal injected site-wide via overrides/main.html).
   Deep-link to `.../#ai-note` to open it; Escape / backdrop click close it. */
.md-typeset h1:has(.ai-pill) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.8rem;
}
.md-typeset h1 .ai-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.26rem 0.66rem;
  border-radius: 2rem;
  background: var(--md-primary-fg-color);
  color: #fff;
  font-weight: 700;
  font-size: 0.68rem;
  letter-spacing: 0.01em;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
}
/* Robot mark as a vector mask so it renders regardless of the page font (an emoji
   would fall back to nothing under self-hosted Poppins). Inherits the pill's text
   colour via currentColor. Icon: Material Design Icons "robot". */
.md-typeset h1 .ai-pill::before {
  content: "";
  width: 1.1em;
  height: 1.1em;
  flex: none;
  background-color: currentColor;
  -webkit-mask: var(--ai-robot) center / contain no-repeat;
  mask: var(--ai-robot) center / contain no-repeat;
  --ai-robot: url('data:image/svg+xml,%3Csvg%20xmlns="http://www.w3.org/2000/svg"%20viewBox="0%200%2024%2024"%3E%3Cpath%20fill="black"%20d="M12,2A2,2%200%200,1%2014,4C14,4.74%2013.6,5.39%2013,5.73V7H14A7,7%200%200,1%2021,14H22A1,1%200%200,1%2023,15V18A1,1%200%200,1%2022,19H21V20A2,2%200%200,1%2019,22H5A2,2%200%200,1%203,20V19H2A1,1%200%200,1%201,18V15A1,1%200%200,1%202,14H3A7,7%200%200,1%2010,7H11V5.73C10.4,5.39%2010,4.74%2010,4A2,2%200%200,1%2012,2M7.5,13A2.5,2.5%200%200,0%205,15.5A2.5,2.5%200%200,0%207.5,18A2.5,2.5%200%200,0%2010,15.5A2.5,2.5%200%200,0%207.5,13M16.5,13A2.5,2.5%200%200,0%2014,15.5A2.5,2.5%200%200,0%2016.5,18A2.5,2.5%200%200,0%2019,15.5A2.5,2.5%200%200,0%2016.5,13Z"/%3E%3C/svg%3E');
}
.ai-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.55);
  padding: 1rem;
}
.ai-modal:target {
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-modal-card {
  background: var(--md-default-bg-color);
  max-width: 42rem;
  width: 100%;
  max-height: 85vh;
  overflow: auto;
  padding: 1.4rem 1.7rem;
  border-radius: 0.3rem;
  border-left: 5px solid var(--md-primary-fg-color);
  box-shadow: 0 10px 44px rgba(0, 0, 0, 0.4);
}
.ai-modal-card > :first-child { margin-top: 0; }
.ai-modal-close {
  display: inline-block;
  margin-top: 1rem;
  font-weight: 700;
  text-decoration: none;
}

/* The depth tabs are the spine of the reading experience — make them prominent. */
.md-typeset .tabbed-set > .tabbed-labels > label {
  font-weight: 700;
}

/* A lightweight "choose your depth" hint banner on the overview. */
.depth-hint {
  border-left: 4px solid var(--md-primary-fg-color);
  padding: 0.6rem 1rem;
  background: var(--md-code-bg-color);
  border-radius: 0.2rem;
}
