/* =============================================================================
   guyhui-showcase — design tokens & components
   Source of truth: DESIGN.md (repository root). Keep the two in sync.

   Principles:
   - Self-hosted fonts only (no Google Fonts CDN — GDPR).
   - Neutral base = slate; a single custom indigo accent.
   - Green / red are RESERVED for pass/fail proof semantics — never decorative.
   - JetBrains Mono carries the textual proof artifacts: versions, JSON, tags.
     Verdict marks (✓ / ✗) are carried by colour, not by the display face — see
     the `.gh-pass` / `.gh-fail` rules below.
   ========================================================================== */

/* --- Self-hosted fonts (woff2, latin subset) ------------------------------ */

@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/inter-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2");
}

/* --- Font wiring ----------------------------------------------------------- */

:root {
  --md-text-font: "Inter";
  --md-code-font: "JetBrains Mono";

  /* Custom design tokens (site-local, not Material's) */
  --gh-font-display: "IBM Plex Sans", "Inter", system-ui, sans-serif;

  /* Slate scale */
  --gh-slate-50:  #f8fafc;
  --gh-slate-100: #f1f5f9;
  --gh-slate-200: #e2e8f0;
  --gh-slate-300: #cbd5e1;
  --gh-slate-400: #94a3b8;
  --gh-slate-500: #64748b;
  --gh-slate-600: #475569;
  --gh-slate-700: #334155;
  --gh-slate-800: #1e293b;
  --gh-slate-900: #0f172a;
  --gh-slate-950: #020617;

  /* Accent — single custom indigo */
  --gh-indigo:       #4f46e5;
  --gh-indigo-light: #6366f1;
  --gh-indigo-dark:  #4338ca;

  /* Proof semantics — RESERVED.
     Light-scheme pass is green-700, not green-600: on the `.gh-proof` surface
     (--gh-slate-50) green-600 lands at 3.15:1, below the AA 4.5:1 text target. */
  --gh-pass: #15803d;
  --gh-fail: #dc2626;
  --gh-pass-light: #4ade80;
  --gh-fail-light: #f87171;
}

/* Headings use the display face; body stays on Inter. */
.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4,
.md-header__title,
.md-nav__title {
  font-family: var(--gh-font-display);
  font-weight: 700;
  letter-spacing: -0.015em;
}

/* --- Colour scheme: light (default) --------------------------------------- */

[data-md-color-scheme="default"] {
  --md-primary-fg-color:        var(--gh-slate-900);
  --md-primary-fg-color--light: var(--gh-slate-700);
  --md-primary-fg-color--dark:  var(--gh-slate-950);
  --md-primary-bg-color:        #ffffff;
  --md-primary-bg-color--light: rgba(255, 255, 255, 0.7);

  --md-accent-fg-color:         var(--gh-indigo);
  --md-accent-fg-color--transparent: rgba(79, 70, 229, 0.1);

  --md-typeset-a-color:         var(--gh-indigo);

  --md-default-bg-color:        #ffffff;
  --md-default-fg-color:        var(--gh-slate-800);
  --md-default-fg-color--light: var(--gh-slate-600);
  --md-default-fg-color--lighter: var(--gh-slate-400);

  --md-code-bg-color:           var(--gh-slate-100);
  --md-code-fg-color:           var(--gh-slate-800);
}

/* --- Colour scheme: dark (slate) ------------------------------------------ */

[data-md-color-scheme="slate"] {
  --md-hue: 222;

  --md-primary-fg-color:        var(--gh-slate-950);
  --md-primary-fg-color--light: var(--gh-slate-800);
  --md-primary-fg-color--dark:  #000000;
  --md-primary-bg-color:        var(--gh-slate-100);

  --md-accent-fg-color:         var(--gh-indigo-light);

  --md-typeset-a-color:         #a5b4fc;

  --md-default-bg-color:        var(--gh-slate-900);
  --md-default-fg-color:        var(--gh-slate-200);
  --md-default-fg-color--light: var(--gh-slate-400);
  --md-default-fg-color--lighter: var(--gh-slate-500);

  --md-code-bg-color:           var(--gh-slate-800);
  --md-code-fg-color:           var(--gh-slate-200);
}

/* =============================================================================
   Hero
   ========================================================================== */

.gh-hero {
  padding: 0.5rem 0 1.5rem;
}

.gh-hero .md-typeset h1,
.md-typeset .gh-hero h1 {
  font-size: 2rem;
  line-height: 1.1;
  margin: 0 0 0.6rem;
  color: var(--md-default-fg-color);
}

.gh-hero p {
  font-size: 0.95rem;
  color: var(--md-default-fg-color--light);
  max-width: 42rem;
  margin: 0 0 1.4rem;
}

.gh-hero .md-button {
  margin: 0 0.5rem 0.5rem 0;
}

