/* =========================================================================
   Design tokens — mirrored from the Faceform app's globals.css so this app
   feels like part of the same family. Light theme, near-black foreground,
   zinc neutrals, ~10px radius.
   ========================================================================= */

:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", ui-sans-serif, system-ui, Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, "Cascadia Code", monospace;

  --bg:                 #000000;
  --fg:                 #fafafa;
  --muted:              #18181b;
  --muted-fg:           #a1a1aa;
  --card:               #0c0c0e;
  --border:             #27272a;
  --border-soft:        rgba(39, 39, 42, 0.7);
  --ring:               #fafafa;
  --primary:            #fafafa;
  --primary-fg:         #0a0a0a;
  --accent:             #18181b;
  --success:            #10b981;
  --warning:            #f59e0b;
  --destructive:        #ef4444;

  --radius:             0.625rem;
  --radius-sm:          0.375rem;
  --radius-lg:          0.875rem;
  --radius-xl:          1rem;

  --shadow-sm:          0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md:          0 4px 24px -4px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

* { box-sizing: border-box; border-color: var(--border); }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color-scheme: dark;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--fg); color: var(--primary-fg); }

/* =========================================================================
   Sticky translucent header
   ========================================================================= */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.site-header__inner {
  max-width: 1152px;
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--fg);
  color: var(--bg);
}
.site-header__nav {
  display: flex;
  align-items: center;
  gap: 18px;
}
.site-link {
  font-size: 0.875rem;
  color: var(--muted-fg);
  transition: color 120ms ease;
}
.site-link:hover { color: var(--fg); }
.credits-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  background: var(--muted);
  border: 1px solid var(--border);
  color: var(--fg);
}
.credits-pill svg { color: var(--warning); }
.credits-pill--unlimited {
  background: linear-gradient(135deg, rgba(245,158,11,0.18), rgba(124,58,237,0.18));
  border-color: rgba(245,158,11,0.5);
  color: #fcd34d;
}
.credits-pill--unlimited svg { color: #fcd34d; }
.credits-pill--unlimited span { font-weight: 700; font-size: 0.92rem; line-height: 1; }
.btn--sm { padding: 7px 14px; font-size: 0.85rem; }
.muted { color: var(--muted-fg); font-size: 0.875rem; }
.muted-tiny { color: var(--muted-fg); font-size: 0.75rem; }

/* =========================================================================
   Layout
   ========================================================================= */

main { padding-bottom: 96px; }
.container {
  max-width: 1152px;
  margin: 0 auto;
  padding: 0 24px;
}
.container-tight {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Hero with the same dot/grid mask treatment Faceform uses */
.hero {
  position: relative;
  overflow: hidden;
  padding-top: 80px;
  padding-bottom: 32px;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  opacity: 0.6;
  pointer-events: none;
}
.hero__inner {
  position: relative;
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}
.hero h1 {
  font-size: 2.6rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 0 0 16px;
}
.hero h1 .accent {
  background: linear-gradient(to bottom right, var(--fg) 0%, rgba(250, 250, 250, 0.35) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.lead {
  font-size: 1.05rem;
  color: var(--muted-fg);
  line-height: 1.55;
  margin: 0 0 28px;
}

/* =========================================================================
   Badges & status pills
   ========================================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
}
.badge svg { width: 12px; height: 12px; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--muted);
  color: var(--fg);
  border: 1px solid var(--border);
}
.status::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.6;
}
.status-queued        { color: #a1a1aa; }
.status-storyboarding { color: #c4b5fd; background: rgba(124, 58, 237, 0.12); border-color: rgba(124, 58, 237, 0.35); }
.status-submitting,
.status-rendering     { color: #93c5fd; background: rgba(37, 99, 235, 0.12); border-color: rgba(37, 99, 235, 0.35); }
.status-stitching     { color: #fdba74; background: rgba(194, 65, 12, 0.12); border-color: rgba(194, 65, 12, 0.4); }
.status-done          { color: #6ee7b7; background: rgba(4, 120, 87, 0.15); border-color: rgba(4, 120, 87, 0.4); }
.status-failed        { color: #fca5a5; background: rgba(220, 38, 38, 0.15); border-color: rgba(220, 38, 38, 0.45); }
.status-done::before, .status-failed::before { opacity: 1; }

/* =========================================================================
   Cards
   ========================================================================= */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 20px; }

.card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}
.card h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.card h3 {
  margin: 24px 0 8px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-fg);
}
.card__sub {
  color: var(--muted-fg);
  font-size: 0.9rem;
  margin: 6px 0 24px;
}

/* =========================================================================
   Forms
   ========================================================================= */

.field {
  display: block;
  margin-bottom: 18px;
}
.field > label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--fg);
}
.field > .hint {
  display: block;
  font-size: 0.78rem;
  color: var(--muted-fg);
  margin-bottom: 8px;
}
input[type="text"],
input[type="number"],
input[type="file"],
select,
textarea {
  width: 100%;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 0.92rem;
  font-family: inherit;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(250, 250, 250, 0.1);
}
textarea { resize: vertical; min-height: 78px; }

