/* MaybeCitizen — landing-only styles. Loaded only by the home page.
   Slate + indigo (#4f46e5), Inter. Motion is restrained: staggered fade-ups,
   one-time scroll reveals, and a self-contained animated app-demo whose scenes
   are driven entirely by the `.is-active` class the client JS toggles. */

/* ---------- Hero: compact, centered, demo-first ---------- */
.hero-compact { text-align: center; padding: var(--space-8) 0 var(--space-10); }
.hero-compact h1 { max-width: none; margin-left: auto; margin-right: auto; font-size: clamp(2rem, 5vw, 2.75rem); }
.hero-compact .lead { max-width: 60ch; margin-left: auto; margin-right: auto; }
.hero-compact .hero-actions { justify-content: center; }
.hero-note { margin-top: var(--space-4); font-size: 0.85rem; color: var(--color-text-subtle); }

.stagger {
  opacity: 0;
  transform: translateY(12px);
  animation: staggerUp 520ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--d, 0) * 90ms + 60ms);
}
@keyframes staggerUp {
  to { opacity: 1; transform: none; }
}

/* ---------- Scroll reveal: one-time subtle fade-up ---------- */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 420ms ease, transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--i, 0) * 55ms);
}
.reveal.revealed { opacity: 1; transform: none; }

/* ===========================================================================
   THE CENTERPIECE — animated workspace window (embedded in the hero)
   =========================================================================== */
.window {
  max-width: 940px;
  margin: var(--space-8) auto 0;
  text-align: left;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  box-shadow: 0 24px 60px -24px rgba(15, 23, 42, 0.28), var(--shadow-md);
  overflow: hidden;
}

