/* ==================================================================
   Insight Analytics — Marketing Site Stylesheet
   Corporate Clean + Futuristic Overtones
   Light: white bg, navy primary, indigo→cyan gradient accents
   Dark: deep navy bg, glassmorphism cards
   ================================================================== */

/* ------------------------------------------------------------------
   1. Design tokens (CSS variables) — light + dark
   ------------------------------------------------------------------ */
:root {
  /* Brand palette */
  --navy: #1e3a8a;
  --navy-deep: #0b1120;
  --indigo: #6366f1;
  --cyan: #06b6d4;
  --gradient: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
  --gradient-soft: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(6, 182, 212, 0.12));

  /* Light theme defaults */
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #475569;
  --text-soft: #64748b;
  --text-inverse: #ffffff;
  --navy-text: #1e3a8a;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 10px 30px -10px rgba(15, 23, 42, 0.15);
  --shadow-lg: 0 24px 60px -20px rgba(30, 58, 138, 0.28);
  --shadow-glow: 0 0 0 1px rgba(99, 102, 241, 0.18), 0 18px 50px -18px rgba(99, 102, 241, 0.35);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(255, 255, 255, 0.6);
  --ring: 0 0 0 3px rgba(99, 102, 241, 0.35);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-xl: 30px;

  --container: 1200px;
  --nav-h: 72px;

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Space Grotesk", "Inter", system-ui, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #0b1120;
  --bg-alt: #0f172a;
  --bg-elevated: #111a2e;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #e6edf7;
  --text-muted: #a8b3c7;
  --text-soft: #8b97ab;
  --text-inverse: #0b1120;
  --navy-text: #93b4ff;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.75);
  --shadow-glow: 0 0 0 1px rgba(99, 102, 241, 0.25), 0 18px 50px -18px rgba(99, 102, 241, 0.45);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.12);
  --ring: 0 0 0 3px rgba(99, 102, 241, 0.45);
}

/* ------------------------------------------------------------------
   2. Reset & base
   ------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* Snap to section starts on Page Down / wheel / touch.
     Using 'mandatory' so the browser always snaps to the nearest section
     start after any scroll gesture — proximity was too weak for tall sections
     (dashboard iframe, methodology grid) where Page Down lands mid-section. */
  scroll-snap-type: y mandatory;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--navy-text);
  text-decoration: none;
  transition: color 0.2s var(--ease-soft);
}

a:hover {
  color: var(--indigo);
}

button {
  font-family: inherit;
  cursor: pointer;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 0.5em;
  font-weight: 700;
}

p {
  margin: 0 0 1rem;
}

ul {
  margin: 0;
  padding: 0;
}

:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: 6px;
}

::selection {
  background: rgba(99, 102, 241, 0.28);
  color: var(--text);
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--indigo), var(--cyan));
  border-radius: 99px;
  border: 3px solid var(--bg);
}
* {
  scrollbar-color: var(--indigo) transparent;
  scrollbar-width: thin;
}

/* ------------------------------------------------------------------
   3. Layout helpers
   ------------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 96px 0;
  position: relative;
  /* Snap each major section's top to the viewport when the user pages down /
     scrolls near a section boundary. scroll-margin-top offsets the fixed
     navbar so the section title isn't hidden behind it. */
  scroll-snap-align: start;
  scroll-margin-top: var(--nav-h);
}
.section-sm {
  padding: 72px 0;
}

.section-head {
  max-width: 760px;
  margin: 0 auto 56px;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-head);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--indigo);
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--gradient-soft);
  border: 1px solid rgba(99, 102, 241, 0.22);
  margin-bottom: 22px;
}

.eyebrow .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gradient);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.7);
}

.section-title {
  font-size: clamp(1.9rem, 4vw, 2.85rem);
  font-weight: 800;
  margin-bottom: 18px;
}
.section-title .grad {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.section-sub {
  font-size: 1.08rem;
  color: var(--text-muted);
  max-width: 640px;
  margin: 0 auto;
}

.text-center { text-align: center; }

/* ------------------------------------------------------------------
   4. Buttons
   ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
  padding: 14px 26px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background 0.3s var(--ease), color 0.3s var(--ease);
  text-decoration: none;
  position: relative;
  overflow: hidden;
  min-height: 48px;
}

.btn .fas,
.btn .far {
  font-size: 0.9em;
}

.btn-primary {
  background: var(--gradient);
  background-size: 160% 160%;
  color: #fff;
  box-shadow: 0 12px 30px -10px rgba(99, 102, 241, 0.7);
}
.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 40px -12px rgba(99, 102, 241, 0.85);
  background-position: 100% 50%;
  color: #fff;
}
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.7s var(--ease);
}
.btn-primary:hover::after {
  transform: translateX(120%);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
  backdrop-filter: blur(8px);
}
.btn-ghost:hover {
  transform: translateY(-3px);
  border-color: var(--indigo);
  color: var(--indigo);
  box-shadow: 0 14px 30px -16px rgba(99, 102, 241, 0.6);
}

.btn-light {
  background: var(--surface);
  color: var(--navy-text);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.btn-light:hover {
  transform: translateY(-3px);
  border-color: var(--indigo);
  color: var(--indigo);
  box-shadow: var(--shadow-md);
}

.btn-lg {
  padding: 16px 32px;
  font-size: 1.05rem;
}

.btn.is-loading {
  pointer-events: none;
  opacity: 0.85;
}
.btn.is-loading .btn-text {
  visibility: hidden;
}
.btn.is-loading::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin: -9px 0 0 -9px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------
   5. Navbar
   ------------------------------------------------------------------ */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  z-index: 100;
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: background 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease), height 0.35s var(--ease);
}
.navbar.is-scrolled {
  height: 64px;
  border-bottom-color: var(--border);
  box-shadow: 0 8px 30px -18px rgba(15, 23, 42, 0.25);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}

