/* StepSim first-screen components for shell pages (docs/VISUAL_LANGUAGE.md
   sections 3.1 to 3.7 and 3.18): the hero with its story card, chips, the
   onboarding card, the how-it-works rail, people cards, mission cards with
   their story band, the CTA and the join card. Loaded after brand/shell.css,
   whose keyframes these rules use.

   Timing: entry motion plays only while an ancestor carries data-enter
   (section 4). Everything a person must read or press is in place by 700 ms;
   the story card is complete by 1.6 s. Any pointerdown or
   keydown removes data-enter and lands everything in its final state. */

/* ---------- 3.1 Hero with story card ---------- */
.gd-hero { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center; gap: clamp(24px, 4vw, 56px); }
.gd-hero-copy { min-width: 0; }
.gd-eyebrow { color: var(--accent); font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.gd-display { margin-top: 12px; text-wrap: balance; color: var(--ink); font-size: var(--fs-display); font-weight: 700; line-height: 1.1; letter-spacing: -.03em; }
.gd-hero .gd-lead { margin-top: 16px; max-width: 46ch; color: var(--ink-2); font-size: var(--fs-lead); line-height: 1.55; }
.gd-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 28px; }
.gd-quiet { color: var(--accent); font-size: var(--fs-ui); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
.gd-quiet:hover { color: var(--accent-press); text-decoration-color: currentColor; }

.gd-scene { position: relative; display: grid; gap: 10px; margin: 0; padding: 22px; overflow: hidden; border-radius: var(--r-2xl); color: var(--on-dark); background: var(--gradient-hero); background-size: 160% 160%; box-shadow: var(--shadow-scene); }
.gd-scene::before { content: ""; position: absolute; top: -80px; right: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgb(255 255 255 / 8%); pointer-events: none; }
.gd-scene > * { position: relative; }
.gd-scene-you { display: flex; align-items: center; gap: 10px; color: var(--on-dark-muted); font-size: 13px; line-height: 1.35; }
.gd-scene-you strong { display: block; color: var(--on-dark); font-size: 15px; }
.gd-scene-you .gd-av-you { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; color: var(--on-dark); background: rgb(255 255 255 / 10%); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 30%); font-size: 12px; font-weight: 700; }
.gd-scene-dash { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-lg); color: var(--ink); background: #fff; }
.gd-scene-k { font-size: 13px; font-weight: 650; }
.gd-scene-tiles { display: flex; gap: 4px; margin-left: auto; }
.gd-scene-tiles i { width: 18px; height: 18px; border-radius: 5px; background: #22c55e; }
.gd-scene-tiles i:nth-child(2) { background: #16a34a; }
.gd-scene-tiles i:nth-child(3) { background: #4ade80; }
.gd-scene-status { margin-left: auto; color: var(--ink-2); font-size: 13px; }

/* Bubbles: the typing dots and the line share one grid cell, so a bubble
   never changes height (3.9). */
.gd-bubble { display: flex; align-items: flex-end; gap: 8px; }
.gd-bubble-body { position: relative; max-width: 86%; padding: 10px 14px; border-radius: 16px 16px 16px 4px; color: var(--ink); background: #fff; font-size: 15px; line-height: 1.4; }
.gd-bubble-ai .gd-bubble-body { background: var(--ai-soft); }
.gd-bubble-right { justify-content: flex-end; }
.gd-bubble-right .gd-bubble-body { border-radius: 16px 16px 4px 16px; }
.gd-bubble-n { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 2px; color: var(--muted); font-size: 12px; font-weight: 650; }
.gd-bubble-ai .gd-bubble-n { color: var(--ai); }
.gd-msg { display: grid; }
.gd-msg > * { grid-area: 1 / 1; }
.gd-said { display: block; font-weight: 600; }
.gd-typing { display: inline-flex; align-items: center; gap: 4px; visibility: hidden; }
.gd-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.gd-av { flex: none; width: 40px; height: 40px; border-radius: 12px; background: #fff; }
.gd-av-ai { box-shadow: 0 0 0 2px var(--tool-line); }

.gd-scene-files { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 2px 0; padding: 0; list-style: none; }
.gd-scene-files li { display: grid; justify-items: center; gap: 6px; padding: 10px 4px; border: 1px dashed rgb(255 255 255 / 40%); border-radius: 12px; background: rgb(255 255 255 / 10%); color: var(--on-dark); font-size: 12px; line-height: 1.25; text-align: center; transition: transform var(--t-base) var(--ease-std), background-color var(--t-base) var(--ease-std); }
.gd-scene-files li:hover { transform: rotate(-3deg) translateY(-2px); background: rgb(255 255 255 / 16%); }
.gd-file-ico { width: 20px; height: 24px; border-radius: 3px 8px 3px 3px; background: rgb(255 255 255 / 85%); }
.gd-scene-clock { display: inline-flex; align-items: center; gap: 8px; justify-self: start; padding: 6px 12px; border-radius: var(--r-pill); color: var(--ink); background: var(--amber-pill); font-size: 13px; font-weight: 700; }
.gd-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--amber-dot); }

/* The card is complete by 1.6 s (design second pass S4); no gradient drift (R12). */
[data-enter] .gd-scene-you { animation: gd-rise var(--t-enter) var(--ease-out) .1s both; }
[data-enter] .gd-scene-dash { animation: gd-rise var(--t-enter) var(--ease-out) .25s both; }
[data-enter] .gd-scene .gd-bubble-ai { --d: .4s; --done: .9s; animation: gd-rise var(--t-enter) var(--ease-out) var(--d) both; }
[data-enter] .gd-scene-files li { animation: gd-flip .45s var(--ease-out) calc(.8s + var(--i, 0) * 80ms) both; }
[data-enter] .gd-scene .gd-bubble-right { --d: 1.1s; --done: 1.5s; animation: gd-rise var(--t-enter) var(--ease-out) var(--d) both; }
[data-enter] .gd-scene-clock { animation: gd-rise var(--t-enter) var(--ease-out) 1.5s both; }
[data-enter] .gd-scene .gd-pulse { animation: gd-beat 2s ease-out 2s 3; }
[data-enter] .gd-typing { visibility: visible; animation: gd-hide 1ms linear var(--done, .7s) forwards; }
[data-enter] .gd-typing i { animation: gd-dots calc(var(--done, .7s) - var(--d, 0s)) ease-in-out var(--d, 0s) 1; }
[data-enter] .gd-typing i:nth-child(2) { animation-delay: calc(var(--d, 0s) + .15s); }
[data-enter] .gd-typing i:nth-child(3) { animation-delay: calc(var(--d, 0s) + .3s); }
[data-enter] .gd-said { animation: gd-show .3s var(--ease-std) var(--done, .7s) both; }

/* ---------- 3.2 Chips ---------- */
.gd-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; padding: 0; list-style: none; }
.gd-tags li { padding: 4px 12px; border-radius: var(--r-pill); color: var(--accent-press); background: var(--accent-soft); font-size: 13px; font-weight: 600; }
.gd-chip { display: inline-flex; align-items: center; flex: none; padding: 2px 8px; border: 1px solid var(--card-line); border-radius: var(--r-pill); color: var(--ink-2); background: var(--card); font-size: 11px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.gd-chip-ai { border-color: var(--tool-line); color: var(--ai); background: var(--ai-soft); }
.gd-chip-done { border-color: var(--ok-line); color: var(--ok); background: var(--ok-bg); }
.gd-chip-done::before { content: "\2713"; margin-right: 4px; }
.gd-chip-warn { border-color: var(--warn-line); color: var(--warn); background: var(--warn-bg); }
.gd-chip-new { border-color: var(--info-line); color: var(--info); background: var(--info-bg); }

/* ---------- 3.3 Onboarding card with ring ---------- */
.gd-setup { display: flex; align-items: center; gap: 16px; width: 100%; padding: 16px 20px; border: 1px solid var(--accent-line); border-radius: var(--r-lg); color: var(--ink); background: var(--accent-soft); font: inherit; text-align: left; cursor: pointer; transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast); }
.gd-setup:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.gd-setup strong { display: block; color: var(--accent-press); font-size: 17px; }
.gd-setup span { color: var(--ink-2); font-size: 15px; }
.gd-setup::after { content: "\203A"; margin-left: auto; color: var(--accent); font-size: 26px; line-height: 1; }
.gd-ring { flex: none; width: 56px; height: 56px; transform: rotate(-90deg); }
.gd-ring circle { fill: none; stroke-width: 5; }
.gd-ring .gd-ring-track { stroke: var(--accent-line); }
.gd-ring .gd-ring-value { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: var(--ring-len, 151); transition: stroke-dashoffset 350ms var(--ease-out); }
[data-enter] .gd-ring .gd-ring-value { animation: gd-draw-ring 600ms var(--ease-out) .4s both; }

/* ---------- 3.4 How it works ---------- */
.gd-journey { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0 0; padding: 0; list-style: none; }
.gd-journey::before { content: ""; position: absolute; top: 28px; right: 12.5%; left: 12.5%; height: 3px; border-radius: 2px; background: var(--gradient-rail); transform-origin: left; }
.gd-journey li { position: relative; display: grid; align-content: start; justify-items: center; gap: 4px; color: var(--ink-2); font-size: 14px; line-height: 1.45; text-align: center; }
.gd-journey strong { margin-top: 6px; color: var(--ink); font-size: 17px; }
.gd-stop { display: grid; place-items: center; width: 56px; height: 56px; border: 3px solid var(--bg-page); border-radius: 50%; color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent-line); transition: transform var(--t-base) var(--ease-out); }
.gd-stop svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gd-journey li:hover .gd-stop { transform: translateY(-3px); }
[data-enter] .gd-journey::before { animation: gd-draw .9s var(--ease-out) .15s both; }
[data-enter] .gd-journey li { animation: gd-rise var(--t-enter) var(--ease-out) calc(.2s + var(--i, 0) * 150ms) both; }

/* ---------- 3.5 People cards ---------- */
.gd-faces { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0 0; padding: 0; list-style: none; }
.gd-faces li { display: grid; justify-items: center; align-content: start; gap: 2px; padding: 16px 10px; border: 1px solid var(--card-line); border-radius: var(--r-lg); background: var(--card); color: var(--muted); font-size: 13px; line-height: 1.35; text-align: center; transition: transform var(--t-base) var(--ease-out), box-shadow var(--t-base); }
.gd-faces li:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); }
.gd-faces strong { margin-top: 8px; color: var(--ink); font-size: 15px; }
.gd-av-face { width: 64px; height: 64px; border-radius: 50%; }
[data-enter] .gd-faces li { animation: gd-pop .45s var(--ease-out) calc(.3s + var(--i, 0) * 100ms) both; }

