/* ─────────────────────────────────────────
   FEATURE CARDS — ported from v2 as-is
   Animations, text styles, scroll triggers.
   Background comes from .cc-grid-card in styles.css
   ───────────────────────────────────────── */

.cc-grid-card.feature-card {
  padding: 32px 28px 36px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: stretch;
  overflow: hidden;
  position: relative;
}

.feature-card > * {
  position: relative;
  z-index: 1;
}

.feature-card p {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  color: rgba(0, 0, 0, 0.45);
  align-self: start;
  letter-spacing: 0.01em;
}

.feature-card h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: rgba(0, 0, 0, 0.85);
  line-height: 1.2;
  align-self: end;
}

/* ── Shared visual container ── */
.feat-vis {
  position: relative;
  width: 100%;
  height: 56px;
  align-self: center;
  justify-self: center;
  margin: 0;
}

/* ── 1 · Digitaliza — light sweeps glass docs ── */
.vis-digitaliza {
  display: flex;
  gap: 6px;
  align-items: stretch;
}
.vis-digitaliza .doc {
  flex: 1;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 4px;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 48px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.vis-digitaliza .doc span {
  display: block;
  height: 2px;
  background: rgba(0, 0, 0, 0.14);
  border-radius: 1px;
  width: 100%;
}
.vis-digitaliza .doc span.short { width: 55%; }
.vis-digitaliza .scan-bar {
  position: absolute;
  top: -2px;
  left: 0;
  width: 36px;
  height: calc(100% + 4px);
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(0, 0, 0, 0.03) 30%,
    rgba(0, 0, 0, 0.07) 50%,
    rgba(0, 0, 0, 0.03) 70%,
    transparent 100%);
  box-shadow: none;
  filter: blur(2px);
  animation: doc-scan 5.5s ease-in-out infinite;
}

@keyframes doc-scan {
  0%   { left: -2%; opacity: 0; }
  8%   { opacity: 1; }
  92%  { opacity: 1; }
  100% { left: 102%; opacity: 0; }
}

/* ── 2 · Integra — glass orbs converging ── */
.vis-integra {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
}
.vis-integra .orb {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: orb-converge 5s ease-in-out infinite;
}
.vis-integra .orb-1 { --tx: -56px; --ty:   2px; animation-delay: 0s;    }
.vis-integra .orb-2 { --tx: -28px; --ty: -10px; animation-delay: 0.06s; }
.vis-integra .orb-3 { --tx:   0px; --ty:  10px; animation-delay: 0.12s; }
.vis-integra .orb-4 { --tx:  28px; --ty: -10px; animation-delay: 0.18s; }
.vis-integra .orb-5 { --tx:  56px; --ty:   2px; animation-delay: 0.24s; }

@keyframes orb-converge {
  0%, 100% { transform: translate(var(--tx), var(--ty)); opacity: 0.85; }
  40%, 60% { transform: translate(0, 0);                  opacity: 1;    }
}

/* ── 3 · Analiza — glass cells reading row by row ── */
.vis-analiza {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.vis-analiza .row {
  display: flex;
  gap: 3px;
  height: 10px;
}
.vis-analiza .cell {
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.06);
  animation: cell-read 4s ease-in-out infinite;
}
.c1 { flex: 2; }
.c2 { flex: 3; }
.c3 { flex: 1.5; }
.c4 { flex: 2.5; }

.row-1 .c1 { animation-delay: 0s; }
.row-1 .c2 { animation-delay: 0.1s; }
.row-1 .c3 { animation-delay: 0.2s; }
.row-1 .c4 { animation-delay: 0.3s; }
.row-2 .c1 { animation-delay: 0.4s; }
.row-2 .c2 { animation-delay: 0.5s; }
.row-2 .c3 { animation-delay: 0.6s; }
.row-2 .c4 { animation-delay: 0.7s; }
.row-3 .c1 { animation-delay: 0.8s; }
.row-3 .c2 { animation-delay: 0.9s; }
.row-3 .c3 { animation-delay: 1.0s; }
.row-3 .c4 { animation-delay: 1.1s; }
.row-4 .c1 { animation-delay: 1.2s; }
.row-4 .c2 { animation-delay: 1.3s; }
.row-4 .c3 { animation-delay: 1.4s; }
.row-4 .c4 { animation-delay: 1.5s; }

@keyframes cell-read {
  0%, 100% { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.06); }
  18%      { background: rgba(0,0,0,0.18); border-color: rgba(0,0,0,0.25); }
  45%      { background: rgba(0,0,0,0.08); border-color: rgba(0,0,0,0.1); }
}

/* ── 4 · Automatiza — workflow with traveling light ── */
.vis-automatiza {
  display: flex;
  align-items: center;
  justify-content: center;
}
.vis-automatiza svg {
  width: 100%;
  height: 48px;
  overflow: visible;
}
.vis-automatiza .wf-node {
  fill: rgba(0, 0, 0, 0.05);
  stroke: rgba(0, 0, 0, 0.15);
  stroke-width: 0.6;
  animation: wf-glow 3.5s ease-in-out infinite;
}
.vis-automatiza .wn-1 { animation-delay: 0s; }
.vis-automatiza .wn-2,
.vis-automatiza .wn-3 { animation-delay: 0.45s; }
.vis-automatiza .wn-4 { animation-delay: 0.95s; }
.vis-automatiza .wn-5 { animation-delay: 1.45s; }

