/**
 * BookingXi template gallery.
 *
 * Design premise: the chrome is a gallery wall, not a painting. Eight templates
 * with eight unrelated colour schemes sit on this page at once — a chromatic
 * interface would fight every one of them. So the entire UI is achromatic and
 * the only colour on the page comes from the live previews themselves. The one
 * hue in the stylesheet is the focus ring, which has to be visible rather than
 * tasteful.
 */

/* ── Tokens ────────────────────────────────────────────────────────────────
   Light is the base. Dark is re-declared twice — once for the un-stamped
   default (system preference) and once for an explicit toggle — so all three
   viewer states resolve. Nothing below this block declares a colour literal. */

:root {
  --paper: #fbfbfc;
  --paper-2: #f2f2f5;
  --paper-3: #e9e9ee;
  --line: #e2e2e8;
  --line-strong: #d0d0d9;
  --ink: #131419;
  --ink-2: #555863;
  --ink-3: #878a94;
  --on-ink: #fbfbfc;
  --focus: #3a4fe0;
  --shadow-card: 0 1px 2px rgba(19, 20, 25, 0.04), 0 12px 28px -14px rgba(19, 20, 25, 0.18);
  --shadow-lift: 0 2px 4px rgba(19, 20, 25, 0.05), 0 28px 56px -24px rgba(19, 20, 25, 0.3);
  --shadow-pop: 0 32px 80px -28px rgba(19, 20, 25, 0.45);

  /* Luxe's pairing, borrowed deliberately. Cormorant Garamond gives the
     headings a printed-card quality, and Jost is unusually legible at the
     small sizes this page leans on — captions, tags, filter chips. Two
     families rather than three: the previous mono earned its keep as texture
     and cost more than it returned in readability, so labels are now Jost,
     tracked and uppercased. */
  --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-body: "Jost", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: "Jost", ui-sans-serif, system-ui, sans-serif;

  --gutter: clamp(1.25rem, 4vw, 4.5rem);
  --measure: 34rem;
  --radius: 14px;
  --bar-h: 57px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e0f13;
    --paper-2: #17181e;
    --paper-3: #1e1f27;
    --line: #2a2c35;
    --line-strong: #3a3d48;
    --ink: #f4f4f7;
    --ink-2: #a4a7b2;
    --ink-3: #797c87;
    --on-ink: #0e0f13;
    --focus: #8494ff;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 28px -14px rgba(0, 0, 0, 0.7);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.45), 0 28px 56px -24px rgba(0, 0, 0, 0.85);
    --shadow-pop: 0 32px 80px -28px rgba(0, 0, 0, 0.9);
  }
}

:root[data-theme="dark"] {
  --paper: #0e0f13;
  --paper-2: #17181e;
  --paper-3: #1e1f27;
  --line: #2a2c35;
  --line-strong: #3a3d48;
  --ink: #f4f4f7;
  --ink-2: #a4a7b2;
  --ink-3: #797c87;
  --on-ink: #0e0f13;
  --focus: #8494ff;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 28px -14px rgba(0, 0, 0, 0.7);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.45), 0 28px 56px -24px rgba(0, 0, 0, 0.85);
  --shadow-pop: 0 32px 80px -28px rgba(0, 0, 0, 0.9);
}

/* ── Base ──────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  /* 600 rather than 700: Cormorant's bold is heavy enough to muddy its thin
     strokes at display sizes. And no negative tracking — a Garamond is already
     tightly fitted, and pulling it in closes the counters. */
  font-weight: 600;
  letter-spacing: 0;
  text-wrap: balance;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

:where(a, button, select, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.vh {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 50%;
  top: 0.6rem;
  transform: translate(-50%, -300%);
  z-index: 60;
  padding: 0.55rem 1rem;
  background: var(--ink);
  color: var(--on-ink);
  border-radius: 999px;
  font-size: 0.85rem;
  text-decoration: none;
}

.skip:focus {
  transform: translate(-50%, 0);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: 0.84rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.btn--solid {
  background: var(--ink);
  color: var(--on-ink);
}

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

.btn--ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line-strong);
}

.btn--ghost:hover {
  color: var(--ink);
  border-color: var(--ink-3);
}

/* ── Masthead ──────────────────────────────────────────────────────────── */

