/* The demo shell: a dark app window, a top bar, a step rail, the guide strip and the helpers every screen shares.
   Built on the tokens of assets/site.css and the .m- components of assets/mockup.css. Tokens only, no raw colors. */

html { background: var(--charcoal); scroll-padding-top: 76px; }
body.demo { background: var(--charcoal); color: var(--white); font: 400 15px/1.55 var(--sans); }
[hidden] { display: none !important; }

/* ---------- Frame ---------- */

/* The app is a .mockup so the m- components find their surface variables; the frame chrome is turned off. */
.demo-app {
  /* The app shell is the page itself, as in the reference; the windows inside it are lifted panels. */
  --m-0: var(--charcoal); --m-1: var(--panel); --m-2: var(--elev);
  --top-h: 57px;
  container-type: normal;
  display: grid;
  grid-template-columns: 208px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  border: 0; border-radius: 0; box-shadow: none; overflow: visible;
  font-size: 14.5px;
}
.demo-app h1, .demo-app h2, .demo-app h3, .demo-app h4 { color: var(--white); text-wrap: balance; }

.demo-top {
  grid-column: 1 / -1;
  position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 10px 16px; min-height: var(--top-h);
  background: var(--m-0); border-bottom: 1px solid var(--hair);
}
.demo-brand { font: 600 20px/1 var(--display); letter-spacing: -0.04em; color: var(--white) !important; text-decoration: none; padding: 6px 2px; }
.demo-pack { padding-left: 12px; border-left: 1px solid var(--edge); color: var(--soft); font-size: 13.5px; white-space: nowrap; }
.demo-gap { flex: 1 1 0; }
.demo-top .m-chip, .demo-top .m-role { max-width: 100%; }
.demo-top .m-role b { text-transform: none; }

/* Buttons: the m-btn spans of the mockup kit, as real buttons. */
button.m-btn, a.m-btn { cursor: pointer; text-decoration: none; min-height: 36px; justify-content: center; font-family: var(--sans); transition: background-color 0.15s ease, border-color 0.15s ease; }
button.m-btn:hover:not(:disabled), a.m-btn:hover { border-color: var(--white); }
button.m-btn.is-primary:hover:not(:disabled) { background: var(--pink-hover); border-color: var(--pink-hover); }
button.m-btn:disabled, button.m-btn[aria-disabled="true"] { cursor: not-allowed; border-style: dashed; border-color: var(--soft); background: var(--m-1); color: var(--soft); }
button.m-btn:active:not(:disabled) { transform: translateY(1px); }

/* ---------- Step rail ---------- */

.demo-rail { position: sticky; top: var(--top-h); align-self: start; max-height: calc(100vh - var(--top-h)); overflow-y: auto; padding: 14px 10px; border-right: 1px solid var(--hair); }
.demo-rail ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.demo-rail a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--soft); font-size: 14px; text-decoration: none; white-space: nowrap;
}
.demo-rail a:hover { background: var(--veil); color: var(--white); }
.demo-rail .n {
  flex: none; width: 24px; height: 24px; display: grid; place-items: center;
  border: 1.5px solid var(--soft); border-radius: 50%; font: 500 12px/1 var(--mono); color: var(--soft);
}
.demo-rail a[aria-current="page"] { background: var(--m-2); color: var(--white); box-shadow: inset 3px 0 0 var(--pink); font-weight: 500; }
.demo-rail a[aria-current="page"] .n { background: var(--white); border-color: var(--white); color: var(--charcoal); font-weight: 600; }

/* ---------- Main column ---------- */

.demo-main { min-width: 0; padding: 20px 28px 56px; }
#guide {
  display: flex; gap: 10px; align-items: baseline;
  max-width: 1200px; margin: 0 auto 18px; padding: 10px 14px;
  background: var(--cyan-veil); border: 1px solid var(--cyan-line); border-radius: 10px;
  color: var(--white); font-size: 14.5px; line-height: 1.45;
}
#guide::before { content: "\2192"; flex: none; color: var(--cyan); font-weight: 600; }
#guide:empty { display: none; }
#screen { container-type: inline-size; max-width: 1200px; margin: 0 auto; min-width: 0; }
#screen > section { animation: d-in 0.18s ease-out; }
#screen > section:focus { outline: none; }
@keyframes d-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.d-title { font: 500 clamp(22px, 1.2rem + 1vw, 30px)/1.2 var(--display); letter-spacing: -0.02em; margin: 4px 0 8px; }
.d-lead { color: var(--soft); max-width: 46em; margin: 0 0 18px; }
.d-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.d-skip { position: absolute; left: 8px; top: -60px; z-index: 40; padding: 8px 14px; background: var(--white); color: var(--charcoal); border-radius: 8px; }
.d-skip:focus { top: 8px; outline: 2px solid var(--cyan); }
.d-noscript { padding: 24px; color: var(--white); }

/* Tabs, for screens that switch panels: <div class="d-tabs" role="tablist"><button role="tab" aria-selected="true">. */
.d-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--hair); margin-bottom: 16px; }
.d-tabs button {
  appearance: none; background: transparent; border: 0; border-bottom: 3px solid transparent; border-radius: 6px 6px 0 0;
  padding: 9px 14px; color: var(--soft); font: 500 14px/1.2 var(--sans); cursor: pointer; min-height: 40px;
}
.d-tabs button:hover { color: var(--white); background: var(--veil); }
.d-tabs button[aria-selected="true"] { color: var(--white); border-bottom-color: var(--pink); }

/* ---------- Phones: the rail becomes a step bar that scrolls inside itself ---------- */

@media (max-width: 760px) {
  .demo-app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); }
  .demo-top { position: static; padding: 10px 16px; }
  .demo-pack { order: 5; flex: 1 0 100%; padding-left: 0; border-left: 0; white-space: normal; }
  .demo-gap { display: none; }
  .demo-top .m-btn { margin-left: auto; }
  .demo-rail { position: sticky; top: 0; z-index: 20; max-height: none; overflow: visible; padding: 0; border-right: 0; border-bottom: 1px solid var(--hair); background: var(--m-0); min-width: 0; }
  .demo-rail ol { display: flex; gap: 4px; overflow-x: auto; padding: 8px 16px; scrollbar-width: thin; scroll-padding-inline: 16px; }
  .demo-rail a { min-height: 44px; padding: 8px 12px; border: 1px solid var(--hair); }
  .demo-rail a[aria-current="page"] { box-shadow: none; border-color: var(--soft); }
  .demo-main { padding: 16px 16px 48px; }
  html { scroll-padding-top: 64px; }
}

/* ---------- Speed and motion ---------- */

html.is-fast *, html.is-fast *::before, html.is-fast *::after { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
