/* The hero (D275): the whole clinic in one living space, concept C (docs/concepts/2026-11-19-hero/c-spatial). Every
   client's WhatsApp arrives out of the depth; Rumman reads each message (a garnet line sweeps the card), stamps it, and
   it is logged into the desk's ledger, answered in the clinic's voice, or handed to the dietitian as a row in "Your day".
   Scoped under .hc. Transform and opacity only; hero.js runs it and pauses it off screen. */
/* ---------- The hero: one living space ---------- */
.hc { padding: 0 12px 12px; }
.hc .space {
  --card-w: 272px;
  position: relative; isolation: isolate; overflow: clip;
  min-height: max(560px, calc(100svh - var(--nav-h) - 12px));
  border-radius: var(--radius-card);
  background:
    radial-gradient(60% 55% at var(--vx, 55%) 6%, oklch(36% 0.09 8 / 0.55), transparent 70%),
    radial-gradient(90% 70% at 100% 100%, oklch(28% 0.04 350 / 0.9), transparent 70%),
    var(--color-night);
  color: var(--color-night-ink);
  box-shadow: inset 0 0 0 1px oklch(97% 0.0087 26 / 0.06);
}
/* Far field: the clinic's other conversations, streaming out of the depth. Pure CSS, transform and opacity only. */
.hc .ambient { position: absolute; inset: 0; z-index: 0; perspective: 900px; perspective-origin: var(--vx, 55%) var(--vy, 12%); pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, oklch(0% 0 0 / 0.08) 18%, #000 46%); mask-image: linear-gradient(90deg, oklch(0% 0 0 / 0.08) 18%, #000 46%); }
.hc .far { position: absolute; left: var(--vx, 55%); top: var(--vy, 12%); display: flex; align-items: center; gap: 8px; padding: 7px 12px 7px 7px; border-radius: 999px;
  background: oklch(30.18% 0.0269 342.1 / 0.85); box-shadow: inset 0 0 0 1px oklch(97% 0.0087 26 / 0.1);
  font-size: 13px; line-height: 1; white-space: nowrap; color: var(--color-night-muted);
  opacity: 0; will-change: transform, opacity; translate: -50% -50%;
  animation: hc-drift var(--d, 16s) linear var(--delay, 0s) infinite; }
.hc .far i { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; background: oklch(45.57% 0.1467 10.53 / 0.55); color: var(--color-night-ink); }
.hc .far[lang="ar"] { font-family: var(--font-outlier); }
@keyframes hc-drift {
  0% { transform: translate3d(var(--x), var(--y), -2600px); opacity: 0; }
  20% { opacity: 0.55; }
  78% { opacity: 0.4; }
  100% { transform: translate3d(calc(var(--x) * 1.15), calc(var(--y) * 1.15), 260px); opacity: 0; }
}

.hc .space-grid { position: relative; z-index: 1; min-height: inherit; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.8fr) minmax(0, 0.95fr); gap: var(--space-xl); align-items: stretch; padding: clamp(28px, 5svh, 64px) clamp(28px, 3.4vw, 56px); }

/* Copy */
.hc .copy { align-self: center; display: grid; gap: var(--space-lg); max-width: 34rem; }
.hc .copy h1 { color: var(--color-night-ink); font-size: clamp(2.4rem, min(3.6vw, 7.4svh) + 0.5rem, 4.6rem); line-height: 1.0; letter-spacing: var(--tracking-display); font-weight: 600; }
.hc .copy h1 em { font-style: normal; color: var(--color-night-accent); }
.hc .lede { font-size: var(--text-lead); line-height: 1.5; color: var(--color-night-muted); max-width: 30rem; }
.hc .actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md) var(--space-lg); }
.hc .btn-primary.on-night { background: var(--color-night-ink); color: var(--color-ink); }
.hc .btn-primary.on-night:hover { background: oklch(100% 0 0); }
.hc .link-more { font-weight: 600; color: var(--color-night-ink); text-decoration: underline; text-decoration-color: var(--color-night-rule); text-underline-offset: 0.3em; padding-block: var(--space-sm); transition: text-decoration-color var(--dur-micro) var(--ease-out); }
.hc .link-more:hover { text-decoration-color: var(--color-night-accent); }
.hc .copy :focus-visible { outline-color: var(--color-night-focus); }
.hc .legend { list-style: none; margin: 0; padding: var(--space-md) 0 0; border-top: 1px solid var(--color-night-rule); display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-lg); font-size: var(--text-sm); color: var(--color-night-muted); }
.hc .legend li { display: flex; align-items: center; gap: var(--space-xs); }
.hc .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.hc .dot.log { background: oklch(78% 0.09 136); } .hc .dot.ans { background: var(--color-night-accent); } .hc .dot.you { background: var(--color-lemon); }

