/*
 * Home Page Styles
 * ================
 * Premium landing page with pipeline visualization, clarity lens,
 * and multi-section content layout.
 */

/* ==================== SHARED SECTION LAYOUT ==================== */

.home-section {
  position: relative;
  padding: var(--space-24) var(--space-6);
  overflow: hidden;
}

.home-section--alt {
  background: var(--bg-raised);
}

.home-section__inner {
  max-width: var(--container-lg);
  margin: 0 auto;
}

.home-section__label {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-primary-500);
  margin-bottom: var(--space-3);
}

.home-section__title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: var(--font-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.home-section__subtitle {
  font-size: var(--text-lg);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
  max-width: 600px;
}

.home-section__header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.home-section__header .home-section__subtitle {
  margin: 0 auto;
}

/* Scroll reveal */
.home-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.home-reveal--visible {
  opacity: 1;
  transform: translateY(0);
}

/* ==================== HERO SECTION ==================== */

.home-hero {
  position: relative;
  min-height: calc(100vh - var(--header-height));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-6) var(--space-8);
  text-align: center;
  overflow: hidden;
}

/* Background blobs */
.home-hero__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.home-hero__blob {
  position: absolute;
  border-radius: var(--radius-full);
  filter: blur(100px);
}

.home-hero__blob--1 {
  top: -5%;
  left: -5%;
  width: 350px;
  height: 350px;
  background: var(--color-primary-500);
  opacity: 0.08;
}

.home-hero__blob--2 {
  top: 20%;
  right: -5%;
  width: 280px;
  height: 280px;
  background: var(--color-primary-700);
  opacity: 0.06;
}

.home-hero__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  max-width: 700px;
}

.home-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.home-hero__badge-dot {
  width: 6px;
  height: 6px;
  background: var(--color-primary-500);
  border-radius: var(--radius-full);
  animation: home-pulse 2s ease-in-out infinite;
}

.home-hero__title {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
  margin: 0;
}

.home-hero__subtitle {
  font-size: var(--text-lg);
  color: var(--text-muted);
  max-width: 520px;
  line-height: var(--leading-relaxed);
  margin: 0;
}

.home-hero__ctas {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
}

.home-hero__cta-secondary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-md);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  text-decoration: none;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.home-hero__cta-secondary:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: var(--hover-bg);
}

/* Scroll hint */
.home-hero__scroll {
  position: absolute;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-faint);
  animation: home-scroll-bounce 2s ease-in-out infinite;
}

@keyframes home-scroll-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.5; }
  50% { transform: translateX(-50%) translateY(6px); opacity: 1; }
}

/* ==================== PIPELINE VISUALIZATION ==================== */

.home-pipeline {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 800px;
  margin-top: var(--space-10);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-6) 0;
}

/* Signals column (left) */
.home-pipeline__signals {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
}

.home-pipeline__signal {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--text-secondary);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-30px);
  animation: home-signal-in 0.8s var(--ease-out) forwards;
}

.home-pipeline__signal--warn {
  color: var(--color-warning);
  border-color: rgba(245, 158, 11, 0.2);
}

.home-pipeline__signal--error {
  color: var(--color-error);
  border-color: rgba(239, 68, 68, 0.2);
}

.home-pipeline__signal--info {
  color: var(--color-primary-400);
  border-color: rgba(6, 182, 212, 0.2);
}

.home-pipeline__signal:nth-child(1) { animation-delay: 0s; }
.home-pipeline__signal:nth-child(2) { animation-delay: 0.3s; }
.home-pipeline__signal:nth-child(3) { animation-delay: 0.6s; }
.home-pipeline__signal:nth-child(4) { animation-delay: 0.9s; }

@keyframes home-signal-in {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Flow connectors */
.home-pipeline__flow {
  width: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.home-pipeline__flow-line {
  width: 100%;
  height: 2px;
  background: var(--border-strong);
  position: relative;
}

.home-pipeline__flow-line::after {
  content: '';
  position: absolute;
  top: -1px;
  right: 0;
  width: 8px;
  height: 4px;
  background: var(--color-primary-500);
  border-radius: 2px;
  animation: home-flow-pulse 2s ease-in-out infinite;
}

@keyframes home-flow-pulse {
  0%, 100% { opacity: 0.3; transform: translateX(-30px); }
  50% { opacity: 1; transform: translateX(0); }
}

/* Core processing box */
.home-pipeline__core {
  position: relative;
  flex-shrink: 0;
  width: 100px;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-overlay);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
}

.home-pipeline__core-ring {
  position: absolute;
  inset: -6px;
  border-radius: calc(var(--radius-xl) + 6px);
  border: 2px solid var(--color-primary-500);
  opacity: 0.3;
  animation: home-core-pulse 3s ease-in-out infinite;
}

@keyframes home-core-pulse {
  0%, 100% { opacity: 0.15; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.04); }
}