.window-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-4);
  background: var(--color-surface-subtle);
  border-bottom: 1px solid var(--color-border);
}
.lights { display: inline-flex; gap: 7px; }
.lights i { width: 11px; height: 11px; border-radius: 50%; background: var(--color-border); }
.lights i:nth-child(1) { background: #f87171; }
.lights i:nth-child(2) { background: #fbbf24; }
.lights i:nth-child(3) { background: #34d399; }
.window-title { font-size: 0.8rem; color: var(--color-text-subtle); font-weight: 500; letter-spacing: -0.01em; }

.window-body { display: flex; min-height: 340px; }

/* Left icon rail */
.rail {
  flex: none;
  width: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  background: var(--color-surface-subtle);
  border-right: 1px solid var(--color-border);
}
.rail-owl { width: 34px; height: auto; flex: none; margin-bottom: var(--space-2); }
.rail-icon {
  width: 34px; height: 34px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-text-subtle);
  transition: background var(--transition), color var(--transition);
}
.rail-icon svg { width: 19px; height: 19px; }
.rail-icon.is-on { background: var(--color-accent-subtle); color: var(--color-accent); }

/* Content pane */
.pane { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.scene-tabs {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4) 0;
  border-bottom: 1px solid var(--color-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.scene-tabs::-webkit-scrollbar { display: none; }
.scene-tab {
  position: relative;
  border: 0; background: none; cursor: pointer;
  padding: 8px 4px 12px;
  margin-right: var(--space-3);
  font-family: inherit; font-size: 0.85rem; font-weight: 600;
  color: var(--color-text-subtle);
  white-space: nowrap;
  transition: color var(--transition);
}
.scene-tab:hover { color: var(--color-text-muted); }
.scene-tab.is-active { color: var(--color-text); }
.scene-tab-track {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: transparent; border-radius: 2px; overflow: hidden;
}
.scene-tab-fill {
  display: block; height: 100%; width: 100%;
  background: var(--color-accent);
  transform: scaleX(0); transform-origin: left;
}
/* Active tab underline sweeps left→right over the scene duration. */
.demo-visible .scene-tab.is-active .scene-tab-fill {
  animation: tabSweep var(--scene-ms, 4500ms) linear forwards;
}
@keyframes tabSweep { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.scene-stage { position: relative; flex: 1; padding: var(--space-5); }

/* Scenes are absolutely stacked; only the active one shows. */
.scene {
  position: absolute; inset: var(--space-5);
  opacity: 0; visibility: hidden;
  transition: opacity 320ms ease;
}
.scene.is-active { opacity: 1; visibility: visible; }

/* ---------- Scene 1: Evidence vault ---------- */
.scene-search {
  display: flex; align-items: center; gap: var(--space-2);
  border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: 9px 12px; margin-bottom: var(--space-4);
  background: var(--color-surface); color: var(--color-text-subtle);
}
.scene-search svg { width: 16px; height: 16px; flex: none; }
.scene-search-text {
  font-size: 0.9rem; color: var(--color-text);
  white-space: nowrap; overflow: hidden;
  max-width: 0;
}
.scene-search-caret {
  width: 1px; height: 15px; background: var(--color-accent);
  opacity: 0;
}
/* Typewriter: the text reveals char-wise via max-width steps once files land. */
.scene-vault.is-active .scene-search-text {
  animation: typeSearch 900ms steps(8) forwards;
  animation-delay: 1500ms;
}
.scene-vault.is-active .scene-search-caret {
  animation: caretBlink 700ms step-end 1500ms 4;
}
@keyframes typeSearch { from { max-width: 0; } to { max-width: 8ch; } }
@keyframes caretBlink { 50% { opacity: 0; } 0%, 100% { opacity: 1; } }

.file-list { display: flex; flex-direction: column; gap: var(--space-3); }
.file-card {
  display: flex; align-items: center; gap: var(--space-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  opacity: 0; transform: translateY(10px);
  transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
}
.scene-vault.is-active .file-card {
  animation: cardDrop 420ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--i) * 340ms + 120ms);
}
@keyframes cardDrop { to { opacity: 1; transform: none; } }
.file-thumb {
  width: 34px; height: 34px; flex: none; border-radius: var(--radius);
  background: var(--color-accent-subtle); color: var(--color-accent);
  display: flex; align-items: center; justify-content: center;
}
.file-thumb svg { width: 18px; height: 18px; }
.file-meta { display: flex; flex-direction: column; min-width: 0; }
.file-name { font-weight: 600; font-size: 0.92rem; }
.file-kind { font-size: 0.78rem; color: var(--color-text-subtle); }
.file-chip {
  margin-left: auto; display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 600; white-space: nowrap;
  padding: 3px 9px; border-radius: 999px;
  background: #dcfce7; color: #15803d;
  opacity: 0; transform: scale(0.9);
}
.file-chip svg { width: 12px; height: 12px; }
/* Chip pops in shortly after its card lands. */
.scene-vault.is-active .file-card .file-chip {
  animation: chipPop 300ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--i) * 340ms + 520ms);
}
@keyframes chipPop { to { opacity: 1; transform: none; } }
/* Matching card lifts + highlights after the search types. */
.scene-vault.is-active .file-card.is-match {
  animation: cardDrop 420ms cubic-bezier(0.22, 1, 0.36, 1) forwards,
             matchLift 500ms cubic-bezier(0.22, 1, 0.36, 1) 2500ms forwards;
}
@keyframes matchLift {
  to {
    transform: translateY(-3px);
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--color-accent-subtle), var(--shadow-md);
  }
}

/* ---------- Scene 2: Smart checklists ---------- */
.check-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-4); margin-bottom: var(--space-4);
}
.check-eyebrow { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-subtle); font-weight: 600; }
.check-count { display: block; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.check-count .count-now { color: var(--color-accent); }
.check-ring { width: 56px; height: 56px; flex: none; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--color-surface-muted); stroke-width: 6; }
.ring-fill {
  fill: none; stroke: var(--color-accent); stroke-width: 6; stroke-linecap: round;
  stroke-dasharray: var(--circ); stroke-dashoffset: var(--circ);
}
.scene-checklist.is-active .ring-fill {
  animation: ringFill 2200ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
  animation-delay: 300ms;
}
@keyframes ringFill { to { stroke-dashoffset: calc(var(--circ) - var(--dash)); } }

