/* =============================================================================
 * pccx — Furo theme overrides
 *
 * Design tenets:
 *   1. SVG diagrams rely on currentColor + CSS variables. Never hardcode
 *      colors here — use ``var(--color-...)`` tokens so dark/light just work.
 *   2. Keep typography tight and print-like; this is a reference manual.
 *   3. Custom tokens are prefixed ``--pccx-`` and are declared in conf_common.
 * ============================================================================= */

/* -- SVG: theme-aware text + lines ----------------------------------------- */
article svg {
  color: var(--color-foreground-primary);
}
article svg text,
article svg tspan {
  fill: currentColor;
}

/* -- Figures: subtler captions ---------------------------------------------- */
article figure figcaption,
article .plot-figcaption,
article .figure .caption {
  font-size: 0.9em;
  color: var(--color-foreground-secondary);
  line-height: 1.45;
  margin-top: 0.4em;
}

/* -- Admonitions used throughout (sphinx-design + built-in) ---------------- */
article .admonition.last-verified,
article .admonition.note {
  border-inline-start-width: 3px;
}

/* "Last verified against" marker block */
article .admonition.last-verified {
  border-color: var(--pccx-accent, #ff7a00);
  background: var(--color-background-secondary);
}

/* -- Code blocks: copy-button sizing + mono baseline ----------------------- */
article pre {
  font-feature-settings: "calt" 0;          /* stop "==" ligatures in diffs */
  line-height: 1.45;
}
article .copybtn {
  opacity: 0.5;
  transition: opacity 120ms ease-in-out;
}
article pre:hover .copybtn {
  opacity: 1;
}

/* -- Tables: pccx-style dense reference tables ----------------------------- */
article table.docutils {
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
article table.docutils th,
article table.docutils td {
  border-color: var(--pccx-muted-border, var(--color-foreground-border));
}
article table.docutils thead th {
  background: var(--color-background-secondary);
  font-weight: 600;
}

/* -- WaveDrom: tidy up the auto-generated SVG ------------------------------ */
article .wavedrom,
article svg.wavedrom-svg {
  max-width: 100%;
  height: auto;
}

/* -- Mermaid: match Furo's content width ----------------------------------- */
article div.mermaid {
  text-align: center;
  overflow-x: auto;
}
article div.mermaid svg {
  max-width: 100%;
  height: auto !important;
}

/* -- Sphinx-gallery thumbnails: tighten grid ------------------------------- */
article div.sphx-glr-thumbnails .sphx-glr-thumbcontainer {
  border: 1px solid var(--pccx-muted-border, var(--color-foreground-border));
  background: var(--color-background-primary);
  border-radius: 6px;
}
article div.sphx-glr-thumbnails .sphx-glr-thumbcontainer:hover {
  border-color: var(--color-brand-primary);
}

/* -- Announcement bar: single-line, cleaner padding ------------------------ */
.announcement {
  font-size: 0.85em;
  padding-block: 0.45em;
}
.announcement a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* -- Footer icons ---------------------------------------------------------- */
.footer-icons a:hover svg {
  fill: var(--color-brand-primary);
}

/* Labeled footer icons: GitHub / RTL repo / blog, each with a visible label
 * so readers can recognize the destination without hovering. The row wraps on
 * narrow viewports; icons inherit theme colors via currentColor. */
.footer-icons a.pccx-footer-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.2em 0.55em;
  border-radius: 6px;
  font-size: 0.9em;
  line-height: 1;
  color: var(--color-foreground-secondary);
  transition:
    background-color 120ms ease-in-out,
    color            120ms ease-in-out;
}
.footer-icons a.pccx-footer-icon:hover,
.footer-icons a.pccx-footer-icon:focus-visible {
  background-color: var(--color-background-hover);
  color: var(--color-brand-primary);
}
.footer-icons a.pccx-footer-icon svg {
  flex: 0 0 auto;
  width: 1.1em;
  height: 1.1em;
}
.footer-icons a.pccx-footer-icon:hover svg {
  color: var(--color-brand-primary);
  fill: var(--color-brand-primary);
}
.pccx-footer-icon__label {
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* -- Sidebar repo-link pill row -------------------------------------------- */
/* Sits directly below `.pccx-langswitch` in the sidebar; echoes the footer
 * funnel so readers can jump to the implementation repo / author portfolio
 * from any page, not just the landing. */
.pccx-repolinks {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.9rem;
  padding: 0 0.25rem;
}
.pccx-repolinks__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 0.22em 0.6em;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1;
  color: var(--color-foreground-secondary);
  background: var(--color-background-secondary);
  border: 1px solid var(--color-background-border);
  border-radius: 999px;
  text-decoration: none !important;
  transition:
    background-color 120ms ease-in-out,
    border-color     120ms ease-in-out,
    color            120ms ease-in-out;
}
.pccx-repolinks__btn:hover,
.pccx-repolinks__btn:focus-visible {
  color: var(--color-brand-primary);
  background: var(--color-background-hover);
  border-color: var(--color-brand-primary);
}
.pccx-repolinks__btn svg {
  flex: 0 0 auto;
  width: 0.95em;
  height: 0.95em;
}
.pccx-repolinks__label {
  letter-spacing: 0.02em;
}
@media (max-width: 67em) {
  .pccx-repolinks {
    font-size: 0.85rem;
  }
}

/* -- Landing CTA grids — unified rhythm for Ecosystem + Tooling sections --- */
/* Both landing grids live under their own H2 sections, so no extra top
 * margin is needed — let Furo's section spacing handle the vertical rhythm.
 * The two grids share identical card dimensions and typography so the page
 * reads as two parallel blocks rather than two different widgets. */
article .pccx-ecosystem-grid,
article .pccx-toolchain-grid {
  margin-top: 0.5rem;
}
article .pccx-ecosystem-grid .sd-card-title,
article .pccx-toolchain-grid .sd-card-title {
  font-size: 1.05em;
  font-weight: 700;
  line-height: 1.3;
}
/* Hero card: Implementation RTL — primary accent (brand blue). */
article .pccx-hero-card {
  border-left: 3px solid var(--color-brand-primary);
  background: linear-gradient(
    135deg,
    var(--color-background-secondary) 0%,
    var(--color-background-primary) 65%
  );
}
article .pccx-hero-card .sd-card-title {
  font-size: 1.15em;    /* slightly larger than peers to signal primary CTA */
}
article .pccx-hero-card .sd-card-title svg {
  color: var(--color-brand-primary);
  vertical-align: -0.15em;
}
/* Lab card: pccx-lab — secondary accent (brand orange). */
article .pccx-lab-card {
  border-left: 3px solid var(--pccx-accent, #ff7a00);
}
article .pccx-lab-card .sd-card-title svg {
  color: var(--pccx-accent, #ff7a00);
  vertical-align: -0.15em;
}

/* -- rtl_source admonition (injected by _ext/rtl_source.py) ---------------- */
article .admonition.pccx-rtl-source {
  border-inline-start-width: 3px;
  border-inline-start-color: var(--color-brand-primary);
  background: var(--color-background-secondary);
  margin-top: 0;
  margin-bottom: 1.5rem;
}
article .admonition.pccx-rtl-source > .admonition-title {
  background: transparent;
  color: var(--color-brand-primary);
  font-weight: 600;
}
article .admonition.pccx-rtl-source > .admonition-title::before {
  /* Drop the default note-bell icon; our own title text is self-describing. */
  content: none;
}
article .admonition.pccx-rtl-source p {
  margin: 0.35em 0;
}
article .admonition.pccx-rtl-source .pccx-rtl-source__cta {
  margin-top: 0.5em;
}
article .admonition.pccx-rtl-source a.pccx-rtl-source__link {
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 120ms ease-in-out;
}
article .admonition.pccx-rtl-source a.pccx-rtl-source__link:hover {
  border-bottom-color: var(--color-brand-primary);
}
article .admonition.pccx-rtl-source ul.pccx-rtl-source__list {
  margin: 0.25em 0 0;
  padding-inline-start: 1.2em;
}
article .admonition.pccx-rtl-source ul.pccx-rtl-source__list li {
  margin: 0.15em 0;
}

/* -- Print ----------------------------------------------------------------- */
@media print {
  .sidebar-drawer,
  .toc-drawer,
  .mobile-header,
  .edit-this-page,
  .announcement {
    display: none !important;
  }
  article {
    max-width: 100%;
  }
}
