/*
 * Component and page styles.
 *
 * Astro scoped each of these to its own component file. Plain CSS has no
 * scoping, so they live here together under BEM-ish class names -- the naming
 * is what keeps them apart. Keep the section order below; it mirrors the order
 * things appear in the markup.
 */

/* ======================================================================== */
/* Logo                                                                     */
/* ======================================================================== */

.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  text-decoration: none;
  /* Each usage sets --logo-size inline; this is the fallback. */
  --logo-size: 32px;
}

.logo__mark {
  width: var(--logo-size);
  height: var(--logo-size);
  flex: none;
}

.logo__word {
  color: var(--color-text);
  font-size: var(--text-title-lg);
  font-weight: var(--weight-extrabold);
  letter-spacing: -0.02em;
}

/* ======================================================================== */
/* Header                                                                   */
/* ======================================================================== */

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--color-surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow var(--duration-base) var(--ease-out);
}

/* Once the page has scrolled, the header lifts off it. Set by js/site.js. */
.header--scrolled {
  box-shadow: 0 6px 20px -16px rgb(38 12 92 / 35%);
}

.header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 64px;
}

.header__brand {
  text-decoration: none;
  margin-inline-end: auto;
}

/*
 * Below 48rem the nav is a panel that drops below the header, opened by the
 * menu button; the button only appears when js/site.js has loaded, since
 * without it nothing could open the panel. Above 48rem it is a plain row.
 */
.header__nav {
  display: none;
}

.header--open .header__nav {
  display: block;
  position: absolute;
  inset-inline: 0;
  top: 100%;
  padding: var(--space-sm) var(--space-md) var(--space-md);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: 0 18px 30px -20px rgb(38 12 92 / 35%);
}

.header__list {
  display: flex;
  flex-direction: column;
  list-style: none;
  padding: 0;
}

.header__link {
  display: flex;
  align-items: center;
  min-height: var(--touch-target);
  color: var(--color-text-label);
  font-size: var(--text-body-md);
  font-weight: var(--weight-semibold);
  text-decoration: none;
}

.header__link:hover,
.header__link[aria-current] {
  color: var(--color-primary);
}

/* Menu and theme buttons: square, icon-only, labelled for assistive tech. */
.header__toggle,
.header__theme {
  display: none;
  place-items: center;
  width: var(--touch-target);
  height: var(--touch-target);
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text-label);
  cursor: pointer;
}

.header__toggle:hover,
.header__theme:hover {
  border-color: var(--color-border);
  color: var(--color-primary);
}

.js .header__toggle,
.js .header__theme {
  display: grid;
}

/* Each button holds two icons and shows one. */
.header__toggle svg,
.header__theme svg {
  width: 22px;
  height: 22px;
}

.header__toggle .icon--close,
.header--open .header__toggle .icon--menu,
.header__theme .icon--sun {
  display: none;
}

.header--open .header__toggle .icon--close,
[data-theme="dark"] .header__theme .icon--sun {
  display: block;
}

[data-theme="dark"] .header__theme .icon--moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .header__theme .icon--sun {
    display: block;
  }

  :root:not([data-theme="light"]) .header__theme .icon--moon {
    display: none;
  }
}

/*
 * The install CTA stays visible at every width. Most visitors arrive on the
 * phone they would install on, so hiding it there would drop the one click
 * this page exists to earn. Padding tightens below 48rem so it still fits
 * beside the wordmark on a 320px screen.
 */
.header__cta {
  padding-inline: var(--space-md);
}

