/* ============================================================
   Home hero: Evalis product showcase
   A recreation of two real Evalis screens, built from the product's own
   markup, tokens and strings (WorkflowPlc/meal):
   - Phone: Evalis Field form screen (mobile/src/app/pages/form, app.html,
     shared/sync-chip, assets/i18n/en.json)
   - Card: results framework snapshot (spa/src/app/pages/landing)
   All values are demo data, labelled as such in the caption.

   Sequence (seconds after the figure scrolls into view):
   0.3  value typed        1.0  Submit pressed
   1.2  "Saved offline"    2.6  signal back: banner closes, chip "1 queued"
   3.4  chip "Synced"      3.5  indicator row updates on the card
   Final state (also the reduced-motion state) is the synced one.
   ============================================================ */

.showcase {
  /* Evalis tokens, copied from mobile/src/styles.scss (light theme) */
  --ev-font: 'IBM Plex Sans', system-ui, sans-serif;
  --ev-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --ev-bg: oklch(0.981 0.004 265);
  --ev-surface: oklch(1 0 0);
  --ev-border: oklch(0.912 0.010 265);
  --ev-border-strong: oklch(0.860 0.013 265);
  --ev-text: oklch(0.215 0.020 268);
  --ev-text-2: oklch(0.398 0.022 266);
  --ev-text-3: oklch(0.490 0.022 265);
  --ev-snackbar: oklch(0.300 0.022 267);
  --ev-brand: oklch(0.515 0.190 268);
  --ev-brand-hover: oklch(0.448 0.175 268);
  --ev-brand-soft: oklch(0.585 0.175 269 / 0.10);
  --ev-brand-text: oklch(0.448 0.175 268);
  --ev-ontrack: oklch(0.660 0.150 158);
  --ev-ontrack-soft: oklch(0.660 0.150 158 / 0.14);
  --ev-ontrack-text: oklch(0.280 0.110 158);
  --ev-atrisk: oklch(0.760 0.140 78);
  --ev-atrisk-soft: oklch(0.760 0.140 78 / 0.16);
  --ev-atrisk-text: oklch(0.300 0.090 78);

  --phone-w: 224px;
  --overlap: 48px;
}

.showcase-stage {
  display: grid;
  grid-template-columns: var(--phone-w) minmax(0, 1fr);
  align-items: center;
  font-family: var(--ev-font);
  color: var(--ev-text);
}

.showcase-caption {
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: var(--step--1);
  line-height: 1.5;
}
.showcase-caption strong { color: var(--ink); font-weight: 600; }
.showcase-demo {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0 0.4rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
}

.ev-icon { width: 1em; height: 1em; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ev-num { font-family: var(--ev-mono); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ——— Phone: Evalis Field form screen ——— */
.ev-phone {
  grid-area: 1 / 1;
  position: relative;
  z-index: 1;
  padding: 7px;
  background: #11131A;
  border-radius: 34px;
  box-shadow: 0 24px 48px -16px rgba(21, 23, 29, 0.35), 0 2px 6px rgba(21, 23, 29, 0.12);
}
.ev-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 368px;
  overflow: hidden;
  background: var(--ev-bg);
  border-radius: 27px;
  padding-top: 22px; /* status bar area */
}
.ev-screen::before { /* camera cutout */
  content: '';
  position: absolute;
  top: 8px; left: 50%;
  width: 9px; height: 9px;
  margin-left: -4.5px;
  border-radius: 50%;
  background: #11131A;
}

.ev-offline {
  overflow: hidden;
  max-height: 0;
  background: var(--ev-atrisk);
  color: var(--ev-atrisk-text);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.04em;
  text-align: center;
  padding-inline: 10px;
  animation: evBannerOut 0.3s ease-in 2.6s backwards;
}

.ev-form-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--ev-surface);
  border-bottom: 1px solid var(--ev-border);
}
.ev-form-header > .ev-icon { font-size: 16px; color: var(--ev-text-2); }
.ev-form-name { flex: 1; min-width: 0; font-size: 12px; font-weight: 600; line-height: 1.3; }