.row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}
@media (max-width: 640px) {
  .row { grid-template-columns: 1fr; }
}

/* =========================================================================
   Buttons
   ========================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: var(--primary-fg);
  border: 1px solid var(--primary);
  padding: 10px 18px;
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform 80ms ease, opacity 120ms ease, background 120ms ease;
  font-family: inherit;
}
.btn:hover { opacity: 0.92; }
.btn:active { transform: translateY(1px); }
.btn--lg { padding: 12px 22px; font-size: 0.98rem; }
.btn--ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border);
}
.btn--ghost:hover { background: var(--muted); opacity: 1; }
.btn--block { width: 100%; }

/* =========================================================================
   Project list
   ========================================================================= */

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 48px 0 16px;
}
.section-head h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

.project-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.project-list a.project-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 80ms ease;
}
.project-list a.project-card:hover {
  border-color: rgba(250, 250, 250, 0.35);
  box-shadow: var(--shadow-md);
}
.project-card .title {
  font-weight: 600;
  font-size: 0.96rem;
  letter-spacing: -0.005em;
}
.project-card .meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  text-align: center;
  color: var(--muted-fg);
  background: var(--card);
}

/* =========================================================================
   Project detail
   ========================================================================= */

.detail-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.error-box {
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.35);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  overflow-x: auto;
  margin-top: 16px;
}

details {
  margin-top: 18px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
details > summary {
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--muted-fg);
  font-weight: 500;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: "▸";
  display: inline-block;
  transition: transform 120ms ease;
  font-size: 0.7rem;
}
details[open] > summary::before { transform: rotate(90deg); }
details > summary:hover { color: var(--fg); }

.insight-block {
  background: var(--muted);
  border-left: 3px solid var(--border);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-top: 12px;
}
.insight-block--insec {
  background: rgba(249, 115, 22, 0.08);
  border-left-color: #f97316;
}
.insight-block p { margin: 4px 0 0; font-size: 0.92rem; line-height: 1.5; }
.insight-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-fg);
}

.approve-bar {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
@media (max-width: 520px) {
  .approve-bar { flex-direction: column; }
}

/* awaiting_approval status pill — distinct so users notice it */
.status-analyzing         { color: #c4b5fd; background: rgba(124, 58, 237, 0.12); border-color: rgba(124, 58, 237, 0.35); }
.status-awaiting_approval { color: #fcd34d; background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.4); }

.storyboard ol {
  margin: 12px 0 0;
  padding-left: 18px;
}
.storyboard li {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--border);
}
.storyboard li:last-child { border-bottom: 0; }
.storyboard .clip-name {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted-fg);
}
.storyboard .vo {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--muted);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.finals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.final-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow 120ms ease;
}
.final-card:hover { box-shadow: var(--shadow-md); }
.final-card video {
  width: 100%;
  display: block;
  background: #000;
  aspect-ratio: 9 / 16;
  object-fit: cover;
}
.final-card .final-foot {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.82rem;
}
.final-card .final-foot a {
  color: var(--fg);
  font-weight: 500;
}
.final-card .final-foot a:hover { text-decoration: underline; }

