/* ===========================================================
   GOMAA INTELLIGENCE — VISUAL ELEVATION LAYER
   Scoped entirely to body.gi-page (services section only).
   Additive on top of services-platform.css — nothing here is
   deleted from the existing file, and css/tokens.css (shared
   with the main portfolio) is never touched.
   Respects prefers-reduced-motion throughout.
   =========================================================== */

/* -----------------------------------------------------------
   1. TOKENS — a restrained secondary accent (deep teal) for a
   "data intelligence" feel, layered next to the existing
   brand bronze/gold rather than replacing it. Bronze stays the
   primary identity color (buttons, brand, nav) for continuity
   with the rest of the site; teal is used sparingly — data
   pulses, secondary numbering, subtle structural marks.
   ----------------------------------------------------------- */
body.gi-page {
  --gi-accent-2: #3E6B5C;
  --gi-accent-2-soft: rgba(62, 107, 92, 0.14);
  --gi-grid-line: rgba(37, 34, 30, 0.045);
  --gi-shadow-soft: 0 1px 2px rgba(37, 34, 30, 0.06), 0 8px 20px -12px rgba(37, 34, 30, 0.12);
}

:root[data-theme="dark"] body.gi-page {
  --gi-accent-2: #7FB8A3;
  --gi-accent-2-soft: rgba(127, 184, 163, 0.14);
  --gi-grid-line: rgba(243, 238, 228, 0.05);
  --gi-shadow-soft: 0 1px 2px rgba(0, 0, 0, 0.25), 0 10px 24px -14px rgba(0, 0, 0, 0.45);
}

/* -----------------------------------------------------------
   2. LIGHTEN THE EXISTING SHADOW/BLUR LOAD
   The audit found 78 box-shadow + 19 backdrop-filter rules in
   services-platform.css — heavier than the "calm technology"
   brief. Rather than rewrite every rule, override the highest-
   traffic surfaces (cards, buttons, form fields) to one
   restrained shadow token and drop decorative blur.
   ----------------------------------------------------------- */
body.gi-page .gi-card,
body.gi-page .gi-service-card,
body.gi-page .gi-form,
body.gi-page .gi-estimator,
body.gi-page .gi-playground {
  box-shadow: var(--gi-shadow-soft) !important;
  backdrop-filter: none !important;
}

body.gi-page .site-button {
  box-shadow: none !important;
}

/* -----------------------------------------------------------
   3. DATA-ENVIRONMENT BACKGROUND
   Very low-contrast grid + one large, slow ambient gradient.
   CSS-only, transform/opacity based, disabled under reduced
   motion (grid stays, motion stops).
   ----------------------------------------------------------- */
body.gi-page {
  position: relative;
  background-image:
    linear-gradient(var(--gi-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--gi-grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: center top;
}

body.gi-page::before {
  content: "";
  position: fixed;
  inset: -10% -10% auto -10%;
  height: 60vh;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(closest-side, var(--color-glow-1), transparent 70%) 15% 10% / 55% 55% no-repeat,
    radial-gradient(closest-side, var(--gi-accent-2-soft), transparent 70%) 85% 25% / 45% 45% no-repeat;
  opacity: 0.6;
  animation: gi-ambient-drift 26s ease-in-out infinite alternate;
}

@media (prefers-reduced-motion: reduce) {
  body.gi-page::before { animation: none; }
}

@keyframes gi-ambient-drift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(0, 3%, 0); }
}

body.gi-page > * { position: relative; z-index: 1; }

/* -----------------------------------------------------------
   4. TYPOGRAPHY HIERARCHY
   ----------------------------------------------------------- */
body.gi-page .gi-hero__eyebrow,
body.gi-page .gi-section__eyebrow,
body.gi-page .gi-card__preview summary {
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: var(--text-xs);
}

body.gi-page .gi-hero__title {
  letter-spacing: -0.01em;
  line-height: 1.08;
}

body.gi-page .gi-hero__lead {
  max-width: 46ch;
  line-height: 1.6;
}

body.gi-page .gi-card__title {
  letter-spacing: -0.005em;
  line-height: 1.25;
}

/* -----------------------------------------------------------
   5. SERVICE CARDS — numbering system + per-card accent line
   so five cards read as one system with individual character,
   without touching the HTML.
   ----------------------------------------------------------- */
body.gi-page .gi-card-grid .gi-card {
  position: relative;
  border-top: 2px solid var(--color-line);
  transition: border-color var(--duration-base) var(--ease-out),
              transform var(--duration-base) var(--ease-out);
}

body.gi-page .gi-card-grid .gi-card::before {
  counter-increment: gi-card;
  content: counter(gi-card, decimal-leading-zero);
  position: absolute;
  top: var(--space-3);
  inset-inline-end: var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  color: var(--color-muted);
  opacity: 0.55;
}

body.gi-page .gi-card-grid {
  counter-reset: gi-card;
}