/* Dark mode: invert the primary button (light fill, dark text) so the CTA
   stays high-contrast — the header keeps its own dark --md-primary-fg-color. */
[data-md-color-scheme="slate"] .md-typeset .md-button--primary {
  background-color: var(--gh-slate-100);
  border-color: var(--gh-slate-100);
  color: var(--gh-slate-900);
}
[data-md-color-scheme="slate"] .md-typeset .md-button--primary:hover,
[data-md-color-scheme="slate"] .md-typeset .md-button--primary:focus {
  background-color: #ffffff;
  border-color: #ffffff;
  color: var(--gh-slate-950);
}

/* Secondary action — quiet link, not a competing button. */
.gh-hero .gh-link {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.35rem 0;
  font-weight: 600;
  color: var(--md-default-fg-color--light);
}
.gh-hero .gh-link:hover {
  color: var(--md-accent-fg-color);
}

@media screen and (min-width: 45rem) {
  /* Align the hero title's cap-height with the side rails (Home nav + TOC):
     Material's residual content top spacing (.6rem padding + .4rem :before)
     lands the caps at ~1.25rem, level with the rail labels at ~1.35rem. */
  .gh-hero {
    padding: 0 0 2rem;
  }
  .gh-hero .md-typeset h1,
  .md-typeset .gh-hero h1 {
    font-size: 2.75rem;
  }
  .gh-hero p {
    font-size: 1.05rem;
  }
}

/* =============================================================================
   Stat strip — four proof figures, in mono
   ========================================================================== */

.gh-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 0 0 2rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--md-default-fg-color--lighter);
  border-bottom: 1px solid var(--md-default-fg-color--lighter);
}

.gh-stat {
  text-align: center;
}

.gh-stat__num {
  display: block;
  font-family: var(--md-code-font), monospace;
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--gh-indigo);
}

[data-md-color-scheme="slate"] .gh-stat__num {
  color: var(--gh-indigo-light);
}

.gh-stat__label {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--md-default-fg-color--light);
}

@media screen and (min-width: 45rem) {
  .gh-stats {
    grid-template-columns: repeat(4, 1fr);
  }
  .gh-stat__num {
    font-size: 2.25rem;
  }
}

/* =============================================================================
   Proof verdicts — reserved green / red
   ========================================================================== */

/* The verdict marks (U+2713 / U+2717) are absent from all three self-hosted
   latin subsets, JetBrains Mono included. The declared stack therefore resolves
   to the generic `monospace` family, which does carry them; the exact face is
   the platform's (Menlo on macOS). Colour, not typeface, is what encodes the
   verdict. Do not "fix" this by dropping the stack — that only moves the
   fallback to the body face and changes a rendering already validated. */
.gh-pass,
.gh-fail {
  font-family: var(--md-code-font), monospace;
  font-weight: 700;
}
.gh-pass { color: var(--gh-pass); }
.gh-fail { color: var(--gh-fail); }

/* Dark mode: lift the verdict colours to match the lightened indigo accent. */
[data-md-color-scheme="slate"] .gh-pass { color: var(--gh-pass-light); }
[data-md-color-scheme="slate"] .gh-fail { color: var(--gh-fail-light); }

/* Proof card — neutral surface; green lives only on the ✓ verdicts. */
.gh-proof {
  margin: 1.5rem 0 2rem;
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 0.5rem;
  background: var(--gh-slate-50);
}
[data-md-color-scheme="slate"] .gh-proof {
  background: var(--gh-slate-800);
}
.gh-proof > :first-child { margin-top: 0; }
.gh-proof > :last-child { margin-bottom: 0; }
.gh-proof .gh-proof__label {
  display: block;
  margin-bottom: 0.6rem;
  font-family: var(--md-code-font), monospace;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--md-default-fg-color--light);
}
.md-typeset .gh-proof ul {
  list-style: none;
  margin-left: 0;
}
.md-typeset .gh-proof ul li {
  margin-left: 0;
}

/* =============================================================================
   Mermaid — vertical stacking on very narrow viewports
   ========================================================================== */

/* Two diagram orientations: horizontal on wide screens, vertical (stacked,
   full-width boxes, readable text) on narrow ones. Mermaid renders to a fixed
   SVG and does not reflow, so we ship both and toggle by viewport. */
.gh-narrow-only {
  display: none;
}

/* Centre the rendered SVG in its container (both orientations). */
.mermaid {
  text-align: center;
}
.md-typeset .mermaid svg {
  display: block;
  margin-inline: auto;
}

@media screen and (max-width: 30rem) {
  .mermaid svg {
    max-width: 100%;
    height: auto;
  }
  .gh-wide-only {
    display: none;
  }
  .gh-narrow-only {
    display: block;
  }
}