.check-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.check-item { display: flex; align-items: center; gap: var(--space-3); font-size: 0.9rem; }
.check-box {
  width: 22px; height: 22px; flex: none; border-radius: 6px;
  border: 1.5px solid var(--color-border); background: var(--color-surface);
  display: flex; align-items: center; justify-content: center;
  color: #fff; transition: background var(--transition), border-color var(--transition);
}
.check-box svg { width: 15px; height: 15px; }
.check-tick { stroke-dasharray: 26; stroke-dashoffset: 26; }
.check-text { color: var(--color-text-muted); transition: color var(--transition); }
/* Each "ready" item ticks itself in sequence: box fills, checkmark draws. */
.scene-checklist.is-active .check-item.is-on .check-box {
  animation: boxOn 260ms ease forwards;
  animation-delay: calc(var(--i) * 260ms + 300ms);
}
.scene-checklist.is-active .check-item.is-on .check-tick {
  animation: tickDraw 320ms ease forwards;
  animation-delay: calc(var(--i) * 260ms + 340ms);
}
.scene-checklist.is-active .check-item.is-on .check-text {
  animation: textOn 260ms ease forwards;
  animation-delay: calc(var(--i) * 260ms + 300ms);
}
@keyframes boxOn { to { background: var(--color-accent); border-color: var(--color-accent); } }
@keyframes tickDraw { to { stroke-dashoffset: 0; } }
@keyframes textOn { to { color: var(--color-text); } }

/* ---------- Scene 3: AI review ---------- */
.review-docs { display: flex; gap: var(--space-3); margin-bottom: var(--space-5); flex-wrap: wrap; }
.doc-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--color-border); background: var(--color-surface);
  font-size: 0.82rem; font-weight: 600; color: var(--color-text-muted);
  opacity: 0; transform: translateY(8px);
}
.doc-chip svg { width: 15px; height: 15px; color: var(--color-accent); }
.scene-review.is-active .doc-chip {
  animation: cardDrop 340ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--i) * 200ms + 150ms);
}

.finding { position: relative; }
.finding-open, .finding-resolved {
  display: flex; align-items: flex-start; gap: var(--space-3);
  padding: var(--space-4); border-radius: var(--radius-lg);
}
.finding-open {
  background: #fffbeb; border: 1px solid #fde68a;
  opacity: 0; transform: translateX(16px);
}
.scene-review.is-active .finding-open {
  animation: findingIn 420ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 700ms;
}
@keyframes findingIn { to { opacity: 1; transform: none; } }
/* After a beat the amber card flips out and the green resolved card flips in. */
.scene-review.is-active .finding-open {
  animation: findingIn 420ms cubic-bezier(0.22, 1, 0.36, 1) 700ms forwards,
             findingOut 360ms ease 3000ms forwards;
}
@keyframes findingOut { to { opacity: 0; transform: translateY(-8px); } }

