/* ------------------------------------------------------------------ *
 * Left navigation — typographic treatment.
 *
 * Each top-level topic (Daniel Tuzes / Structile / fpml-convert) is a
 * bold label with a hairline rule beneath it; the topic you're currently
 * inside — and its rule — turn the site's primary colour. No boxes, no
 * fills. Sub-pages keep Material's standard nav styling, spaced in under
 * the rule. Topic labels remain links to each topic's overview page.
 * ------------------------------------------------------------------ */

/* On desktop the sidebar repeats the site name above the list; with the
   first nav item now reading "Daniel Tuzes" that line is redundant. */
@media screen and (min-width: 76.25em) {
  .md-nav--primary>.md-nav__title {
    display: none;
  }
}

.md-nav--primary>.md-nav__list>.md-nav__item {
  margin: 0.9rem 0 0;
}

.md-nav--primary>.md-nav__list>.md-nav__item:first-child {
  margin-top: 0;
}

/* The topic label row. */
.md-nav--primary>.md-nav__list>.md-nav__item>.md-nav__link,
.md-nav--primary>.md-nav__list>.md-nav__item>.md-nav__container {
  margin: 0;
  padding: 0.15rem 0.6rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--md-default-fg-color);
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
}

/* The <a> (and toggle <label>) inside the flex container inherit it. */
.md-nav--primary>.md-nav__list>.md-nav__item>.md-nav__container>.md-nav__link {
  padding: 0;
  font: inherit;
  color: inherit;
}

/* Current topic — highlighted whenever any of its pages is open. */
.md-nav--primary>.md-nav__list>.md-nav__item--active>.md-nav__link,
.md-nav--primary>.md-nav__list>.md-nav__item--active>.md-nav__container,
.md-nav--primary>.md-nav__list>.md-nav__item--active>.md-nav__container>.md-nav__link {
  color: var(--md-primary-fg-color);
  border-bottom-color: var(--md-primary-fg-color);
}

/* Sub-pages: Material's own nav colours, just given room under the rule. */
.md-nav--primary>.md-nav__list>.md-nav__item>.md-nav {
  padding: 0.25rem 0 0;
}

.md-nav--primary>.md-nav__list>.md-nav__item>.md-nav .md-nav__link {
  font-size: 0.7rem;
}


/* ------------------------------------------------------------------ *
 * Embedded window screenshot styling
 *
 * The screenshot itself uses the light Explico theme. A subtle border
 * and shadow separate it from the surrounding MkDocs page in both the
 * light and dark documentation themes.
 * ------------------------------------------------------------------ */

.embed-window {
  display: block;
  width: 100%;
  border-radius: 0.35rem;
  border: 1px solid rgba(0, 0, 0, 0.10);
  box-shadow:
    0 0.25rem 0.75rem rgba(0, 0, 0, 0.10),
    0 0.05rem 0.2rem rgba(0, 0, 0, 0.08);
  transition:
    box-shadow 150ms ease,
    transform 150ms ease;
}

/* Slight visual response because the screenshot is also a link. */
a:hover>.embed-window {
  box-shadow:
    0 0.4rem 1rem rgba(0, 0, 0, 0.16),
    0 0.1rem 0.3rem rgba(0, 0, 0, 0.10);
  transform: translateY(-1px);
}

/* The embedded screenshot remains light, so give it stronger separation
   when it sits inside Material's dark "slate" colour scheme. */
[data-md-color-scheme="slate"] .embed-window {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow:
    0 0.4rem 1.2rem rgba(0, 0, 0, 0.40),
    0 0.1rem 0.35rem rgba(0, 0, 0, 0.28);
}

[data-md-color-scheme="slate"] a:hover>.embed-window {
  box-shadow:
    0 0.55rem 1.5rem rgba(0, 0, 0, 0.50),
    0 0.15rem 0.45rem rgba(0, 0, 0, 0.32);
}

/* ------------------------------------------------------------------ *
 * Screenshots that carry both viewer themes — and, where one exists,
 * link to the live document they were taken from.
 *
 * Two stacked <img>s inside one .embed-window frame: the resting one
 * matches the documentation theme you are reading in (light shot in the
 * default scheme, dark shot in "slate"), and hovering or focusing shows
 * the other. That is the whole point of the pair — the viewer follows
 * prefers-color-scheme, so this is what the same document looks like on
 * the other setting, without leaving the page.
 *
 * The screenshots are stills; the ".shot-cta" badge is the way out of
 * that: it marks the frames whose live document is published under
 * downloads/samples-and-interpreters/ (from the structile release's own
 * samples zip — see that repo's scripts/stage_github_release_assets.py),
 * so a reader can open the exact file in the picture and drive it.
 * ------------------------------------------------------------------ */

.shot {
  position: relative;
  overflow: hidden;
  text-decoration: none;
}

.shot>img {
  display: block;
  width: 100%;
}

.shot>.shot-alt {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 150ms ease;
}

.shot:hover>.shot-alt,
.shot:focus-visible>.shot-alt {
  opacity: 1;
}

/* Reversed in the dark documentation theme: there the dark shot is what
   belongs on the page, and the light one is the alternative to peek at. */
[data-md-color-scheme="slate"] .shot>.shot-alt {
  opacity: 1;
}

[data-md-color-scheme="slate"] .shot:hover>.shot-alt,
[data-md-color-scheme="slate"] .shot:focus-visible>.shot-alt {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .shot>.shot-alt {
    transition: none;
  }
}

/* The lift a:hover>.embed-window gives a linked screenshot — restated
   because here the frame IS the <a>, not a child of it. */
a.shot:hover,
a.shot:focus-visible {
  box-shadow:
    0 0.4rem 1rem rgba(0, 0, 0, 0.16),
    0 0.1rem 0.3rem rgba(0, 0, 0, 0.10);
  transform: translateY(-1px);
}