@media (min-width: 48rem) {
  .header__inner {
    gap: var(--space-md);
  }

  .header__nav,
  .header--open .header__nav {
    display: block;
    position: static;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .header__list {
    flex-direction: row;
    gap: var(--space-xl);
  }

  .header__link {
    min-height: 0;
  }

  .js .header__toggle {
    display: none;
  }

  .header__cta {
    padding-inline: var(--space-xl);
  }
}

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

.hero {
  padding-block: clamp(3rem, 1.5rem + 8vw, 7rem);
  background:
    radial-gradient(
      ellipse 80% 60% at 50% -10%,
      var(--color-primary-container) 0%,
      transparent 70%
    ),
    var(--color-surface-tinted);
}

.hero__inner {
  display: grid;
  justify-items: start;
  gap: var(--space-xxl);
}

/* Copy above the phone on a narrow screen, beside it once there is room. */
@media (min-width: 64rem) {
  .hero__inner {
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: var(--space-section);
  }
}

.hero__copy {
  display: grid;
  justify-items: start;
  gap: var(--space-lg);
}

.hero__shot {
  justify-self: center;
  view-transition-name: hero-shot;
}

.hero__shot img {
  width: clamp(200px, 54vw, 300px);
  height: auto;
  border-radius: 22px;
  border: 1px solid var(--color-border);
  /* Lifted off the tinted hero background rather than sitting flat on it. */
  box-shadow:
    0 18px 40px -20px rgb(38 12 92 / 45%),
    0 4px 12px -6px rgb(38 12 92 / 25%);
}

@media (min-width: 64rem) {
  .hero__shot img {
    width: 300px;
  }
}

/*
 * Role switch. Three pages -- students, experts, facilitators -- each carry
 * this same control at the top of the hero, with the current page's link
 * marked aria-current. It replaced a static "For students" eyebrow, so the
 * active pill keeps that eyebrow's colours and uppercase voice.
 *
 * They are plain links, so each role gets its own URL that can be sent to a
 * lecturer or a student directly. Browsers that support cross-document view
 * transitions morph the active pill and the phone between the pages (see the
 * @view-transition rule at the end of this file); the rest just navigate.
 */
.hero__roles ul {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--space-xxs);
  padding: var(--space-xxs);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  list-style: none;
}

.hero__role {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-pill);
  color: var(--color-text-label);
  font-size: var(--text-label-md);
  font-weight: var(--weight-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    color var(--duration-fast) var(--ease-out);
}

.hero__role:hover {
  color: var(--color-primary);
}

.hero__role[aria-current="page"] {
  background: var(--color-primary-container-strong);
  color: var(--color-primary-dark);
  view-transition-name: role-pill;
}

.hero__title {
  max-width: 18ch;
  color: var(--color-text);
}

.hero__lede {
  max-width: 52ch;
  color: var(--color-text-info);
  font-size: var(--text-body-lg);
}

/* ======================================================================== */
/* Sections                                                                 */
/* ======================================================================== */

.section--tinted {
  background: var(--color-surface-muted);
}

.section__lede {
  margin-top: var(--space-sm);
  color: var(--color-text-info);
}

/* ======================================================================== */
/* Feature cards                                                            */
/* ======================================================================== */

.grid {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: 1fr;
  margin-top: var(--space-xxl);
  padding: 0;
  list-style: none;
}

@media (min-width: 40rem) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 64rem) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Two wide cards rather than three: the role comparison and the
     "teach it" pair on the home page. */
  .grid--two {
    grid-template-columns: repeat(2, 1fr);
  }
}