.nav-inner {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 700;
}
.brand:hover { color: var(--text); }

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--gradient);
  display: grid;
  place-items: center;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  letter-spacing: 0.02em;
  box-shadow: 0 8px 20px -6px rgba(99, 102, 241, 0.7), inset 0 1px 0 rgba(255,255,255,0.3);
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--font-head);
  font-size: 1.12rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-name b { color: var(--navy-text); font-weight: 800; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.nav-link {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 0.94rem;
  color: var(--text-muted);
  padding: 9px 14px;
  border-radius: 8px;
  position: relative;
  transition: color 0.2s var(--ease-soft), background 0.2s var(--ease-soft);
}
.nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
}
.nav-link.is-active {
  color: var(--indigo);
}
.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 4px;
  height: 2px;
  background: var(--gradient);
  border-radius: 2px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}

/* (nav-pill rules removed — Platform-Agnostic + Agile now live as .meta-link inside .hero-meta) */

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  transition: transform 0.4s var(--ease), background 0.2s var(--ease-soft), border-color 0.2s var(--ease-soft), color 0.2s var(--ease-soft);
}
.theme-toggle:hover {
  transform: rotate(20deg) scale(1.05);
  color: var(--indigo);
  border-color: var(--indigo);
}

.nav-cta {
  padding: 8px 14px;
  font-size: 0.82rem;
  height: 36px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
}

.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
  align-items: center;
  justify-content: center;
}

.mobile-menu {
  position: fixed;
  inset: var(--nav-h) 0 auto 0;
  background: var(--bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px 24px;
  transform: translateY(-12px);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease), visibility 0.3s var(--ease);
  z-index: 99;
}
.mobile-menu.is-open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}
.mobile-menu .nav-link {
  display: block;
  padding: 14px 12px;
  font-size: 1.05rem;
  border-radius: 10px;
  border-bottom: 1px solid var(--border);
}
.mobile-menu .nav-link:last-of-type { border-bottom: 0; }
.mobile-menu .btn { width: 100%; margin-top: 14px; }

/* ------------------------------------------------------------------
   6. Hero
   ------------------------------------------------------------------ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding: calc(var(--nav-h) + 40px) 0 60px;
  overflow: hidden;
  /* Snap target — Page Up from any lower section snaps back to hero top */
  scroll-snap-align: start;
  scroll-margin-top: 0;
  background:
    radial-gradient(900px 500px at 78% 12%, rgba(99, 102, 241, 0.16), transparent 60%),
    radial-gradient(700px 500px at 12% 88%, rgba(6, 182, 212, 0.14), transparent 60%),
    var(--bg);
}
[data-theme="dark"] .hero {
  background:
    radial-gradient(900px 500px at 78% 12%, rgba(99, 102, 241, 0.2), transparent 60%),
    radial-gradient(700px 500px at 12% 88%, rgba(6, 182, 212, 0.16), transparent 60%),
    var(--bg);
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 900px;
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 24px;
}
.hero h1 .grad {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.hero-sub {
  font-size: clamp(1.05rem, 1.4vw, 1.25rem);
  color: var(--text-muted);
  max-width: 740px;
  margin-bottom: 36px;
  line-height: 1.7;
}

/* .hero-cta removed — CTAs now live only in the top nav menu */
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: center;
}
.hero-meta .meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hero-meta .meta-num {
  font-family: var(--font-head);
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.hero-meta .meta-num .grad {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-meta .meta-label {
  font-size: 0.82rem;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.hero-meta .meta-divider {
  width: 1px;
  height: 36px;
  background: var(--border-strong);
}

/* Clickable meta items (Platform-Agnostic, Agile) — same format as the stat tiles, just links */
.hero-meta .meta-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 6px;
  margin: -4px -6px;
  border-radius: 8px;
  transition: background 180ms ease, transform 180ms ease;
}
.hero-meta .meta-link:hover {
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(6,182,212,0.04));
  transform: translateY(-2px);
}
.hero-meta .meta-link:hover .meta-label {
  color: var(--text);
}
.hero-meta .meta-link.is-active .meta-label,
.hero-meta .meta-link.is-active .meta-num {
  color: var(--text);
}
.hero-meta .meta-link.is-active {
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(6,182,212,0.05));
}
/* Icon-sized equivalent of the gradient .grad text treatment */
.hero-meta .grad-icon {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  font-size: 1.5rem;
  line-height: 1;
}

