/* Shared styles for the demo pages only. Not part of the library. */

:root {
  --bg: #0c0d12;
  --bg-2: #14161d;
  --fg: #f3f1ec;
  --muted: #a8a7a2;
  --line: rgb(255 255 255 / .1);
  --line-2: rgb(255 255 255 / .2);
  --mw-accent: #c9f26b;
  --mw-accent-fg: #11140a;
  --mw-ease: cubic-bezier(.16, 1, .3, 1);
  /* Demo palette: one hue per demo through --d-tint. */
  --lime: #c9f26b;
  --sky: #7cc4ff;
  --coral: #ff7a59;
  --violet: #a78bfa;
  --mint: #5eead4;
  --amber: #ffc857;
  --rose: #ff6fae;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

/* Light pages (white media such as the sample video): <html class="d-light">. */
html.d-light {
  --bg: #fff;
  --fg: #121212;
  --muted: #5f5d58;
  --line: rgb(0 0 0 / .1);
  --line-2: rgb(0 0 0 / .2);
  --mw-accent: #121212;
  --mw-accent-fg: #fff;
  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

img, svg, video, canvas { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.06; letter-spacing: -.025em; text-wrap: balance; }
p { margin: 0; }
code { font-family: var(--mono); font-size: .9em; }
em.serif, .serif { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; }

.wrap { width: min(1200px, 100%); margin-inline: auto; padding-inline: 16px; }
@media (min-width: 768px) { .wrap { padding-inline: 40px; } }

.demo-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: .85rem;
  color: var(--muted);
}
/* The back link is a 44 × 44 px target (WCAG 2.5.5); the negative margins keep
   the bar as tall as the text and the label where it was. */
.demo-bar a {
  display: inline-flex;
  flex: none;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  margin: -11px -10px;
  padding-inline: 10px;
  border-radius: 10px;
  color: var(--fg);
  text-decoration: none;
}
.demo-bar a:hover { text-decoration: underline; }
.demo-bar a:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }
.demo-bar code { font-family: var(--mono); font-size: .8rem; overflow-wrap: anywhere; text-align: right; }

.intro { padding-block: clamp(36px, 7vw, 80px) clamp(24px, 4vw, 44px); }
/* Title left, lead right on wide screens: the demo starts higher in the fold. */
@media (min-width: 960px) {
  .intro--split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); gap: 24px 64px; align-items: end; }
  .intro--split .eyebrow { grid-column: 1 / -1; margin-bottom: -8px; }
  .intro--split .lead { margin-top: 0; padding-bottom: .5em; }
}
.eyebrow {
  margin-bottom: 14px;
  color: var(--d-tint, var(--mw-accent));
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.title { font-size: clamp(2.4rem, 6.2vw, 5rem); font-weight: 760; letter-spacing: -.035em; }
.title .tint, .tint { color: var(--d-tint, var(--mw-accent)); }
.lead { max-width: 60ch; margin-top: 18px; color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.12rem); line-height: 1.6; text-wrap: pretty; }
.lead code, .note code { color: var(--fg); }

.section { padding-block: clamp(56px, 9vw, 112px); }
.section + .section { border-top: 1px solid var(--line); }
.section h2 { font-size: clamp(1.8rem, 4.2vw, 3rem); letter-spacing: -.03em; }
.section .lead { margin-top: 14px; }

.grid { display: grid; gap: 16px; margin-top: 32px; }
@media (min-width: 720px) {
  .grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Text card: thin border, no fill. Demonstrations never sit in a filled box. */
.card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
}
.card h3 { font-size: 1.15rem; margin-bottom: 8px; }
.card p { color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--mw-accent);
  color: var(--mw-accent-fg);
  font: 700 1rem/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: transform .4s var(--mw-ease), filter .3s;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn--ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

.code {
  margin-top: 28px;
  padding: 18px 20px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: color-mix(in srgb, var(--fg) 82%, transparent);
  font: .82rem/1.6 var(--mono);
  white-space: pre;
  tab-size: 2;
}

.note { margin-top: 16px; color: var(--muted); font-size: .9rem; }

/* Property table: a code name and what it does, one per row. */
.d-specs { display: grid; margin-top: 28px; border-top: 1px solid var(--line); font-size: .95rem; }
.d-specs > div { display: grid; grid-template-columns: minmax(0, 12rem) minmax(0, 1fr); gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.d-specs code { color: var(--d-tint, var(--mw-accent)); font: .84rem/1.6 var(--mono); overflow-wrap: anywhere; }
.d-specs span { color: var(--muted); }
@media (max-width: 560px) { .d-specs > div { grid-template-columns: minmax(0, 1fr); gap: 4px; } }

/* Small scroll hint under a first fold. */
.d-hint { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; }
.d-hint::before { content: ""; width: 1px; height: 28px; background: linear-gradient(var(--d-tint, var(--mw-accent)), transparent); }

/* Pause control for anything that moves by itself for more than 5 s (WCAG
   2.2.2): visible, labelled, 44 px tall, and it stays paused until pressed again
   (d-pause.js). Nothing moves under reduced motion, so it hides there. */
.d-pause {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 18px 0 15px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  color: var(--fg);
  font: 600 .88rem/1 var(--sans);
  white-space: nowrap;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  transition: border-color .3s;
}
.d-pause:hover { border-color: var(--d-tint, var(--mw-accent)); }
.d-pause:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }
.d-pause svg { flex: none; width: 13px; height: 13px; fill: currentColor; }
.d-pause[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .d-pause { display: none; } }

.spacer { height: 60vh; display: grid; place-items: center; color: var(--muted); font-size: .9rem; }

.demo-footer { padding-block: 48px 64px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
  .btn:hover { transform: none; }
}
