/* #status: Vivi's answer to "where is Vivi today?" on the page itself (js/status.js). The components are ports of
   assistant-ui's AgentCard and AgentPlan in the site's tokens (css/site.css): bone / basalt surfaces a step lighter
   than the page, alpha borders, nested radii, glacier only for what is in progress now and the one primary action. */

#status {
  --st-r: 20px;        /* card radius (AgentCard rounded-[20px]) */
  --st-pad: 16px;      /* card padding (p-4) */
  --st-r-in: calc(var(--st-r) - var(--st-pad) + 4px);
  --st-gap: 0.75rem;
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
/* a proper section header on top, then Vivi's answer across the whole container (founder, 2026-11-26) */
#status.said {
  grid-template-columns: minmax(0, 1fr); row-gap: clamp(1.75rem, 3.5vw, 2.75rem);
  > h2 { grid-column: 1; grid-row: auto; max-width: 22ch; }
  > .st-answer { grid-column: 1; }
}

/* every rule is scoped to the section (nesting): the .said rules in css/site.css style bare <p>s in it */
#status {
p { padding-top: 0; }   /* .said's wide rule pads every <p>; the answer's own spacing is set below */
.st-answer { display: grid; gap: clamp(1.5rem, 3vw, 2.25rem); inline-size: 100%; min-inline-size: 0; }
/* no JS: the plain paragraphs (index.html) keep the section's usual look */
.st-answer[data-fallback] { gap: clamp(1rem, 2vw, 1.5rem); }

/* ---- the turn: the visitor's question, then Vivi's orb and one spoken line */
.st-ask {
  justify-self: end; max-inline-size: 80%; margin: 0;
  padding: 0.55rem 0.95rem; border-radius: 18px 18px 6px 18px;
  background: var(--paper-2); color: var(--ink-2); font-size: 1rem; line-height: 1.4;
}
.st-turn { display: grid; grid-template-columns: auto minmax(0, 62ch); justify-content: start; gap: 0.85rem; align-items: start; }
/* the question and Vivi's line on one row, read left to right; stacked on phones (the question to the right, as in a chat) */
.st-convo { display: grid; gap: 1rem; }
@media (width >= 700px) {
  .st-convo { grid-template-columns: auto minmax(0, 1fr); column-gap: clamp(1.25rem, 3vw, 2.5rem); align-items: start; }
  .st-ask { justify-self: start; max-inline-size: 22ch; margin-top: 0.1rem; }
}
.st-orb { --orb-size: 36px; margin-top: 0.05rem; }
.st-say { margin: 0; font-size: var(--step-1); line-height: 1.45; color: var(--ink); text-wrap: pretty; display: grid; }
.st-say > * { grid-area: 1 / 1; }
.st-think { color: var(--ink-3); font-size: 0.95rem; opacity: 0; align-self: start; padding-top: 0.45rem; }

/* ---- device cards: assistant-ui AgentCard content on the design system's Magic Card (.ds-card.ds-card--magic, Magic UI,
   js/ui/magic-card.js) + .ds-facts + .ds-chip. The device is the hero (a fixed 9rem stage, no fill: product shots sit on
   the card), the status chip in its top corner, then name, kind and two facts. Every card has the same rows and a
   reserved slot for the one disclosure, so closed cards are equal; cards align to the top of their row, so opening the
   laptop's extra specs grows only that card. */
