/* Preview a demo request: the product page title and lead on the gutter, as on every product
   page, then one raised card that holds the form and a quiet side panel, then the local test
   inbox. Shared parts (header, footer, page-top rhythm, lead, card, icon tile, step badge,
   buttons, link, chips, text fields, inline errors and status notes) come from styles.css;
   tokens from brand.css.
   The card is one grid. Its three parts follow the reading order a phone needs (the
   fictional-details note, the form, what a walkthrough covers). From 64rem the note and the
   walkthrough move into a tinted side column that runs the full height of the card. */

.demo-page { --pane: clamp(1.25rem, 4.4vw, 4rem); --side: clamp(1.25rem, 3.4vw, 3rem); }

/* ---------- Title ---------- */
.demo-head { margin-bottom: 2.5rem; }
.demo-lead { max-width: 34rem; text-wrap: balance; }
/* Where the first sentence fits on one line, break between the sentences instead of balancing. */
@media (min-width: 48rem) and (max-width: 63.99rem), (min-width: 72rem) {
  .demo-lead { text-wrap: pretty; }
}

/* ---------- The card ---------- */
.demo-card {
  display: grid; grid-template-columns: minmax(0, 1fr);
  box-shadow: inset 0 0 0 1px var(--hairline), var(--shadow-3);
}

/* The quiet side panel: the panel tint (Soft iris fading to Chalk) with two pre-blurred glows. */
.demo-card::before, .walkthrough {
  background:
    radial-gradient(70% 34rem at 100% 0%, rgb(182 185 255 / .24), rgb(182 185 255 / 0) 72%),
    radial-gradient(80% 24rem at 0% 100%, rgb(255 241 199 / .6), rgb(255 241 199 / 0) 70%),
    var(--panel-tint);
}

/* Local saving: a small surface at the top of the card, so the honest scope is read first. Its
   heading carries a plain inline glyph, like a chip or the storage note. */
.demo-note {
  margin: var(--pane) var(--pane) 0; padding: 1.25rem 1.25rem .5rem;
  border-radius: 1.25rem;
  background: var(--panel-tint);
  box-shadow: inset 0 0 0 1px var(--hairline);
}
.demo-note h2 {
  display: flex; align-items: center; gap: .625rem;
  font: 700 1rem/1.5rem var(--font-body); letter-spacing: -.005em;
}
.demo-note h2 .icon { width: 1.25rem; height: 1.25rem; stroke-width: 1.9; }
.demo-note p { margin-top: .75rem; color: var(--ink-muted); text-wrap: pretty; }
.demo-note .link { margin-top: .25rem; }
.link .icon.is-down { rotate: 90deg; }

/* ---------- The form ---------- */
.demo-form { padding: 2rem var(--pane) clamp(2rem, 5vw, 4rem); }
.demo-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.demo-form fieldset + fieldset { margin-top: 2.25rem; padding-top: 2rem; border-top: 1px solid var(--hairline); }
/* A floated legend sits in normal flow, so the divider above the second group stays a plain rule. */
.demo-form legend {
  float: left; width: 100%;
  display: flex; align-items: center; gap: .75rem;
  margin: 0 0 1.25rem; padding: 0;
  font: 700 var(--type-subheading)/var(--leading-subheading) var(--font-display); letter-spacing: -.018em;
}
.demo-form legend + * { clear: both; }

.field { display: grid; align-content: start; gap: .5rem; min-width: 0; }
.field-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
fieldset > :is(.field, .field-pair) + :is(.field, .field-pair) { margin-top: 1.25rem; }
.field-label { font: 650 var(--type-small)/var(--leading-small) var(--font-body); letter-spacing: -.003em; color: var(--text); }
.optional { font-weight: 400; color: var(--ink-muted); }


.form-actions { margin-top: 2.5rem; }
.demo-form .btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.demo-form .btn-primary:disabled .sparkles { visibility: hidden; }

/* The outcome under the button: the shared status note. */
.demo-form .status-note { margin-top: 1.25rem; }

/* ---------- What a walkthrough covers ---------- */
/* Its three tiles are the page's one static radiant list (brand.md §2): the page has no current
   item, and nothing else on it is radiant. */