.vis-automatiza .wf-arrow {
  stroke: rgba(0, 0, 0, 0.12);
  stroke-width: 0.5;
  fill: none;
}

.vis-automatiza .flow-dot {
  fill: rgba(0, 0, 0, 0.7);
  filter: drop-shadow(0 0 2.5px rgba(0, 0, 0, 0.25));
}

.vis-automatiza .wf-final {
  fill: rgba(77, 1, 255, 0.6);
  filter: drop-shadow(0 0 6px rgba(77, 1, 255, 0.75));
  opacity: 0;
  transform-origin: 50% 50%;
  transform-box: fill-box;
  animation: wf-done 3.5s ease-in-out infinite;
  animation-delay: 1.6s;
}

@keyframes wf-glow {
  0%, 100% { stroke: rgba(0,0,0,0.15); fill: rgba(0,0,0,0.05); }
  18%, 32% { stroke: rgba(0,0,0,0.35);  fill: rgba(0,0,0,0.12); }
}

@keyframes wf-done {
  0%, 100% { opacity: 0; transform: scale(1); }
  20%      { opacity: 1; transform: scale(1); }
  60%      { opacity: 1; transform: scale(1); }
  100%     { opacity: 0; transform: scale(1.4); }
}


/* ─────────────────────────────────────────
   CC HOME — scroll-triggered overrides
   ───────────────────────────────────────── */

.cc-home .feature-card {
  transition: background 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.5s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.cc-home .feature-card .feat-vis {
  opacity: 0.7;
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.cc-home .feature-card:hover .feat-vis {
  opacity: 1;
}

/* Paused by default, unpaused when in viewport */
.cc-home .feature-card .scan-bar,
.cc-home .feature-card .orb,
.cc-home .feature-card .orb-core,
.cc-home .feature-card .cell,
.cc-home .feature-card .wf-node,
.cc-home .feature-card .wf-final,
.cc-home .feature-card .flow-dot {
  animation-play-state: paused;
}
.cc-home .feature-card.in-view .scan-bar,
.cc-home .feature-card.in-view .orb,
.cc-home .feature-card.in-view .orb-core,
.cc-home .feature-card.in-view .cell,
.cc-home .feature-card.in-view .wf-node,
.cc-home .feature-card.in-view .wf-final,
.cc-home .feature-card.in-view .flow-dot {
  animation-play-state: running;
}

/* 1 · Digitaliza — soft grey sweep */
.cc-home .vis-digitaliza .scan-bar {
  width: 40px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(0, 0, 0, 0.03) 30%,
    rgba(0, 0, 0, 0.08) 50%,
    rgba(0, 0, 0, 0.03) 70%,
    transparent 100%);
  box-shadow: none;
  filter: blur(2px);
  animation: cc-doc-scan 5.5s ease-in-out infinite;
}

@keyframes cc-doc-scan {
  0%   { left: -8%; opacity: 0; }
  8%   { opacity: 1; }
  88%  { opacity: 1; }
  100% { left: 102%; opacity: 0; }
}

.cc-home .vis-digitaliza .doc {
  transition: border-color 0.4s ease, background 0.4s ease;
}

/* 2 · Integra — refined convergence */
.cc-home .vis-integra { overflow: visible; }

.cc-home .vis-integra .orb {
  animation: cc-orb-converge 6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.cc-home .vis-integra .orb-1 { --tx: -48px; --ty:  -4px; }
.cc-home .vis-integra .orb-2 { --tx: -24px; --ty:   8px; }
.cc-home .vis-integra .orb-3 { --tx:   0px; --ty:  -6px; }
.cc-home .vis-integra .orb-4 { --tx:  24px; --ty:   8px; }
.cc-home .vis-integra .orb-5 { --tx:  48px; --ty:  -4px; }

@keyframes cc-orb-converge {
  0%, 100% { transform: translate(var(--tx), var(--ty)); opacity: 0.8; }
  40%, 60% { transform: translate(0, 0); opacity: 1; }
}

.cc-home .vis-integra .orb-core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(0, 0, 0, 0.6) 0%,
    rgba(0, 0, 0, 0.15) 45%,
    rgba(0, 0, 0, 0) 70%);
  opacity: 0;
  pointer-events: none;
  animation: cc-orb-click 6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes cc-orb-click {
  0%, 38%  { opacity: 0; transform: scale(0.3); }
  46%      { opacity: 0.9; transform: scale(1.2); }
  54%      { opacity: 0.45; transform: scale(2.6); }
  64%, 100% { opacity: 0; transform: scale(3.5); }
}

/* 3 · Analiza — refined cell sweep */
.cc-home .vis-analiza .cell {
  animation: cc-cell-read 5s ease-in-out infinite;
}

@keyframes cc-cell-read {
  0%, 100% { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.06); }
  18%      { background: rgba(0,0,0,0.18); border-color: rgba(0,0,0,0.25); }
  42%      { background: rgba(0,0,0,0.08); border-color: rgba(0,0,0,0.1); }
}