body.gi-page .gi-card-grid .gi-card:hover {
  border-top-color: var(--gi-card-accent, var(--color-accent));
  transform: translateY(-3px);
}

/* Adaptive per-service accents (spec: "Adaptive Service Accents") —
   five restrained, low-saturation hues so each service has its own
   identity while staying inside one coherent, muted palette. Bronze
   (card 1) and teal (card 3) reuse the two brand accents already
   defined; the rest are close relatives at the same lightness/
   saturation so nothing reads as a "different theme". */
body.gi-page .gi-card-grid .gi-card:nth-child(1) { --gi-card-accent: var(--color-accent); }
body.gi-page .gi-card-grid .gi-card:nth-child(2) { --gi-card-accent: #6E7F5C; }
body.gi-page .gi-card-grid .gi-card:nth-child(3) { --gi-card-accent: var(--gi-accent-2); }
body.gi-page .gi-card-grid .gi-card:nth-child(4) { --gi-card-accent: #5C7285; }
body.gi-page .gi-card-grid .gi-card:nth-child(5) { --gi-card-accent: #7A6285; }

body.gi-page .gi-card-grid .gi-card::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: -2px;
  width: 28px;
  height: 2px;
  background: var(--gi-card-accent, var(--color-accent));
}

/* Once a card has been scrolled past (marked by the journey observer
   in gi-interactions.js), give it a slightly stronger presence —
   this is the "services form a connected system" cue: reached
   stages settle into their final, fuller state. */
body.gi-page .gi-card-grid .gi-card.is-reached {
  border-top-color: var(--gi-card-accent, var(--color-accent));
}
body.gi-page .gi-card-grid .gi-card.is-reached::before {
  opacity: 0.85;
}

@media (prefers-reduced-motion: reduce) {
  body.gi-page .gi-card-grid .gi-card { transition: none; }
  body.gi-page .gi-card-grid .gi-card:hover { transform: none; }
}

/* -----------------------------------------------------------
   6. BUTTONS — quieter, more deliberate hover
   ----------------------------------------------------------- */
body.gi-page .site-button {
  transition: transform var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              background-color var(--duration-fast) var(--ease-out);
}

body.gi-page .site-button:hover {
  transform: translateX(2px);
}

body.gi-page .site-button--secondary:hover {
  border-color: var(--color-accent);
}

@media (prefers-reduced-motion: reduce) {
  body.gi-page .site-button:hover { transform: none; }
}

/* -----------------------------------------------------------
   7. FLOW / DATA-PULSE — restrained secondary-accent pulse on
   the existing hero flow line, reusing the SVG already in the
   markup (no new DOM).
   ----------------------------------------------------------- */
body.gi-page .gi-flow__dot {
  animation: gi-pulse 2.4s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 0.25s);
}

@keyframes gi-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
  body.gi-page .gi-flow__dot { animation: none; }
}

/* -----------------------------------------------------------
   8. MOBILE — grid + ambient gradient are already lightweight
   at any size, but shrink the grid cell so it doesn't read as
   a giant graph paper sheet on small screens.
   ----------------------------------------------------------- */
@media (max-width: 640px) {
  body.gi-page {
    background-size: 40px 40px;
  }
  body.gi-page::before {
    height: 40vh;
    opacity: 0.4;
  }
}

/* -----------------------------------------------------------
   9. CURSOR SPOTLIGHT — desktop-only soft radial light that
   follows the pointer. The element is only ever created by
   gi-interactions.js on pointer-fine/hover-capable devices with
   no reduced-motion preference, so touch devices never pay for
   it. Very low opacity, pointer-events: none so it can never
   block a click.
   ----------------------------------------------------------- */
body.gi-page .gi-spotlight {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 1;
  transition: opacity 220ms ease;
  background: radial-gradient(
    260px circle at var(--gi-spot-x, 50%) var(--gi-spot-y, 50%),
    var(--color-glow-1),
    transparent 70%
  );
}

/* ===========================================================
   LEVEL 2 — SERVICE JOURNEY / DATA-PIPELINE STORYTELLING
   =========================================================== */

/* -----------------------------------------------------------
   10. SERVICE JOURNEY NAV — compact, appears only while the
   five-service grid is in play (toggled by IntersectionObserver
   in gi-interactions.js). Desktop: a slim vertical dot-rail
   pinned to the inline-end edge, labels reveal on hover/active
   only, so it never reads as a "large sticky component" per the
   brief. Mobile: a single-row horizontally scrollable pill bar.
   ----------------------------------------------------------- */
body.gi-page .gi-journey-nav {
  position: fixed;
  z-index: 5;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-out);
}