/* Scroll-down indicator */
.scroll-indicator {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
}
.scroll-mouse {
  width: 26px;
  height: 42px;
  border: 2px solid var(--border-strong);
  border-radius: 14px;
  display: flex;
  justify-content: center;
  padding-top: 7px;
}
.scroll-mouse::before {
  content: "";
  width: 4px;
  height: 8px;
  border-radius: 4px;
  background: var(--gradient);
  animation: scrolldot 1.8s var(--ease) infinite;
}
@keyframes scrolldot {
  0% { opacity: 0; transform: translateY(-4px); }
  40% { opacity: 1; }
  100% { opacity: 0; transform: translateY(14px); }
}

/* ------------------------------------------------------------------
   7. Glass card base
   ------------------------------------------------------------------ */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), border-color 0.4s var(--ease);
  position: relative;
  overflow: hidden;
  height: 100%;
}
.card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(99, 102, 241, 0.4);
}
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.card:hover::before { opacity: 1; }

/* ------------------------------------------------------------------
   8. Problem section
   ------------------------------------------------------------------ */
#problem {
  background: var(--bg-alt);
}
.problem-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.problem-card {
  text-align: left;
}
.problem-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  background: var(--gradient-soft);
  border: 1px solid rgba(99, 102, 241, 0.22);
  margin-bottom: 22px;
  color: var(--indigo);
}
.problem-card h3 {
  font-size: 1.28rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.problem-card p {
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.7;
  margin: 0;
}

/* ------------------------------------------------------------------
   9. Methodology 8-step grid
   ------------------------------------------------------------------ */
.methodology-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}
.method-card {
  padding: 26px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease), border-color 0.4s var(--ease);
  height: 100%;
}
.method-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
  border-color: rgba(99, 102, 241, 0.4);
}
.method-card::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 120px;
  height: 120px;
  background: var(--gradient-soft);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.method-card:hover::after { opacity: 1; }
.method-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  position: relative;
  z-index: 1;
}
.step-num {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  background: var(--gradient);
  box-shadow: 0 8px 18px -6px rgba(99, 102, 241, 0.7);
  flex-shrink: 0;
}
.method-icon {
  font-size: 1.5rem;
  line-height: 1;
}
.method-card h3 {
  font-size: 1.06rem;
  font-weight: 700;
  margin-bottom: 8px;
  position: relative;
  z-index: 1;
}
.method-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
  position: relative;
  z-index: 1;
}

/* ------------------------------------------------------------------
   10. Dashboard showcase
   ------------------------------------------------------------------ */
#dashboard { background: var(--bg); }
.browser-mock {
  max-width: 1100px;
  margin: 0 auto;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
}
.browser-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.browser-dots {
  display: flex;
  gap: 8px;
}
.browser-dots span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: block;
}
.browser-dots span:nth-child(1) { background: #ff5f57; }
.browser-dots span:nth-child(2) { background: #ffbd2e; }
.browser-dots span:nth-child(3) { background: #28c840; }
.browser-url {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 0.82rem;
  color: var(--text-soft);
  font-family: var(--font-head);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.browser-url .fas { color: var(--text-soft); font-size: 0.75rem; }
.browser-actions {
  display: flex;
  gap: 14px;
  color: var(--text-soft);
}
.browser-frame {
  position: relative;
  width: 100%;
  height: 960px;
  background: var(--bg);
}
.browser-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.browser-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--text-soft);
  font-family: var(--font-head);
  font-size: 0.9rem;
  gap: 12px;
}
.browser-loading .spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--indigo);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* ============================ DASHBOARD SWITCHER ============================ */
.dashboard-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 20px;
}
.dash-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-family: var(--font-head);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease, transform 180ms ease, box-shadow 180ms ease;
  white-space: nowrap;
}
.dash-tab i {
  font-size: 0.82rem;
  color: var(--accent);
  transition: color 180ms ease;
}
.dash-tab:hover {
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.dash-tab.is-active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 6px 18px -6px rgba(99, 102, 241, 0.55);
}
.dash-tab.is-active i {
  color: #fff;
}
.dash-tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* (Removed: .dashboard-mobile — iframe is now visible on all breakpoints) */
.dashboard-caption {
  text-align: center;
  margin-top: 24px;
  font-size: 0.95rem;
  color: var(--text-muted);
}
.dashboard-caption b { color: var(--text); font-weight: 700; }