.card {
  padding: var(--space-xl);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.card__title {
  font-size: var(--text-title-lg);
  line-height: var(--leading-title-lg);
}

.card__body {
  margin-top: var(--space-xs);
  color: var(--color-text-info);
  font-size: var(--text-body-md);
}

.card__body + .card__body {
  margin-top: var(--space-sm);
}

/* Small uppercase kicker above a card title, e.g. "Student Expert". */
.card__kicker {
  margin-bottom: var(--space-xs);
  color: var(--color-primary);
  font-size: var(--text-label-md);
  font-weight: var(--weight-extrabold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card__link {
  display: inline-block;
  margin-top: var(--space-md);
  font-size: var(--text-body-md);
  font-weight: var(--weight-semibold);
}

/* ======================================================================== */
/* Prose sections (the role pages)                                          */
/* ======================================================================== */

/*
 * The expert and facilitator pages carry more running text than the home
 * page: paragraphs and bullet lists under a heading. These keep that copy at
 * reading width and give lists the same rhythm as the privacy page.
 */
.copy {
  margin-top: var(--space-xl);
  max-width: var(--width-prose);
  color: var(--color-text-label);
}

.copy p + p,
.copy p + ul,
.copy ul + p {
  margin-top: var(--space-md);
}

.copy ul {
  padding-left: var(--space-lg);
}

.copy li + li {
  margin-top: var(--space-sm);
}

/*
 * Text beside a phone screen. The heading and lede stay full width above;
 * the split holds the body copy on the left and a figure on the right, and
 * stacks with the figure last on anything narrower than a laptop.
 */
.split {
  display: grid;
  gap: var(--space-xxl);
  margin-top: var(--space-xl);
}

@media (min-width: 64rem) {
  .split {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: var(--space-section);
  }

  /* Cards beside a figure have two thirds of the width; three across would
     be cramped, so they stack. Steps stay three-up -- they are short. */
  .split .grid {
    grid-template-columns: 1fr;
  }

  /* When the text is much shorter than the phone, centre it rather than
     leaving a gap under it. */
  .split--center {
    align-items: center;
  }
}

/* The split's first child carries the table and copy, which set their own
   top margins as if they followed the lede directly. */
.split > :first-child > :first-child {
  margin-top: 0;
}

.split__figure {
  justify-self: center;
  margin: 0;
}

.split__figure img {
  width: clamp(200px, 54vw, 300px);
  height: auto;
  border-radius: 22px;
  border: 1px solid var(--color-border);
  box-shadow:
    0 18px 40px -20px rgb(38 12 92 / 45%),
    0 4px 12px -6px rgb(38 12 92 / 25%);
}

.split__figure figcaption {
  margin-top: var(--space-sm);
  max-width: 300px;
  color: var(--color-text-info);
  font-size: var(--text-body-md);
  text-align: center;
  text-wrap: balance;
}

/* ======================================================================== */
/* Table                                                                    */
/* ======================================================================== */

/* The content-type table. The wrapper scrolls sideways on its own so a
   narrow phone never has to scroll the whole page. */
.table-scroll {
  margin-top: var(--space-xl);
  overflow-x: auto;
}

.table {
  width: 100%;
  max-width: var(--width-prose);
  border-collapse: collapse;
  font-size: var(--text-body-md);
}

.table th,
.table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--color-divider);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--color-text-hint);
  font-size: var(--text-label-md);
  font-weight: var(--weight-extrabold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.table td:first-child {
  color: var(--color-text);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.table td {
  color: var(--color-text-label);
}

/* ======================================================================== */
/* Screenshots                                                              */
/* ======================================================================== */

.shots {
  display: grid;
  gap: var(--space-xl);
  /* Two up on a phone, four across once there is room. Nothing in between
     needs its own breakpoint — auto-fit handles the middle. */
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  margin-top: var(--space-xxl);
  padding: 0;
  list-style: none;
}

@media (min-width: 64rem) {
  .shots {
    grid-template-columns: repeat(4, 1fr);
  }

  /* The expert page has five tiles; at ~190px each they still read. */
  .shots--five {
    grid-template-columns: repeat(5, 1fr);
    gap: var(--space-lg);
  }
}

.shot {
  display: grid;
  gap: var(--space-sm);
  justify-items: center;
  text-align: center;
}

.shot__image {
  width: 100%;
  /* The exports are a few pixels apart in height, which left the captions on
     four different baselines. A shared ratio lines them up; anything taller
     than it loses a sliver of the bottom, where these screens carry least. */
  aspect-ratio: 640 / 1310;
  height: auto;
  object-fit: cover;
  object-position: top;
  border-radius: 16px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  box-shadow: 0 10px 26px -18px rgb(38 12 92 / 40%);
}

.shot__caption {
  color: var(--color-text-info);
  font-size: var(--text-body-md);
  text-wrap: balance;
}

/*
 * js/site.js wraps each screenshot in this button so it can open the
 * lightbox. It takes the image's shape; the image keeps its own styling.
 */
.zoom {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: none;
  cursor: zoom-in;
  transition: transform var(--duration-fast) var(--ease-out);
}

.zoom:hover {
  transform: translateY(-2px);
}

.split__figure .zoom {
  width: auto;
  border-radius: 22px;
}

/* ======================================================================== */
/* Steps                                                                    */
/* ======================================================================== */

.steps {
  display: grid;
  gap: var(--space-xl);
  grid-template-columns: 1fr;
  margin-top: var(--space-xxl);
  padding: 0;
  list-style: none;
}

@media (min-width: 48rem) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Four steps: two-by-two until there is room for a row of four. */
  .steps--four {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 64rem) {
  .steps--four {
    grid-template-columns: repeat(4, 1fr);
  }
}

.step {
  display: grid;
  gap: var(--space-sm);
  /* Steps in a row stretch to the tallest one; without this the spare height
     is shared between the two rows and the titles drift out of line. */
  align-content: start;
}

.step__number {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: var(--text-title-md);
  font-weight: var(--weight-extrabold);
}

/* ======================================================================== */
/* FAQ                                                                      */
/* ======================================================================== */

.faq {
  margin-top: var(--space-xxl);
}

.faq__item + .faq__item {
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-divider);
}

/*
 * <summary> in a <details>. The default disclosure triangle is replaced with a
 * chevron drawn in CSS so it can pick up the brand colour and rotate; both
 * vendor selectors are needed to suppress the native marker.
 */
.faq__q {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  min-height: var(--touch-target);
  font-size: var(--text-title-md);
  font-weight: var(--weight-bold);
  cursor: pointer;
  list-style: none;
}

.faq__q::-webkit-details-marker {
  display: none;
}

.faq__q::after {
  content: "";
  flex: none;
  width: 0.55em;
  height: 0.55em;
  border-right: 2px solid var(--color-primary);
  border-bottom: 2px solid var(--color-primary);
  transform: rotate(45deg) translate(-0.1em, -0.1em);
  transition: transform var(--duration-fast) var(--ease-out);
}

.faq__item[open] .faq__q::after {
  transform: rotate(-135deg) translate(-0.1em, -0.1em);
}

/* js/site.js animates the item's height open and closed. It sets overflow
   hidden only for the duration, so the summary's focus ring is never clipped
   at rest. */

.faq__q:hover {
  color: var(--color-primary);
}

.faq__a {
  margin: var(--space-xs) 0 0;
  color: var(--color-text-info);
  font-size: var(--text-body-md);
}

/* ======================================================================== */
/* Closing CTA                                                              */
/* ======================================================================== */

.cta {
  display: grid;
  justify-items: center;
  gap: var(--space-md);
  padding: var(--space-section) var(--space-xl);
  border-radius: var(--radius-lg);
  background: var(--color-primary-container);
  text-align: center;
}

.cta__title {
  font-size: var(--text-headline-md);
  line-height: var(--leading-headline);
}

.cta__body {
  max-width: 44ch;
  color: var(--color-text-label);
}

.cta .downloads {
  justify-items: center;
}

.cta .downloads__row {
  justify-content: center;
}

/* ======================================================================== */
/* Download buttons                                                         */
/* ======================================================================== */

.downloads {
  display: grid;
  gap: var(--space-md);
}

.downloads__row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.store {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: var(--touch-target);
  padding: var(--space-xs) var(--space-lg);
  border-radius: var(--radius-md);
  background: var(--color-on-surface);
  color: var(--color-surface);
  text-decoration: none;
  transition: transform var(--duration-fast) var(--ease-out);
}

.store:hover {
  transform: translateY(-1px);
}

.store__glyph {
  width: 24px;
  height: 24px;
  flex: none;
}

.store__text {
  display: grid;
  line-height: 1.2;
}

.store__kicker {
  font-size: var(--text-body-sm);
  opacity: 0.75;
}

.store__name {
  font-size: var(--text-title-md);
  font-weight: var(--weight-bold);
}

.downloads__pending {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  color: var(--color-text-info);
  font-size: var(--text-body-md);
}

.downloads__badge {
  padding: var(--space-xxs) var(--space-sm);
  border-radius: var(--radius-pill);
  background: var(--color-primary-container);
  color: var(--color-primary);
  font-size: var(--text-label-md);
  font-weight: var(--weight-bold);
}

/* ======================================================================== */
/* Footer                                                                   */
/* ======================================================================== */

.footer {
  margin-top: var(--space-section);
  padding-block: var(--space-xxl) var(--space-xl);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-muted);
}

.footer__inner {
  display: grid;
  gap: var(--space-xl);
  grid-template-columns: 1fr;
}

@media (min-width: 48rem) {
  .footer__inner {
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: var(--space-xxl);
  }
}

.footer__tagline {
  margin-top: var(--space-sm);
  max-width: 28ch;
  color: var(--color-text-info);
  font-size: var(--text-body-md);
}

.footer__heading {
  margin-bottom: var(--space-sm);
  font-size: var(--text-label-md);
  font-weight: var(--weight-extrabold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-hint);
}

.footer__list {
  display: grid;
  gap: var(--space-xs);
  list-style: none;
  padding: 0;
  font-size: var(--text-body-md);
}

.footer__list a {
  color: var(--color-text-label);
  text-decoration: none;
}

.footer__list a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.footer__legal {
  margin-top: var(--space-xxl);
  padding-top: var(--space-md);
  border-top: 1px solid var(--color-border);
  color: var(--color-text-hint);
  font-size: var(--text-body-sm);
}

/* ======================================================================== */
/* 404 page                                                                 */
/* ======================================================================== */

.notfound {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--space-md);
  min-height: 100svh;
  padding: var(--space-xxl) var(--space-md);
  text-align: center;
}