.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--bar-h);
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}

.wordmark__mark {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 7px;
  background: var(--ink);
  color: var(--on-ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.86rem;
  line-height: 1;
}

.wordmark__text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.94rem;
  letter-spacing: 0;
}

.wordmark__text span {
  color: var(--ink-3);
  font-weight: 500;
}

.masthead__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 33px;
  height: 33px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition:
    color 0.16s ease,
    border-color 0.16s ease;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--ink-3);
}

.theme-toggle__label {
  font-size: 0;
}

.theme-toggle::before {
  content: "";
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1.6px solid currentColor;
  /* Half-filled disc: reads as a contrast/appearance control at any size. */
  background: linear-gradient(90deg, currentColor 0 50%, transparent 50% 100%);
}

/* ── Hero ──────────────────────────────────────────────────────────────── */

.hero {
  display: grid;
  gap: clamp(2.25rem, 5vw, 4rem);
  align-items: center;
  max-width: 1500px;
  margin-inline: auto;
  padding: clamp(2.5rem, 6vw, 5rem) var(--gutter) clamp(2rem, 4vw, 3.5rem);
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 64rem) {
  .hero {
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  }
}

.hero__title {
  margin-top: 0.9rem;
  font-size: clamp(2.4rem, 5.6vw, 4.3rem);
  line-height: 1.08;
  max-width: 17ch;
}

.hero__lede {
  margin-top: 1.25rem;
  max-width: var(--measure);
  font-size: clamp(1rem, 1.35vw, 1.09rem);
  line-height: 1.62;
  color: var(--ink-2);
}

.included {
  list-style: none;
  margin: clamp(1.5rem, 3vw, 2.1rem) 0 0;
  padding: 1.35rem 0 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 40rem;
}

.included li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 0.925rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.included li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.52em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  border: 1.5px solid var(--ink-3);
}

.included li strong {
  color: var(--ink);
  font-weight: 600;
}

.hero__cta {
  margin-top: 1.75rem;
}

/* ── Hero rotator ────────────────────────────────────────────────────────
   A live preview that cycles the library, so the first screen shows the range
   rather than describing it. */

.hero__stage {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
}

.rotator {
  position: relative;
}

.rotator__screen {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--rot-ground, var(--paper-2));
  box-shadow: var(--shadow-lift);
  transition: background 0.6s ease;
}

.rotator__pane {
  position: absolute;
  top: 0;
  left: 0;
  width: 1440px;
  height: 900px;
  border: 0;
  transform: scale(var(--rot-scale, 0.5));
  transform-origin: top left;
  pointer-events: none;
  opacity: 0;
  /* Out is quicker than in, so the ground shows for a beat between templates
     rather than the two of them overlapping. */
  transition: opacity 0.3s ease;
}

.rotator__pane[data-visible] {
  opacity: 1;
  transition: opacity 0.45s ease;
}

.rotator__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 2.35rem;
}

.rotator__id {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}

.rotator__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rotator__id:hover .rotator__name {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rotator__kind {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rotator__dots {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex: none;
}

.rotator__dot {
  width: 22px;
  height: 4px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--line-strong);
  cursor: pointer;
  transition:
    background 0.2s ease,
    width 0.3s ease;
}

.rotator__dot:hover {
  background: var(--ink-3);
}

.rotator__dot[aria-selected="true"] {
  background: var(--ink);
  width: 30px;
}

/* ── Process ───────────────────────────────────────────────────────────── */

.process {
  max-width: 1500px;
  margin-inline: auto;
  padding: clamp(2rem, 4vw, 3rem) var(--gutter) clamp(2.5rem, 5vw, 3.75rem);
  border-top: 1px solid var(--line);
}

.process__head h2 {
  margin-top: 0.7rem;
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  max-width: 22ch;
}

.process__steps {
  list-style: none;
  display: grid;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  margin: clamp(1.75rem, 3.5vw, 2.75rem) 0 0;
  padding: 0;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.process__steps li {
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
}

.process__n {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--ink-3);
}

.process__steps h3 {
  margin-top: 0.75rem;
  font-size: 1.08rem;
}

.process__steps p {
  margin-top: 0.55rem;
  color: var(--ink-2);
  font-size: 0.92rem;
  line-height: 1.58;
}

/* ── Filters ───────────────────────────────────────────────────────────── */

.filters {
  position: sticky;
  top: var(--bar-h);
  z-index: 20;
  padding: 0.7rem var(--gutter);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}

.filters__row {
  display: flex;
  gap: 0.4rem;
  max-width: 1500px;
  margin-inline: auto;
  overflow-x: auto;
  scrollbar-width: none;
  padding-block: 1px;
}

.filters__row::-webkit-scrollbar {
  display: none;
}

.chip {
  flex: none;
  display: inline-flex;
  align-items: baseline;
  gap: 0.42rem;
  padding: 0.42rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-2);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    border-color 0.16s ease;
}

