/* The /demo playground: the full Pulse tour with room to breathe. Devices are sized much
   larger than the hero ever allowed, so the framed page is actually readable. Requires tokens.css,
   pulse.css and home.css. */

.playground { width: 100%; max-width: 76rem; margin: 0 auto; padding: 0 1.25rem 4rem; }
.playground-top { width: 100%; max-width: 76rem; margin: 0 auto; padding: 0 1.25rem; }
.playground .device-rail { margin: 0 auto 1.75rem; width: max-content; }

/* Settings on the left, preview on the right, so a tall phone does not push the controls
   off screen. The columns collapse below the width the laptop needs. */
.playground__split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 7fr); gap: 2rem; align-items: start; }
@media (max-width: 1180px) { .playground__split { grid-template-columns: 1fr; } }

.tool-panel { position: sticky; top: 1.5rem; display: flex; flex-direction: column; gap: 1.5rem; padding: 1.25rem; border: 1px solid var(--border-default); border-radius: var(--radius-card); background: var(--surface-default); box-shadow: var(--shadow-subtle); text-align: left; }
@media (max-width: 1180px) { .tool-panel { position: static; } }
.tool-panel__group { display: flex; flex-direction: column; gap: 0.35rem; }
.tool-panel__label { margin: 0 0 0.15rem; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.6875rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-muted); }
.tool-panel__list { display: flex; flex-direction: column; gap: 0.15rem; }
.tool-panel__note { margin: 0; padding-top: 1rem; border-top: 1px solid var(--border-subtle); font-size: 0.8125rem; line-height: 1.45; color: var(--text-muted); }
.tool-panel__note--tight { padding-top: 0.35rem; border-top: 0; }
.tool-panel__note.is-bad { color: var(--text-error); }
.tool-panel__email { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.5rem; }
.tool-panel .try-input { font-size: 0.9375rem; padding: 0.55rem 0.7rem; }
.tool-panel [hidden] { display: none !important; }

.tool-opt { display: flex; align-items: center; gap: 0.6rem; width: 100%; padding: 0.5rem 0.65rem; border: 1px solid transparent; border-radius: 0.6rem; background: transparent; font: inherit; font-size: 0.9375rem; color: var(--text-body); text-align: left; cursor: pointer; transition: background-color 140ms, color 140ms, border-color 140ms; }
.tool-opt:hover { background: var(--surface-muted); }
.tool-opt:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(227,27,84,0.16); }
.tool-opt.is-on { background: var(--surface-brand-soft); border-color: var(--primitive-brand-200); color: var(--color-scheme-1--text_brand_primary); font-weight: 500; }
.tool-opt__dot { flex-shrink: 0; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--border-default); transition: background-color 140ms; }
.tool-opt.is-on .tool-opt__dot { background: var(--surface-brand); }

.tool-switch { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; width: 100%; padding: 0.5rem 0.65rem; border: 0; border-radius: 0.6rem; background: transparent; font: inherit; font-size: 0.9375rem; color: var(--text-body); text-align: left; cursor: pointer; transition: background-color 140ms, color 140ms; }
.tool-switch:hover { background: var(--surface-muted); }
.tool-switch:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(227,27,84,0.16); }
.tool-switch.is-on { color: var(--text-primary); font-weight: 500; }
.tool-switch__track { position: relative; flex-shrink: 0; width: 2.1rem; height: 1.2rem; border-radius: 99px; background: var(--border-default); transition: background-color 160ms var(--easing-standard, ease); }
.tool-switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: calc(1.2rem - 4px); height: calc(1.2rem - 4px); border-radius: 50%; background: #fffffd; box-shadow: 0 1px 2px rgba(10,13,18,0.3); transition: transform 160ms var(--easing-standard, ease); }
.tool-switch.is-on .tool-switch__track { background: var(--surface-brand); }
.tool-switch.is-on .tool-switch__track::after { transform: translateX(0.9rem); }
@media (prefers-reduced-motion: reduce) { .tool-switch__track, .tool-switch__track::after { transition: none; } }
.playground__head { padding: clamp(1.5rem, 5vw, 3rem) 0 1.5rem; text-align: center; }
.playground__head .lede { margin-left: auto; margin-right: auto; }
.playground .demo { gap: 1rem; }
.playground .demo { gap: 0; }
.playground .demo .pulse-card { max-width: 34rem; }