.notfound__code {
  margin-top: var(--space-xl);
  color: var(--color-primary);
  font-size: var(--text-label-md);
  font-weight: var(--weight-extrabold);
  letter-spacing: 0.16em;
}

.notfound__title {
  font-size: var(--text-display-sm);
}

.notfound__body {
  max-width: 44ch;
  color: var(--color-text-info);
}

/* ======================================================================== */
/* Privacy page                                                             */
/* ======================================================================== */

.policy-page {
  border-top: 1px solid var(--color-divider);
}

.policy-shell {
  max-width: var(--width-prose);
  padding-block: var(--space-section);
}

.policy-intro {
  padding-bottom: var(--space-xxl);
  border-bottom: 1px solid var(--color-border);
}

.policy__title {
  font-size: var(--text-headline-lg);
  line-height: var(--leading-headline-lg);
}

.policy__meta {
  margin-top: var(--space-xs);
  color: var(--color-text-info);
  font-size: var(--text-body-md);
}

.policy-intro > p:last-child {
  max-width: var(--width-prose);
  margin-top: var(--space-xl);
  color: var(--color-text-label);
}

.policy-contents {
  padding-block: var(--space-xxl);
  border-bottom: 1px solid var(--color-border);
}

.policy-contents h2 {
  margin-bottom: var(--space-md);
  font-size: var(--text-title-lg);
  line-height: var(--leading-title-lg);
}

