/* ---------- Landing page ---------- */

/* Screenshot / animation frames */
.sps-shot {
  border-radius: 0.5rem;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  border: 1px solid var(--md-default-fg-color--lightest);
}

/* Caption under a .sps-shot figure */
.md-typeset .sps-caption {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  text-align: center;
  color: var(--md-default-fg-color--light);
}

/* Card title icons pick up the brand color */
.md-typeset .grid.cards > ul > li > p:first-child .twemoji {
  color: var(--md-primary-fg-color);
}

/* ---------- Figures built at docs-build time ----------
   `docs_support.embed` + javascripts/figures.js: the figure renders at its
   own pixel size inside `.sps-plot-stage` and is scaled to the column as one
   block, so the host reserves its aspect ratio until then. */

.md-typeset .sps-figure {
  margin: 1.2em 0;
}

.md-typeset .sps-plot {
  position: relative;
  width: 100%;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 0.4rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  /* The figures carry the stimulus page's own white background. */
  background: #fff;
}

.md-typeset .sps-plot-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}

.md-typeset .sps-plot[data-state="error"]::after {
  content: "This figure could not be drawn — try reloading the page.";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #555;
  font-size: 0.75rem;
}

/* A legend drawn under a figure from the app's own colours. */
.md-typeset .sps-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1rem;
  margin: 0.5rem 0 0;
  font-size: 0.7rem;
}

.md-typeset .sps-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.md-typeset .sps-swatch {
  width: 1.2rem;
  height: 0.25rem;
  border-radius: 0.1rem;
}

/* A figure's code sits right under it, as its caption would. */
.md-typeset .sps-figure + .highlight,
.md-typeset .sps-figure + div > .highlight {
  margin-top: 0.4em;
}

/* ---------- Generated reference tables ---------- */

/* The reference tables span the column, so the description gets the room
   the names leave; Material would otherwise size them to their content and
   scroll them sideways. */
.md-typeset .sps-reference-table table:not([class]) {
  display: table;
  width: 100%;
}

/* An option name or flag is one token: never break it. Its cell is the
   first; the CLI tables' second (the value) may wrap. */
.md-typeset .sps-reference-table td:first-child {
  white-space: nowrap;
  width: 1%;
}

/* A default such as `('order_in_trial', 'duration_ms')` wraps anywhere. */
.md-typeset .sps-option-table td:nth-child(2) code {
  overflow-wrap: anywhere;
}

/* The `render` flag under an option's name, as its secondary label. */
.md-typeset .sps-option-table td:first-child br + code,
.md-typeset .sps-option-table td:first-child br ~ code {
  color: var(--md-default-fg-color--light);
  background: none;
  padding-left: 0;
}

/* A flag such as `--trial-metadata-participant-column` is too long to keep
   whole, so the CLI tables break flags and values at their hyphens and
   spaces only, never mid-word. */
.md-typeset .sps-flag-table td:first-child {
  white-space: normal;
  width: 28%;
}

.md-typeset .sps-flag-table td:nth-child(-n + 2) code {
  word-break: normal;
  overflow-wrap: normal;
}

.md-typeset .sps-flag-table td:nth-child(2) {
  width: 16%;
}

/* A metavar such as `KIND=POSITION[,...]` has no hyphen to break at. */
.md-typeset .sps-flag-table td:nth-child(2) code {
  overflow-wrap: anywhere;
}

/* The API index: a section's row heads the functions under it. */
.md-typeset .sps-api-index tr:has(td:empty) td {
  background: var(--sps-surface-alt);
  padding-top: 0.5em;
  padding-bottom: 0.5em;
}

/* ---------- Home page recording ---------- */

.md-typeset video.sps-shot {
  display: block;
  width: 100%;
  height: auto;
}

/* ---------- Annotated screenshots ---------- */

.md-typeset figure.sps-screenshot {
  margin: 1.2em 0;
}

.md-typeset figure.sps-screenshot img {
  border-radius: 0.4rem;
  border: 1px solid var(--md-default-fg-color--lightest);
}

/* The app's icons: a page writes `:material/database:`, the docs hook
   turns it into a span, and this draws the glyph from the Material Symbols font
   Streamlit ships (copied into the site by the hook) — the same one the app uses. */
@font-face {
  font-family: "Material Symbols Rounded";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("../assets/fonts/material-symbols-rounded.woff2") format("woff2");
}

.md-typeset .sps-icon::before {
  content: attr(data-icon);
  font-family: "Material Symbols Rounded";
  font-weight: normal;
  font-style: normal;
  font-size: 1.15em;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  white-space: nowrap;
  direction: ltr;
  font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
}

.md-typeset .sps-icon {
  display: inline-block;
  vertical-align: -0.2em;
  margin-right: 0.15em;
  user-select: none;
}