[data-md-color-scheme="slate"] a.shot:hover,
[data-md-color-scheme="slate"] a.shot:focus-visible {
  box-shadow:
    0 0.55rem 1.5rem rgba(0, 0, 0, 0.50),
    0 0.15rem 0.45rem rgba(0, 0, 0, 0.32);
}

.shot-cta,
.shot-hint {
  position: absolute;
  z-index: 2;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.3rem 0.6rem;
  border-radius: 0.3rem;
  white-space: nowrap;
}

.shot-cta {
  right: 0.6rem;
  top: 0.6rem;
  color: #fff;
  background: var(--md-primary-fg-color);
  box-shadow: 0 0.1rem 0.4rem rgba(0, 0, 0, 0.3);
}

a.shot:hover .shot-cta,
a.shot:focus-visible .shot-cta {
  background: var(--md-accent-fg-color);
}

.shot-hint {
  right: 0.6rem;
  bottom: 0.6rem;
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--md-default-fg-color--light);
  background: var(--md-default-bg-color);
  border: 1px solid var(--md-default-fg-color--lightest);
  opacity: 0.82;
}

/* Small screens: one badge is plenty, and the call to action is the one
   that does something. */
@media screen and (max-width: 44.9375em) {
  .shot-hint {
    display: none;
  }
}

/* ------------------------------------------------------------------ *
 * A stack of screenshots: several pages of one live site, overlapping.
 *
 * Three 16:10 frames at 70% of a 16:10 stage, each stepped 15% down and
 * right of the one behind it. Hovering a frame, or picking its chip,
 * selects it: the frame scales by 1/0.7 about its own corner (0%, 50%,
 * 100% for the three), so it covers the stage exactly and still contains
 * the pointer that selected it. The other frames fade out and the
 * selected one fades to its night-theme shot. Each frame links to the
 * page in its picture. docs/javascripts/shot-stack.js keeps the
 * selection; without it the stack still shows and every frame links.
 *
 * The explico page uses it; scripts/sync_explico_playground.py makes its
 * screenshots.
 * ------------------------------------------------------------------ */

.shot-stack {
  margin: 1.6em 0 2em;
}

.shot-stack__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
}

.md-typeset .shot-stack__page {
  position: absolute;
  left: calc(var(--i) * 15%);
  top: calc(var(--i) * 15%);
  z-index: calc(var(--i) + 1);
  width: 70%;
  height: 70%;
  overflow: hidden;
  border-radius: 0.35rem;
  border: 1px solid rgba(0, 0, 0, 0.10);
  box-shadow:
    0 0.25rem 0.75rem rgba(0, 0, 0, 0.12),
    0 0.05rem 0.2rem rgba(0, 0, 0, 0.08);
  background: var(--md-default-bg-color);
  transform-origin: calc(var(--i) * 50%) calc(var(--i) * 50%);
  transition:
    transform 450ms cubic-bezier(0.2, 0.75, 0.25, 1),
    opacity 300ms ease;
}

[data-md-color-scheme="slate"] .md-typeset .shot-stack__page {
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow:
    0 0.4rem 1.2rem rgba(0, 0, 0, 0.40),
    0 0.1rem 0.35rem rgba(0, 0, 0, 0.28);
}

.md-typeset .shot-stack__page:focus-visible {
  outline: 2px solid var(--md-accent-fg-color);
  outline-offset: 3px;
}

.shot-stack__page>img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
  transition: opacity 300ms ease;
}

.shot-stack__page>.shot-stack__night {
  opacity: 0;
}

.shot-stack__stage[data-selected] .shot-stack__page {
  opacity: 0;
}

.shot-stack__stage[data-selected] .shot-stack__page.is-selected {
  z-index: 10;
  opacity: 1;
  transform: scale(calc(1 / 0.7));
}

.shot-stack__page.is-selected>.shot-stack__night {
  opacity: 1;
}

/* The .shot-cta badge, on the selected frame only, scaled back down by
   the frame's 1/0.7 so it keeps its size. */
.shot-stack__page>.shot-cta {
  opacity: 0;
  transform: scale(0.7);
  transform-origin: 100% 0;
  transition: opacity 200ms ease 150ms;
}

.shot-stack__page.is-selected>.shot-cta {
  opacity: 1;
}

.shot-stack__hint {
  margin: 0.9em 0 0.6em;
  font-size: 0.85em;
  color: var(--md-default-fg-color--light);
}

.shot-stack__hint strong {
  color: var(--md-default-fg-color);
}

.shot-stack__hint .shot-stack__touch {
  display: none;
}

@media (hover: none), (pointer: coarse) {
  .shot-stack__hint .shot-stack__mouse {
    display: none;
  }

  .shot-stack__hint .shot-stack__touch {
    display: inline;
  }
}

.shot-stack__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
}

.md-typeset .shot-stack__chip {
  padding: 0.35em 0.9em;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 2em;
  font: inherit;
  font-size: 0.8em;
  color: var(--md-default-fg-color);
  background: transparent;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    color 150ms ease;
}

.md-typeset .shot-stack__chip:hover,
.md-typeset .shot-stack__chip:focus-visible {
  border-color: var(--md-accent-fg-color);
  color: var(--md-accent-fg-color);
}

.md-typeset .shot-stack__chip[aria-pressed="true"] {
  border-color: var(--md-primary-fg-color);
  color: var(--md-primary-bg-color);
  background: var(--md-primary-fg-color);
}

@media (prefers-reduced-motion: reduce) {

  .md-typeset .shot-stack__page,
  .shot-stack__page>img,
  .shot-stack__page>.shot-cta,
  .md-typeset .shot-stack__chip {
    transition: none;
  }
}
