/* goxpyriment docs — presentational tweaks only (no content). */

/* ---------- Palette: light, high-contrast (MNE-like) ----------
   White header with dark text; one blue for links/accents. All text/background
   pairs are >= 4.5:1 contrast (WCAG AA). */
[data-md-color-scheme="default"] {
  --gx-blue: #1f5fbf;
  --gx-blue-soft: #eef4fc;
  --gx-ink: #1b2330;
  --gx-card-bg: #ffffff;
  --gx-card-border: #dde3ea;
  --gx-card-shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --gx-card-shadow-hover: 0 8px 20px rgba(16, 24, 40, .10);
  --gx-hero-bg: linear-gradient(180deg, #f3f7fc 0%, #ffffff 100%);

  --md-primary-fg-color: #ffffff;        /* header / tabs background */
  --md-primary-fg-color--light: #f3f7fc;
  --md-primary-fg-color--dark: #e6edf6;
  --md-primary-bg-color: var(--gx-ink);  /* text on header / tabs */
  --md-primary-bg-color--light: rgba(27, 35, 48, .7);
  --md-accent-fg-color: #174a96;
  --md-typeset-a-color: var(--gx-blue);
}

[data-md-color-scheme="slate"] {
  --gx-blue: #7ab3ff;
  --gx-blue-soft: rgba(122, 179, 255, .12);
  --gx-ink: #e8edf4;
  --gx-card-bg: #1d2230;
  --gx-card-border: #2e3548;
  --gx-card-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --gx-card-shadow-hover: 0 8px 20px rgba(0, 0, 0, .45);
  --gx-hero-bg: linear-gradient(180deg, #1a2030 0%, #151923 100%);

  --md-default-bg-color: #151923;
  --md-primary-fg-color: #1a1f2c;
  --md-primary-fg-color--light: #232a3a;
  --md-primary-fg-color--dark: #121620;
  --md-primary-bg-color: var(--gx-ink);
  --md-primary-bg-color--light: rgba(232, 237, 244, .7);
  --md-accent-fg-color: #a8ccff;
  --md-typeset-a-color: var(--gx-blue);
}

/* ---------- Header & tabs ---------- */
.md-header {
  border-bottom: 1px solid var(--gx-card-border);
  box-shadow: none;
}
.md-header[data-md-state="shadow"],
.md-header--shadow {
  box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
}
.md-tabs {
  border-bottom: 1px solid var(--gx-card-border);
}
.md-tabs__link {
  font-weight: 500;
  opacity: .75;
}
.md-tabs__item--active .md-tabs__link,
.md-tabs__link:hover {
  opacity: 1;
  color: var(--gx-blue);
}
.md-search__input {
  background: var(--gx-blue-soft);
  color: var(--gx-ink);
}

/* ---------- Typography ---------- */
.md-typeset h1 {
  font-weight: 700;
  color: var(--md-default-fg-color);
  letter-spacing: -.01em;
}
.md-typeset h2 {
  font-weight: 650;
  padding-bottom: .3em;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
}
.md-typeset hr {
  border-bottom-color: var(--md-default-fg-color--lightest);
}

/* ---------- Code, tables, admonitions ---------- */
.md-typeset pre > code {
  border-radius: 8px;
}
.md-typeset :not(pre) > code {
  border-radius: 4px;
}
.md-typeset table:not([class]) {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--gx-card-border);
  box-shadow: none;
}
.md-typeset table:not([class]) th {
  background: var(--gx-blue-soft);
}
.md-typeset .admonition,
.md-typeset details {
  border-radius: 8px;
}

/* ---------- Landing hero ---------- */
.gx-hero {
  background: var(--gx-hero-bg);
  color: var(--gx-ink);
}
.gx-hero__inner {
  display: flex;
  align-items: center;
  gap: 2.4rem;
  padding: 2.6rem .8rem 2.4rem;
}
.gx-hero__logo {
  width: 7rem;
  height: 7rem;
  border-radius: 22%;
  box-shadow: 0 6px 18px rgba(16, 24, 40, .15);
  flex-shrink: 0;
}
.gx-hero__title {
  margin: 0;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.1;
}
.gx-hero__tagline {
  margin: .5rem 0 1.4rem;
  font-size: 1.05rem;
  max-width: 34rem;
  opacity: .8;
}
.gx-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}
.gx-btn {
  display: inline-block;
  padding: .55rem 1.2rem;
  border-radius: 999px;
  border: 1.5px solid var(--gx-card-border);
  background: var(--gx-card-bg);
  color: var(--gx-ink);
  font-weight: 600;
  font-size: .8rem;
  transition: border-color .15s, color .15s, transform .15s;
}
.gx-btn:hover,
.gx-btn:focus {
  color: var(--gx-blue);
  border-color: var(--gx-blue);
  transform: translateY(-1px);
}
.gx-btn--primary {
  background: var(--gx-blue);
  border-color: var(--gx-blue);
  color: #ffffff;
}
.gx-btn--primary:hover,
.gx-btn--primary:focus {
  background: #174a96;
  border-color: #174a96;
  color: #ffffff;
}
[data-md-color-scheme="slate"] .gx-btn--primary,
[data-md-color-scheme="slate"] .gx-btn--primary:hover {
  color: #0d1420;
}