/* ---------- 3.6 Mission cards with a story band ---------- */
.home-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--card-line); border-radius: var(--r-xl); background: var(--card); box-shadow: var(--shadow-card); transition: transform var(--t-base) var(--ease-out), box-shadow var(--t-base); }
.home-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-lg); }
.home-band { position: relative; display: flex; align-items: center; min-height: 112px; padding: 14px 18px; overflow: hidden; background: var(--gradient-hero); background-size: 160% 160%; }
.home-band::before { content: ""; position: absolute; top: -70px; right: -50px; width: 160px; height: 160px; border-radius: 50%; background: rgb(255 255 255 / 8%); }
.home-band > * { position: relative; flex: 1; min-width: 0; }
.home-band .gd-bubble-body { max-width: none; padding: 8px 12px; font-size: 14px; }
.home-band .gd-av { width: 36px; height: 36px; }
.home-band .gd-scene-dash { padding: 10px 12px; }
.home-card-body { display: flex; flex: 1; flex-direction: column; padding: 20px; }
.home-card-body h3 { margin-top: 6px; color: var(--ink); font-size: var(--fs-h2); font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
.home-card-body > p:not(.gd-eyebrow) { flex: 1; margin-top: 8px; color: var(--ink-2); font-size: 15px; line-height: 1.55; }
.home-card .ps-card-foot { margin-top: 16px; }
[data-enter] .home-card { animation: gd-rise var(--t-enter) var(--ease-out) calc(.3s + var(--i, 0) * var(--t-stagger)) both; }
[data-enter] .home-band .gd-bubble { --d: calc(.3s + var(--i, 0) * var(--t-stagger)); --done: calc(var(--d) + .7s); }

/* ---------- 3.7 Buttons: the CTA ---------- */
.ps-btn-lg { min-height: 48px; padding: 12px 22px; font-size: 15px; }
.gd-cta { position: relative; overflow: hidden; gap: 10px; }
.gd-cta::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgb(255 255 255 / 35%) 50%, transparent 70%); transform: translateX(-120%); pointer-events: none; }
.gd-arrow { display: inline-block; transition: transform var(--t-base) var(--ease-std); }
.gd-cta:hover .gd-arrow { transform: translateX(4px); }
[data-enter] .gd-hero .gd-cta::before { animation: gd-shine 1.1s ease-in-out 1.8s both; }