.finding-resolved {
  position: absolute; inset: 0;
  background: #f0fdf4; border: 1px solid #bbf7d0;
  opacity: 0; transform: translateY(8px);
}
.scene-review.is-active .finding-resolved {
  animation: findingIn 400ms cubic-bezier(0.22, 1, 0.36, 1) 3200ms forwards;
}
.finding-icon { flex: none; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.finding-icon svg { width: 18px; height: 18px; }
.finding-icon-warn { background: #fef3c7; color: var(--color-warning); }
.finding-icon-ok { background: #dcfce7; color: var(--color-success); }
.finding-body { display: flex; flex-direction: column; min-width: 0; }
.finding-title { font-weight: 600; font-size: 0.9rem; }
.finding-sub { font-size: 0.8rem; color: var(--color-text-muted); }
.finding-fix {
  margin-left: auto; flex: none; align-self: center;
  padding: 5px 14px; border-radius: 999px;
  background: var(--color-warning); color: #fff;
  font-size: 0.8rem; font-weight: 600;
}
.scene-review.is-active .finding-fix {
  animation: fixPress 300ms ease 2600ms;
}
@keyframes fixPress { 50% { transform: scale(0.9); filter: brightness(0.92); } }

/* ---------- Scene 4: Ask, approve, done ---------- */
.chat-row { display: flex; margin-bottom: var(--space-4); }
.chat-bubble {
  display: inline-flex; align-items: center;
  max-width: 90%;
  padding: 10px var(--space-4); border-radius: var(--radius-lg);
  border-bottom-left-radius: 4px;
  background: var(--color-surface-muted);
  font-size: 0.9rem;
}
.chat-typed { white-space: nowrap; overflow: hidden; max-width: 0; }
.chat-caret { width: 1px; height: 15px; background: var(--color-accent); margin-left: 1px; opacity: 0; }
.scene-assistant.is-active .chat-typed {
  animation: typeChat 1600ms steps(41) forwards;
  animation-delay: 300ms;
}
.scene-assistant.is-active .chat-caret {
  animation: caretBlink 700ms step-end 300ms 3;
}
@keyframes typeChat { from { max-width: 0; } to { max-width: 41ch; } }

.proposal {
  border: 1px solid #c7d2fe; background: var(--color-accent-subtle);
  border-radius: var(--radius-lg); padding: var(--space-4);
  opacity: 0; transform: translateY(10px);
}
.scene-assistant.is-active .proposal {
  animation: cardDrop 420ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 2100ms;
}
.proposal-tag { display: inline-block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; color: var(--color-accent); margin-bottom: var(--space-2); }
.proposal-main { display: flex; align-items: center; gap: var(--space-2); font-size: 0.9rem; }
.proposal-main svg { width: 18px; height: 18px; flex: none; color: var(--color-accent); }
.proposal-text { color: var(--color-text); }
.proposal-actions { position: relative; display: flex; gap: var(--space-2); margin-top: var(--space-4); }
.proposal-btn { padding: 6px 16px; border-radius: var(--radius); font-size: 0.82rem; font-weight: 600; }
.proposal-approve { background: var(--color-accent); color: #fff; }
.proposal-dismiss { background: var(--color-surface); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.scene-assistant.is-active .proposal-approve { animation: fixPress 300ms ease 3600ms; }
/* Cursor dot glides to the Approve button, then a click ripple fires. */
.cursor-dot {
  position: absolute; left: 100%; top: 120%;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--color-text); box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.14);
  opacity: 0;
}
.scene-assistant.is-active .cursor-dot {
  animation: cursorGlide 900ms cubic-bezier(0.4, 0, 0.2, 1) 2700ms forwards,
             cursorRipple 500ms ease 3600ms;
}
@keyframes cursorGlide {
  0% { opacity: 0; left: 100%; top: 120%; }
  20% { opacity: 1; }
  100% { opacity: 1; left: 42px; top: 14px; }
}
@keyframes cursorRipple {
  0% { box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.4); }
  100% { box-shadow: 0 0 0 16px rgba(79, 70, 229, 0); }
}
.assistant-done {
  display: flex; align-items: center; gap: var(--space-2);
  margin-top: var(--space-4); font-size: 0.9rem; color: var(--color-text-muted);
  opacity: 0; transform: translateY(8px);
}
.assistant-done .check-box.is-done { width: 20px; height: 20px; background: var(--color-success); border-color: var(--color-success); }
.assistant-done .check-box svg { width: 13px; height: 13px; }
.scene-assistant.is-active .assistant-done {
  animation: cardDrop 360ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 4000ms;
}

/* ===========================================================================
   Live-data ticker band
   =========================================================================== */
.ticker {
  border: 1px solid var(--color-border); border-radius: var(--radius-xl);
  background: var(--color-surface); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.ticker-head {
  display: flex; align-items: center; gap: var(--space-2);
  padding: 10px var(--space-5);
  background: var(--color-surface-subtle); border-bottom: 1px solid var(--color-border);
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em; color: var(--color-text-muted);
  text-transform: uppercase;
}
.live-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--color-success); flex: none;
  box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5);
  animation: livePulse 2s ease-out infinite;
}
@keyframes livePulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}
.ticker-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.ticker-card {
  display: flex; flex-direction: column; gap: var(--space-1);
  padding: var(--space-5);
  color: inherit; border-right: 1px solid var(--color-border);
  transition: background var(--transition);
}
.ticker-card:last-child { border-right: 0; }
.ticker-card:hover { background: var(--color-surface-subtle); text-decoration: none; color: inherit; }
.ticker-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-subtle); font-weight: 600; }
.ticker-value { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.ticker-sub { font-size: 0.88rem; color: var(--color-text-muted); }
.ticker-more { font-size: 0.85rem; font-weight: 600; color: var(--color-accent); margin-top: var(--space-1); }
@media (max-width: 820px) {
  .ticker-grid { grid-template-columns: 1fr; }
  .ticker-card { border-right: 0; border-bottom: 1px solid var(--color-border); }
  .ticker-card:last-child { border-bottom: 0; }
}

/* ===========================================================================
   Benefit cards
   =========================================================================== */
.benefit-grid { margin-top: var(--space-2); }
.benefit { transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition); }
.benefit:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--color-text-subtle); }
.benefit-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--radius-lg);
  background: var(--color-accent-subtle); color: var(--color-accent);
  margin-bottom: var(--space-3);
  transition: background var(--transition), color var(--transition);
}
.benefit:hover .benefit-icon { background: var(--color-accent); color: #fff; }
.benefit-glyph { width: 22px; height: 22px; }
.benefit h3 { font-size: 1.02rem; margin-bottom: var(--space-2); }
.benefit p { color: var(--color-text-muted); font-size: 0.9rem; margin-bottom: 0; }

/* Tools grid: keep compact card styling; reveal handled above. */
.tools-grid .tool-card { display: flex; flex-direction: column; }

/* Closing CTA band: the owl, small and calm, on a light chip so the navy
   head reads against the dark band. */
.cta-owl-wrap {
  display: flex; align-items: center; justify-content: center;
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--color-surface-subtle);
  margin: 0 auto var(--space-4);
}
.cta-owl { height: 34px; width: auto; display: block; }