/* ---------- Landing cards ---------- */
.gx-cards-wrap {
  padding-bottom: 1rem;
}
.gx-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 1rem;
  padding: 0 .8rem;
}
.gx-card {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: 1.1rem 1.2rem 1.2rem;
  background: var(--gx-card-bg);
  border: 1px solid var(--gx-card-border);
  border-top: 3px solid var(--gx-blue);
  border-radius: 10px;
  box-shadow: var(--gx-card-shadow);
  color: var(--md-default-fg-color);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.gx-card:hover,
.gx-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--gx-blue);
  box-shadow: var(--gx-card-shadow-hover);
  color: var(--md-default-fg-color);
}
.gx-card__icon {
  display: inline-flex;
  width: 2.2rem;
  height: 2.2rem;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--gx-blue-soft);
  margin-bottom: .3rem;
}
.gx-card__icon svg {
  width: 1.3rem;
  height: 1.3rem;
  fill: var(--md-typeset-a-color);
}
.gx-card__title {
  font-weight: 700;
  font-size: .9rem;
}
.gx-card__text {
  font-size: .72rem;
  line-height: 1.5;
  color: var(--md-default-fg-color--light);
}

/* On the home page the left nav only lists "Home"; hide it on wide screens
   so the landing reads as a single column (it stays in the mobile drawer). */
@media screen and (min-width: 76.25em) {
  .md-container:has(.gx-hero) .md-sidebar--primary {
    display: none;
  }
}

@media screen and (max-width: 44.9375em) {
  .gx-hero__inner {
    flex-direction: column;
    text-align: center;
    gap: 1.2rem;
    padding: 2rem 1rem 2.8rem;
  }
  .gx-hero__logo {
    width: 5.5rem;
    height: 5.5rem;
  }
  .gx-hero__title {
    font-size: 1.9rem;
  }
  .gx-hero__actions {
    justify-content: center;
  }
  .gx-cards {
    padding: 0 .4rem;
  }
}

/* Home page: present the index.md text as one large card matching the tiles. */
.md-container:has(.gx-hero) .md-content__inner {
  background: var(--gx-card-bg);
  border: 1px solid var(--gx-card-border);
  border-top: 3px solid var(--gx-blue);
  border-radius: 10px;
  box-shadow: var(--gx-card-shadow);
  padding: 1.2rem 1.6rem 1.6rem;
  margin: 0 .8rem 1.2rem;
}
.md-container:has(.gx-hero) .md-content__inner::before {
  display: none; /* drop Material's top spacer inside the card */
}
.md-container:has(.gx-hero) .md-content__inner > h1:first-child {
  margin-top: 0;
}
@media screen and (max-width: 44.9375em) {
  .md-container:has(.gx-hero) .md-content__inner {
    margin: 0 .4rem 1rem;
    padding: 1rem 1rem 1.2rem;
  }
}

/* Home page: the index.md text lives behind the "About goxpyriment" card.
   Hidden by default; shown when #gx-about (or any heading inside it, e.g. a
   search result) is the URL target. */
.md-container:has(.gx-hero) .md-content__inner:not(:has(.gx-about--open, .gx-about:target, .gx-about :target)) {
  display: none;
}
.md-container:has(.gx-hero) .md-sidebar--secondary {
  display: none;
}
.md-container:has(.gx-hero) .md-content__inner {
  scroll-margin-top: 5rem;
}
.gx-about {
  scroll-margin-top: 6rem;
}
.gx-about__close {
  float: right;
  font-size: .75rem;
  font-weight: 600;
  padding: .2rem .7rem;
  border: 1px solid var(--gx-card-border);
  border-radius: 999px;
  color: var(--md-default-fg-color--light);
}
.gx-about__close:hover {
  color: var(--gx-blue);
  border-color: var(--gx-blue);
}

/* ---------- Gallery page: generated tables rendered as a card grid ----------
   docs/GalleryOfExamples.md is generated (cmd/gen-gallery) as 3-column Markdown
   tables; here each non-empty cell becomes a card in a responsive grid. */