.demo-stage { position: relative; display: grid; place-items: center; width: 100%; min-height: 21rem; transition: height 260ms var(--easing-standard, ease); }
.demo-stage > [hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { .demo-stage { transition: none; } }

.device-rail { display: flex; gap: 0.375rem; padding: 0.25rem; border: 1px solid var(--border-default); border-radius: 99px; background: var(--surface-default); box-shadow: 0 1px 2px rgba(10,13,18,0.06); }
.device-rail .chip { border: 0; background: transparent; box-shadow: none; }
.device-rail .chip.is-on { background: var(--surface-brand-soft); color: var(--color-scheme-1--text_brand_primary); font-weight: 500; }

.extra-rail { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; justify-content: center; }
.extra-rail__label { font-size: 0.8125rem; color: var(--text-muted); }
.extra-rail .chip { font-size: 0.8125rem; padding: 0.3rem 0.7rem; }
.extra-rail .chip::before { content: ""; width: 0.45rem; height: 0.45rem; margin-right: 0.4rem; border-radius: 50%; background: var(--border-default); transition: background-color 150ms; }
.extra-rail .chip.is-on::before { background: var(--surface-brand); }

.device { --shell: #10131a; }
.device-screen { border: 0; display: block; transform-origin: top left; background: var(--surface-brand-soft); }

/* Phone: 312x664 of screen, so a 390px viewport renders at 312/390. */
.device-phone { position: relative; width: 21rem; height: 43rem; padding: 12px; border-radius: 3.25rem; background: var(--shell); box-shadow: 0 30px 70px -22px rgba(10,13,18,0.45), 0 2px 6px rgba(10,13,18,0.18), inset 0 0 0 1.5px rgba(255,255,255,0.16); }
.device-phone__screen { width: 312px; height: 664px; border-radius: 2.6rem; overflow: hidden; background: var(--surface-brand-soft); }
.device-phone__island { position: absolute; top: 24px; left: 50%; transform: translateX(-50%); width: 92px; height: 26px; border-radius: 99px; background: var(--shell); z-index: 2; }
.device-phone::before, .device-phone::after { content: ""; position: absolute; left: -3px; width: 3px; border-radius: 3px 0 0 3px; background: var(--shell); }
.device-phone::before { top: 142px; height: 38px; }
.device-phone::after { top: 196px; height: 64px; }
.device-phone .device-screen { width: 390px; height: 830px; transform: scale(0.8); }

/* Laptop: 712x445 of screen (16:10), so a 1280px viewport renders at 712/1280. */
.device-laptop { width: 46rem; }
.device-laptop__lid { padding: 12px; border-radius: 1rem 1rem 0.25rem 0.25rem; background: var(--shell); box-shadow: 0 30px 70px -24px rgba(10,13,18,0.45), inset 0 0 0 1.5px rgba(255,255,255,0.14); }
.device-laptop__screen { width: 712px; height: 445px; border-radius: 0.25rem; overflow: hidden; background: var(--surface-brand-soft); }
.device-laptop__base { position: relative; left: 50%; transform: translateX(-50%); width: 48rem; height: 13px; border-radius: 0 0 0.75rem 0.75rem; background: linear-gradient(var(--primitive-n-300, #cdd0d7), var(--primitive-n-400, #a3a8b3)); box-shadow: 0 6px 14px -6px rgba(10,13,18,0.35); }
.device-laptop__base span { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 110px; height: 6px; border-radius: 0 0 0.375rem 0.375rem; background: rgba(10,13,18,0.16); }
.device-laptop .device-screen { width: 1280px; height: 800px; transform: scale(0.55625); }

/* Below the widest device there is no room to frame anything, so the raw card wins. */
@media (max-width: 820px) {
  .demo-stage { min-height: 0; height: auto; }
  .device-rail { display: none; }
  .device { display: none !important; }
  .playground .demo .pulse-card { min-height: 21rem; }
}