body.gi-page .gi-journey-nav.is-visible {
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 901px) {
  body.gi-page .gi-journey-nav {
    top: 50%;
    inset-inline-end: var(--space-4);
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }

  body.gi-page .gi-journey-nav__item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    text-decoration: none;
    color: var(--color-muted);
    font-size: var(--text-xs);
    padding: 0.3em 0;
  }

  body.gi-page .gi-journey-nav__index {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1.5px solid var(--color-line);
    flex-shrink: 0;
    font-size: 0;
    transition: background-color var(--duration-fast) var(--ease-out),
                border-color var(--duration-fast) var(--ease-out);
  }

  body.gi-page .gi-journey-nav__label {
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    transition: max-width var(--duration-base) var(--ease-out),
                opacity var(--duration-fast) var(--ease-out);
  }

  body.gi-page .gi-journey-nav__item:hover .gi-journey-nav__label,
  body.gi-page .gi-journey-nav__item.is-active .gi-journey-nav__label {
    max-width: 12em;
    opacity: 1;
    margin-inline-end: 0.2em;
  }

  body.gi-page .gi-journey-nav__item.is-active .gi-journey-nav__index {
    background: var(--color-accent);
    border-color: var(--color-accent);
  }

  body.gi-page .gi-journey-nav__item.is-active .gi-journey-nav__label,
  body.gi-page .gi-journey-nav__item:hover .gi-journey-nav__label {
    color: var(--color-ink);
  }
}

@media (max-width: 900px) {
  body.gi-page .gi-journey-nav {
    top: auto;
    bottom: var(--space-3);
    inset-inline: var(--space-3);
    display: flex;
    gap: var(--space-2);
    overflow-x: auto;
    padding: var(--space-2) var(--space-3);
    background: color-mix(in srgb, var(--color-surface) 92%, transparent);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    box-shadow: var(--gi-shadow-soft);
    scrollbar-width: none;
  }

  body.gi-page .gi-journey-nav::-webkit-scrollbar { display: none; }

  body.gi-page .gi-journey-nav__item {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.4em;
    text-decoration: none;
    color: var(--color-muted);
    font-size: var(--text-xs);
    padding: 0.3em 0.6em;
    border-radius: 999px;
    border: 1px solid transparent;
  }

  body.gi-page .gi-journey-nav__index {
    font-family: var(--font-display);
    opacity: 0.6;
  }

  body.gi-page .gi-journey-nav__item.is-active {
    border-color: var(--color-accent);
    color: var(--color-ink);
  }

  body.gi-page .gi-journey-nav__item.is-active .gi-journey-nav__index {
    opacity: 1;
    color: var(--color-accent);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.gi-page .gi-journey-nav,
  body.gi-page .gi-journey-nav__label,
  body.gi-page .gi-journey-nav__index {
    transition: none;
  }
}

/* -----------------------------------------------------------
   11. DATA-PIPELINE SCROLL INDICATOR ("DATA —●— INSIGHT")
   One thin fixed bar under the main nav. Pure width transform
   driven by a single rAF-throttled scroll listener — cheap even
   on long pages.
   ----------------------------------------------------------- */
body.gi-page .gi-progress {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.35em var(--space-4);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--color-muted);
  background: color-mix(in srgb, var(--color-bg) 70%, transparent);
  pointer-events: none;
}

body.gi-page .gi-progress__track {
  flex: 1;
  height: 2px;
  background: var(--color-line);
  border-radius: 2px;
  overflow: hidden;
}

body.gi-page .gi-progress__fill {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--color-accent), var(--gi-accent-2));
  transition: width 90ms linear;
}

@media (max-width: 640px) {
  body.gi-page .gi-progress { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  body.gi-page .gi-progress__fill { transition: none; }
}

/* ===========================================================
   LEVEL 2 — BEFORE/AFTER VALUE STORY (homepage only)
   Plain two-column comparison, no slider/JS — keeps to the
   brief's "should not become a wall of marketing copy" and
   avoids any fabricated metrics (spec §6/§5): every line is a
   general value statement, not a client-specific number.
   =========================================================== */
body.gi-page .gi-transform__grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-5);
  margin-top: var(--space-5);
}

body.gi-page .gi-transform__col {
  padding: var(--space-5);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

body.gi-page .gi-transform__col--after {
  border-color: var(--color-accent);
}

body.gi-page .gi-transform__tag {
  display: inline-block;
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: var(--space-3);
}

body.gi-page .gi-transform__col--after .gi-transform__tag {
  color: var(--color-accent-dark);
}

body.gi-page .gi-transform__col ul {
  margin: 0;
  padding-inline-start: 1.1em;
  display: grid;
  gap: 0.5em;
  color: var(--color-muted);
  font-size: var(--text-sm);
}

body.gi-page .gi-transform__col--after li {
  color: var(--color-ink);
}

body.gi-page .gi-transform__arrow {
  font-size: var(--text-xl);
  color: var(--gi-accent-2);
}

html[dir="rtl"] body.gi-page .gi-transform__arrow {
  display: inline-block;
  transform: scaleX(-1);
}

@media (max-width: 700px) {
  body.gi-page .gi-transform__grid {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }
  body.gi-page .gi-transform__arrow {
    justify-self: center;
    transform: rotate(90deg);
  }
  html[dir="rtl"] body.gi-page .gi-transform__arrow {
    transform: rotate(90deg);
  }
}
