/* Call-to-action banner in the Material header. It rides in the normal flex
   flow (not absolutely positioned) so it can never overlap the title or the
   search box — flexbox reserves its space. */

.md-header__banner {
  display: none; /* shown only at desktop widths; see media query below */
  flex: 0 0 auto;
  align-items: center;
  gap: 0.4rem;
  max-width: 40vw;
  padding: 0.28rem 0.75rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.1;
  white-space: nowrap;
  color: var(--md-primary-bg-color);
  background-color: color-mix(in srgb, var(--md-primary-bg-color) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--md-primary-bg-color) 45%, transparent);
  transition: background-color 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.md-header__banner:hover,
.md-header__banner:focus-visible {
  background-color: var(--md-primary-bg-color);
  color: var(--md-primary-fg-color);
  transform: scale(1.03);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  outline: none;
}

.md-header__banner-icon {
  font-size: 0.8rem;
  line-height: 1;
}

.md-header__banner-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Show the banner at desktop widths only, centered in the free space of the
   Playground toolbar (its auto margins share the gap with the variant switch's
   own `margin-right: auto`). The Playground page hides the title and search, so
   there is nothing to collide with; on narrower viewports the banner stays
   hidden (default above) to keep the slim toolbar uncluttered. */
@media screen and (min-width: 76.25em) {
  .md-header__banner {
    display: inline-flex;
    margin: 0 auto;
  }
}

/* "Integrate with one prompt" — the toggle that rewrites the copy-paste prompt. */

.nansense-prompt-option {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin: 0.6rem 0 0.8rem;
  padding: 0.55rem 0.75rem;
  border: 0.05rem solid var(--md-default-fg-color--lightest);
  border-radius: 0.2rem;
  background-color: var(--md-code-bg-color);
  font-size: 0.72rem;
  cursor: pointer;
}

.nansense-prompt-option input {
  margin-top: 0.12rem;
  flex-shrink: 0;
}

/* Playground embedded on the home page (`.pg-embed` in docs/index.md). The
   standalone /playground/ page styles its own fullscreen frame inline; this is
   the boxed, in-content variant that sits above the hero video. */

.pg-embed {
  margin: 1.2rem 0 1.5rem;
  /* Zoom level of the embedded app. The frame is laid out at `1 / --pg-scale`
     of the box and scaled back down, so the app sees a viewport that much wider
     than the column: at 0.8 a 1100px box gives it ~1375px to lay out in, well
     clear of its 800px floor (nansense/ui/static.py — below that it pans
     instead of reflowing). Lower = more app on screen, smaller text. */
  --pg-scale: 0.8;
}

.pg-embed__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.pg-embed__label {
  margin-right: 0.2rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--md-default-fg-color--light);
}

.pg-embed__btn {
  appearance: none;
  border: 0.05rem solid var(--md-default-fg-color--lightest);
  border-radius: 999px;
  background: transparent;
  color: var(--md-default-fg-color--light);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 0.3rem 0.7rem;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.pg-embed__btn:hover {
  color: var(--md-default-fg-color);
  border-color: var(--md-default-fg-color--light);
}

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

/* The visible box; the frame inside is scaled to `--pg-scale` around it. */
.pg-embed__screen {
  position: relative;
  overflow: hidden;
  /* Tall enough for the app's toolbar plus a layer card; capped so the video
     underneath still shows on a laptop screen. */
  height: clamp(400px, 64vh, 620px);
  border: 0.05rem solid var(--md-default-fg-color--lightest);
  border-radius: 0.2rem;
  background: var(--md-code-bg-color);
}

/* `zoom` rather than `transform: scale()`: it shrinks the rendering *and*
   enlarges the frame's own viewport, so `width/height: 100%` keeps filling the
   box while the app inside lays out at `box / --pg-scale`. A transform would
   only shrink what the app already drew at the box's width. */
.pg-embed__frame {
  display: block;
  width: 100%;
  height: 100%;
  zoom: var(--pg-scale, 1);
  border: 0;
}

.pg-embed__note {
  margin: 0.5rem 0 0;
  font-size: 0.7rem;
  color: var(--md-default-fg-color--light);
}

/* Phones and small tablets: scaling a 960px-wide app down to a 320px column
   makes it unreadable, so drop the embed entirely — the "Try the Playground"
   button below the video already leads there. */
@media screen and (max-width: 44.9em) {
  .pg-embed {
    display: none;
  }
}

/* A wider content column than Material's stock 61rem. The home page embeds the
   playground, which is a desktop app with an 800px floor (nansense/ui/static.py)
   — at 61rem it had to be scaled down to fit the column. Prose pages trade a
   longer measure for it, so this is deliberately moderate rather than full-width. */
.md-grid {
  max-width: 76rem;
}
