/*
 * Capibo app components for the landing page.
 * Static replicas of the platform UI (platform/src): same tokens, icons and
 * layout as the Vue components, animated by app-components.js.
 */

.cp-scope {
  --cp-bg: #fff;
  --cp-fg: #0a0a0a;
  --cp-muted: #f5f5f5;
  --cp-muted-fg: #737373;
  --cp-border: #e5e5e5;
  --cp-primary: #171717;
  --chart-1: #2a78d6;
  --chart-2: #eb6834;
  --chart-3: #1baf7a;
  --chart-4: #eda100;
  --chart-5: #e87ba4;
  --status-good: #0ca30c;
  --status-good-text: #006300;
  --status-warning: #fab219;
  --status-critical: #d03b3b;
  --emerald: #10b981;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  font-family: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--cp-fg);
  font-size: 14px;
  line-height: 1.4;
  letter-spacing: normal;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
.cp-scope *, .cp-scope *::before, .cp-scope *::after { box-sizing: border-box; }
.cp-scope p { margin: 0; }
.cp-scope ol, .cp-scope ul { list-style: none; margin: 0; padding: 0; }

/* ---------- Gradient tiles that frame each component (same mood as the previous lottie tiles) ---------- */
.cp-tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(120% 90% at 0% 0%, #ff8a4c 0%, transparent 55%),
    radial-gradient(90% 80% at 100% 100%, #e2584a 0%, transparent 60%),
    radial-gradient(80% 70% at 100% 0%, #ffd6bd 0%, transparent 60%),
    linear-gradient(140deg, #ffb27a 0%, #ff8f5a 55%, #f0a68b 100%);
}
.cp-tile.is-rose {
  background:
    radial-gradient(110% 80% at 0% 100%, #c9a7d8 0%, transparent 55%),
    radial-gradient(90% 80% at 100% 0%, #ff9f6e 0%, transparent 60%),
    radial-gradient(80% 80% at 100% 100%, #e2584a 0%, transparent 60%),
    linear-gradient(160deg, #ffc7a3 0%, #f59a83 60%, #d8a3c0 100%);
}
.cp-tile.is-sand {
  background:
    radial-gradient(100% 80% at 100% 0%, #ffb27a 0%, transparent 55%),
    radial-gradient(90% 90% at 0% 100%, #ff7b3a 0%, transparent 55%),
    linear-gradient(150deg, #ffe4cf 0%, #ffc49b 50%, #f39a6b 100%);
}
/* Fine grain, like the original artwork */
.cp-tile::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.22;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.cp-tile > .cp-scope { max-width: 100%; }

/* Tiles keep the template's image proportions; the component floats inside, never edge to edge. */
.hero-card-image.cp-tile { padding: 1.5rem; }
.feature-v1-grid > *, .feature-tiles, .feature-tiles-row > *, .hero-cards > *, .growth-v1-card > *, .cp-tile { min-width: 0; }
.feature-tile-image.cp-tile.is-estimate { aspect-ratio: 588 / 400; padding: 1.5rem; }
.feature-tiles-row > .feature-tile-image { aspect-ratio: 294 / 284; height: auto; }
.feature-tile-image.cp-tile.is-dispatch { padding: 1rem; }
.growth-v1-image.cp-tile { align-self: stretch; padding: 2rem; }

/* ---------- Shared primitives (shadcn-vue look) ---------- */
.cp-card {
  background: var(--cp-bg);
  border: 1px solid var(--cp-border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgb(0 0 0 / 4%), 0 12px 32px -12px rgb(80 30 0 / 25%);
  overflow: hidden;
}
.cp-muted { color: var(--cp-muted-fg); }
.cp-xs { font-size: 12px; line-height: 16px; }
.cp-sm { font-size: 13px; line-height: 18px; }
.cp-medium { font-weight: 500; }
.cp-semibold { font-weight: 600; }
.cp-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cp-row { display: flex; align-items: center; gap: 8px; }
.cp-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cp-grow { flex: 1 1 auto; min-width: 0; }

.cp-ico { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cp-ico.sm { width: 14px; height: 14px; }
.cp-ico.xs { width: 12px; height: 12px; }
.cp-ico.lg { width: 20px; height: 20px; }
.cp-spin { animation: cp-spin 0.9s linear infinite; }
@keyframes cp-spin { to { transform: rotate(360deg); } }

/* Colored icon tiles: TONES from platform/src/lib/visuals.js */
.cp-tone { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; border-radius: 8px; width: 28px; height: 28px; }
.cp-tone.md { width: 40px; height: 40px; border-radius: 10px; }
.cp-tone.md .cp-ico { width: 20px; height: 20px; }
.tone-violet { background: rgb(139 92 246 / 12%); color: #7c3aed; }
.tone-sky { background: rgb(14 165 233 / 12%); color: #0284c7; }
.tone-amber { background: rgb(245 158 11 / 15%); color: #d97706; }
.tone-emerald { background: rgb(16 185 129 / 12%); color: #059669; }
.tone-rose { background: rgb(244 63 94 / 12%); color: #e11d48; }
.tone-orange { background: rgb(249 115 22 / 12%); color: #ea580c; }
.tone-blue { background: rgb(59 130 246 / 12%); color: #2563eb; }
.tone-teal { background: rgb(20 184 166 / 12%); color: #0d9488; }
.tone-fuchsia { background: rgb(217 70 239 / 12%); color: #c026d3; }
.tone-lime { background: rgb(132 204 22 / 15%); color: #4d7c0f; }
.tone-muted { background: var(--cp-muted); color: var(--cp-muted-fg); }

.cp-badge {
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--cp-muted); color: var(--cp-fg); border: 1px solid transparent;
}
.cp-badge.is-outline { background: transparent; border-color: var(--cp-border); color: var(--cp-muted-fg); }
.cp-badge.is-live { background: var(--emerald); color: #fff; }
.cp-badge .cp-dot { width: 6px; height: 6px; border-radius: 50%; }

.cp-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
  border-radius: 8px; font: inherit; font-size: 13px; font-weight: 500;
  border: 1px solid var(--cp-border); background: var(--cp-bg); color: var(--cp-fg);
  transition: transform 160ms var(--ease), box-shadow 160ms, background-color 160ms;
}
.cp-btn.is-primary { background: var(--cp-primary); color: #fafafa; border-color: var(--cp-primary); }
.cp-btn.is-pressed { transform: scale(0.94); box-shadow: 0 0 0 4px rgb(23 23 23 / 12%); }

.cp-bar { height: 6px; border-radius: 999px; background: var(--cp-muted); overflow: hidden; }
.cp-bar > span { display: block; height: 100%; width: 0; border-radius: inherit; transition: width 900ms var(--ease); }

/* rise-in from platform/src/style.css */
@keyframes cp-rise-in {
  from { opacity: 0; transform: translateY(8px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.cp-rise { animation: cp-rise-in 420ms var(--ease) both; }

/* Shimmering label for the running step (StepList.vue) */
.cp-shimmer {
  background: linear-gradient(90deg, var(--cp-fg) 35%, var(--cp-muted-fg) 50%, var(--cp-fg) 65%);
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: cp-shimmer 1.6s linear infinite;
}
@keyframes cp-shimmer { from { background-position: 100% 0; } to { background-position: -150% 0; } }

/* ---------- Floating cards ---------- */
.cp-float { display: flex; flex-direction: column; gap: 12px; padding: 16px; transition: opacity 360ms ease, transform 360ms var(--ease); }
.cp-float.is-out { opacity: 0; transform: translateY(6px); }
.cp-pad { padding: 12px; display: grid; gap: 10px; }
.cp-list { display: grid; gap: 8px; }
.cp-item { display: flex; align-items: center; gap: 10px; font-size: 13px; opacity: 0; transform: translateY(6px); transition: opacity 360ms var(--ease), transform 360ms var(--ease); }
.cp-item.is-in { opacity: 1; transform: none; }
.cp-item .cp-tone { width: 24px; height: 24px; border-radius: 7px; }
.cp-item .cp-tone .cp-ico { width: 13px; height: 13px; }
.cp-sw { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cp-state { display: inline-flex; color: var(--cp-muted-fg); }
.cp-state [data-state] { display: none; }
[data-phase='running'] .cp-state [data-state='running'],
[data-phase='live'] .cp-state [data-state='done'],
[data-phase='done'] .cp-state [data-state='done'] { display: block; }
[data-phase='live'] .cp-state, [data-phase='done'] .cp-state { color: var(--emerald); }
.cp-total { font-size: 26px; line-height: 30px; font-weight: 600; letter-spacing: -0.025em; }

/* ---------- Hero · planner ---------- */
.cp-planner { width: min(100%, 17rem); padding: 0; gap: 10px; }
.cp-msg {
  align-self: flex-end; max-width: 92%; min-height: 34px; padding: 8px 14px; border-radius: 18px;
  background: rgb(255 255 255 / 92%); color: var(--cp-fg); font-size: 13px; line-height: 18px;
  box-shadow: 0 6px 20px -10px rgb(80 30 0 / 35%);
}
.cp-caret { display: inline-block; width: 1px; height: 14px; margin-left: 1px; vertical-align: -2px; background: currentColor; animation: cp-blink 0.9s steps(1) infinite; }
.cp-caret[hidden] { display: none; }
@keyframes cp-blink { 50% { opacity: 0; } }
.cp-planner [data-card] { opacity: 0; transform: translateY(8px) scale(0.985); transition: opacity 420ms var(--ease), transform 420ms var(--ease); }
.cp-planner [data-card].is-in { opacity: 1; transform: none; }

/* ---------- Hero · rings (RadialRingsChart.vue) ---------- */
.cp-rings-card { width: min(100%, 13rem); gap: 2px; }
.cp-rings { position: relative; width: 120px; height: 120px; margin: 14px auto 2px; }
.cp-rings svg { width: 100%; height: 100%; transform: rotate(-90deg); display: block; }
.cp-rings .track { stroke: var(--cp-muted); }
.cp-rings .arc { transition: stroke-dasharray 900ms ease-out; }
.cp-rings-center { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.cp-rings-center b { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.cp-fade { transition: opacity 280ms ease, transform 280ms ease; }
.cp-fade.is-out { opacity: 0; transform: translateY(4px); }

/* ---------- Features · cost estimate (CostEstimateTool.vue) ---------- */
.cp-estimate { width: min(100%, 17.5rem); }
.cp-estimate .cp-btn { height: 26px; padding: 0 10px; font-size: 12px; }
.cp-estimate .cp-btn.is-done { background: var(--emerald); border-color: var(--emerald); }
.cp-segbar { display: flex; gap: 2px; height: 8px; border-radius: 999px; overflow: hidden; background: var(--cp-muted); }
.cp-segbar > span { height: 100%; flex-basis: 0; flex-grow: 0.0001; transition: flex-grow 900ms var(--ease); }
.cp-estimate .cp-item { font-size: 12px; }

/* ---------- Features · dispatch (DispatchTool.vue) ---------- */
.cp-dispatch { width: min(100%, 13.5rem); padding: 14px; gap: 10px; }
.cp-dispatch-icon { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--cp-border); background: var(--cp-bg); flex-shrink: 0; }
.cp-dispatch .cp-bar > span { background: var(--emerald); transition: none; }

/* ---------- Platform · mission detail (MissionDetailView.vue) ---------- */
.cp-mission { width: min(100%, 19rem); gap: 14px; }
.cp-mission .cp-bar > span { transition: none; }
.cp-chart { position: relative; height: 56px; }
.cp-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.cp-chart .line { fill: none; stroke: var(--status-good); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.cp-chart .area { fill: url(#cp-area-grad); opacity: 0; transition: opacity 900ms ease 500ms; }
.cp-chart.is-drawn .area { opacity: 1; }
.cp-videos { gap: 6px; }
.cp-videos .cp-item { font-size: 12px; }
.cp-thumb { width: 24px; height: 24px; border-radius: 6px; flex-shrink: 0; background: var(--cp-muted); color: var(--cp-muted-fg); display: flex; align-items: center; justify-content: center; }
/* StatusBadge.vue: outline pill, colored icon + label */
.cp-status { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; height: 22px; padding: 0 8px; border: 1px solid var(--cp-border); border-radius: 999px; background: var(--cp-bg); font-size: 11px; font-weight: 500; white-space: nowrap; }
.cp-status .cp-ico { width: 12px; height: 12px; }
.cp-status.is-good .cp-ico { color: var(--status-good); }
.cp-status.is-warning .cp-ico { color: var(--status-warning); }

/* Example task icons */
.task-icon.cp-tone { width: 3.25rem; height: 3.25rem; border: 0; border-radius: 12px; }
.task-icon.cp-tone .cp-ico { width: 1.5rem; height: 1.5rem; }

/* ---------- Marquee: task icons over the black bar ---------- */
.marquee-icon {
  --c: #a78bfa;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 4.25rem; height: 4.25rem; margin-right: 3.25rem; border-radius: 1rem;
  color: var(--c); background: color-mix(in srgb, var(--c) 22%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 40%, transparent);
}
.marquee-icon svg { width: 2rem; height: 2rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.marquee-icon.is-sky { --c: #38bdf8; }
.marquee-icon.is-amber { --c: #fbbf24; }
.marquee-icon.is-emerald { --c: #34d399; }
.marquee-icon.is-rose { --c: #fb7185; }

@media (max-width: 991px) {
  .growth-v1-image.cp-tile { width: 100%; min-height: 26rem; }
}
@media (max-width: 767px) {
  .hero-card-image.cp-tile { padding: 1rem; }
  .feature-tile-image.cp-tile.is-estimate { aspect-ratio: auto; padding: 2.5rem 1rem; }
  .feature-tiles-row { grid-template-columns: 1fr; }
  .feature-tiles-row > .feature-tile-image { aspect-ratio: 4 / 3; }
  .growth-v1-image.cp-tile { padding: 2rem 1rem; min-height: 0; }
  .marquee-icon { width: 3.2rem; height: 3.2rem; margin-right: 2rem; border-radius: .75rem; }
  .marquee-icon svg { width: 1.5rem; height: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cp-scope *, .cp-scope *::before, .cp-scope *::after { animation: none !important; transition: none !important; }
  .cp-float, .cp-planner [data-card], .cp-item { opacity: 1; transform: none; }
  .cp-shimmer { color: var(--cp-fg); background: none; }
}