.cc-home .row-1 .c1 { animation-delay: 0s; }
.cc-home .row-1 .c2 { animation-delay: 0.12s; }
.cc-home .row-1 .c3 { animation-delay: 0.24s; }
.cc-home .row-1 .c4 { animation-delay: 0.36s; }
.cc-home .row-2 .c1 { animation-delay: 0.48s; }
.cc-home .row-2 .c2 { animation-delay: 0.60s; }
.cc-home .row-2 .c3 { animation-delay: 0.72s; }
.cc-home .row-2 .c4 { animation-delay: 0.84s; }
.cc-home .row-3 .c1 { animation-delay: 0.96s; }
.cc-home .row-3 .c2 { animation-delay: 1.08s; }
.cc-home .row-3 .c3 { animation-delay: 1.20s; }
.cc-home .row-3 .c4 { animation-delay: 1.32s; }
.cc-home .row-4 .c1 { animation-delay: 1.44s; }
.cc-home .row-4 .c2 { animation-delay: 1.56s; }
.cc-home .row-4 .c3 { animation-delay: 1.68s; }
.cc-home .row-4 .c4 { animation-delay: 1.80s; }

/* 4 · Automatiza — refined workflow */
.cc-home .vis-automatiza .wf-node {
  animation: cc-wf-glow 4.5s ease-in-out infinite;
}
.cc-home .vis-automatiza .wn-1 { animation-delay: 0s; }
.cc-home .vis-automatiza .wn-2,
.cc-home .vis-automatiza .wn-3 { animation-delay: 0.5s; }
.cc-home .vis-automatiza .wn-4 { animation-delay: 1.0s; }
.cc-home .vis-automatiza .wn-5 { animation-delay: 1.5s; }

.cc-home .vis-automatiza .wf-final {
  animation: cc-wf-done 4.5s ease-in-out infinite;
  animation-delay: 1.8s;
}

@keyframes cc-wf-glow {
  0%, 100% { stroke: rgba(0,0,0,0.15); fill: rgba(0,0,0,0.05); }
  20%, 35% { stroke: rgba(0,0,0,0.35);  fill: rgba(0,0,0,0.12); }
}

@keyframes cc-wf-done {
  0%, 100% { opacity: 0; transform: scale(1); }
  20%      { opacity: 1; transform: scale(1); }
  60%      { opacity: 1; transform: scale(1); }
  85%      { opacity: 0; transform: scale(1.4); }
}

/* ── Responsive: 768px ── */
@media (max-width: 768px) {
  .cc-grid-card.feature-card {
    padding: 24px 20px 28px;
  }

  .feature-card p {
    font-size: 13px;
  }

  .feature-card h3 {
    font-size: 16px;
  }

  .feat-vis {
    height: 48px;
  }
}

/* ── Responsive: 640px — horizontal card layout ── */
@media (max-width: 640px) {
  .cc-grid-card.feature-card {
    display: grid;
    grid-template-columns: 1fr 0.8fr;
    grid-template-rows: auto 1fr;
    gap: 8px 16px;
    padding: 20px;
    min-height: auto;
    align-items: center;
  }

  .feature-card p {
    grid-column: 1;
    grid-row: 1;
    font-size: 13px;
    line-height: 1.5;
    align-self: start;
  }

  .feature-card h3 {
    grid-column: 1;
    grid-row: 2;
    font-size: 16px;
    align-self: end;
  }

  .feature-card .feat-vis {
    grid-column: 2;
    grid-row: 1 / -1;
    height: 56px;
    align-self: center;
    justify-self: end;
    width: 100%;
  }

  .vis-integra .orb {
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
  }
}

/* ── Responsive: 480px ── */
@media (max-width: 480px) {
  .cc-grid-card.feature-card {
    grid-template-columns: 1fr 0.6fr;
    gap: 6px 12px;
    padding: 18px;
  }

  .feature-card p {
    font-size: 12px;
  }

  .feature-card h3 {
    font-size: 15px;
  }

  .feature-card .feat-vis {
    height: 48px;
  }

  .vis-automatiza svg {
    height: 36px;
  }

  .vis-integra .orb {
    width: 18px;
    height: 18px;
    margin: -9px 0 0 -9px;
  }
}

/* ── Responsive: 360px ── */
@media (max-width: 360px) {
  .cc-grid-card.feature-card {
    grid-template-columns: 1fr 0.5fr;
    gap: 4px 10px;
    padding: 16px;
  }

  .feature-card p {
    font-size: 11px;
  }

  .feature-card h3 {
    font-size: 14px;
  }

  .feature-card .feat-vis {
    height: 40px;
  }
}


/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .cc-home .feature-card * {
    animation: none !important;
    transition: none !important;
  }
  .cc-home .vis-digitaliza .scan-bar { display: none; }
  .cc-home .vis-integra .orb { transform: translate(0, 0); opacity: 1; }
  .cc-home .vis-analiza .cell {
    background: rgba(0,0,0,0.08);
    border-color: rgba(0,0,0,0.12);
  }
}