/* ------------------------------------------------------------------
   11. Case studies
   ------------------------------------------------------------------ */
#cases { background: var(--bg-alt); }
.case-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.case-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.case-banner {
  height: 8px;
  background: var(--gradient);
}
.case-body {
  padding: 28px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.case-industry {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-head);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--indigo);
  margin-bottom: 14px;
}
.case-card h3 {
  font-size: 1.32rem;
  font-weight: 700;
  margin-bottom: 18px;
  line-height: 1.25;
}
.case-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-muted);
}
.case-row .label {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--text);
  min-width: 88px;
  flex-shrink: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 2px;
}
.case-row .label.success { color: var(--cyan); }
.case-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.tag {
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--gradient-soft);
  color: var(--indigo);
  border: 1px solid rgba(99, 102, 241, 0.2);
  font-family: var(--font-head);
  letter-spacing: 0.02em;
}

/* ------------------------------------------------------------------
   12. Why now panel (glassmorphism full-width)
   ------------------------------------------------------------------ */
#why-now {
  background: var(--bg);
  position: relative;
  overflow: hidden;
}
#why-now::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 400px at 10% 0%, rgba(99,102,241,0.12), transparent 60%),
    radial-gradient(600px 400px at 90% 100%, rgba(6,182,212,0.12), transparent 60%);
  pointer-events: none;
}
.why-panel {
  position: relative;
  z-index: 1;
  padding: 48px;
  border-radius: var(--radius-xl);
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
}
.why-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
}
.why-item {
  text-align: left;
}
.why-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  color: #fff;
  background: var(--gradient);
  box-shadow: 0 8px 18px -6px rgba(99, 102, 241, 0.7);
  margin-bottom: 18px;
}
.why-item h3 {
  font-size: 1.12rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.why-item p {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0;
}

/* ------------------------------------------------------------------
   13. Contact section
   ------------------------------------------------------------------ */
#contact { background: var(--bg-alt); }
.contact-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 40px;
  align-items: stretch;
}
.contact-form-wrap {
  padding: 36px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}