/* All controls: each section's menu, as it opens in the app, behind a small
   button beside the section's title (javascripts/controls.js). Without
   JavaScript the picture is shown under the title instead. */
.md-typeset .sps-ctl {
  display: block;
  width: fit-content;
  margin: 0.8rem auto 1rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.4rem;
  overflow: hidden;
}
.md-typeset .sps-ctl img { display: block; max-width: 100%; max-height: 26rem; }
.md-typeset .sps-shot-btn {
  margin-left: 0.6rem;
  padding: 0.1rem 0.55rem;
  border: 1px solid var(--md-default-fg-color--lighter);
  border-radius: 1rem;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color--light);
  font-size: 0.65rem;
  font-weight: 400;
  letter-spacing: normal;
  vertical-align: middle;
  cursor: pointer;
}
.md-typeset .sps-shot-btn:hover,
.md-typeset .sps-shot-btn[aria-expanded="true"] {
  border-color: var(--md-accent-fg-color);
  color: var(--md-accent-fg-color);
}
.sps-shot-pop {
  position: absolute;
  z-index: 5;
  padding: 0.4rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.5rem;
  background: var(--md-default-bg-color);
  box-shadow: var(--md-shadow-z3);
}
.sps-shot-pop img { display: block; max-width: min(36rem, calc(100vw - 2rem)); max-height: 70vh; }

/* Quiet disclosure at the end of the home page. */
.md-typeset .sps-development-note {
  color: var(--md-default-fg-color--light);
  font-size: 0.75rem;
  margin-top: 2rem;
}

/* Home: introduction and overview recording share the first screen. */
.sps-home-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.25fr);
  align-items: center;
  gap: 2rem;
  margin: 1rem 0 2.5rem;
}

.sps-home-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.sps-home-brand img {
  flex: 0 0 56px;
  border-radius: 22%;
}

.md-typeset .sps-home-brand h1 {
  margin: 0;
  color: var(--md-default-fg-color);
  font-size: clamp(1.3rem, 2.7vw, 1.8rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.md-typeset .sps-home-headline {
  margin: 1rem 0 0.5rem;
  font-size: 1.3rem;
  line-height: 1.3;
}

.sps-home-intro > p:not(.sps-home-headline) {
  color: var(--md-default-fg-color--light);
}

.sps-home-intro .sps-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 1rem 0 0;
}

.md-typeset .sps-home-intro .md-button {
  min-width: 0;
  margin: 0;
  padding: 0.45em 0.75em;
  font-size: 0.7rem;
}

/* Keep the recording prominent within each workflow tab. */
.sps-home-workflows .tabbed-block::after {
  content: "";
  display: table;
  clear: both;
}

@media (min-width: 60em) {
  .sps-home-workflows .tabbed-block > p:first-child {
    float: left;
    width: 73%;
    margin: 0 1.5rem 0 0;
  }

  .sps-home-workflows .tabbed-block > p:nth-child(2) {
    padding-top: 1.5rem;
  }
}
.sps-home-workflows .sps-shot {
  width: 100%;
  margin: 0.75rem 0;
}

.md-typeset .sps-home-workflows .md-button {
  padding: 0.5em 0.75em;
  font-size: 0.7rem;
}

.md-typeset .sps-first-figure {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* Keep project destinations visible without the repository statistics. */
.md-header .md-header__source {
  display: block;
  width: auto;
  margin-left: 0.4rem;
}

.sps-project-links {
  display: flex;
  align-items: center;
  gap: 0.1rem;
}

.sps-project-links .md-header__button {
  margin: 0;
  padding: 0.35rem;
}

.sps-home-links {
  border-top: 1px solid var(--md-default-fg-color--lightest);
  margin-top: 1.5rem;
  padding-top: 0.5rem;
}

@media (max-width: 60em) {
  .sps-home-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.2rem;
    margin-bottom: 1.5rem;
  }
}

@media (max-width: 34em) {
  .md-typeset .sps-first-figure {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The gallery index is a catalogue; each example opens on its own page. */
.sps-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.md-typeset .sps-gallery-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow: hidden;
  padding: 0.7rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.5rem;
  transition: border-color 0.15s ease;
}

.md-typeset .sps-gallery-card:hover,
.md-typeset .sps-gallery-card:focus-visible {
  border-color: var(--md-primary-fg-color);
}

.sps-gallery-card .sps-figure {
  margin: 0 0 0.35rem;
}

.sps-gallery-card .sps-plot {
  pointer-events: none;
}

.sps-gallery-card > span {
  color: var(--md-default-fg-color--light);
  font-size: 0.75rem;
}

@media (max-width: 40em) {
  .sps-gallery-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