/* app-sync-chip: three states stacked, one visible at a time */
.ev-chip { display: inline-grid; justify-items: end; }
.ev-chip > span {
  grid-area: 1 / 1;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.ev-chip .ev-icon { font-size: 12px; }
.ev-chip-offline { background: var(--ev-atrisk-soft); color: var(--ev-atrisk-text); opacity: 0; animation: evHold 2.6s linear; }
.ev-chip-pending { background: var(--ev-brand-soft); color: var(--ev-brand-text); opacity: 0; animation: evHold 0.8s linear 2.6s; }
.ev-chip-synced  { background: var(--ev-ontrack-soft); color: var(--ev-ontrack-text); animation: evHide 3.4s linear; }

.ev-form-progress { height: 3px; background: var(--ev-brand); }

.ev-form-body { flex: 1; padding: 14px 12px; }
.ev-label { display: block; margin-bottom: 3px; color: var(--ev-text-2); font-size: 11px; line-height: 1.4; }
.ev-input {
  display: flex;
  align-items: center;
  height: 36px;
  margin-bottom: 12px;
  padding-inline: 10px;
  background: var(--ev-surface);
  border: 1px solid var(--ev-border-strong);
  border-radius: 8px;
  font-size: 13px;
}
.ev-typed { animation: evType 0.45s steps(3, end) 0.3s backwards; }

.ev-snackbar {
  position: absolute;
  left: 10px; right: 10px; bottom: 62px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--ev-snackbar);
  color: #fff;
  border-radius: 8px;
  font-size: 10.5px;
  line-height: 1.35;
  opacity: 0;
  animation: evToast 1.4s ease-out 1.2s;
}
.ev-snackbar .ev-icon { font-size: 13px; color: var(--ev-ontrack); }

.ev-form-footer { padding: 10px 12px 14px; background: var(--ev-surface); border-top: 1px solid var(--ev-border); }
.ev-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  background: var(--ev-brand);
  color: #fff;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  animation: evPress 0.18s ease-out 1s;
}

/* ——— Card: results framework snapshot ——— */
.ev-card {
  grid-area: 1 / 2;
  margin-left: calc(var(--overlap) * -1);
  padding: 20px 20px 18px calc(var(--overlap) + 20px);
  background: var(--ev-surface);
  border: 1px solid var(--ev-border);
  border-radius: 12px;
  box-shadow: 0 4px 12px oklch(0.3 0.03 268 / 0.08);
}
.ev-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.ev-eyebrow { display: block; color: var(--ev-text-3); font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.ev-card-title { margin-top: 4px; font-size: 16px; font-weight: 600; line-height: 1.25; }
.ev-pill {
  flex-shrink: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ev-atrisk-soft);
  color: var(--ev-atrisk-text);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.ev-meter { margin-inline: -8px; padding: 6px 8px; border-radius: 8px; }
.ev-meter + .ev-meter { margin-top: 4px; }
.ev-meter-row { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 12px; line-height: 1.35; color: var(--ev-text-2); }
.ev-meter-row .ev-num { color: var(--ev-text); font-size: 12px; }
.ev-progress { height: 6px; background: var(--ev-border); border-radius: 999px; overflow: hidden; }
.ev-progress > span { display: block; height: 100%; width: var(--w); border-radius: inherit; }
.ev-progress .ontrack { background: var(--ev-ontrack); }
.ev-progress .atrisk { background: var(--ev-atrisk); }

/* The row the synced submission lands on */
.ev-meter.is-live { animation: evRowFlash 1.6s ease-out 3.5s; }
.ev-meter.is-live .ev-progress > span { transform-origin: left; animation: evFill 0.8s cubic-bezier(0.4, 0, 0.2, 1) 3.5s backwards; }
.ev-meter.is-live .ev-num { animation: evFade 0.3s ease-out 3.9s backwards; }

.ev-card-foot { display: flex; gap: 18px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--ev-border); }
.ev-stat { display: grid; }
.ev-stat .ev-num { font-size: 15px; font-weight: 600; color: var(--ev-text); line-height: 1.2; }
.ev-stat-label { color: var(--ev-text-2); font-size: 11px; }

/* main.js holds the sequence until the figure is on screen */
.showcase.is-waiting *,
.showcase.is-waiting *::before,
.showcase.is-waiting *::after { animation-play-state: paused; }

@keyframes evBannerOut { from { max-height: 4em; padding-block: 4px; } }
@keyframes evHold  { from, to { opacity: 1; } }
@keyframes evHide  { from, to { opacity: 0; } }
@keyframes evType  { from { clip-path: inset(0 100% 0 0); } }
@keyframes evPress { 50% { background: var(--ev-brand-hover); transform: scale(0.97); } }
@keyframes evToast {
  0%   { opacity: 0; transform: translateY(6px); }
  15%, 85% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}
@keyframes evFill  { from { transform: scaleX(0); } }
@keyframes evFade  { from { opacity: 0; } }
@keyframes evRowFlash { from, 40% { background: var(--ev-brand-soft); } }

/* ——— Responsive ——— */
@media (max-width: 560px) {
  .showcase-stage { grid-template-columns: minmax(0, 1fr); }
  .ev-phone { justify-self: center; width: var(--phone-w); }
  .ev-card {
    grid-area: 2 / 1;
    margin: calc(var(--overlap) * -1) 0 0;
    padding: calc(var(--overlap) + 18px) 18px 18px;
  }
}