/* The field: where messages arrive in depth and Rumman sorts them */
.hc .hc-field { position: relative; z-index: 3; perspective: 1000px; perspective-origin: 50% 4%; min-height: 420px; }
.hc .field-label { position: absolute; top: 0; left: 50%; translate: -50% 0; font-size: var(--text-xs); letter-spacing: 0.04em; color: var(--color-night-muted); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.hc .field-label::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--color-night-accent); box-shadow: 0 0 0 4px oklch(78.03% 0.1079 8.18 / 0.18); }

.hc .card { position: absolute; left: 50%; top: var(--slot-y, 50%); width: var(--card-w); translate: -50% -50%; transform-origin: 50% 50%; opacity: 0; will-change: transform, opacity; color: var(--color-ink); }
.hc .card-body { position: relative; padding: 10px; border-radius: 20px; }
.hc .card-body::before { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--color-bubble-in); box-shadow: 0 0 0 1px oklch(29.44% 0.0762 3.94 / 0.08), 0 30px 60px -28px oklch(10% 0.02 344 / 0.8); transition: opacity 260ms var(--ease-out); }
.hc .card-body.shed::before { opacity: 0; }
.hc .card-body.shed .photo { border-radius: 50%; }
.hc .card.is-out .card-body::before { background: var(--color-paper-2); }
.hc .card-body > * { position: relative; }
.hc .who { display: flex; align-items: center; gap: 8px; padding: 2px 2px 8px; font-size: 13px; line-height: 1.2; transition: opacity 220ms var(--ease-out); }
.hc .who b { font-weight: 600; }
.hc .who > span:last-child { color: var(--color-muted); margin-inline-start: auto; font-variant-numeric: tabular-nums; }
.hc .av { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--color-ink); color: var(--color-paper); font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.hc .av.yc { background: var(--color-accent); }
.hc .photo { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; mix-blend-mode: multiply; transition: border-radius 600ms var(--ease-out); }
.hc .cap { padding: 8px 4px 2px; font-size: 14.5px; line-height: 1.35; transition: opacity 220ms var(--ease-out); }
.hc .text { padding: 0 4px 2px; font-size: 15px; line-height: 1.4; }
.hc .voice { display: flex; align-items: center; gap: 10px; padding: 4px 4px 2px; }
.hc .voice .play { width: 32px; height: 32px; border-radius: 50%; background: var(--color-accent); display: grid; place-items: center; flex-shrink: 0; }
.hc .voice .play svg { width: 12px; height: 12px; fill: var(--color-accent-ink); margin-inline-start: 2px; }
.hc .voice .hc-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 26px; }
.hc .voice .hc-wave i { flex: 1; border-radius: 2px; background: oklch(29.44% 0.0762 3.94 / 0.45); height: var(--h); }
.hc .voice small { font-size: 12px; color: var(--color-muted); font-variant-numeric: tabular-nums; }
.hc .voice-ar { font-family: var(--font-outlier); direction: rtl; padding: 6px 4px 2px; font-size: 14.5px; color: var(--color-ink-2); transition: opacity 220ms var(--ease-out); }
.hc .plan { list-style: none; margin: 0; padding: 0 4px 2px; display: grid; gap: 4px; font-size: 14px; }
.hc .plan li { display: flex; gap: 10px; } .hc .plan li span { color: var(--color-muted); width: 3.6em; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.hc .plan-head { padding: 0 4px 6px; font-weight: 600; font-size: 15px; }
.hc .below { position: absolute; left: 0; right: 0; top: calc(100% + 10px); display: grid; gap: 8px; justify-items: start; }
.hc .stamp { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; border-radius: 999px; font-size: 13px; font-weight: 600; line-height: 1.2; opacity: 0;
  background: oklch(30.18% 0.0269 342.1 / 0.92); color: var(--color-night-ink); box-shadow: inset 0 0 0 1px oklch(97% 0.0087 26 / 0.14); }
.hc .stamp .dot { width: 8px; height: 8px; }
.hc .reply { max-width: 88%; justify-self: end; padding: 8px 12px; border-radius: 16px 16px 6px 16px; background: var(--color-paper-2); color: var(--color-ink); font-size: 14px; line-height: 1.4; opacity: 0; transform-origin: 100% 0; box-shadow: 0 20px 40px -24px oklch(10% 0.02 344 / 0.8); }
.hc .reply b { display: block; font-size: 11.5px; color: var(--color-accent); font-weight: 600; margin-bottom: 2px; }
.hc .reply > span { display: block; }

/* The desk: the dietitian's portal, "Your day" */
.hc .desk-wrap { position: relative; z-index: 1; perspective: 1400px; perspective-origin: 0% 50%; align-self: center; }
.hc .desk { --r: 28px; --pad: 10px; position: relative; background: var(--color-paper); color: var(--color-ink); border-radius: var(--r); padding: var(--pad);
  transform: rotateY(-7deg) translateZ(0); transform-origin: 100% 50%;
  box-shadow: 0 0 0 1px oklch(97% 0.0087 26 / 0.1), 0 60px 120px -50px oklch(5% 0.02 344 / 0.9); }
.hc .desk-in { border-radius: calc(var(--r) - var(--pad)); background: var(--color-paper-2); padding: 18px 18px 14px; box-shadow: inset 0 0 0 1px var(--color-rule); }
.hc .desk-top { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--color-muted); }
.hc .desk-top .av { width: 28px; height: 28px; font-size: 11px; }
.hc .desk-top b { color: var(--color-ink); font-weight: 600; }
.hc .desk-top .live { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; }
.hc .desk-top .live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--color-success); }
.hc .desk h2 { font-size: clamp(1.5rem, 1.2vw + 0.9rem, 2rem); line-height: 1.1; margin: 16px 0 4px; max-width: none; }
.hc .desk-sub { font-size: 14px; color: var(--color-muted); line-height: 1.4; }
.hc .q-head { display: flex; align-items: baseline; justify-content: space-between; margin: 16px 0 8px; font-size: 13px; font-weight: 600; color: var(--color-ink-2); }
.hc .q-head .num { color: var(--color-muted); font-weight: 400; }
.hc .queue { position: relative; list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; align-content: start; min-height: calc(3 * 58px + 2 * 6px); }
.hc .q-empty { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 16px; border: 1px dashed var(--color-rule); font-size: 14px; color: var(--color-muted); transition: opacity 300ms var(--ease-out); }
.hc .queue.has-rows .q-empty { opacity: 0; }
.hc .row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; height: 58px; padding: 0 10px; border-radius: 16px; background: var(--color-paper); box-shadow: inset 0 0 0 1px var(--color-rule); will-change: transform; }
.hc .row .av { width: 30px; height: 30px; font-size: 11px; }
.hc .row-t { min-width: 0; line-height: 1.25; }
.hc .row-t b { display: block; font-size: 14px; font-weight: 600; }
.hc .row-t span { display: block; font-size: 13px; color: var(--color-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc .tag { position: relative; display: grid; font-size: 12px; font-weight: 600; white-space: nowrap; }
.hc .tag > span { grid-area: 1 / 1; padding: 4px 9px; border-radius: 999px; text-align: center; transition: opacity 260ms var(--ease-out), filter 260ms var(--ease-out), scale 260ms var(--ease-out); }
.hc .tag .t-now { background: var(--color-accent-tint); color: var(--color-accent); }
.hc .tag .t-today { background: var(--color-warning-surface); color: oklch(42% 0.07 80); box-shadow: inset 0 0 0 1px oklch(86% 0.12 86 / 0.6); }
.hc .tag .t-done { background: var(--color-success-surface); color: var(--color-success); opacity: 0; filter: blur(4px); scale: 0.9; }
.hc .row.is-done .tag > span:not(.t-done) { opacity: 0; filter: blur(4px); scale: 0.9; }
.hc .row.is-done .tag .t-done { opacity: 1; filter: none; scale: 1; }
.hc .ledger { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--color-rule); display: grid; gap: 8px; font-size: 14px; }
.hc .ledger div { display: flex; align-items: center; gap: 10px; min-height: 28px; }
.hc .ledger .num { min-width: 1.6em; text-align: end; font-weight: 600; color: var(--color-ink); display: inline-block; }
.hc .ledger .lab { color: var(--color-ink-2); }
.hc .thumbs { display: flex; margin-inline-start: auto; }
.hc .thumbs img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--color-paper-2); box-shadow: 0 0 0 2px var(--color-paper-2); margin-inline-start: -8px; mix-blend-mode: multiply; }
.hc .ledger .mark { margin-inline-start: auto; width: 8px; height: 8px; border-radius: 50%; }

