/* ============================================================
   IQFulfillment — design tokens, base, and bespoke components.
   Tailwind (CDN) handles layout/spacing utilities; this file
   owns typography defaults, the signature op-panel, timeline
   line-draw, nav/menu behaviour, theme switching, and motion.
   ============================================================ */

:root {
  --charcoal: #1E1E1E;        /* fixed dark surface: footer, inverse CTA bands, logo mark — does NOT react to theme */
  --text-primary: #1E1E1E;    /* reactive: primary text */
  --ink-muted: #6B6F6A;       /* reactive: secondary text */
  --paper: #FFFFFF;           /* reactive: page / card surface */
  --mist: #F5F6F4;            /* reactive: alt section surface */
  --hairline: #E3E5E1;        /* reactive: borders */
  --header-glass: rgba(255,255,255,0.88);
  --dot-color: rgba(30,30,30,0.10);
  --iq-blue: #2F6FED;         /* base accent fill */
  --iq-blue-hover: #1F4FBD;   /* pressed/hover fill under white text */
  --iq-blue-text: #1F4FBD;    /* accent used as text/icon color on page background */
  --iq-blue-tint: #E8F0FE;    /* pale wash behind accent text/icons */
  --danger: #C0392B;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="dark"] {
  --text-primary: #EDEEF0;
  --ink-muted: #9BA1A8;
  --paper: #17181B;
  --mist: #1E2024;
  --hairline: #2E3136;
  --header-glass: rgba(20,21,24,0.82);
  --dot-color: rgba(255,255,255,0.14);
  --iq-blue: #4C86F0;
  --iq-blue-hover: #17408F;
  --iq-blue-text: #8AB4F8;
  --iq-blue-tint: rgba(76,134,240,0.16);
  --danger: #E57373;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--text-primary);
  background: var(--paper);
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

h1, h2, h3, h4, .font-display {
  font-family: 'Space Grotesk', sans-serif;
  letter-spacing: -0.02em;
}

.font-mono-data {
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0;
}

::selection {
  background: var(--iq-blue);
  color: #fff;
}

a, button {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--iq-blue);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- layout helpers ---------- */

.container-iq {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: 24px;
}

@media (min-width: 768px) {
  .container-iq { padding-inline: 40px; }
}

.section-pad {
  padding-block: 88px;
}

@media (max-width: 767px) {
  .section-pad { padding-block: 56px; }
}

/* blueprint / warehouse-floor dot grid backdrop */
.bp-grid {
  position: relative;
  background-image: radial-gradient(circle, var(--dot-color) 1px, transparent 1px);
  background-size: 28px 28px;
  background-position: -10px -10px;
}

.bp-grid--fade::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0) 0%, var(--paper) 92%);
  pointer-events: none;
}

/* eyebrow / mono tag */
.eyebrow {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--iq-blue-text);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--iq-blue);
  border-radius: 1px;
  display: inline-block;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 500;
  font-size: 15px;
  padding: 13px 26px;
  border-radius: 4px;
  transition: transform 0.25s var(--ease), background-color 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease);
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--text-primary);
  color: var(--paper);
  border: 1px solid var(--text-primary);
}
.btn-primary:hover { background: var(--iq-blue-hover); border-color: var(--iq-blue-hover); color: #fff; }

.btn-accent {
  background: var(--iq-blue);
  color: #fff;
  border: 1px solid var(--iq-blue);
}
.btn-accent:hover { background: var(--iq-blue-hover); border-color: var(--iq-blue-hover); }

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--hairline);
}
.btn-outline:hover { border-color: var(--text-primary); }

.btn-outline-light {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.28);
}
.btn-outline-light:hover { border-color: #fff; }

/* ---------- theme toggle ---------- */

.theme-toggle {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--text-primary);
  transition: border-color 0.25s var(--ease), color 0.25s var(--ease);
}
.theme-toggle:hover { border-color: var(--iq-blue); color: var(--iq-blue-text); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-glass);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), background-color 0.3s var(--ease);
}

.site-header.is-scrolled {
  border-bottom-color: var(--hairline);
  box-shadow: 0 4px 24px rgba(30,30,30,0.04);
}

.nav-link {
  position: relative;
  font-size: 14.5px;
  color: var(--text-primary);
  padding-block: 4px;
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 0; right: 100%;
  bottom: 0;
  height: 1.5px;
  background: var(--iq-blue);
  transition: right 0.3s var(--ease);
}

.nav-link:hover::after,
.nav-link.is-active::after {
  right: 0;
}

.nav-link.is-active { color: var(--iq-blue-text); }

.mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s var(--ease);
}
.mobile-menu.is-open { max-height: 720px; }

/* ---------- footer ---------- */

.site-footer {
  background: var(--charcoal);
  color: rgba(255,255,255,0.72);
}
.site-footer a:hover { color: #fff; }

/* ---------- cards ---------- */

.card {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 6px;
  transition: transform 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease), background-color 0.3s var(--ease);
}

.card-hover:hover {
  transform: translateY(-4px);
  border-color: var(--iq-blue);
  box-shadow: 0 16px 36px rgba(30,30,30,0.08);
}

