/*
 * OphieAI — Home Page Styles (cinematic revamp)
 *
 * Sections:
 *   1. Hero cinematic: pinned 4-scene crossfade + paper video background + progress rail
 *   2. What we do: 3 cards with Kling imagery
 *   3. Proof: carousel of customer stories with JSON artifacts
 *   4. FAQ on home
 */

/* ============================================
   HERO CINEMATIC
   ============================================ */

.hero-cinematic {
  position: relative;
  height: 400vh;              /* pin duration; JS pins the stage inside (4 scenes) */
  background: var(--color-bg);
}

/* Static fallback (reduced-motion, narrow, or GSAP missing) */
.hero-cinematic--static {
  height: auto;
}

.hero-cinematic--static .hero-stage {
  position: relative;
  height: auto;
}

.hero-cinematic--static .hero-scene-wrap {
  position: relative;
  height: auto;
}

.hero-cinematic--static .hero-scene {
  position: relative;
  opacity: 1;
  transform: none;
  min-height: 90dvh;
  padding-block: var(--space-3xl);
  border-bottom: 1px solid var(--color-border);
}

.hero-cinematic--static .hero-scene:last-child {
  border-bottom: none;
}

/* Pinned stage (fills the viewport while pinned) */
.hero-stage {
  position: relative;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

/* Background video — covers the stage.
   Scaled up ~15% and object-position centred so that the frames near
   the end of the loop (where the paper edges pinch inward at the left
   and right borders) get cropped out of view. */
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  z-index: 0;
  transform: scale(1.15);
  transform-origin: center center;
  filter: saturate(0.4) brightness(0.85);
}

/* Paper texture backdrop — warm grey paper feel, no animation. */
.hero-paper {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url('/assets/images/hero-poster.png') center / cover no-repeat;
  filter: saturate(0.35) brightness(0.85);
  transform: scale(1.15);
  transform-origin: center center;
}

/* Dark gradient overlay — keeps text legible over any video frame */
.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(135deg,
      oklch(9% 0.01 268 / 0.72) 0%,
      oklch(9% 0.01 268 / 0.55) 45%,
      oklch(9% 0.01 268 / 0.88) 100%);
}

/* Scene container — all scenes stacked, absolute, crossfaded */
.hero-scene-wrap {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  padding-top: var(--nav-height);
}

.hero-scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-inline: var(--space-16);
  padding-block: var(--space-2xl);
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity 650ms var(--ease-out),
    transform 650ms var(--ease-out);
  pointer-events: none;
  max-width: var(--max-width);
  margin-inline: auto;
  width: 100%;
}

.hero-scene.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* Eyebrow label */
.hero-eyebrow {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-8);
}

/* Display headline */
.hero-heading {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: var(--tracking-hero);
  color: var(--color-ink);
  margin-bottom: var(--space-8);
  max-width: 18ch;
}

.hero-heading em {
  font-style: italic;
  font-weight: 400;
}

/* Supporting body text */
.hero-body {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  /* Brighter than --color-text-muted (60%) so it reads cleanly over the
     dark video background. Subtle shadow lifts it off the noisier areas. */
  color: oklch(90% 0.005 268);
  text-shadow: 0 1px 2px oklch(0% 0 0 / 0.4);
  max-width: 52ch;
  margin-bottom: var(--space-10);
}

/* Trademark superscripts — size down so the ™ does not disrupt line height
   on either the hero body text or the solution card titles. */
.hero-body sup,
.hero-heading sup,
.solution-card-title sup,
.solution-card-desc sup {
  font-size: 0.55em;
  vertical-align: super;
  line-height: 0;
  margin-left: 0.05em;
}

/* Hero CTA row (scene 3 only) */
.hero-cta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* Scroll indicator (scene 1 only) */
.hero-scene .scroll-indicator {
  position: absolute;
  bottom: var(--space-8);
  left: var(--space-16);
}

@media (max-width: 900px) {
  .hero-scene {
    padding-inline: var(--space-6);
  }
  .hero-scene .scroll-indicator {
    left: var(--space-6);
  }
}

/* ============================================
   WHAT WE DO — fuller section, image-on-top cards
   ============================================ */

.what-we-do {
  padding-block: var(--space-3xl);
  position: relative;
}

.what-we-do-header {
  max-width: none;
  margin-bottom: var(--space-2xl);
}

.what-we-do-eyebrow {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-4);
}

/* Large "Start here" title — bumped up from the previous 1.75–2.6rem
   scale to match the cinematic hero scale. */
.what-we-do-title {
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 5.5vw, 4.75rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: var(--tracking-hero);
  color: var(--color-ink);
  max-width: none;
  margin-bottom: var(--space-4);
}

.what-we-do-title em {
  font-style: italic;
}

.what-we-do-subtitle {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--color-text-muted);
  max-width: 52ch;
}

/* Cards grid — three cards across on desktop, image-on-top, text-on-bottom. */
.solution-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: var(--space-6);
}

.solution-card {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 220px 1fr;
  align-items: stretch;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  min-height: 420px;
  transition:
    border-color var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out),
    background var(--dur-base) var(--ease-out);
}

.solution-card:hover {
  transform: translateY(-4px);
  background: var(--color-surface-high);
}

.solution-card-media {
  background: var(--color-surface-high);
  overflow: hidden;
  position: relative;
  align-self: stretch;
  min-height: 100%;
}

.solution-card-media img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  filter: saturate(0.6) brightness(0.95);
  transition: transform 600ms var(--ease-out), filter var(--dur-base);
}


