body {
  display: grid;
  min-height: 100svh;
  grid-template-rows: auto 1fr auto;
  --demo-margin: clamp(1rem, 3.15vw, 4rem);
  --sun-color: #fff0d0;
  --sky-tone: #b7a7ee;
}
button { cursor: pointer; }
button:disabled { cursor: default; }
.demo-masthead, .demo-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-inline: var(--demo-margin);
}
.demo-masthead {
  min-height: 4.35rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.demo-masthead .wordmark { padding-inline: 0; }
.demo-masthead .brand-mark svg { width: 1.4rem; height: 1.4rem; }
.demo-daylight {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-height: 2rem;
  padding-inline: .7rem;
  border: 1px solid var(--selection);
  border-radius: 50rem;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: .77rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.demo-daylight > span {
  width: .44rem;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--accent);
}
.demo-main {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  width: min(calc(100% - var(--demo-margin) * 2), 96rem);
  min-height: min(40rem, 72svh);
  overflow: hidden;
  margin: clamp(.8rem, 3vh, 2rem) auto;
  padding: clamp(1.4rem, 5.1vw, 5.25rem);
  border: 1px solid var(--line);
  border-radius: clamp(.9rem, 2vw, 1.6rem);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.demo-sky, .demo-landscape, .demo-atmosphere {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.demo-sky { overflow: hidden; z-index: -1; isolation: isolate; background: var(--night); }
.demo-landscape {
  background: center 53% / cover no-repeat url('/static/cedarline-daylight.webp'),
    linear-gradient(#a5aac3 0 46%, #746e8e 64%, #393144);
  filter: saturate(.88) contrast(1.04);
  animation: landscape-drift 16s ease-in-out infinite alternate;
}
@keyframes landscape-drift {
  from { transform: translateX(-1%) scale(1.025); }
  to { transform: translateX(1.15%) scale(1.093); }
}
.demo-atmosphere {
  background: radial-gradient(ellipse at 69% 34%, var(--sky-tone), transparent 60%);
  mix-blend-mode: screen;
  animation: light-drift 12s ease-in-out infinite alternate;
}
@keyframes light-drift {
  from { transform: translate(-8%, 2%) scale(1.04); opacity: .2; }
  to { transform: translate(6%, -3%) scale(1.18); opacity: .64; }
}
.demo-sky:not([data-motion-running]) :is(.demo-landscape, .demo-atmosphere) {
  animation-play-state: paused;
}
.demo-sun {
  position: absolute;
  top: var(--solar-y, 27%);
  left: calc(46% + var(--solar-x, 60%) * .51);
  width: clamp(1.2rem, 3vw, 3rem);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: var(--solar-opacity, .9);
  background: #fffbea;
  filter: blur(1px);
  box-shadow: 0 0 .58rem .13rem var(--sun-color),
    0 0 3rem 1rem color-mix(in srgb, var(--sun-color) 56%, transparent),
    0 0 8rem 3rem color-mix(in srgb, var(--sky-tone) 53%, transparent);
  transform: translate(-50%, -50%);
}
body[data-daylight='dawn'], body[data-daylight='dusk'] { --sun-color: #ffd7af; --sky-tone: #dcabd0; }
body[data-daylight='afternoon'] { --sun-color: #fff2c5; --sky-tone: #c0bbfa; }
body[data-daylight='night'] { --sky-tone: #443768; }
body[data-daylight='night'] .demo-landscape { filter: brightness(.64) saturate(.77); }
.demo-motion-toggle {
  position: absolute;
  inset: auto 1rem 1rem auto;
  display: grid;
  width: 2.95rem;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 48%);
  border-radius: .75rem;
  color: var(--surface);
  background: rgb(24 19 37 / 82%);
  transition: background-color 160ms ease, transform 180ms var(--motion-soft);
}
.demo-motion-toggle svg { width: 1.18rem; height: 1.18rem; }
.demo-motion-toggle:focus-visible { outline-color: var(--surface); }
.demo-motion-toggle:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) {
  .demo-motion-toggle:hover { background: var(--night); }
}
.demo-hero {
  width: min(35rem, 66%);
  padding: clamp(1.4rem, 3.1vw, 3.2rem);
  border: 1px solid var(--line);
  border-radius: 1.2rem;
  background: var(--surface);
  box-shadow: 0 16px 46px #18132630;
  --demo-arrive-offset: 8px;
}
.demo-hero h1, .demo-step h2 { margin: 0; font-weight: 400; letter-spacing: -.035em; }
.demo-hero h1 {
  max-inline-size: 15ch;
  font-size: clamp(2.15rem, 5.2vw, 4rem);
  line-height: 1.07;
  text-wrap: balance;
}
.demo-hero h1, .demo-hero .demo-lede {
  animation: demo-arrive 380ms var(--motion-soft) both;
}
.demo-lede {
  max-width: 29rem;
  margin: 1rem 0 1.4rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.55;
  text-wrap: pretty;
}
.demo-hero .demo-lede { animation-delay: 60ms; }
.demo-entry { display: flex; align-items: center; flex-wrap: wrap; gap: .85rem; }
.demo-entry > span { font-size: .84rem; color: var(--muted); }
.demo-primary, .demo-back {
  display: inline-flex;
  gap: .55rem;
  justify-content: center;
  align-items: center;
  min-height: 2.85rem;
  padding: .62rem .95rem;
  border: 1px solid transparent;
  border-radius: .56rem;
  font-weight: 550;
  font-size: .9rem;
  transition: background 160ms ease, transform 180ms ease-out;
}
.demo-primary { color: var(--surface); background: var(--accent); }
.demo-primary:hover { background: var(--accent-strong); }
.demo-primary:active, .demo-back:active { transform: scale(.97); }
.demo-primary:disabled { opacity: .61; }
.demo-back {
  margin-top: .55rem;
  padding-inline: .25rem;
  color: var(--accent-strong);
  background: transparent;
  font-weight: 500;
  min-height: 2.35rem;
}
.demo-back:hover { text-decoration: underline; }
.demo-footer {
  min-height: 3.3rem;
  color: var(--muted);
  font-size: .78rem;
}
.demo-story { display: inline-flex; align-items: center; gap: .43rem; }
.demo-story span { color: var(--accent); }
.demo-flow { width: min(34rem, 100%); }
.demo-onboarding .demo-main { padding-block: clamp(1.25rem, 3vw, 3rem); }
.demo-step {
  border: 1px solid var(--selection);
  border-radius: var(--radius);
  padding: clamp(1.1rem, 3.6vw, 1.85rem);
  background: var(--surface);
  box-shadow: 0 .55rem 2.6rem #25185e1a;
  animation: demo-arrive 360ms cubic-bezier(.2, .73, .28, 1) both;
}
@keyframes demo-arrive {
  from { opacity: 0; transform: translateY(var(--demo-arrive-offset, 12px)); }
  to { opacity: 1; transform: none; }
}
.demo-step > :is(.demo-message, .demo-fields, .demo-step-actions) {
  animation: demo-arrive 390ms 52ms cubic-bezier(.2, .73, .28, 1) both;
}
.demo-agent {
  display: flex;
  align-items: center;
  gap: .65rem;
  color: var(--ink);
  font-size: .85rem;
  font-weight: 520;
  margin-bottom: .95rem;
}
.demo-agent small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  margin-top: .05rem;
}
.demo-agent > .demo-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.2rem;
  aspect-ratio: 1;
  border: 1px solid var(--selection);
  border-radius: .55rem;
  background: var(--accent-soft);
  color: var(--accent);
}
.demo-icon svg { width: 1.07rem; height: 1.07rem; display: block; }
.demo-step h2 {
  font-size: clamp(1.75rem, 3.8vw, 2.45rem);
  line-height: 1.13;
  overflow-wrap: anywhere;
  outline: none;
}
.demo-message {
  color: var(--muted);
  margin: .7rem 0 1rem;
  line-height: 1.52;
  overflow-wrap: anywhere;
}
.demo-fields { display: grid; gap: .7rem; }
.demo-field { display: grid; gap: .3rem; }
.demo-field label { font-size: .85rem; font-weight: 520; }
.demo-field input {
  width: 100%;
  min-height: 2.6rem;
  padding: .58rem .66rem;
  color: var(--ink);
  border-radius: .5rem;
  border: 1px solid var(--line);
  background: var(--canvas);
}
.demo-field input::placeholder { color: var(--subtle); }
.demo-field small, .demo-role small { color: var(--muted); font-size: .79rem; line-height: 1.4; }
.demo-consent { display: flex; align-items: start; gap: .5rem; font-size: .83rem; }
.demo-consent input, .demo-role input { accent-color: var(--accent); }
.demo-step-actions { display: flex; justify-content: flex-start; margin-top: .2rem; }
.demo-roles { border: 0; padding: 0; margin: 0; display: grid; gap: .48rem; }
.demo-role {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: .55rem;
  cursor: pointer;
  border: 1px solid var(--line);
  padding: .62rem .69rem;
  border-radius: .6rem;
  transition: background 170ms ease, border-color 170ms ease;
}
.demo-role:hover, .demo-role:has(:checked) {
  background: var(--accent-soft);
  border-color: var(--selection);
}
.demo-role strong, .demo-role small { display: block; }
.demo-role strong { font-weight: 520; }
.demo-role .demo-icon { color: var(--accent); }
.demo-error { color: #8c282e; font-size: .84rem; margin: .3rem 0 0; }
.demo-error:empty { display: none; }
.demo-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}
@media (max-width: 780px) {
  .demo-main, .demo-onboarding .demo-main {
    display: grid;
    grid-template-rows: minmax(clamp(10rem, 26svh, 15rem), 1fr) auto;
    align-items: stretch;
    min-height: 0;
    padding: 0;
  }
  .demo-sky { position: relative; z-index: auto; }
  .demo-sun { left: var(--solar-x, 64%); }
  .demo-motion-toggle { inset-block: 1rem auto; }
  .demo-hero, .demo-flow { width: 100%; }
  .demo-hero, .demo-step { border: 0; border-radius: 0; box-shadow: none; }
}
@media (max-width: 550px) {
  .demo-hero h1 { font-size: clamp(2.15rem, 8.8vw, 3rem); }
  .demo-footer { flex-direction: column; justify-content: center; align-items: start; gap: .2rem; }
  .demo-masthead .brand-mark { width: 2.15rem; height: 2.15rem; }
}
@media (prefers-reduced-motion: reduce) {
  .demo-landscape, .demo-atmosphere, .demo-hero h1, .demo-hero .demo-lede, .demo-step, .demo-step > *,
  .demo-primary, .demo-role, .demo-back { animation: none; transition: none; }
  .demo-atmosphere { opacity: .38; }
  .demo-motion-toggle { display: none; }
  .demo-primary:active, .demo-back:active { transform: none; }
}