/* ===========================================================================
   Responsive: shrink the window, collapse the rail to dots at mobile widths
   =========================================================================== */
@media (max-width: 640px) {
  .window-body { min-height: 380px; }
  .rail { width: 40px; gap: var(--space-2); padding: var(--space-3) 0; }
  .rail-owl { width: 26px; }
  .rail-icon { width: 0; height: 8px; border-radius: 999px; background: var(--color-border); }
  .rail-icon svg { display: none; }
  .rail-icon.is-on { width: 8px; background: var(--color-accent); }
  .rail-icon:not(.is-on) { width: 8px; }
  .scene-stage { padding: var(--space-4); }
  .scene { inset: var(--space-4); }
  .window-title { display: none; }
  .file-chip { font-size: 0.66rem; padding: 2px 7px; }
  .check-count { font-size: 1.15rem; }
}
@media (max-width: 420px) {
  .file-name { font-size: 0.85rem; }
  .doc-chip { font-size: 0.76rem; }
  .chat-bubble { font-size: 0.82rem; }
}

/* ===========================================================================
   Reduced motion: honour the user preference.
   - Hero staggers / reveals render final state instantly.
   - The demo shows scene 1 statically; tabs still switch scenes (no motion).
   =========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .stagger { opacity: 1; transform: none; animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .live-dot { animation: none; }

  .scene-tab-fill { animation: none !important; transform: scaleX(0); }
  .scene.is-active { opacity: 1; visibility: visible; }
  /* Kill every scene animation; show final resting state. */
  .window * { animation: none !important; transition: none !important; }
  .file-card, .doc-chip, .proposal, .assistant-done { opacity: 1; transform: none; }
  .file-chip { opacity: 1; transform: none; }
  .scene-search-text { max-width: 8ch; }
  .check-box { background: var(--color-accent); border-color: var(--color-accent); }
  .check-item:not(.is-on) .check-box { background: var(--color-surface); border-color: var(--color-border); }
  .check-tick { stroke-dashoffset: 0; }
  .check-item.is-on .check-text { color: var(--color-text); }
  .ring-fill { stroke-dashoffset: calc(var(--circ) - var(--dash)); }
  .chat-typed { max-width: 41ch; }
  /* Resolved review card hidden at rest; amber finding stays visible. */
  .finding-resolved { display: none; }
  .cursor-dot { display: none; }
}