.contact-form-wrap h3 {
  font-size: 1.5rem;
  margin-bottom: 6px;
}
.contact-form-wrap .form-lead {
  color: var(--text-muted);
  margin-bottom: 26px;
  font-size: 0.98rem;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.form-field label {
  font-family: var(--font-head);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.form-field label .req { color: var(--indigo); }
.form-field input,
.form-field textarea {
  font-family: var(--font-body);
  font-size: 0.97rem;
  padding: 13px 15px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s var(--ease-soft), box-shadow 0.2s var(--ease-soft);
  width: 100%;
}
.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: var(--ring);
}
.form-field textarea {
  resize: vertical;
  min-height: 130px;
}
.form-submit-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 8px;
}
.form-status {
  font-size: 0.9rem;
  color: var(--text-muted);
  min-height: 1.4em;
}
.form-status.success { color: #16a34a; font-weight: 600; }
.form-status.error { color: #dc2626; font-weight: 600; }
[data-theme="dark"] .form-status.success { color: #4ade80; }
[data-theme="dark"] .form-status.error { color: #f87171; }

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.info-card {
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.info-card.glass {
  background: var(--glass-bg);
  border-color: var(--glass-border);
  box-shadow: var(--shadow-md);
}
.info-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
}
.info-item + .info-item { border-top: 1px solid var(--border); }
.info-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  color: #fff;
  background: var(--gradient);
  flex-shrink: 0;
  box-shadow: 0 8px 18px -8px rgba(99, 102, 241, 0.7);
}
.info-text .label {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
  font-weight: 600;
  margin-bottom: 2px;
}
.info-text .value {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}
.info-text a.value:hover { color: var(--indigo); }

/* Value chain */
.value-chain {
  margin-top: 4px;
}
.value-chain-title {
  font-family: var(--font-head);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 16px;
}
.chain-flow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.chain-step {
  flex: 1;
  text-align: center;
  padding: 14px 6px;
  border-radius: 12px;
  background: var(--gradient-soft);
  border: 1px solid rgba(99, 102, 241, 0.22);
  font-family: var(--font-head);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--indigo);
}
.chain-arrow {
  color: var(--cyan);
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* ------------------------------------------------------------------
   14. Footer
   ------------------------------------------------------------------ */
.footer {
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 56px 0 32px;
}
[data-theme="dark"] .footer { background: var(--navy-deep); }
.footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.footer-brand .brand-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.05rem;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
}
.footer-links a {
  font-family: var(--font-head);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
}
.footer-links a:hover { color: var(--indigo); }
.footer-bottom {
  padding-top: 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 0.86rem;
  color: var(--text-soft);
}
.footer-bottom .social {
  display: flex;
  gap: 12px;
}
.footer-bottom .social a {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.3s var(--ease);
}
.footer-bottom .social a:hover {
  color: var(--indigo);
  border-color: var(--indigo);
  transform: translateY(-3px);
}

/* ------------------------------------------------------------------
   15. Reveal animations
   ------------------------------------------------------------------ */
.reveal,
[data-stagger-item] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  will-change: opacity, transform;
}
.reveal.is-visible,
[data-stagger-item].is-visible {
  opacity: 1;
  transform: none;
}
.reveal-left { transform: translateX(-32px); }
.reveal-right { transform: translateX(32px); }
.reveal-scale { transform: scale(0.96); }
.reveal-left.is-visible,
.reveal-right.is-visible,
.reveal-scale.is-visible {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  /* Disable scroll snapping for reduced-motion users — they should be able
     to scroll freely without the browser re-anchoring to section starts. */
  html { scroll-snap-type: none !important; }
  .section, .hero { scroll-snap-align: none !important; }
  .reveal, [data-stagger-item] { opacity: 1; transform: none; }
  .scroll-mouse::before { animation: none; }
}

/* ------------------------------------------------------------------
   16. Responsive — tablet
   ------------------------------------------------------------------ */
@media (max-width: 1024px) {
  .section { padding: 80px 0; }
  .why-grid { grid-template-columns: repeat(2, 1fr); gap: 32px; }
  .methodology-grid { grid-template-columns: repeat(4, 1fr); }
  .browser-frame { height: 560px; }
}

/* ------------------------------------------------------------------
   17. Responsive — mobile
   ------------------------------------------------------------------ */
@media (max-width: 860px) {
  body { font-size: 16px; }
  .section { padding: 64px 0; }
  .section-head { margin-bottom: 40px; }

  /* Hide the "Book a Demo" CTA at tablet width (accessible via hamburger if needed) —
     but keep the nav-links (Services, Dashboard, Case Studies, Contact) visible directly
     so users don't have to tap the hamburger just to see the menu. */
  .nav-actions .nav-cta { display: none; }

  /* Compact the nav-links so all 4 fit on a portrait tablet (~768-834px wide) */
  .nav-links { gap: 2px; }
  .nav-link { font-size: 0.85rem; padding: 7px 10px; }

  .problem-grid { grid-template-columns: 1fr; }
  .methodology-grid { grid-template-columns: repeat(2, 1fr); }
  .case-grid { grid-template-columns: 1fr; }
  .why-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }

  .why-panel { padding: 28px; }

  .form-row { grid-template-columns: 1fr; }

  .hero { min-height: auto; padding-top: calc(var(--nav-h) + 48px); padding-bottom: 64px; }
  .hero h1 { font-size: clamp(2rem, 9vw, 3rem); }
  /* .hero-cta removed — top nav holds the only CTAs */
  .hero-meta { gap: 20px; }
  .hero-meta .meta-divider { display: none; }

  .scroll-indicator { display: none; }

  /* Iframe visible on mobile too — shorter height for smaller screens,
     user can scroll within the iframe to see the whole dashboard */
  .browser-mock .browser-frame { height: 480px; }
  .browser-frame iframe { display: block; }
  .dashboard-switcher { gap: 6px; }
  .dash-tab { padding: 8px 12px; font-size: 0.76rem; }
  .dash-tab span { font-size: 0.76rem; }

  .footer-top { flex-direction: column; align-items: flex-start; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 520px) {
  .container, .nav-inner { padding: 0 18px; }
  .methodology-grid { grid-template-columns: 1fr; }
  .contact-form-wrap, .info-card { padding: 22px; }
  .browser-bar { padding: 10px 12px; gap: 10px; }
  .browser-actions { display: none; }
  .chain-flow { flex-wrap: wrap; }
  .chain-step { flex: 1 1 38%; }
  .chain-arrow:nth-of-type(2n) { display: none; }
}

/* Print */
@media print {
  .navbar, .hero-canvas, .scroll-indicator, .theme-toggle, .menu-toggle, .mobile-menu { display: none !important; }
  .hero { min-height: auto; }
  .reveal, [data-stagger-item] { opacity: 1; transform: none; }
  body { font-size: 12pt; color: #000; background: #fff; }
}

/* ============================ OPERATING DAY TIMELINE ============================ */
.timeline { position: relative; padding-left: 100px; max-width: 900px; margin: 0 auto; }
.timeline::before { content: ''; position: absolute; left: 80px; top: 12px; bottom: 12px; width: 2px; background: linear-gradient(180deg, var(--accent), var(--primary), transparent); }
.timeline-item { display: grid; grid-template-columns: 60px 24px 1fr; gap: 16px; align-items: start; margin-bottom: 24px; }
.timeline-time { font-family: 'Space Grotesk', sans-serif; font-size: 13px; font-weight: 700; color: var(--primary); text-align: right; padding-top: 14px; white-space: nowrap; }
.timeline-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); margin: 14px auto 0; box-shadow: 0 0 0 4px rgba(99,102,241,0.12); position: relative; z-index: 1; }
.timeline-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.timeline-card p { font-size: 13px; line-height: 1.6; }
.shift-banner { display: flex; align-items: center; justify-content: center; gap: 24px; margin-top: 40px; padding: 20px 32px; border-radius: 16px; background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(6,182,212,0.04)); border: 1px solid var(--border); flex-wrap: wrap; }
.shift-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); display: block; margin-bottom: 4px; }
.shift-flow { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 600; }
.shift-from .shift-flow { color: var(--muted); text-decoration: line-through; opacity: 0.7; }
.shift-arrow { font-size: 20px; color: var(--accent); }
@media (max-width: 768px) { .timeline { padding-left: 60px; } .timeline::before { left: 44px; } .timeline-item { grid-template-columns: 40px 16px 1fr; gap: 10px; } .shift-banner { flex-direction: column; gap: 12px; } }