.chip:hover {
  color: var(--ink);
  border-color: var(--ink-3);
}

.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
}

.chip__n {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.6;
}

/* ── Catalogue grid ────────────────────────────────────────────────────── */

.catalogue {
  max-width: 1500px;
  margin-inline: auto;
  padding: clamp(1.75rem, 4vw, 3.25rem) var(--gutter) clamp(3rem, 7vw, 5.5rem);
}

.grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(2rem, 4vw, 3.4rem) clamp(1.5rem, 2.6vw, 2.5rem);
  grid-template-columns: 1fr;
}

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

.grid__empty {
  padding: 3rem 0;
  color: var(--ink-3);
  text-align: center;
}

/* ── Card ──────────────────────────────────────────────────────────────── */

.card {
  display: flex;
  flex-direction: column;
}

/* The `hidden` attribute hides via the UA stylesheet's display:none, which
   ANY explicit display rule outranks — and .card sets display:flex. So the
   category filter set hidden on every non-matching card and nothing moved.
   This is the rule that makes filtering actually work. */
.card[hidden] {
  display: none;
}

.card__open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.card__frame {
  /* A <span>, because a <button>'s content model is phrasing content — so it
     needs an explicit box before aspect-ratio and width mean anything. */
  display: block;
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--shot-ground, var(--paper-2));
  box-shadow: var(--shadow-card);
  transition:
    box-shadow 0.28s cubic-bezier(0.2, 0.7, 0.3, 1),
    transform 0.28s cubic-bezier(0.2, 0.7, 0.3, 1),
    border-color 0.28s ease;
}

.card__open:hover .card__frame,
.card__open:focus-visible .card__frame {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
  border-color: var(--line-strong);
}

/* The preview is a real page scaled down. Width/height are the notional desktop
   viewport; --shot-scale is set from the card's measured width so the whole
   1440px layout lands exactly inside the frame. */
.card__frame iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 1440px;
  height: 900px;
  border: 0;
  transform: scale(var(--shot-scale, 0.4));
  transform-origin: top left;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.card__frame[data-loaded] iframe {
  opacity: 1;
}

/* Holding state: the template's own ground colour, so the card never flashes
   grey before settling into a dark or light design. */
.card__frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--shot-ground, var(--paper-2));
  opacity: 1;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.card__frame[data-loaded]::after {
  opacity: 0;
}

.card__view {
  position: absolute;
  right: 0.85rem;
  bottom: 0.85rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

.card__open:hover .card__view,
.card__open:focus-visible .card__view {
  opacity: 1;
  transform: translateY(0);
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.15rem 0.15rem 0;
}

.card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.card__name {
  font-size: 1.42rem;
  font-weight: 600;
  letter-spacing: 0;
}

.card__kind {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-3);
  text-align: right;
  white-space: nowrap;
}

.card__tagline {
  color: var(--ink-2);
  font-size: 0.95rem;
  max-width: 46ch;
}

.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.3rem;
}

.tag {
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.735rem;
  line-height: 1.45;
  white-space: nowrap;
}

/* "This one is running a real business" is the strongest claim on the card, so
   it gets the only weight the tag row carries — still no hue, per the palette. */
.tag--live {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  border-color: var(--ink-3);
  color: var(--ink);
  font-weight: 500;
}

.tag--live::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  animation: live-pulse 2.6s ease-in-out infinite;
}

@keyframes live-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.btn--live {
  background: transparent;
  color: var(--ink);
  border-color: var(--ink-3);
  font-weight: 500;
}