.gx-gallery .md-typeset__scrollwrap,
.gx-gallery .md-typeset__table {
  display: block;
  margin: 0;
  overflow: visible;
}
.gx-gallery table,
.gx-gallery table:not([class]) {
  display: block;
  width: 100%;
  max-width: none;
  border: none;
  box-shadow: none;
  background: none;
  overflow: visible;
  font-size: inherit;
  margin: 1rem 0 1.6rem;
}
.gx-gallery table thead {
  display: none;
}
.gx-gallery table tbody {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr));
  gap: 1rem;
}
.gx-gallery table tr {
  display: contents;
}
.gx-gallery table td,
.gx-gallery table:not([class]) td {
  display: block;
  position: relative;
  text-align: left !important; /* generated cells are center-aligned inline */
  vertical-align: top;
  padding: 1rem 1.1rem 3.2rem; /* room for the pinned "Run in browser" button */
  font-size: .72rem;
  line-height: 1.55;
  color: var(--md-default-fg-color--light);
  background: var(--gx-card-bg);
  border: 1px solid var(--gx-card-border) !important;
  border-top: 3px solid var(--gx-blue) !important;
  border-radius: 10px;
  box-shadow: var(--gx-card-shadow);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.gx-gallery table td:hover {
  transform: translateY(-2px);
  box-shadow: var(--gx-card-shadow-hover);
}
.gx-gallery table td:empty,
.gx-gallery table td[hidden] {
  display: none;
}
.gx-gallery table tr:hover {
  background: none;
  box-shadow: none;
}
/* Title (bold link) */
.gx-gallery table td > strong {
  display: block;
  font-size: .9rem;
  line-height: 1.3;
  word-break: break-word;
}
.gx-gallery table td > strong a {
  color: var(--md-default-fg-color);
}
.gx-gallery table td > strong a:hover {
  color: var(--gx-blue);
}
/* Reference */
.gx-gallery table td > em {
  display: inline-block;
  margin-top: .1rem;
  padding: .05rem .5rem;
  border-radius: 4px;
  background: var(--gx-blue-soft);
  color: var(--md-default-fg-color--light);
  font-size: .66rem;
}
/* "▶ Run in browser" link → small button pinned to the card bottom */
.gx-gallery table td > a {
  position: absolute;
  left: 1.1rem;
  bottom: .9rem;
  padding: .2rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--gx-blue);
  color: var(--gx-blue);
  font-weight: 600;
  font-size: .68rem;
}
.gx-gallery table td > a:hover {
  background: var(--gx-blue);
  color: #fff;
}
[data-md-color-scheme="slate"] .gx-gallery table td > a:hover {
  color: #0d1420;
}
/* Cards without a Run button don't need the bottom padding. */
.gx-gallery table td:not(:has(> a)) {
  padding-bottom: 1rem;
}

/* Filter box */
.gx-filter {
  position: sticky;
  top: 3.4rem;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0 0 1rem;
  padding: .5rem .9rem;
  background: var(--gx-card-bg);
  border: 1px solid var(--gx-card-border);
  border-radius: 999px;
  box-shadow: var(--gx-card-shadow);
}
.gx-filter:focus-within {
  border-color: var(--gx-blue);
}
.gx-filter__icon svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: var(--md-default-fg-color--light);
  display: block;
}
.gx-filter__input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--md-default-fg-color);
  font: inherit;
  font-size: .8rem;
}
.gx-filter__count {
  font-size: .7rem;
  color: var(--md-default-fg-color--light);
  white-space: nowrap;
}

/* Gallery refinements: tighten the <br><br> spacing of generated cells. */
.gx-gallery .md-typeset__table {
  padding: 0;
}
.gx-gallery table td > br {
  display: none;
}
.gx-gallery table td > strong {
  margin-bottom: .45rem;
}
.gx-gallery table td > em {
  display: table; /* own line, shrink-wrapped */
  margin-top: .6rem;
}
.gx-gallery table td a {
  text-decoration: none;
}
/* The Gallery section's left nav only repeats its two tab entries; give the
   grid the room instead on wide screens. */
@media screen and (min-width: 76.25em) {
  .md-container:has(.gx-gallery) .md-sidebar--primary {
    display: none;
  }
}

/* Gallery: homogeneous card heights. Titles ≤ 2 lines, descriptions ≤ 3 lines
   (click to expand; full text in the tooltip), references ≤ 1 line. */
.gx-gallery table td > strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.gx-gallery .gx-desc {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  cursor: pointer;
}
.gx-gallery .gx-desc--open {
  -webkit-line-clamp: unset;
  display: block;
}
.gx-gallery table td > em {
  display: block;
  max-width: 100%;
  width: fit-content;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}