.policy-contents ol {
  columns: 2;
  gap: var(--space-xxl);
  padding-left: var(--space-lg);
}

.policy-contents li {
  margin-bottom: var(--space-xs);
  break-inside: avoid;
  color: var(--color-text-info);
  font-size: var(--text-body-md);
}

.policy-contents a {
  color: var(--color-text-label);
}

.policy {
  margin-inline: 0;
}

.policy section {
  margin-top: var(--space-xxl);
  scroll-margin-top: var(--space-xxl);
}

.policy h2 {
  margin-bottom: var(--space-md);
  font-size: var(--text-headline-sm);
  line-height: var(--leading-headline);
}

.policy h3 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-xs);
  font-size: var(--text-title-md);
  line-height: var(--leading-title-md);
}

.policy p,
.policy li,
.policy address {
  color: var(--color-text-label);
}

.policy p + p,
.policy p + ul,
.policy ul + p,
.policy address + p {
  margin-top: var(--space-md);
}

.policy ul {
  padding-left: var(--space-lg);
}

.policy li + li {
  margin-top: var(--space-sm);
}

.policy address {
  margin-top: var(--space-md);
  font-style: normal;
}

@media (max-width: 39.99rem) {
  .policy-contents ol {
    columns: 1;
  }
}

/* ======================================================================== */
/* Enhancements driven by js/site.js                                        */
/* ======================================================================== */