.home-pipeline__core-label {
  font-size: var(--text-md);
  font-weight: var(--font-bold);
  color: var(--color-primary-400);
  letter-spacing: var(--tracking-wide);
}

/* Actions column (right) */
.home-pipeline__actions {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.home-pipeline__action {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  color: var(--color-primary-400);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(30px);
  animation: home-action-out 0.8s var(--ease-out) forwards;
}

.home-pipeline__action:nth-child(1) { animation-delay: 1.2s; }
.home-pipeline__action:nth-child(2) { animation-delay: 1.5s; }
.home-pipeline__action:nth-child(3) { animation-delay: 1.8s; }

@keyframes home-action-out {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==================== CLARITY LENS SECTION ==================== */

.home-clarity {
  position: relative;
  padding: var(--space-24) 0;
  overflow: hidden;
}

.home-clarity__header {
  text-align: center;
  padding: 0 var(--space-6);
  margin-bottom: var(--space-12);
}

/* Scrolling text viewport */
.home-clarity__viewport {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
}

/* Blurred background layer */
.home-clarity__layer {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-4);
}

.home-clarity__layer--blur {
  filter: blur(4px);
  opacity: 0.3;
}

/* Clear layer - clipped to lens shape */
.home-clarity__layer--clear {
  clip-path: inset(
    calc(50% - 80px)
    calc(50% - 200px)
    calc(50% - 80px)
    calc(50% - 200px)
    round var(--radius-xl)
  );
  z-index: 2;
}

/* Scrolling text rows */
.home-clarity__row {
  display: flex;
  gap: var(--space-6);
  white-space: nowrap;
  will-change: transform;
}

.home-clarity__row--left {
  animation: home-scroll-left 30s linear infinite;
}

.home-clarity__row--right {
  animation: home-scroll-right 28s linear infinite;
}

@keyframes home-scroll-left {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@keyframes home-scroll-right {
  from { transform: translateX(-50%); }
  to { transform: translateX(0); }
}

.home-clarity__item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-overlay);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.home-clarity__item-dot {
  width: 6px;
  height: 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.home-clarity__item-dot--red { background: var(--color-error); }
.home-clarity__item-dot--yellow { background: var(--color-warning); }
.home-clarity__item-dot--cyan { background: var(--color-primary-400); }
.home-clarity__item-dot--green { background: var(--color-success); }

/* The lens overlay decoration */
.home-clarity__lens {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 400px;
  height: 160px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-primary-500);
  box-shadow:
    0 0 30px rgba(6, 182, 212, 0.15),
    inset 0 0 30px rgba(6, 182, 212, 0.05);
  pointer-events: none;
  z-index: 3;
}

.home-clarity__lens-label {
  position: absolute;
  bottom: var(--space-2);
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-primary-500);
  opacity: 0.6;
  white-space: nowrap;
}

/* ==================== PROBLEM SECTION ==================== */

.home-problem__inner {
  max-width: 700px;
  margin: 0 auto;
  text-align: center;
}

.home-problem__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  font-size: var(--text-md);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.home-problem__text strong {
  color: var(--text-primary);
  font-weight: var(--font-semibold);
}

/* ==================== HOW IT WORKS (PROCESS GRID) ==================== */

.home-process__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
}

.home-process__step {
  padding: var(--space-6);
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-base);
}

.home-process__step:hover {
  border-color: var(--border-strong);
}

.home-process__num {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--color-primary-500);
  opacity: 0.4;
  line-height: 1;
  margin-bottom: var(--space-3);
  font-family: var(--font-mono);
}

.home-process__step h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.home-process__step p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
}

/* ==================== FEATURES GRID ==================== */

.home-features__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.home-features__card {
  padding: var(--space-6);
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-base);
}

.home-features__card:hover {
  border-color: var(--border-strong);
}

.home-features__card--highlight {
  border-color: rgba(6, 182, 212, 0.3);
  background: rgba(6, 182, 212, 0.03);
}

.home-features__card--highlight:hover {
  border-color: rgba(6, 182, 212, 0.5);
}