/* Same height whether the title takes one line or two (Run button is pinned
   to the bottom, so shorter cards just gain a little air above it). */
.gx-gallery table td {
  min-height: 13.25rem;
}

/* ======================================================================
   Readability (site-wide)
   ====================================================================== */

/* Quote blocks — used throughout the docs for tips and notes — as callouts. */
.md-typeset blockquote {
  margin: 1.2em 0;
  padding: .7em 1em .7em 1.1em;
  border-left: 4px solid var(--gx-blue);
  border-radius: 0 8px 8px 0;
  background: var(--gx-blue-soft);
  color: var(--md-default-fg-color);
}
.md-typeset blockquote > :first-child {
  margin-top: 0;
}
.md-typeset blockquote > :last-child {
  margin-bottom: 0;
}
.md-typeset blockquote strong:first-child {
  color: var(--gx-blue);
}

/* Body text: slightly larger, more line spacing, comfortable line length. */
.md-typeset {
  font-size: .82rem;
  line-height: 1.7;
}
.md-typeset p,
.md-typeset ul,
.md-typeset ol {
  max-width: 44rem;
}
.md-typeset h2 {
  margin-top: 2.2em;
}
.md-typeset h3 {
  margin-top: 1.8em;
  font-weight: 650;
}
.md-typeset li {
  margin-bottom: .3em;
}

/* Table of contents: small uppercase label, clear active entry. */
.md-nav--secondary > .md-nav__title {
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--md-default-fg-color--light);
}
.md-nav--secondary .md-nav__link--active {
  color: var(--gx-blue);
  font-weight: 600;
}

/* Left navigation: section headings (e.g. the Misc groups) read as labels. */
.md-nav--primary .md-nav__item--section > .md-nav__link,
.md-nav--primary .md-nav__item--nested > .md-nav__link {
  font-weight: 600;
  color: var(--md-default-fg-color);
}
.md-nav__link--active {
  font-weight: 600;
}

/* Breadcrumbs above the page title. */
.md-path {
  font-size: .68rem;
}

/* ======================================================================
   Footer: light, matching the header
   ====================================================================== */
.md-footer {
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
  border-top: 1px solid var(--gx-card-border);
}
.md-footer__link {
  opacity: 1;
}
.md-footer__link:hover .md-footer__title,
.md-footer__link:focus .md-footer__title {
  color: var(--gx-blue);
}
.md-footer__direction {
  color: var(--md-default-fg-color--light);
}
.md-footer-meta {
  background: var(--gx-blue-soft);
  color: var(--md-default-fg-color--light);
}
.md-footer-meta.md-typeset a,
.md-footer-meta .md-copyright a {
  color: var(--gx-blue);
}
.md-social__link svg {
  fill: var(--md-default-fg-color--light);
}
.md-social__link:hover svg {
  fill: var(--gx-blue);
}

/* Pages that are a top-level tab on their own (User Manual, API) or not in
   the nav at all have nothing to list in the left sidebar; drop the empty
   column on wide screens so the text uses the space. (Mobile keeps the
   drawer, which holds the full navigation.) */
@media screen and (min-width: 76.25em) {
  .md-main__inner:not(:has(.md-nav--primary .md-nav__item--active.md-nav__item--nested)) .md-sidebar--primary {
    display: none;
  }
}

/* "## Table of Contents" followed by a numbered list (User Manual): two
   columns with round number badges. The Markdown is unchanged. */
.md-typeset h2#table-of-contents + ol {
  columns: 2;
  column-gap: 2.4rem;
  list-style: none;
  counter-reset: gx-toc;
  margin-left: 0;
  padding-left: 0;
  max-width: none;
}
.md-typeset h2#table-of-contents + ol > li {
  counter-increment: gx-toc;
  break-inside: avoid;
  position: relative;
  margin: 0 0 .55em;
  padding-left: 2.1em;
  line-height: 1.45;
}
.md-typeset h2#table-of-contents + ol > li::before {
  content: counter(gx-toc);
  position: absolute;
  left: 0;
  top: .05em;
  width: 1.55em;
  height: 1.55em;
  border-radius: 50%;
  background: var(--gx-blue-soft);
  color: var(--gx-blue);
  font-size: .8em;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.md-typeset h2#table-of-contents + ol > li > a {
  font-weight: 600;
  text-decoration: none;
}
.md-typeset h2#table-of-contents + ol > li > a:hover {
  text-decoration: underline;
}
@media screen and (max-width: 44.9375em) {
  .md-typeset h2#table-of-contents + ol {
    columns: 1;
  }
}