/* ---------- 3.18 Join a session ---------- */
.home-join { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 12px; margin-top: 24px; padding: 16px 18px; border: 1px solid var(--card-line); border-radius: var(--r-lg); background: var(--card); box-shadow: var(--shadow-card); }
.home-join label { display: grid; gap: 6px; color: var(--ink); font-size: var(--fs-ui); font-weight: 650; }
.home-join input { width: 12ch; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); color: var(--ink); background: var(--card); font: 600 20px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; transition: border-color var(--t-fast); }
.home-join input:focus { border-color: var(--accent); }
.home-join input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.home-join .ps-btn { min-height: 44px; }
.home-join .join-msg { width: 100%; margin: 0; color: var(--ink-2); font-size: var(--fs-sm); }
.home-join .join-msg:empty { display: none; }
.home-join .join-msg[data-tone="warn"] { color: var(--warn); }
.home-join .join-msg.is-new { animation: gd-fade 200ms var(--ease-std); }
/* The phone's quiet line that opens the join card (design second pass S11); laptops never show it. */
.home-join-open { display: none; min-height: 44px; margin-top: 14px; padding: 0; border: 0; background: none; font-family: inherit; cursor: pointer; }

/* ---------- Layout ---------- */
@media (max-width: 900px) {
  .gd-hero { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .gd-hero .gd-lead { font-size: 17px; }
  .gd-scene { gap: 8px; padding: 14px; border-radius: var(--r-xl); }
  .gd-scene-files { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
  .gd-scene-files li { grid-auto-flow: column; justify-content: start; align-items: center; justify-items: start; gap: 8px; padding: 7px 10px; text-align: left; }
  .gd-file-ico { width: 12px; height: 15px; }
  .gd-bubble-body { padding: 8px 12px; font-size: 14px; }
  .gd-scene-dash { padding: 10px 12px; }
  .gd-scene-tiles i { width: 14px; height: 14px; }
  .gd-journey { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .gd-journey::before { top: 28px; bottom: 28px; left: 27px; right: auto; width: 3px; height: auto; transform-origin: top; }
  .gd-journey li { grid-template-columns: 56px minmax(0, 1fr); justify-items: start; column-gap: 14px; text-align: left; }
  .gd-journey li .gd-stop { grid-row: span 2; }
  [data-enter] .gd-journey::before { animation-name: gd-drawy; }
  /* The hub on a phone (S11): the story card follows the CTA; the chips and
     the join line come after it, and the join card opens from its line. */
  .home .gd-hero { row-gap: 0; }
  .home .gd-hero-copy { display: contents; }
  .home .gd-hero > .gd-scene { order: 1; margin-top: 24px; }
  .home .gd-hero-copy > :is(.gd-tags, .home-join-open, .home-join) { order: 2; }
  .home .home-join-open { display: inline-flex; align-items: center; justify-self: start; }
  .home .home-join { display: none; }
  .home .home-join-open[aria-expanded="true"] { display: none; }
  .home .home-join-open[aria-expanded="true"] + .home-join { display: flex; margin-top: 16px; }
}