.st-tested { display: grid; gap: var(--st-gap); }
.st-tested h3, .st-plan-head h3 { margin: 0; font-size: 0.95rem; font-weight: 600; line-height: 1.3; color: var(--ink); letter-spacing: -0.005em; }
.st-devs { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--st-gap); grid-template-columns: minmax(0, 1fr); align-items: stretch; }
.st-dev { align-content: start; }   /* spec tiles wrap differently per card: the cards in a row share one height */
@media (width >= 640px) { .st-devs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (width >= 1400px) { .st-devs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }   /* four equal cards; 2 x 2 below */
.st-devs > li { display: grid; }
.st-dev { grid-template-columns: minmax(0, 1fr) auto; row-gap: var(--ds-2); column-gap: var(--ds-3); align-items: start; }
.st-dev-media { grid-area: 1 / 1 / 2 / 3; block-size: 9rem; display: grid; place-items: center; margin-block-end: var(--ds-2); }
.st-dev-chip { grid-area: 1 / 2; position: relative; z-index: 1; justify-self: end; align-self: start; .aui-i { width: 0.95em; height: 0.95em; stroke-width: 2.4; } }
.st-dev-name { grid-row: 2; grid-column: 1 / -1; margin: 0; font: var(--ds-title); letter-spacing: var(--ds-title-track); color: var(--ink);
  text-wrap: balance; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.st-dev-kind { grid-row: 3; grid-column: 1 / -1; margin: -0.3rem 0 0; font: var(--ds-hint); color: var(--ink-3); }
.st-dev-facts { grid-row: 4; grid-column: 1 / -1; margin-top: var(--ds-1); }
.st-dev-slot { grid-row: 5; grid-column: 1 / -1; min-block-size: max(var(--target), 2rem); }
.st-dev-slot:empty { display: none; }   /* cards in a row share one height now (stretch), so an empty slot is only dead space */
.st-dev-slot:has(> [open]) { margin-top: 0; }   /* opened, the extra tiles follow the two above at the grid gap */

/* one visual size: the phone 128 px tall, the case 104, the landscape devices 144 px wide (the sizes their dithered
   stills are drawn at, so a dot stays one pixel at 1x / 2x / 3x) */
.st-shot { display: block; line-height: 0; }
.st-shot img { display: block; inline-size: auto; filter: drop-shadow(0 1px 1.5px var(--contact)); }
[data-st-dev="phone"] .st-shot img { block-size: 128px; }
[data-st-dev="buds"] .st-shot img { block-size: 104px; }
:is([data-st-dev="laptop"], [data-st-dev="tablet"]) .st-shot img { inline-size: 144px; block-size: auto; }
.st-shot--dark { display: none; }
html[data-scheme="dark"] & { .st-shot--light { display: none; } .st-shot--dark { display: block; } }

/* progressive disclosure: native <details>, smooth height (interpolate-size), chevron before the label */
.st-more {
  summary {
    list-style: none; display: inline-flex; align-items: center; gap: 0.3rem; cursor: pointer;
    min-block-size: max(var(--target), 2rem); margin-inline-start: -0.4rem; padding: 0 0.55rem 0 0.4rem; border-radius: 8px;
    font-size: 0.875rem; font-weight: 500; color: var(--ink-2);
    transition: background-color 150ms ease-out, color 150ms ease-out, scale 150ms ease-out;
    &::-webkit-details-marker { display: none; }
    &:hover { background: color-mix(in oklch, var(--ink) 6%, transparent); color: var(--ink); }
    &:active { scale: var(--press); }
    &:focus-visible { outline: var(--ds-focus-w) solid var(--ds-focus-c); outline-offset: 2px; }
  }
  .st-chev { width: 1em; height: 1em; stroke-width: 2.2; }
  &:dir(rtl) .st-chev { rotate: 180deg; }
  &[open] .st-chev { rotate: -90deg; }   /* the rows open above the toggle */
  &[open]:dir(rtl) .st-chev { rotate: -90deg; }
  /* the extra rows continue the list straight after the last row above (no gap); the toggle sits under them */
  display: flex; flex-direction: column;
  summary { order: 2; align-self: flex-start; }
  &[open] .st-more-closed, &:not([open]) .st-more-open { display: none; }
  &::details-content { order: 1; }
  > .ds-facts:not(.ds-facts--bento) > div:first-child { border-top: 1px solid var(--ds-divider); padding-top: 0.32rem; }
  > .ds-facts--bento { margin-block-end: var(--ds-2); }
  &::details-content { interpolate-size: allow-keywords; overflow: clip; contain: layout; }
  &:not([open])::details-content { block-size: 0; }
  @media (prefers-reduced-motion: no-preference) {
    .st-chev { transition: rotate 0.25s var(--ease-out); }
    &::details-content { transition: block-size 0.35s var(--ease-out), content-visibility 0.35s allow-discrete; }
  }
}
:root[data-motion="off"] & .st-more { .st-chev, &::details-content { transition: none; } }

/* ---- roadmap: AgentPlan on the design system's .ds-card + .ds-plan (css/ds.css owns the look; placement only here) */
.st-plan { gap: var(--ds-4); padding: var(--ds-4) var(--ds-5) var(--ds-5); }
.st-plan-head { display: flex; align-items: center; gap: var(--ds-3); }
.st-plan-gauge { --gauge-size: 2.75rem; }
.st-plan-head > .st-plan-count { margin-inline-start: auto; }
.st-plan-count { font: var(--ds-hint); color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---- the one next step */
.st-next { display: flex; justify-content: flex-end; }
/* the bar and #invite already carry the invite; here it is a plain text link, Vivi's one next step */
.st-cta { display: inline-flex; align-items: center; gap: 0.35rem; min-block-size: var(--target); font: 500 var(--step-0)/1.3 var(--font); color: var(--accent);
  text-decoration: underline; text-decoration-color: color-mix(in oklch, currentColor 35%, transparent); text-underline-offset: 0.2em;
  &:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
  .aui-i { width: 1em; height: 1em; stroke-width: 2.2; transition: translate 200ms var(--ease-out); }
  &:hover .aui-i { translate: 2px 0; } }

/* ---- the build: only while JS runs it with motion on (js/status.js); reduced motion never reaches these states */
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="off"]) & {
    .st-answer:is([data-build="pending"], [data-build="think"], [data-build="say"]) .st-in { opacity: 0; scale: 0.97; }
    .st-answer:is([data-build="pending"], [data-build="think"]) .st-w { opacity: 0; }
    .st-answer[data-build="think"] .st-think { opacity: 1; animation: st-think 1.2s ease-in-out infinite alternate; }
    .st-answer[data-build="pending"] .st-turn { opacity: 0; }
    .st-answer[data-build="say"] .st-w { animation: st-word 0.32s var(--ease-out) both; animation-delay: calc(var(--w) * 38ms); }
    .st-answer[data-build="cards"] .st-in { animation: st-in 0.5s var(--ease-enter) both; animation-delay: calc(var(--i) * 90ms); }
    .st-answer[data-build="cards"] .st-devs > .st-in { animation-delay: calc(90ms + var(--i) * 90ms); }
    .st-turn { transition: opacity 0.3s var(--ease-out); }
  }
}
}
@keyframes st-word { from { opacity: 0; filter: blur(4px); } to { opacity: 1; filter: none; } }
@keyframes st-in { from { opacity: 0; scale: 0.97; } to { opacity: 1; scale: 1; } }
@keyframes st-think { from { opacity: 0.45; } to { opacity: 1; } }

/* opening one card's extra specs grows only that card: closed cards keep their own height (founder: "expanding one card breaks all") */
#status .st-devs:has(details[open]) { align-items: start; }
#status .st-devs:has(details[open]) > li { align-self: start; }
.st-dev-facts :is(dd, .ds-facts-v, b) { hyphens: manual; }