/* ============================ ORG CHANGE ============================ */
.org-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 32px; }
@media (max-width: 1024px) { .org-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .org-grid { grid-template-columns: 1fr; } }
.org-card { padding: 24px; }
.org-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; margin-bottom: 14px; }
.org-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.org-today, .org-target { font-size: 12px; line-height: 1.6; margin-bottom: 8px; padding-left: 12px; border-left: 2px solid var(--border); }
.org-today { border-left-color: rgba(239,68,68,0.3); }
.org-target { border-left-color: rgba(16,185,129,0.3); }
.org-frees { font-size: 13px; font-weight: 600; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.common-thread { text-align: center; padding: 24px; border-radius: 16px; background: linear-gradient(135deg, rgba(99,102,241,0.04), rgba(6,182,212,0.03)); border: 1px solid var(--border); }
.common-thread p { font-size: 14px; line-height: 1.6; margin-bottom: 8px; }
.common-thread strong { font-weight: 700; }
.thread-sub { font-size: 13px !important; color: var(--muted); font-style: italic; }

/* ============================ TECHNICAL OPERATING MODEL ============================ */
.tech-pipeline { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 32px; }
@media (max-width: 1024px) { .tech-pipeline { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .tech-pipeline { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .tech-pipeline { grid-template-columns: 1fr; } }
.tech-layer { position: relative; }
.tech-num { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; font-size: 13px; font-weight: 800; display: grid; place-items: center; z-index: 2; box-shadow: 0 4px 12px rgba(99,102,241,0.25); }
.tech-card { padding: 24px 16px 16px; text-align: left; }
.tech-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 10px; text-align: center; }
.tech-card ul { list-style: none; padding: 0; margin: 0; }
.tech-card li { font-size: 11px; line-height: 1.5; padding: 3px 0 3px 14px; position: relative; color: var(--text-soft); }
.tech-card li::before { content: '▸'; position: absolute; left: 0; color: var(--accent); }
.blocks-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 32px; }
.pill-block { padding: 6px 14px; border-radius: 20px; font-size: 11px; font-weight: 600; background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(6,182,212,0.06)); border: 1px solid var(--border); color: var(--text-soft); }
.production-blocks { padding: 24px 32px; border-radius: 16px; background: linear-gradient(135deg, rgba(99,102,241,0.04), rgba(6,182,212,0.03)); border: 1px solid var(--border); }
.production-blocks h3 { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.production-blocks p { font-size: 13px; line-height: 1.7; margin-bottom: 10px; }
.blocks-note { font-size: 12px !important; color: var(--muted); font-style: italic; }

/* ============================ BROWSER MAXIMIZE BUTTON + FULLSCREEN ============================ */
.browser-maximize {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 14px;
  display: grid;
  place-items: center;
  transition: all 180ms ease;
}
.browser-maximize:hover {
  background: var(--border);
  color: var(--text);
}

/* Fullscreen / maximized state */
.browser-mock.is-maximized {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  max-width: none !important;
  margin: 0 !important;
  border-radius: 0 !important;
  border: 0 !important;
  height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
}
.browser-mock.is-maximized .browser-frame {
  flex: 1;
  height: auto !important;
  min-height: 0;
}
.browser-mock.is-maximized .browser-bar {
  padding: 8px 16px;
}
.browser-mock.is-maximized .browser-maximize i::before {
  content: "\f066"; /* fa-compress */
}

/* Add a dark backdrop when maximized */
.browser-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  z-index: 99998;
  display: none;
}
.browser-backdrop.is-visible {
  display: block;
}