.hc .caption { position: absolute; z-index: 2; left: clamp(28px, 3.4vw, 56px); bottom: 14px; display: flex; align-items: center; gap: 12px; font-size: var(--text-xs); color: oklch(78.95% 0.0259 348.7 / 0.75); }
.hc .pause { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px 0 10px; border-radius: 999px; border: 1px solid var(--color-night-rule); background: transparent; color: var(--color-night-muted); font-size: 12.5px; cursor: pointer; }
.hc .pause:hover { color: var(--color-night-ink); border-color: oklch(97% 0.0087 26 / 0.35); }
.hc .pause svg { width: 12px; height: 12px; fill: currentColor; }
.hc .pause:focus-visible { outline-color: var(--color-night-focus); }
.hc .is-paused .far { animation-play-state: paused; }

/* Static composition: the first paint, no-JS, and reduced motion. The live loop clears it. */
.hc .card.is-static { opacity: 1; }
.hc .card.is-static .stamp { opacity: 1; }

/* ---------- Short laptops (1280x650 and the like): the same space, tighter ---------- */
@media (min-width: 68.76rem) and (max-height: 760px) {
  .hc .space-grid { padding-block: 24px 44px; gap: var(--space-lg) var(--space-xl); }
  .hc .copy { gap: var(--space-md); }
  .hc .copy h1 { font-size: clamp(2.3rem, 8.4svh, 3.6rem); }
  .hc .lede { font-size: 1.0625rem; }
  .hc .legend { display: none; }
  .hc .desk-sub { display: none; }
  .hc .desk h2 { margin-top: 10px; }
  .hc .desk-in { padding: 14px 16px 10px; }
  .hc .row { height: 50px; }
  .hc .queue { min-height: calc(3 * 50px + 2 * 6px); }
  .hc .ledger { gap: 2px; margin-top: 10px; padding-top: 8px; }
  .hc .hc-field { min-height: 0; }
  .hc .space { --card-w: 256px; }
  .hc .photo { aspect-ratio: 16 / 10; }
}
/* ---------- Tablet: copy above, field and desk side by side ---------- */
@media (max-width: 68.75rem) {
  .hc .space-grid { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr); grid-template-rows: auto 1fr; row-gap: var(--space-lg); }
  .hc .copy { grid-column: 1 / -1; max-width: 40rem; }
  .hc .copy h1 { font-size: clamp(2.3rem, 4.6vw + 0.6rem, 3.6rem); }
  .hc .hc-field { min-height: 440px; }
  .hc .desk { transform: rotateY(-5deg); }
}
/* ---------- Phone: a deliberate single column. Copy, then the field above a compact desk; the flow runs downward. ---------- */
@media (max-width: 43.75rem) {
  .hc { padding: 0 8px 8px; }
  .hc .space { --card-w: min(250px, 72vw); min-height: auto; border-radius: 24px; }
  .hc .space-grid { display: flex; flex-direction: column; gap: var(--space-lg); padding: 28px 18px 64px; }
  .hc .copy { gap: var(--space-md); }
  .hc .copy h1 { font-size: clamp(2.1rem, 9vw, 2.8rem); line-height: 1.02; }
  .hc .lede { font-size: 1.0625rem; }
  .hc .actions .btn { width: 100%; }
  .hc .legend { display: none; }
  .hc .hc-field { min-height: 330px; perspective: 800px; --slot-y: 44%; margin-top: 4px; }
  .hc .photo { aspect-ratio: 16 / 10; }
  .hc .desk-wrap { perspective: none; }
  .hc .desk { transform: none; --r: 24px; --pad: 8px; }
  .hc .desk-in { padding: 14px 14px 12px; }
  .hc .desk h2 { margin-top: 10px; }
  .hc .desk-sub { display: none; }
  .hc .queue { min-height: calc(2 * 58px + 6px); }
  .hc .ledger { grid-template-columns: repeat(3, auto); gap: 4px 12px; font-size: 12.5px; }
  .hc .ledger div { flex-direction: column; align-items: flex-start; gap: 0; }
  .hc .ledger .num { text-align: start; font-size: 18px; }
  .hc .ledger .thumbs, .hc .ledger .mark { display: none; }
  .hc .ambient { -webkit-mask-image: linear-gradient(180deg, transparent 28%, #000 52%); mask-image: linear-gradient(180deg, transparent 28%, #000 52%); }
  .hc .far:nth-child(n+11) { display: none; }
  .hc .caption { position: static; padding: 0 18px 18px; flex-wrap: wrap; }
  .hc .space-grid { padding-bottom: 20px; }
  .hc .ledger .lab { line-height: 1.3; }
  .hc .hc-field { min-height: 350px; }
}
@media (prefers-reduced-motion: reduce) {
  .hc .far { animation: none; opacity: 0.3; transform: translate3d(var(--x), var(--y), var(--z, -900px)); }
  .hc .pause { display: none; }
}

/* Reading, in place of the prototype's ring: a garnet line with a soft glow sweeps down the card before the stamp lands. */
.hc .scan { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
.hc .scan i { position: absolute; inset-inline: 0; top: 0; height: 2px; background: var(--color-accent); box-shadow: 0 0 16px 5px oklch(45.57% 0.1467 10.53 / 0.28); opacity: 0; }
/* Right to left: the desk leans the other way and the far field fades from the other side. */
[dir="rtl"] .hc .desk-wrap { perspective-origin: 100% 50%; }
[dir="rtl"] .hc .desk { transform: rotateY(7deg) translateZ(0); transform-origin: 0% 50%; }
[dir="rtl"] .hc .ambient { -webkit-mask-image: linear-gradient(270deg, oklch(0% 0 0 / 0.08) 18%, #000 46%); mask-image: linear-gradient(270deg, oklch(0% 0 0 / 0.08) 18%, #000 46%); }
.hc .caption { gap: 0; }
@media (max-width: 68.75rem) { [dir="rtl"] .hc .desk { transform: rotateY(5deg); } }
@media (max-width: 43.75rem) { [dir="rtl"] .hc .desk { transform: none; } [dir="rtl"] .hc .ambient { -webkit-mask-image: linear-gradient(180deg, transparent 28%, #000 52%); mask-image: linear-gradient(180deg, transparent 28%, #000 52%); } }
:lang(ar) .hc .copy h1 { letter-spacing: 0; line-height: 1.15; }