.btn--live:hover {
  background: var(--paper-2);
  border-color: var(--ink);
}

.btn--live[hidden] {
  display: none;
}

/* ── Closing ───────────────────────────────────────────────────────────── */

.closing {
  max-width: 1500px;
  margin-inline: auto;
  padding: 0 var(--gutter) clamp(3.5rem, 7vw, 6rem);
}

.closing h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.35rem);
  letter-spacing: 0;
}

.closing p {
  margin-top: 0.85rem;
  max-width: var(--measure);
  color: var(--ink-2);
  line-height: 1.65;
}

.closing em {
  font-style: italic;
  color: var(--ink);
}

.footer {
  padding: 1.75rem var(--gutter) 3rem;
  max-width: 1500px;
  margin-inline: auto;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 2rem;
  justify-content: space-between;
  color: var(--ink-3);
  font-size: 0.84rem;
}

/* ── Viewer ────────────────────────────────────────────────────────────── */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}

.viewer[hidden] {
  display: none;
}

.viewer__bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--bar-h);
  padding: 0 clamp(0.75rem, 2vw, 1.25rem);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.viewer__identity {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.viewer__close {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.8rem 0.45rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.83rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition:
    color 0.16s ease,
    border-color 0.16s ease;
}

.viewer__close:hover {
  color: var(--ink);
  border-color: var(--ink-3);
}

.viewer__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.viewer__center {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.viewer__pages select {
  appearance: none;
  padding: 0.44rem 1.9rem 0.44rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  /* Chevron drawn with a gradient pair so no colour literal is needed. */
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 15px) center,
    calc(100% - 10px) center;
  background-size:
    5px 5px,
    5px 5px;
  background-repeat: no-repeat;
}

.viewer__pages select:hover {
  color: var(--ink);
  border-color: var(--ink-3);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--paper-2);
  border: 1px solid var(--line);
}

.segmented button {
  padding: 0.34rem 0.78rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 0.79rem;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  transition:
    background 0.16s ease,
    color 0.16s ease;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button[aria-pressed="true"] {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-card);
}

.viewer__end {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.viewer__stage {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  padding: 0;
  background: var(--paper-2);
  overflow: auto;
}

.viewer__frame {
  width: 100%;
  height: 100%;
  background: var(--paper);
  transition:
    width 0.32s cubic-bezier(0.2, 0.7, 0.3, 1),
    height 0.32s cubic-bezier(0.2, 0.7, 0.3, 1),
    margin 0.32s cubic-bezier(0.2, 0.7, 0.3, 1),
    border-radius 0.32s ease;
}

.viewer__frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Device sizes are real widths, so the template's own breakpoints do the work. */
.viewer__stage[data-size="tablet"] .viewer__frame {
  width: 834px;
  max-width: 100%;
  height: calc(100% - 2.5rem);
  margin: 1.25rem 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-pop);
}

.viewer__stage[data-size="phone"] .viewer__frame {
  width: 390px;
  max-width: 100%;
  height: calc(100% - 2.5rem);
  margin: 1.25rem 0;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow-pop);
}

/* ── Chosen dialog ─────────────────────────────────────────────────────── */

.chosen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: color-mix(in srgb, var(--ink) 42%, transparent);
  backdrop-filter: blur(3px);
}

.chosen[hidden] {
  display: none;
}

.chosen__panel {
  width: min(30rem, 100%);
  padding: clamp(1.5rem, 4vw, 2.25rem);
  border-radius: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
}

.chosen__panel h2 {
  margin: 0.55rem 0 0.7rem;
  font-size: 1.55rem;
  letter-spacing: 0;
}

.chosen__panel p {
  color: var(--ink-2);
  font-size: 0.94rem;
  line-height: 1.6;
}

.chosen__slug {
  margin-top: 1rem;
}

.chosen__slug code {
  display: inline-block;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink);
}

.chosen__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* ── Responsive + motion ───────────────────────────────────────────────── */

@media (max-width: 60rem) {
  .viewer__center .segmented {
    display: none;
  }
  .viewer__end .btn--ghost {
    display: none;
  }
}

@media (max-width: 40rem) {
  .viewer__name {
    display: none;
  }
  .masthead__actions .btn--ghost {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