.home-features__icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-info-muted);
  border-radius: var(--radius-md);
  color: var(--color-primary-500);
  margin-bottom: var(--space-4);
}

.home-features__icon svg {
  width: 20px;
  height: 20px;
}

.home-features__card h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.home-features__card ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.home-features__card li {
  font-size: var(--text-sm);
  color: var(--text-muted);
  padding-left: var(--space-4);
  position: relative;
  line-height: var(--leading-relaxed);
}

.home-features__card li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 5px;
  height: 5px;
  border-radius: var(--radius-full);
  background: var(--color-primary-500);
  opacity: 0.5;
}

/* ==================== HUMAN-IN-THE-LOOP CALLOUT ==================== */

.home-callout {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  gap: var(--space-5);
  padding: var(--space-6);
  background: var(--bg-raised);
  border: 1px solid rgba(6, 182, 212, 0.2);
  border-left: 3px solid var(--color-primary-500);
  border-radius: var(--radius-lg);
}

.home-callout__icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-info-muted);
  border-radius: var(--radius-md);
  color: var(--color-primary-500);
}

.home-callout__icon svg {
  width: 22px;
  height: 22px;
}

.home-callout__content h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.home-callout__content p {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
}

/* ==================== BOTTOM CTA ==================== */

.home-cta {
  text-align: center;
  padding: var(--space-24) var(--space-6);
}

.home-cta__inner {
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
}

.home-cta__title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: var(--font-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

.home-cta__text {
  font-size: var(--text-md);
  color: var(--text-muted);
  line-height: var(--leading-relaxed);
}

/* ==================== KEYFRAME ANIMATIONS ==================== */

@keyframes home-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

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

@media (max-width: 1024px) {
  .home-process__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .home-section {
    padding: var(--space-16) var(--space-4);
  }

  .home-hero {
    padding: var(--space-8) var(--space-4) var(--space-6);
    min-height: auto;
  }

  .home-hero__ctas {
    flex-direction: column;
    width: 100%;
  }

  .home-hero__ctas .btn {
    width: 100%;
    justify-content: center;
  }

  .home-hero__cta-secondary {
    width: 100%;
    justify-content: center;
  }

  /* Pipeline stacks vertically */
  .home-pipeline {
    flex-direction: column;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
    gap: var(--space-3);
  }

  .home-pipeline__signals {
    align-items: center;
  }

  .home-pipeline__actions {
    align-items: center;
  }

  .home-pipeline__flow {
    transform: rotate(90deg);
    width: 40px;
  }

  .home-pipeline__signal {
    transform: translateY(-20px);
    animation-name: home-signal-in-mobile;
  }

  .home-pipeline__action {
    transform: translateY(20px);
    animation-name: home-action-out-mobile;
  }

  @keyframes home-signal-in-mobile {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes home-action-out-mobile {
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Clarity lens shrinks */
  .home-clarity__lens {
    width: 280px;
    height: 150px;
  }

  .home-clarity__layer--clear {
    clip-path: inset(
      calc(50% - 75px)
      calc(50% - 140px)
      calc(50% - 75px)
      calc(50% - 140px)
      round var(--radius-xl)
    );
  }

  .home-clarity__viewport {
    height: 180px;
  }

  /* Grids collapse */
  .home-process__grid {
    grid-template-columns: 1fr;
  }

  .home-features__grid {
    grid-template-columns: 1fr;
  }

  /* Callout stacks */
  .home-callout {
    flex-direction: column;
    gap: var(--space-3);
  }
}

@media (max-width: 480px) {
  .home-clarity__lens {
    width: 220px;
    height: 120px;
  }

  .home-clarity__layer--clear {
    clip-path: inset(
      calc(50% - 60px)
      calc(50% - 110px)
      calc(50% - 60px)
      calc(50% - 110px)
      round var(--radius-lg)
    );
  }

  .home-clarity__item {
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-3);
  }
}

/* ==================== REDUCED MOTION ==================== */

@media (prefers-reduced-motion: reduce) {
  .home-pipeline__signal,
  .home-pipeline__action {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .home-pipeline__core-ring {
    animation: none;
    opacity: 0.2;
  }

  .home-pipeline__flow-line::after {
    animation: none;
    opacity: 0.6;
    transform: none;
  }

  .home-clarity__row--left,
  .home-clarity__row--right {
    animation: none;
  }

  .home-hero__badge-dot {
    animation: none;
  }

  .home-hero__scroll {
    animation: none;
    opacity: 0.5;
  }

  .home-reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
