/* ============================================================
   Component · Service Card  (3 pillars: Modeling / Coordination / Advisory)
   Idle = thin ruled border, no fill.
   Hover = border → accent, faint sweep fill from bottom-left,
           "Learn more" arrow shifts 4px right, top stripe 2 → 4px.
   ============================================================ */

.service-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0; /* rules separate cards instead */
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
@media (min-width: 768px) {
  .service-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
  }
}

.service {
  --stripe-h: 2px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  padding: var(--space-xl) var(--space-lg);
  background: transparent;
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
  isolation: isolate;
  transition: background var(--duration-normal) var(--ease-out);
}
@media (min-width: 768px) {
  .service {
    border-bottom: none;
    border-right: 1px solid var(--color-border);
  }
  .service:last-child { border-right: none; }
}

/* Top stripe — section-marker on an architectural drawing */
.service::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--stripe-h);
  background: var(--color-ink-muted);
  transition: height var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
  z-index: 1;
}

/* Hover wash — a soft accent glow. JS (services.js) sets --mx/--my so
   it tracks the cursor; the defaults keep the original bottom-left
   origin before JS runs / on touch. */
.service::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at var(--mx, 0%) var(--my, 100%),
    color-mix(in srgb, var(--color-accent) 10%, transparent) 0%,
    transparent 55%
  );
  opacity: 0;
  transition: opacity var(--duration-normal) var(--ease-out);
  pointer-events: none;
  z-index: 0;
}

.service > * { position: relative; z-index: 2; }

.service:hover {
  background: color-mix(in srgb, var(--color-surface) 50%, var(--color-white));
}
.service:hover::before { --stripe-h: 4px; background: var(--color-accent); }
.service:hover::after  { opacity: 1; }

.service__index {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--color-ink-muted);
}

.service__title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--color-ink);
}

.service__client-think {
  font-family: var(--font-body);
  font-style: italic;
  font-size: var(--text-base);
  color: var(--color-ink-muted);
  max-width: 28ch;
  border-left: 2px solid var(--color-border);
  padding-left: var(--space-md);
}

.service__desc { color: var(--color-ink-light); max-width: 38ch; }

.service__tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs) var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-ink-muted);
}
.service__tool::before { content: '·  '; color: var(--color-border); }
.service__tool:first-child::before { content: ''; }

.service__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-ink);
}
.service__cta .arrow {
  transition: transform var(--duration-fast) var(--ease-out);
}
.service:hover .service__cta { color: var(--color-accent); }
.service__cta:hover .arrow { transform: translateX(4px); }

/* ============================================================
   Services — enhanced motion & interactivity
   ============================================================ */

/* --- Staggered scroll-reveal + stripe draw ---------------
   Scoped to .service[data-reveal] (0,2,0) so it out-ranks the generic
   reveal rules AND the card's own `transition: background`; the per-card
   delay is baked in here via --stagger-i (set by intersection.js). */
.service[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity var(--duration-slow) var(--ease-out) calc(var(--stagger-i, 0) * 90ms),
    transform var(--duration-slow) var(--ease-out) calc(var(--stagger-i, 0) * 90ms),
    background var(--duration-normal) var(--ease-out);
}
.service[data-reveal].is-visible { opacity: 1; transform: translateY(0); }

.service[data-reveal]::before {
  transform: scaleX(0);
  transform-origin: left center;
  transition:
    transform 700ms var(--ease-out) calc(var(--stagger-i, 0) * 90ms + 150ms),
    height var(--duration-fast) var(--ease-out),
    background var(--duration-fast) var(--ease-out);
}
.service[data-reveal].is-visible::before { transform: scaleX(1); }

/* --- Tool tags illuminate in a left→right stagger on hover ---
   The mono spec row powers on. Separators (::before) stay neutral. */
.service__tool { transition: color var(--duration-fast) var(--ease-out); }
.service:hover .service__tool { color: var(--color-accent); }
.service:hover .service__tool:nth-child(1) { transition-delay:   0ms; }
.service:hover .service__tool:nth-child(2) { transition-delay:  45ms; }
.service:hover .service__tool:nth-child(3) { transition-delay:  90ms; }
.service:hover .service__tool:nth-child(4) { transition-delay: 135ms; }
.service:hover .service__tool:nth-child(5) { transition-delay: 180ms; }
.service:hover .service__tool:nth-child(6) { transition-delay: 225ms; }

/* Whole card is clickable (services.js navigates to the CTA). No
   cursor: pointer — the custom crosshair's interactive state (via
   cursor.js) signals it, so the native hand cursor never stacks on top. */

/* --- CAD viewport overlay -----------------------------------------
   Brackets, hairlines and readout come from components/card-cad.css
   (shared with the stat / session / path cards). Only the placement
   of the readout is service-specific: it lands on the title block's
   static "BIM" field, so the fixed label swaps for a live one.
   Gated on a real pointer to match the JS guard — on touch nothing
   is injected, so the field must not be blanked. */
.service {
  --cad-read-top: var(--space-xl);
  --cad-read-right: var(--space-lg);
}
/* The overlay is a direct child, so `.service > *` below would hoist it
   to z-index 2 and put the hairlines in front of the text. Beat it on
   specificity rather than relying on stylesheet order. */
.service > .cad { z-index: 1; }

@media (hover: hover) and (pointer: fine) {
  .service__index span:last-child {
    transition: opacity var(--duration-fast) var(--ease-out);
  }
  /* Only clear the field where a readout actually arrives to take
     its place — cards with the readout off keep "BIM" on show. */
  .service:not([data-cad-read='off']):hover .service__index span:last-child {
    opacity: 0;
  }
}

/* --- "Learn more" underline draws in from the left on hover ------ */
.service__cta::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 1px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--duration-normal) var(--ease-out);
  pointer-events: none;
}
.service__cta:hover::after { transform: scaleX(1); }

@media (prefers-reduced-motion: reduce) {
  .service__cta::after { transition: none; } /* underline snaps in, no draw */
  /* services.js bails under reduced-motion, so no overlay is injected —
     keep the static title-block field visible. */
  .service:hover .service__index span:last-child { opacity: 1; }
  .service[data-reveal] {
    opacity: 1;
    transform: none;
    transition: background var(--duration-normal) var(--ease-out);
  }
  .service[data-reveal]::before {
    transform: none;
    transition:
      height var(--duration-fast) var(--ease-out),
      background var(--duration-fast) var(--ease-out);
  }
  .service__tool, .service:hover .service__tool { transition-delay: 0ms; }
}