.walkthrough {
  padding: 2rem var(--pane) clamp(2rem, 5vw, 3rem);
  border-top: 1px solid var(--hairline);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
}
.walkthrough h2 { font-size: var(--type-subheading); line-height: var(--leading-subheading); letter-spacing: -.018em; }
.cover-list { display: grid; gap: 1.5rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.cover-list li { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 1.125rem; }
.cover-list h3 { padding-top: .125rem; font: 700 1rem/1.5rem var(--font-body); letter-spacing: -.005em; }
.cover-list p { margin-top: .25rem; font-size: var(--type-small); line-height: var(--leading-small); color: var(--ink-muted); text-wrap: pretty; }
/* In the narrower side column (1024 to 1407 px) pretty still leaves "is ready." alone; balance it. */
@media (min-width: 64rem) and (max-width: 87.99rem) { .cover-list p { text-wrap: balance; } }
.walkthrough .link { margin-top: 1.25rem; }

/* ---------- Wide screens: form on the left, the tinted panel on the right ---------- */
@media (min-width: 40rem) {
  .field-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 64rem) {
  .demo-page { --pane: clamp(3rem, 4.4vw, 4rem); --side: clamp(2.25rem, 3.4vw, 3rem); }
  .demo-card {
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    /* The form spans both rows; the walkthrough follows the note, whichever side is taller. */
    grid-template-rows: auto 1fr;
    grid-template-areas: "form note" "form cover";
  }
  .demo-card::before {
    content: ""; grid-column: 2; grid-row: 1 / -1;
    border-radius: 0 var(--radius-card) var(--radius-card) 0;
    box-shadow: inset 1px 0 0 var(--hairline);
  }
  .demo-note {
    grid-area: note; align-self: start;
    margin: var(--side) var(--side) 0; padding: 1.5rem 1.5rem .75rem;
    background: rgb(255 255 255 / .82);
    box-shadow: inset 0 0 0 1px var(--hairline), var(--shadow-1);
  }
  /* The first legend lines up with the note's heading across the card. */
  .demo-form { grid-area: form; padding-top: calc(var(--side) + 1.5rem); }
  .walkthrough {
    grid-area: cover; align-self: start;
    padding: 2.5rem var(--side) var(--side);
    border: 0; border-radius: 0; background: none;
  }
}

/* On a tall enough desktop window the walkthrough keeps pace with the form as it scrolls. */
@media (min-width: 64rem) and (min-height: 46rem) {
  .walkthrough { position: sticky; top: 0; }
}

/* ---------- Local test inbox ---------- */
.inbox { margin-top: clamp(3.5rem, 8vw, 5.5rem); }
.inbox-title { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.inbox-title h2 { letter-spacing: -.025em; }
.inbox-head p { max-width: 46ch; margin-top: .5rem; color: var(--ink-muted); }
.inbox-list { margin-top: 1.5rem; padding: .5rem; }
.inbox-list:empty { display: none; }  /* without JavaScript nothing renders, so no empty strip */
#inbox-status { margin-top: 1.25rem; }

/* Empty or unavailable: one calm line under a plain icon tile. */
.inbox-empty { display: grid; justify-items: center; gap: .875rem; padding: 2.25rem 1.25rem 2.5rem; text-align: center; color: var(--ink-muted); text-wrap: balance; }

/* One request per row on a continuous surface; the open row takes the Soft iris selection. */
.request { border-radius: 1rem; }
.request + .request { margin-top: .25rem; }
.request + .request::before { content: ""; display: block; height: 1px; margin: 0 1rem .25rem; background: var(--hairline); }
.request summary {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: .875rem;
  min-height: 4.25rem; padding: .75rem 1rem; border-radius: 1rem;
  list-style: none;
  transition: background-color var(--dur-quick) ease;
}
.request summary::-webkit-details-marker { display: none; }
@media (hover: hover) { .request summary:hover { background: rgb(220 215 242 / .35); } }
.request[open] > summary { background: rgb(220 215 242 / .6); }
.request[open] { background: rgb(220 215 242 / .22); }
/* A person's initials: a circle with the avatar fill, as in the homepage queue and the app. */
.request-initial {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%;
  font: 700 1rem/1.5rem var(--font-body); color: var(--plum);
  background: var(--avatar-fill);
  box-shadow: inset 0 0 0 1px rgb(48 36 67 / .07), inset 0 1px 0 rgb(255 255 255 / .8);
}
.request-main { display: grid; min-width: 0; }
.request-name { font-weight: 700; letter-spacing: -.005em; overflow-wrap: anywhere; }
.request-meta { font-size: var(--type-small); line-height: var(--leading-small); color: var(--ink-muted); overflow-wrap: anywhere; }
.request .chip-outline.is-new::after { content: ""; width: .4375rem; height: .4375rem; margin-left: .125rem; border-radius: 50%; background: var(--poppy); }
.request-chevron { width: 1.25rem; height: 1.25rem; color: var(--ink-muted); transition: transform var(--dur-base) var(--ease-out); }
.request[open] .request-chevron { transform: rotate(180deg); }

.request-body { padding: .75rem 1rem 1.25rem; }
.request-body dl {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 1.5rem;
  overflow-wrap: anywhere;
}
.request-body dt { margin-top: .625rem; font-size: var(--type-small); line-height: var(--leading-small); color: var(--ink-muted); }
.request-body dd { margin: 0; }
.inbox-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin-top: 1.25rem; }

@media (min-width: 48rem) {
  .request-body { padding: .5rem 1rem 1.5rem 4.375rem; }
  .request-body dl { grid-template-columns: max-content minmax(0, 1fr); gap: .5rem 1.5rem; }
  .request-body dt { margin-top: 0; line-height: var(--leading-body); }
}
@media (min-width: 64rem) {
  .request-body dl { grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); column-gap: 2rem; }
}
@media (max-width: 29.99rem) {
  .request summary { grid-template-columns: auto minmax(0, 1fr) auto; row-gap: .5rem; }
  .request summary .chip { grid-column: 2; grid-row: 2; justify-self: start; }
  .request-chevron { grid-column: 3; grid-row: 1 / span 2; }
}

/* ---------- Phone ---------- */
@media (max-width: 47.99rem) {
  .demo-head { margin-bottom: 1.5rem; }
}

/* ---------- Forced colours ---------- */
/* The note and the request rows are drawn with tints and hairlines, which contrast themes drop. */
@media (forced-colors: active) {
  .demo-note, .request { border: 1px solid CanvasText; }
}