@media (max-width: 1356px) {
  .browser-frame { height: 800px; }
}
@media (max-width: 1100px) {
  .browser-frame { height: 640px; }
}

/* ============================ PULL-TO-REFRESH ============================ */
/* X-centered via left:50% + margin-left:-half-width. JS only controls Y axis. */
.ptr-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  margin-left: -70px; /* half of min-width 140px */
  transform: translate3d(0, 0, 0);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 14px 18px 12px;
  border-radius: 0 0 18px 18px;
  background: linear-gradient(180deg,
    rgba(255,255,255,0.98) 0%,
    rgba(248,250,252,0.95) 100%);
  box-shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.25),
              0 2px 6px -2px rgba(15, 23, 42, 0.12);
  border: 1px solid var(--border);
  border-top: none;
  min-width: 140px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
  will-change: transform;
}
.ptr-indicator.ptr-visible {
  opacity: 1;
}

.ptr-spinner {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary, #1E3A8A);
  transition: color 220ms ease;
}
.ptr-spinner svg {
  width: 24px;
  height: 24px;
}
.ptr-indicator.ready .ptr-spinner,
.ptr-indicator.refreshing .ptr-spinner {
  color: var(--accent, #06B6D4);
}

.ptr-label {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-soft, #475569);
  text-transform: uppercase;
}

/* Spin animation for the refreshing state */
@keyframes ptr-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Dark theme adjustments */
[data-theme="dark"] .ptr-indicator {
  background: linear-gradient(180deg,
    rgba(30, 41, 59, 0.98) 0%,
    rgba(15, 23, 42, 0.95) 100%);
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.55),
              0 2px 6px -2px rgba(0, 0, 0, 0.35);
}
[data-theme="dark"] .ptr-label {
  color: rgba(226, 232, 240, 0.85);
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  .ptr-indicator,
  .ptr-spinner,
  .ptr-indicator.ready .ptr-spinner {
    transition: none !important;
  }
}

/* ============================ AI ASSISTANT BUTTON + PANEL ============================ */