.solution-card:hover .solution-card-media img {
  transform: scale(1.04);
  filter: saturate(0.85) brightness(1);
}

.solution-card-body {
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 0;
}

.solution-card-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 400;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-ink);
}

.solution-card-tagline {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 400;
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  color: var(--color-accent);
  margin-top: calc(-1 * var(--space-2));
}

.solution-card-tagline em {
  font-style: italic;
}

.solution-card-desc {
  font-size: var(--text-base);
  line-height: var(--leading-snug);
  color: var(--color-text-muted);
  max-width: 42ch;
  flex: 1;
}

.solution-card-footer {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-accent);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

/* ============================================
   INTAKE FORM
   ============================================ */

.intake-section {
  padding-block: var(--space-3xl);
  border-top: 1px solid var(--color-border);
  position: relative;
}

/* 2-column layout — form on the left, vertical marquee on the right */
.intake-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-2xl);
  align-items: center;
}

.intake-content {
  min-width: 0;
}

.intake-header {
  margin-bottom: var(--space-2xl);
  max-width: 48ch;
}

.intake-eyebrow {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-4);
}

.intake-title {
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 5.5vw, 4.75rem);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: var(--tracking-hero);
  color: var(--color-ink);
  margin-bottom: var(--space-4);
}

.intake-title em { font-style: italic; }

.intake-subtitle {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-text-muted);
}

/* Form */
.intake-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5) var(--space-6);
  max-width: 640px;
}

.intake-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.intake-field--full {
  grid-column: span 2;
}

.intake-label {
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.intake-label-optional {
  margin-left: var(--space-2);
  font-weight: 400;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-subtle);
  text-transform: none;
}

.intake-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-ink);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--dur-fast), background var(--dur-fast);
}

.intake-input::placeholder {
  color: var(--color-text-subtle);
}

.intake-input:hover {
  border-color: var(--color-border-hover);
}

.intake-input:focus {
  border-color: var(--color-accent);
  background: var(--color-surface-high);
  outline: none;
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.intake-textarea {
  min-height: 7rem;
  resize: vertical;
  line-height: var(--leading-relaxed);
}

.intake-submit {
  margin-top: var(--space-2);
  grid-column: span 2;
  justify-self: start;
}

.intake-footnote {
  margin-top: var(--space-6);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 56ch;
}

.intake-footnote a {
  color: var(--color-accent);
  text-decoration: none;
}

.intake-footnote a:hover { text-decoration: underline; }

/* Success state (after submit) */
.intake-success {
  display: none;
  padding: var(--space-8) var(--space-10);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-lg);
  max-width: 640px;
}

.intake-success.is-visible { display: block; }

.intake-form.is-submitted { display: none; }

.intake-success-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 400;
  color: var(--color-ink);
  margin-bottom: var(--space-3);
}

.intake-success-body {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-text-muted);
  max-width: 52ch;
}

/* ============================================
   INTAKE VERTICAL MARQUEE (right column)
   ============================================ */

.intake-marquee {
  position: relative;
  height: clamp(600px, 75vh, 900px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  pointer-events: none;
}

.intake-marquee-track {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  animation: marquee-vertical 60s linear infinite;
  will-change: transform;
}

.intake-marquee.is-reduced-motion .intake-marquee-track {
  animation: none;
}

.intake-marquee-item {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.8vw, 2.75rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: var(--tracking-hero);
  color: var(--color-ink);
  padding-block: var(--space-5);
  text-align: left;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 120ms linear;
}

.intake-marquee-vignette {
  position: absolute;
  left: 0;
  right: 0;
  height: 40%;
  pointer-events: none;
  z-index: 2;
}

.intake-marquee-vignette--top {
  top: 0;
  background: linear-gradient(
    to bottom,
    var(--color-bg) 0%,
    oklch(9% 0.005 268 / 0.55) 55%,
    transparent 100%
  );
}

.intake-marquee-vignette--bottom {
  bottom: 0;
  background: linear-gradient(
    to top,
    var(--color-bg) 0%,
    oklch(9% 0.005 268 / 0.55) 55%,
    transparent 100%
  );
}

@keyframes marquee-vertical {
  from { transform: translateY(0); }
  to   { transform: translateY(-100%); }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1100px) {
  .solution-card {
    grid-template-rows: 180px 1fr;
    min-height: 380px;
  }

  .intake-layout {
    gap: var(--space-xl);
  }
}

@media (max-width: 900px) {
  .solution-cards {
    grid-template-columns: 1fr;
  }

  .solution-card {
    grid-template-rows: 200px 1fr;
    min-height: 360px;
  }

  .what-we-do-title {
    font-size: clamp(2rem, 7vw, 3rem);
  }

  .intake-layout {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }

  .intake-title {
    font-size: clamp(2rem, 7vw, 3rem);
  }

  .intake-marquee {
    height: clamp(320px, 45vh, 480px);
  }

  .hero-heading {
    font-size: clamp(2.4rem, 9vw, 4rem);
  }

  .hero-body {
    font-size: var(--text-base);
  }
}

@media (max-width: 600px) {
  .hero-scene {
    padding-block: var(--space-xl);
  }

  .intake-form {
    grid-template-columns: 1fr;
  }

  .intake-field--full,
  .intake-submit {
    grid-column: span 1;
  }

  .intake-marquee-item {
    font-size: clamp(1.25rem, 6vw, 1.9rem);
    padding-block: var(--space-4);
  }
}