.icon-tile {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--iq-blue-tint);
  color: var(--iq-blue-text);
  border-radius: 6px;
}

/* ---------- signature element: live operations panel ---------- */

.op-panel {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  box-shadow: 0 24px 64px rgba(30,30,30,0.08);
  overflow: hidden;
}

.op-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--hairline);
  background: var(--mist);
}

.op-panel__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--iq-blue);
  box-shadow: 0 0 0 3px var(--iq-blue-tint);
}

.op-panel__body { padding: 22px 20px; }

.op-track {
  display: flex;
  align-items: center;
  gap: 0;
}

.op-track__step {
  flex: 1;
  text-align: center;
  position: relative;
}

.op-track__label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin-top: 8px;
  display: block;
}

.op-track__node {
  width: 11px; height: 11px;
  margin-inline: auto;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--hairline);
  position: relative;
  z-index: 2;
  transition: border-color 0.4s var(--ease), background-color 0.4s var(--ease);
}

.op-track__bar {
  position: absolute;
  top: 5px;
  left: -50%;
  right: 50%;
  height: 2px;
  background: var(--hairline);
  z-index: 1;
}
.op-track__step:first-child .op-track__bar { display: none; }

.op-track__step.is-done .op-track__node,
.op-track__step.is-active .op-track__node {
  border-color: var(--iq-blue);
  background: var(--iq-blue);
}
.op-track__step.is-done .op-track__bar,
.op-track__step.is-active .op-track__bar {
  background: var(--iq-blue);
}
.op-track__step.is-active .op-track__label,
.op-track__step.is-done .op-track__label { color: var(--text-primary); }

.op-panel__meta {
  display: flex;
  justify-content: space-between;
  margin-top: 22px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--ink-muted);
}
.op-panel__meta strong { color: var(--text-primary); font-weight: 500; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--hairline); border-top: 1px solid var(--hairline); }
.stat-tile { background: var(--paper); padding: 16px 18px; }
.stat-tile__num { font-family: 'Space Grotesk', sans-serif; font-size: 22px; font-weight: 600; }
.stat-tile__label { font-size: 11.5px; color: var(--ink-muted); margin-top: 2px; }

/* ---------- timeline (how it works) ---------- */

.timeline { position: relative; }

.timeline__spine {
  position: absolute;
  left: 27px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--hairline);
}
.timeline__spine-fill {
  position: absolute;
  left: 0; top: 0;
  width: 100%;
  height: 0%;
  background: var(--iq-blue);
  transition: height 0.6s var(--ease);
}

.timeline__item {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.timeline__item.is-visible { opacity: 1; transform: translateY(0); }

.timeline__num {
  width: 56px; height: 56px;
  border: 2px solid var(--hairline);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  background: var(--paper);
  color: var(--ink-muted);
  transition: border-color 0.5s var(--ease), color 0.5s var(--ease), background-color 0.5s var(--ease);
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.timeline__item.is-visible .timeline__num {
  border-color: var(--iq-blue);
  color: var(--iq-blue-text);
  background: var(--iq-blue-tint);
}

/* ---------- scroll reveal ---------- */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }
.reveal-delay-1 { transition-delay: 0.08s; }
.reveal-delay-2 { transition-delay: 0.16s; }
.reveal-delay-3 { transition-delay: 0.24s; }
.reveal-delay-4 { transition-delay: 0.32s; }

/* ---------- FAQ accordion ---------- */

.faq-item summary {
  cursor: pointer;
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }

.faq-item .faq-chevron { transition: transform 0.35s var(--ease); }
.faq-item[open] .faq-chevron { transform: rotate(45deg); }

.faq-item .faq-answer {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.4s var(--ease);
}
.faq-item[open] .faq-answer { grid-template-rows: 1fr; }
.faq-answer > div { overflow: hidden; }

/* ---------- form ---------- */

.field-input {
  width: 100%;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 12px 14px;
  font-size: 15px;
  background: var(--paper);
  color: var(--text-primary);
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.field-input::placeholder { color: var(--ink-muted); }
.field-input:focus {
  border-color: var(--iq-blue);
  box-shadow: 0 0 0 3px var(--iq-blue-tint);
  outline: none;
}
.field-input.has-error { border-color: var(--danger); }
.field-error {
  font-size: 12.5px;
  color: var(--danger);
  margin-top: 6px;
  display: none;
}
.field-error.is-shown { display: block; }

/* ---------- misc ---------- */

.logo-tile {
  border: 1px solid var(--hairline);
  border-radius: 6px;
  background: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  height: 88px;
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease);
}
.logo-tile:hover { border-color: var(--iq-blue); background: var(--iq-blue-tint); }

.marquee-track {
  animation: marquee 28s linear infinite;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .timeline__item, .op-track__node, .op-track__bar,
  .marquee-track, .btn, .card-hover, .nav-link::after {
    transition: none !important;
    animation: none !important;
  }
  .reveal, .timeline__item { opacity: 1 !important; transform: none !important; }
}