/*
 * Scroll reveal. The hidden state is gated on .js so nothing disappears if
 * the script fails to load; the script adds .is-visible as each element
 * enters the viewport, staggered by --reveal-delay. base.css zeroes every
 * transition under prefers-reduced-motion, so there the change is instant.
 */
.js .reveal {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity var(--duration-base) var(--ease-out) var(--reveal-delay, 0ms),
    transform var(--duration-base) var(--ease-out) var(--reveal-delay, 0ms);
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Back to top: appended by the script, shown after a screen and a half. */
.to-top {
  position: fixed;
  right: var(--space-md);
  bottom: var(--space-md);
  z-index: 9;
  display: grid;
  place-items: center;
  width: var(--touch-target);
  height: var(--touch-target);
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: var(--color-on-primary);
  box-shadow: 0 10px 24px -12px rgb(38 12 92 / 55%);
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.to-top:hover {
  background: var(--color-primary-dark);
  transform: translateY(-2px);
}

/* display:grid above would otherwise beat the hidden attribute. */
.to-top[hidden] {
  display: none;
}

/*
 * Screenshot lightbox. A native <dialog>: focus trapping, Escape and focus
 * return come free. The tiles crop their screens to a shared ratio, so this
 * is where the whole screen can be seen.
 */
.lightbox {
  width: min(90vw, 420px);
  max-height: 92vh;
  /* The reset in base.css zeroes every margin, which would pin a modal
     dialog to the top-left; auto is what centres it. */
  margin: auto;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: 22px;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 30px 60px -30px rgb(0 0 0 / 60%);
  /* Clip the scrolling pane to the rounded corners. */
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity var(--duration-base) var(--ease-out),
    transform var(--duration-base) var(--ease-out);
}

/* Only when open: display on the bare class would also show it closed. */
.lightbox[open] {
  display: flex;
  flex-direction: column;
}

.lightbox.is-open {
  opacity: 1;
  transform: none;
}

.lightbox::backdrop {
  background: rgb(10 6 20 / 72%);
}

.lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  flex: none;
  padding: var(--space-xs) var(--space-xs) var(--space-xs) var(--space-md);
  border-bottom: 1px solid var(--color-divider);
}

.lightbox__caption {
  margin: 0;
  color: var(--color-text-info);
  font-size: var(--text-body-md);
}

.lightbox__close {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--touch-target);
  height: var(--touch-target);
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text);
  cursor: pointer;
}

.lightbox__close:hover {
  color: var(--color-primary);
}

/* The screenshot scrolls inside the dialog; the bar stays put. */
.lightbox__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.lightbox__image {
  display: block;
  width: 100%;
  height: auto;
}

/*
 * Cross-document view transition between the three role pages: the active
 * role pill and the phone morph into place. Same-origin only, and only in
 * browsers that support it; everyone else gets a normal navigation.
 */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}
