/* ==========================================================================
   Nock Technologies — Product Cards
   Isolated styles and hover animations for the 2×2 products grid.
   ========================================================================== */


/* ==========================================================================
   1. Products Section Container + Grid
   ========================================================================== */

.products {
  padding: var(--section-py) 0;
  background-color: var(--card-bg);
}

.products-header {
  margin-bottom: 48px;
}

.products-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}


/* ==========================================================================
   2. Card Base Styles
   ========================================================================== */

.product-card {
  display: flex;
  flex-direction: column;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--bg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition:
    box-shadow var(--dur-slow) var(--ease-out),
    border-color var(--dur-normal) var(--ease-out),
    opacity var(--dur-normal) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
}

.product-card__animation {
  height: 180px;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background-color: var(--bg);
}

.product-card__content {
  padding: 24px 28px 28px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.product-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.product-card__title {
  font-size: 1.25rem;
  font-weight: var(--fw-medium);
  color: var(--navy);
  letter-spacing: -0.02em;
}

.product-card__badge {
  font-size: 0.6875rem;
  font-weight: var(--fw-semibold);
  border-radius: 4px;
  padding: 2px 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Badge variants */
.product-card__badge--live {
  background-color: var(--mint);
  color: #FFFFFF;
}

.product-card__badge--coming-soon {
  background-color: var(--navy-light);
  color: var(--navy);
}

.product-card__badge--construction {
  background-color: var(--coral-light);
  color: var(--coral);
}

/* Developer card io badge */
.product-card__io-badge {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.product-card__subtitle {
  font-size: 0.9375rem;
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.product-card__desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.6;
}


/* ==========================================================================
   3. Card State Styles
   ========================================================================== */

/* JobCost — live, clickable */
.product-card--live {
  cursor: pointer;
}

/* Forge — coming soon, not clickable */
.product-card--coming-soon {
  cursor: default;
  opacity: 0.95;
}

/* Nexus — under construction, not clickable */
.product-card--construction {
  cursor: default;
  opacity: 0.95;
}

/* For Developers — clickable, permanent dark theme */
.product-card--dev {
  cursor: pointer;
  background-color: #0A0A0F;
  border-color: var(--emerald);
}

.product-card--dev .product-card__title {
  color: #F1F1F3;
}

.product-card--dev .product-card__subtitle,
.product-card--dev .product-card__desc {
  color: rgba(241, 241, 243, 0.6);
}

.product-card--dev .product-card__io-badge {
  color: rgba(241, 241, 243, 0.4);
}

.product-card--dev .product-card__animation {
  background-color: #0A0A0F;
}

@media (hover: hover) and (pointer: fine) {
  .product-card--live:hover {
    box-shadow: var(--shadow-hover);
    border-color: rgba(30, 58, 95, 0.15);
    transform: translateY(-3px);
  }

  .product-card--coming-soon:hover {
    opacity: 1;
    box-shadow: var(--shadow-ambient);
  }

  .product-card--construction:hover {
    opacity: 1;
    box-shadow: var(--shadow-ambient);
  }

  .product-card--dev:hover {
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2), rgba(16, 185, 129, 0.12) 0px 20px 40px -20px;
  }
}


/* ==========================================================================
   4. JobCost — Live job budget tracker dashboard
   ========================================================================== */

.jobcost-anim {
  width: 100%;
  max-width: none;
  position: relative;
}

.jc-dashboard {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Header — job ID + name */
.jc-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.jc-job-id {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--navy);
  opacity: 0.45;
  letter-spacing: 0.06em;
}

.jc-job-sep {
  font-size: 0.625rem;
  color: var(--text-secondary);
  opacity: 0.4;
}

.jc-job-name {
  font-size: 0.6875rem;
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
}

/* Metric rows */
.jc-metrics {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.jc-metric {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.jc-metric-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.jc-label {
  font-size: 0.625rem;
  font-weight: var(--fw-medium);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.jc-val {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.jc-val--profit {
  color: var(--mint);
  font-weight: 600;
}

/* Progress tracks */
.jc-track {
  height: 4px;
  background-color: rgba(30, 58, 95, 0.07);
  border-radius: 2px;
  overflow: hidden;
}

.jc-fill {
  height: 100%;
  border-radius: 2px;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.55s var(--ease-out),
              opacity var(--dur-normal) var(--ease-out);
}

/* Bars grow in when card becomes visible */
.js-ready .fade-in.visible .jc-fill--budget {
  transform: scaleX(1);
  transition-delay: 0.08s;
}
.js-ready .fade-in.visible .jc-fill--spent {
  transform: scaleX(1);
  transition-delay: 0.18s;
}
.js-ready .fade-in.visible .jc-fill--profit {
  transform: scaleX(1);
  transition-delay: 0.3s;
}

.jc-fill--budget { width: 100%; background-color: rgba(30, 58, 95, 0.28); }
.jc-fill--spent  { width: 69%;  background-color: var(--coral); opacity: 0.7; }
.jc-fill--profit { width: 31%;  background-color: var(--mint);  opacity: 0.85; }

/* Footer */
.jc-footer-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.jc-live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background-color: var(--mint);
  flex-shrink: 0;
  animation: jc-dot-idle 2.4s ease-in-out infinite;
}

.jc-footer-label {
  font-family: var(--font-mono);
  font-size: 0.5625rem;
  color: var(--text-secondary);
  opacity: 0.55;
  letter-spacing: 0.02em;
}

@keyframes jc-dot-idle {
  0%, 100% { opacity: 1;   transform: scale(1); }
  50%       { opacity: 0.3; transform: scale(0.65); }
}

/* Hover: profit glows, spent bar brightens */
@media (hover: hover) and (pointer: fine) {
  .product-card--live:hover .jc-fill--spent  { opacity: 0.9; }
  .product-card--live:hover .jc-fill--profit { opacity: 1; }
  .product-card--live:hover .jc-val--profit  { color: var(--mint); }
  .product-card--live:hover .jc-live-dot {
    animation: jc-dot-hover 0.9s ease-in-out infinite;
  }
}

@keyframes jc-dot-hover {
  0%, 100% { opacity: 1;   transform: scale(1.2); box-shadow: 0 0 0 3px rgba(45,139,117,0.2); }
  50%       { opacity: 0.5; transform: scale(0.8); box-shadow: none; }
}


/* ==========================================================================
   5. Forge — Pipeline workflow (pulse travels on hover, nodes light up)
   ========================================================================== */

.forge-anim {
  width: 100%;
}

.forge-pipeline {
  width: 100%;
  height: auto;
}

/* Connection lines — visible at rest */
.forge-line {
  opacity: 0.3;
  transition: opacity 200ms var(--ease-out);
}

/* Nodes — visible at rest, light up sequentially on hover */
.forge-node {
  opacity: 0.5;
  transition: opacity 200ms var(--ease-out);
}

.forge-dot {
  transition: opacity 200ms var(--ease-out);
}

/* Labels under each node */
.forge-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 9px;
  font-weight: 500;
  fill: #64748B;
  opacity: 0.6;
  transition: opacity 200ms var(--ease-out);
}

/* Pulse dots — hidden at rest, animate along lines on hover */
.forge-pulse {
  opacity: 0;
}

@media (hover: hover) and (pointer: fine) {
  .product-card--coming-soon:hover .forge-line {
    opacity: 0.6;
  }

  .product-card--coming-soon:hover .forge-label {
    opacity: 1;
  }

  /* Nodes light up sequentially — staggered 60ms per Emil */
  .product-card--coming-soon:hover .forge-node--1 {
    opacity: 1;
  }
  .product-card--coming-soon:hover .forge-node--2 {
    opacity: 1;
    transition-delay: 60ms;
  }
  .product-card--coming-soon:hover .forge-node--3 {
    opacity: 1;
    transition-delay: 120ms;
  }
  .product-card--coming-soon:hover .forge-node--4 {
    opacity: 1;
    transition-delay: 180ms;
  }

  .product-card--coming-soon:hover .forge-dot--1 { opacity: 0.8; transition-delay: 0ms; }
  .product-card--coming-soon:hover .forge-dot--2 { opacity: 0.8; transition-delay: 60ms; }
  .product-card--coming-soon:hover .forge-dot--3 { opacity: 1;   transition-delay: 120ms; }
  .product-card--coming-soon:hover .forge-dot--4 { opacity: 0.8; transition-delay: 180ms; }

  /* Pulse traveling along lines — CSS keyframe animation triggered by hover */
  .product-card--coming-soon:hover .forge-pulse {
    opacity: 0.8;
  }
  .product-card--coming-soon:hover .forge-pulse--1 {
    animation: pulse-travel 800ms var(--ease-out) 100ms both;
  }
  .product-card--coming-soon:hover .forge-pulse--2 {
    animation: pulse-travel 800ms var(--ease-out) 200ms both;
  }
  .product-card--coming-soon:hover .forge-pulse--3 {
    animation: pulse-travel 800ms var(--ease-out) 300ms both;
  }
}

/* Pulse dots — positioned at line start, translate across */
.forge-pulse {
  transform-box: fill-box;
  transform-origin: center;
}
.forge-pulse--1 { cx: 40; cy: 40; }
.forge-pulse--2 { cx: 110; cy: 40; }
.forge-pulse--3 { cx: 180; cy: 40; }

@keyframes pulse-travel {
  0%   { transform: translateX(0); opacity: 0; }
  15%  { opacity: 0.9; }
  85%  { opacity: 0.9; }
  100% { transform: translateX(50px); opacity: 0; }
}


/* ==========================================================================
   6. Nexus — Layered dashboard wireframes (parallax depth on hover)
   ========================================================================== */

/* Nexus — full-bleed light panel for neural network canvas */
.product-card--construction .product-card__animation {
  background-color: var(--bg);
  padding: 0;
  position: relative;
}

/* Absolute fill — bypasses flex centering that constrained the canvas */
.product-card--construction .nexus-anim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
}

.nexus-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Each layer is a small wireframe card stacked with offsets */
.nexus-layer {
  position: absolute;
  width: 180px;
  border-radius: 6px;
  border: 1px solid rgba(30, 58, 95, 0.18);
  background-color: #FFFFFF;
  overflow: hidden;
  transition: transform 250ms var(--ease-out),
              box-shadow 250ms var(--ease-out),
              opacity 250ms var(--ease-out);
}

/* Title bar — visible stripe at top of each layer */
.nexus-layer-bar {
  height: 10px;
  border-bottom: 1px solid rgba(30, 58, 95, 0.1);
  background-color: rgba(30, 58, 95, 0.07);
}

.nexus-layer-body {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Content skeleton blocks — visible fills */
.nexus-layer-block {
  border-radius: 2px;
  background-color: rgba(30, 58, 95, 0.12);
}

/* Stack positioning — back to front */
.nexus-layer--3 {
  top: 0;
  left: 0;
  height: 72px;
  opacity: 0.5;
  z-index: 1;
}

.nexus-layer--2 {
  top: 18px;
  left: 24px;
  height: 80px;
  opacity: 0.72;
  z-index: 2;
}

.nexus-layer--1 {
  top: 36px;
  left: 48px;
  height: 90px;
  opacity: 1;
  z-index: 3;
  box-shadow: rgba(30, 58, 95, 0.1) 0px 4px 12px -4px, rgba(0, 0, 0, 0.05) 0px 2px 4px -2px;
}

/* Hover: layers fan apart — parallax depth effect */
@media (hover: hover) and (pointer: fine) {
  .product-card--construction:hover .nexus-layer--3 {
    transform: translate(-8px, -10px);
    opacity: 0.65;
  }

  .product-card--construction:hover .nexus-layer--2 {
    transform: translate(0, 0);
    opacity: 0.82;
    transition-delay: 30ms;
  }

  .product-card--construction:hover .nexus-layer--1 {
    transform: translate(8px, 10px);
    opacity: 1;
    box-shadow: rgba(30, 58, 95, 0.18) 0px 8px 20px -8px, rgba(0, 0, 0, 0.08) 0px 4px 8px -4px;
    transition-delay: 60ms;
  }
}


/* ==========================================================================
   7. For Developers — Full dark terminal with cursor blink on hover
   ========================================================================== */

.dev-anim {
  width: 100%;
}

.dev-terminal {
  border-radius: 8px;
  border: 1px solid rgba(16, 185, 129, 0.2);
  background-color: #0F172A;
  overflow: hidden;
  transition: box-shadow 200ms var(--ease-out);
}

.dev-terminal-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background-color: rgba(255, 255, 255, 0.03);
}

.dev-terminal-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.15);
  display: inline-block;
  transition: background-color 200ms var(--ease-out);
}

.dev-terminal-body {
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dev-line {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1.6;
  color: rgba(241, 241, 243, 0.6);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.dev-prompt {
  color: var(--emerald);
  font-weight: var(--fw-bold);
}

.dev-cmd {
  color: rgba(241, 241, 243, 0.8);
}

.dev-check {
  color: var(--emerald);
  font-weight: var(--fw-bold);
}

.dev-line--output {
  color: rgba(241, 241, 243, 0.5);
}

/* Cursor — hidden at rest, blinks on hover */
.dev-cursor {
  display: inline-block;
  width: 7px;
  height: 13px;
  background-color: var(--emerald);
  opacity: 0;
  vertical-align: middle;
}

@media (hover: hover) and (pointer: fine) {
  .product-card--dev:hover .dev-terminal {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.12);
  }

  .product-card--dev:hover .dev-terminal-dot:nth-child(1) {
    background-color: #FF5F57;
  }
  .product-card--dev:hover .dev-terminal-dot:nth-child(2) {
    background-color: #FFBD2E;
    transition-delay: 40ms;
  }
  .product-card--dev:hover .dev-terminal-dot:nth-child(3) {
    background-color: var(--emerald);
    transition-delay: 80ms;
  }

  .product-card--dev:hover .dev-line--output {
    color: rgba(241, 241, 243, 0.7);
  }

  .product-card--dev:hover .dev-cursor {
    animation: cursor-blink 1s steps(1) infinite;
  }
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}


/* ==========================================================================
   8. Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  .product-card,
  .jc-fill,
  .jc-live-dot,
  .forge-line,
  .forge-node,
  .forge-dot,
  .forge-label,
  .forge-pulse,
  .nexus-layer,
  .dev-terminal,
  .dev-terminal-dot,
  .dev-line,
  .dev-cursor {
    transition: none !important;
    animation: none !important;
  }

  /* Show illustrations in completed state */
  .jc-fill { transform: scaleX(1) !important; }
  .forge-line { opacity: 0.6; }
  .forge-node { opacity: 0.7; }
  .forge-dot { opacity: 0.7; }
  .forge-pulse { display: none; }
  .nexus-layer--3 { opacity: 0.55; }
  .nexus-layer--2 { opacity: 0.75; }
  .nexus-layer--1 { opacity: 1; }
  .dev-cursor { display: none; }
}


/* ==========================================================================
   9. Responsive
   ========================================================================== */

@media (max-width: 768px) {
  .products-grid {
    grid-template-columns: 1fr;
  }

  .product-card__animation {
    height: 140px;
    padding: 16px;
  }
}


/* ==========================================================================
   10. Scroll Animation Stagger (products grid)
   ========================================================================== */

.products-grid .fade-in:nth-child(2) {
  transition-delay: 60ms;
}

.products-grid .fade-in:nth-child(3) {
  transition-delay: 120ms;
}

.products-grid .fade-in:nth-child(4) {
  transition-delay: 180ms;
}