/* Nav button (top-right, beside theme toggle) */
.assistant-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(6,182,212,0.05));
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 180ms ease;
  position: relative;
  font-family: var(--font-ui, inherit);
  white-space: nowrap;
}
.assistant-btn:hover {
  background: linear-gradient(135deg, rgba(99,102,241,0.18), rgba(6,182,212,0.12));
  border-color: var(--accent, #06B6D4);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px -4px rgba(99,102,241,0.4);
}
.assistant-btn i {
  font-size: 13px;
  background: linear-gradient(135deg, var(--primary, #1E3A8A), var(--accent, #06B6D4));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.assistant-btn::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px var(--bg, #fff);
  animation: pulse-dot 2.4s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}
.assistant-btn[aria-expanded="true"]::after {
  animation: none;
  background: #22c55e;
}
@media (max-width: 640px) {
  /* On actual phones, hide the inline nav-links and show the hamburger menu.
     Tablet portrait (641-860px) keeps the inline links from the 860px block above. */
  .nav-links { display: none; }
  .menu-toggle { display: flex; margin-left: auto; }

  .assistant-btn-label { display: none; }
  .assistant-btn { padding: 8px 10px; }
}

/* Backdrop (dims page when panel is open on mobile) */
.assistant-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 99998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.assistant-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}
@media (min-width: 768px) {
  /* On desktop, no backdrop dim — the panel just floats */
  .assistant-backdrop.visible {
    opacity: 0;
    pointer-events: none;
  }
}

/* Floating chat panel — docks under the nav button on desktop, full-width sheet on mobile */
.assistant-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: var(--bg, #ffffff);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px -16px rgba(15, 23, 42, 0.25);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
  font-family: var(--font-ui, system-ui, sans-serif);
}
.assistant-panel.open {
  transform: translateX(0);
}
@media (max-width: 767px) {
  .assistant-panel {
    max-width: 100%;
    border-left: none;
  }
}
@media (min-width: 768px) {
  .assistant-panel {
    top: 72px;
    bottom: auto;
    height: min(640px, calc(100vh - 96px));
    border-radius: 14px;
    border: 1px solid var(--border);
    box-shadow: 0 16px 48px -16px rgba(15, 23, 42, 0.3);
    right: 16px;
  }
}

/* Header */
.assistant-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(99,102,241,0.06), rgba(6,182,212,0.03));
}
.assistant-id {
  display: flex;
  align-items: center;
  gap: 10px;
}
.assistant-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary, #1E3A8A), var(--accent, #06B6D4));
  color: #fff;
  flex-shrink: 0;
}
.assistant-id h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.assistant-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted, #64748b);
  margin-top: 2px;
}
.assistant-status .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b; /* amber = checking */
}
.assistant-status.state-live .dot { background: #22c55e; }
.assistant-status.state-offline .dot { background: #ef4444; }
.assistant-status.state-checking .dot { background: #f59e0b; animation: pulse-dot 1.6s ease-in-out infinite; }

.assistant-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 160ms ease;
}
.assistant-close:hover {
  background: var(--border);
  color: var(--text);
}

/* Body / messages */
.assistant-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
  background: var(--bg);
}
.assistant-body::-webkit-scrollbar { width: 6px; }
.assistant-body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* Suggestion chips (first open) */
.assistant-suggestions {
  padding: 4px 0 12px;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 4px;
}
.suggestions-intro {
  font-size: 11px;
  color: var(--muted);
  margin: 0 0 10px 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.suggestion-chip {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-soft);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  transition: all 160ms ease;
  font-family: inherit;
  text-align: left;
}
.suggestion-chip:hover {
  border-color: var(--accent, #06B6D4);
  color: var(--text);
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(6,182,212,0.04));
}

/* Message bubbles */
.user-message, .assistant-message {
  display: flex;
  max-width: 88%;
}
.user-message {
  align-self: flex-end;
  justify-content: flex-end;
}
.assistant-message {
  align-self: flex-start;
  justify-content: flex-start;
}
.msg-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.user-message .msg-bubble {
  background: linear-gradient(135deg, var(--primary, #1E3A8A), var(--accent, #06B6D4));
  color: #fff;
  border-bottom-right-radius: 4px;
}
.assistant-message .msg-bubble {
  background: var(--bg-soft, #f1f5f9);
  color: var(--text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}
.assistant-message.streaming .msg-bubble {
  background: linear-gradient(135deg, rgba(99,102,241,0.04), rgba(6,182,212,0.02));
}
.assistant-message.error .msg-bubble {
  background: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.25);
  color: #b91c1c;
}
.msg-stream { /* inline span inside bubble, updated by JS */ }
.msg-cursor {
  display: inline-block;
  color: var(--accent, #06B6D4);
  animation: blink 1s steps(2) infinite;
  margin-left: 1px;
  font-weight: 600;
}
@keyframes blink {
  50% { opacity: 0; }
}
.assistant-message:not(.streaming) .msg-cursor { display: none; }

/* Input row */
.assistant-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
#assistant-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  background: var(--bg);
  color: var(--text);
  max-height: 140px;
  line-height: 1.4;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
#assistant-input:focus {
  border-color: var(--accent, #06B6D4);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}
#assistant-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.assistant-send {
  border: 0;
  background: linear-gradient(135deg, var(--primary, #1E3A8A), var(--accent, #06B6D4));
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 180ms ease;
  flex-shrink: 0;
}
.assistant-send:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -4px rgba(99,102,241,0.5);
}
.assistant-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Footer */
.assistant-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 10px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
  background: var(--bg-soft, #f8fafc);
}
.assistant-cta {
  color: var(--primary, #1E3A8A);
  font-weight: 600;
  text-decoration: none;
  transition: color 160ms ease;
}
.assistant-cta:hover {
  color: var(--accent, #06B6D4);
}

/* Dark theme adjustments */
[data-theme="dark"] .assistant-btn {
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(6,182,212,0.08));
  border-color: rgba(148, 163, 184, 0.25);
  color: rgba(226, 232, 240, 0.95);
}
[data-theme="dark"] .assistant-btn:hover {
  background: linear-gradient(135deg, rgba(99,102,241,0.28), rgba(6,182,212,0.18));
}
[data-theme="dark"] .assistant-panel {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.2);
  box-shadow: -12px 0 40px -16px rgba(0, 0, 0, 0.7);
}
[data-theme="dark"] .assistant-header {
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(6,182,212,0.05));
}
[data-theme="dark"] .assistant-message .msg-bubble {
  background: rgba(30, 41, 59, 0.7);
  color: rgba(226, 232, 240, 0.95);
  border-color: rgba(148, 163, 184, 0.18);
}
[data-theme="dark"] .assistant-message.streaming .msg-bubble {
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(6,182,212,0.04));
}
[data-theme="dark"] #assistant-input {
  background: rgba(15, 23, 42, 0.7);
  color: rgba(226, 232, 240, 0.95);
  border-color: rgba(148, 163, 184, 0.25);
}
[data-theme="dark"] .assistant-foot {
  background: rgba(15, 23, 42, 0.6);
}
[data-theme="dark"] .suggestion-chip {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(148, 163, 184, 0.22);
  color: rgba(148, 163, 184, 0.95);
}
[data-theme="dark"] .suggestion-chip:hover {
  background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(6,182,212,0.06));
  color: #fff;
}
[data-theme="dark"] .assistant-body::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.25);
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .assistant-panel,
  .assistant-backdrop,
  .assistant-btn,
  .assistant-btn::after,
  .assistant-status .dot {
    transition: none !important;
    animation: none !important;
  }
}