/* progress indicator next to status while processing */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--fg);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  vertical-align: -2px;
  margin-right: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================================
   Landing page — hero, feature grid, CTA band
   ========================================================================= */

.landing-hero {
  padding-top: 96px;
  padding-bottom: 64px;
}
.landing-hero h1 {
  font-size: 3.4rem;
  line-height: 1.05;
}
@media (max-width: 640px) { .landing-hero h1 { font-size: 2.2rem; } }
.cta-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}
.cta-checks {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 18px;
  font-size: 0.78rem;
  color: var(--muted-fg);
  flex-wrap: wrap;
}
.cta-checks span { display: inline-flex; align-items: center; gap: 6px; }
.cta-checks svg { color: var(--success); width: 14px; height: 14px; }

.section { padding: 80px 0; }
.section-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.section-sub {
  text-align: center;
  color: var(--muted-fg);
  max-width: 580px;
  margin: 0 auto 40px;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 720px) { .steps-grid { grid-template-columns: 1fr; } }
.step-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  transition: box-shadow 120ms ease;
}
.step-card:hover { box-shadow: var(--shadow-md); }
.step-card .step-num {
  position: absolute;
  top: 16px; right: 16px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-fg);
  opacity: 0.7;
}
.step-icon {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--fg);
  color: var(--bg);
  margin-bottom: 16px;
}
.step-card h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: -0.005em;
  color: var(--fg);
}
.step-card p {
  margin: 8px 0 0;
  font-size: 0.9rem;
  color: var(--muted-fg);
  line-height: 1.5;
}

/* Feature grid — borders-only mosaic like Faceform's */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
@media (max-width: 720px) { .feature-grid { grid-template-columns: 1fr; } }
.feature {
  background: var(--card);
  padding: 24px;
  transition: background 120ms ease;
}
.feature:hover { background: rgba(244, 244, 245, 0.45); }
.feature h4 {
  margin: 0 0 6px;
  font-size: 0.98rem;
  font-weight: 600;
}
.feature p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted-fg);
  line-height: 1.55;
}

.cta-band {
  border-top: 1px solid var(--border-soft);
  padding: 96px 0;
  text-align: center;
}
.cta-band h2 {
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0 0 12px;
}
.cta-band p { color: var(--muted-fg); margin: 0 0 28px; }

/* =========================================================================
   Pricing
   ========================================================================= */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
@media (max-width: 1000px) { .pricing-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 580px)  { .pricing-grid { grid-template-columns: 1fr; } }

.plan {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  transition: box-shadow 120ms ease, transform 120ms ease;
}
.plan:hover { box-shadow: var(--shadow-md); }
.plan--highlight {
  border-color: var(--fg);
  box-shadow: 0 0 0 1px var(--fg), 0 0 60px -20px rgba(250, 250, 250, 0.25);
}
.plan--highlight .plan-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--primary-fg);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}
.plan h3 {
  margin: 0;
  font-size: 1.1rem;
  text-transform: none;
  letter-spacing: -0.005em;
  color: var(--fg);
}
.plan .price {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.plan .price .amount {
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.plan .price .per {
  color: var(--muted-fg);
  font-size: 0.85rem;
}
.plan .credits-line {
  font-size: 0.85rem;
  color: var(--muted-fg);
}
.plan .credits-line strong { color: var(--fg); font-weight: 600; }
.plan .tagline { color: var(--muted-fg); font-size: 0.88rem; }
.plan ul {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.plan li {
  position: relative;
  padding-left: 22px;
  font-size: 0.88rem;
  color: var(--fg);
}
.plan li::before {
  content: "";
  position: absolute;
  left: 0; top: 6px;
  width: 14px; height: 14px;
  border-radius: 999px;
  background: var(--success);
  background-image: linear-gradient(135deg, #10b981 0%, #059669 100%);
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
  mask-size: 14px;
  -webkit-mask-size: 14px;
}

.pricing-note {
  margin-top: 28px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted-fg);
}

/* Out-of-credits banner */
.banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fcd34d;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.banner a { color: var(--fg); font-weight: 600; }

/* fadeIn for late-loading content */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 280ms ease-out both; }
