/* ==========================================================================
   GAV3 (Gen AI Ventures) -- Styles
   ========================================================================== */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Backgrounds */
  --c-bg: #f5f5f3;
  --c-bg-card: #ffffff;
  --c-bg-footer: #eaeae8;
  --c-surface: rgba(255,255,255,0.88);
  --c-surface-solid: #ffffff;
  --c-surface-elevated: rgba(255,255,255,0.97);
  --c-nav-bg: rgba(245,245,243,0.82);
  --c-footer-bg: rgba(234,234,232,0.85);
  --c-footer-muted: rgba(26,26,26,0.4);
  --c-footer-faint: rgba(26,26,26,0.35);

  /* Text */
  --c-text: #3a3a42;
  --c-text-heading: #1a1a1a;
  --c-text-muted: #6b6b78;
  --c-text-light: #9999a8;

  /* Accents */
  --c-accent: #536dfe;
  --c-accent-light: rgba(83, 109, 254, 0.10);
  --c-accent-subtle: rgba(83, 109, 254, 0.06);

  /* Borders */
  --c-border: rgba(0, 0, 0, 0.08);
  --c-border-light: rgba(0, 0, 0, 0.04);
  --c-input-border: rgba(0, 0, 0, 0.12);

  /* Gradient motif */
  --gradient-line: linear-gradient(90deg, #00e5cc, #536dfe, #b388ff);
  --glow-color: rgba(83, 109, 254, 0.18);
  --c-shadow-hover: rgba(83, 109, 254, 0.12);

  /* Typography */
  --f-display: 'Instrument Serif', Georgia, serif;
  --f-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 3rem;
  --space-xl: 5rem;
  --space-2xl: 8rem;

  /* Transitions */
  --ease-out: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.35s;
  --duration-fast: 0.2s;
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: #111113;
    --c-bg-card: #1a1a1e;
    --c-bg-footer: #0c0c0e;
    --c-surface: rgba(26,26,30,0.85);
    --c-surface-solid: #1a1a1e;
    --c-surface-elevated: rgba(26,26,30,0.95);
    --c-nav-bg: rgba(17,17,19,0.85);
    --c-footer-bg: rgba(12,12,14,0.9);
    --c-footer-muted: rgba(255,255,255,0.35);
    --c-footer-faint: rgba(255,255,255,0.25);
    --c-text: #b8b8c4;
    --c-text-heading: #eeeef2;
    --c-text-muted: #888899;
    --c-text-light: #555568;
    --c-accent: #7b8ffe;
    --c-accent-light: rgba(123, 143, 254, 0.12);
    --c-accent-subtle: rgba(123, 143, 254, 0.08);
    --c-border: rgba(255, 255, 255, 0.08);
    --c-border-light: rgba(255, 255, 255, 0.04);
    --c-input-border: rgba(255, 255, 255, 0.12);
    --glow-color: rgba(123, 143, 254, 0.22);
    --c-shadow-hover: rgba(123, 143, 254, 0.15);
  }
}

/* --- Animated borders --- */
@property --gradient-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
@keyframes borderFlow { to { --gradient-angle: 360deg; } }
@keyframes dividerFlow { 0% { background-position: 0% 0; } 100% { background-position: 200% 0; } }
@keyframes marqueeScroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* --- Base --- */
html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow-x: hidden; }

body {
  font-family: var(--f-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.6;
  color: var(--c-text);
  background-color: var(--c-bg);
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; border: none; background: none; color: inherit; touch-action: manipulation; }
input, textarea, select { font-family: inherit; font-size: inherit; touch-action: manipulation; }
a, .chat-suggestion { touch-action: manipulation; }

.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 var(--space-md); }

/* --- Background --- */
.metaball-bg { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; will-change: transform; }
.content-layer { position: relative; z-index: 1; }

/* --- Page load --- */
.is-loading .nav { opacity: 0; transform: translateY(-12px); }
.is-loading .hero__title { opacity: 0; transform: translateY(24px); }
.is-loading .hero__subtitle { opacity: 0; transform: translateY(16px); }
.is-loading .chat-container { opacity: 0; transform: translateY(16px); }
.is-loading .scroll-hint { opacity: 0; }

.nav {
  transition: opacity 0.7s ease 0.3s, transform 0.7s var(--ease-out) 0.3s,
              background var(--duration) var(--ease-in-out), padding var(--duration) var(--ease-in-out);
}
.hero__title { transition: opacity 0.8s ease 0.5s, transform 0.8s var(--ease-out) 0.5s; }
.hero__subtitle { transition: opacity 0.7s ease 0.7s, transform 0.7s var(--ease-out) 0.7s; }
.chat-container { transition: opacity 0.7s ease 0.9s, transform 0.7s var(--ease-out) 0.9s; }
.scroll-hint { transition: opacity 0.6s ease 1.3s; }

/* ==========================================================================
   SECTION HEADERS
   ========================================================================== */
.section-label {
  display: inline-block;
  font-family: var(--f-body);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: var(--space-sm);
  color: var(--c-accent);
}

.section-title {
  font-family: var(--f-display);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 500;
  line-height: 1.2;
  color: var(--c-text-heading);
  margin-bottom: var(--space-md);
}

.section-desc { font-size: 1rem; color: var(--c-text-muted); max-width: 540px; line-height: 1.7; }
.section-header { margin-bottom: var(--space-xl); }

.section-header--centered { text-align: center; }
.section-header--centered .section-desc { margin: 0 auto; }
.section-desc--centered { margin: 0 auto; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.875rem 2rem; font-size: 0.8125rem; font-weight: 500;
  letter-spacing: 0.04em; border-radius: 100px;
  transition: all var(--duration) var(--ease-out); white-space: nowrap; cursor: pointer;
}
.btn--primary { background: var(--gradient-line); color: #fff; border: none; }
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--glow-color); }

/* ==========================================================================
   NAVIGATION
   ========================================================================== */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 100; padding: var(--space-md) 0; background: transparent; }

.nav--scrolled {
  background: var(--c-nav-bg); padding: var(--space-sm) 0;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 2px solid transparent;
  border-image: linear-gradient(90deg, transparent, #00e5cc, #536dfe, #b388ff, transparent) 1;
}

.nav__inner { display: flex; align-items: center; max-width: 1600px; margin: 0 auto; padding: 0 var(--space-md); }
@media (min-width: 769px) { .nav__inner { padding: 0 var(--space-lg); } }

.nav__logo {
  font-family: var(--f-body); font-size: 0.9rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--c-text-heading);
  transition: color var(--duration-fast); margin-right: auto;
}
.nav__logo:hover { color: var(--c-accent); }

.nav__links { display: flex; align-items: center; gap: 2.5rem; list-style: none; }

.nav__links a {
  font-size: 0.8125rem; font-weight: 400; letter-spacing: 0.02em;
  color: var(--c-text-muted); transition: color var(--duration-fast); position: relative;
}
.nav__links a::after {
  content: ''; position: absolute; bottom: -4px; left: 0; width: 0; height: 1px;
  background: var(--gradient-line); transition: width var(--duration) var(--ease-out);
}
.nav__links a:hover { color: var(--c-text-heading); }
.nav__links a:hover::after { width: 100%; }

.nav-cta {
  padding: 0.5rem 1.4rem; background: var(--gradient-line); color: #fff !important;
  border-radius: 100px; font-weight: 500; transition: all var(--duration) var(--ease-out);
}
.nav-cta::after { display: none !important; }
.nav-cta:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--glow-color); color: #fff !important; }

.nav__actions { display: none; }
.nav__toggle { display: none; flex-direction: column; gap: 5px; padding: 4px; cursor: pointer; }
.nav__toggle span { display: block; width: 22px; height: 1.5px; background: var(--c-text-heading); transition: all var(--duration) var(--ease-out); }

/* ==========================================================================
   HERO
   ========================================================================== */
.hero {
  position: relative; min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-start; text-align: center;
  z-index: 1; padding: 5.5rem var(--space-md) 2.5rem;
}

.hero__content { pointer-events: none; margin-bottom: 0.5rem; flex-shrink: 0; transition: opacity 0.4s ease, max-height 0.4s ease, margin 0.4s ease; max-height: 300px; overflow: hidden; }
.hero.chat-active .hero__content { opacity: 0; max-height: 0; margin-bottom: 0; pointer-events: none; }

.hero__title {
  font-family: var(--f-body); font-size: clamp(3.5rem, 10vw, 8rem); font-weight: 300;
  line-height: 0.95; letter-spacing: -0.04em;
  background: var(--gradient-line); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text; margin-bottom: var(--space-sm);
}

.hero__subtitle {
  font-family: var(--f-body); font-size: clamp(0.875rem, 1.5vw, 1.125rem); font-weight: 300;
  letter-spacing: 0.15em; text-transform: uppercase; color: var(--c-text-muted);
}

/* ==========================================================================
   LOGO MARQUEE — integrated in hero
   ========================================================================== */
.marquee {
  overflow: hidden;
  position: relative;
  width: 100%;
  padding: 2.5rem 0;
  z-index: 1;
}

.marquee::before,
.marquee::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 150px;
  z-index: 2;
  pointer-events: none;
}
.marquee::before { left: 0; background: linear-gradient(to right, var(--c-bg), transparent); }
.marquee::after { right: 0; background: linear-gradient(to left, var(--c-bg), transparent); }

.marquee__track {
  display: flex;
  width: max-content;
  animation: marqueeScroll 40s linear infinite;
}

.marquee__set {
  display: flex;
  align-items: center;
  gap: 3.5rem;
  padding-right: 3.5rem;
}

.marquee__set img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex-shrink: 0;
}

/* CSS mask fallback for logos not on cdn.simpleicons.org */
.marquee__icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
}

.marquee__icon--openai {
  background-color: #412991;
  -webkit-mask-image: url('https://cdn.jsdelivr.net/npm/simple-icons@13/icons/openai.svg');
  mask-image: url('https://cdn.jsdelivr.net/npm/simple-icons@13/icons/openai.svg');
}

.marquee__icon--aws {
  background-color: #FF9900;
  -webkit-mask-image: url('https://cdn.jsdelivr.net/npm/simple-icons@13/icons/amazonwebservices.svg');
  mask-image: url('https://cdn.jsdelivr.net/npm/simple-icons@13/icons/amazonwebservices.svg');
}

/* ==========================================================================
   HERO CHAT
   ========================================================================== */
.chat-back { display: none; } /* hidden globally, shown only in mobile overlay */

.chat-container {
  width: 100%; max-width: 800px; display: flex; flex-direction: column;
  gap: 0.75rem; padding-bottom: 2rem; flex: 1; min-height: 0;
}
.hero.chat-active .chat-container { padding-top: 0; max-width: 100%; }
.hero.chat-active { padding-top: 5rem; justify-content: flex-start; }
.hero.chat-active .chat-bubble { max-width: 85%; font-size: 1.2rem; }
.hero.chat-active .chat-bubble--ai {
  background: linear-gradient(var(--c-surface-solid), var(--c-surface-solid)) padding-box,
    linear-gradient(var(--gradient-angle), #00e5cc, #536dfe, #b388ff, #00e5cc) border-box;
}

.chat-messages {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 1rem;
  overflow-y: auto; padding: 0.5rem 0; scrollbar-width: none; flex: 1; min-height: 0;
}
.hero.chat-active .chat-messages { justify-content: flex-start; }
.chat-messages::-webkit-scrollbar { display: none; }

.chat-bubble {
  max-width: 75%; padding: 1.4rem 1.8rem; border-radius: 20px; text-align: left;
  font-size: 1.25rem; line-height: 1.7; font-weight: 400; letter-spacing: 0.005em;
  animation: bubbleIn 0.3s ease; word-break: break-word; overflow-wrap: break-word;
}
@keyframes bubbleIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.chat-bubble--ai {
  align-self: flex-start; border: 2px solid transparent;
  background: linear-gradient(var(--c-surface-elevated), var(--c-surface-elevated)) padding-box,
    linear-gradient(var(--gradient-angle), #00e5cc, #536dfe, #b388ff, #00e5cc) border-box;
  border-bottom-left-radius: 4px; color: var(--c-text-heading);
  animation: bubbleIn 0.3s ease, borderFlow 8s linear infinite;
}

.chat-bubble--user {
  align-self: flex-end; background: linear-gradient(135deg, #536dfe, #7c8fff);
  border: none; border-bottom-right-radius: 4px; color: #ffffff;
}

.chat-bubble a { color: var(--c-accent); text-decoration: underline; text-underline-offset: 2px; }
.chat-bubble--user a { color: #ffffff; }

.chat-typing {
  display: inline-flex; gap: 5px; padding: 1rem 1.4rem; align-self: flex-start;
  border: 2px solid transparent;
  background: linear-gradient(var(--c-surface-elevated), var(--c-surface-elevated)) padding-box,
    linear-gradient(var(--gradient-angle), #00e5cc, #536dfe, #b388ff, #00e5cc) border-box;
  border-radius: 20px; border-bottom-left-radius: 4px;
  animation: bubbleIn 0.3s ease, borderFlow 8s linear infinite;
}
.chat-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--c-accent); animation: typingDot 1.2s ease-in-out infinite; }
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingDot { 0%, 60%, 100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

.chat-input-row { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }

.chat-input {
  flex: 1; text-align: left; border: 2px solid transparent;
  background: linear-gradient(var(--c-surface-solid), var(--c-surface-solid)) padding-box,
    linear-gradient(var(--gradient-angle), #00e5cc66, #536dfe66, #b388ff66, #00e5cc66) border-box;
  border-radius: 100px; padding: 1rem 1.6rem; color: var(--c-text-heading);
  font-family: inherit; font-size: 1.05rem; font-weight: 400; outline: none;
  transition: box-shadow var(--duration-fast); animation: borderFlow 10s linear infinite;
}
.chat-input::placeholder { color: var(--c-text-light); }
.chat-input:focus {
  background: linear-gradient(var(--c-surface-solid), var(--c-surface-solid)) padding-box,
    linear-gradient(var(--gradient-angle), #00e5cc, #536dfe, #b388ff, #00e5cc) border-box;
  box-shadow: 0 0 0 3px var(--c-shadow-hover);
}

.chat-send {
  width: 48px; height: 48px; border-radius: 50%; background: var(--gradient-line);
  border: none; color: #fff; cursor: pointer; display: flex; align-items: center;
  justify-content: center; transition: all var(--duration) var(--ease-out); flex-shrink: 0;
}
.chat-send:hover { transform: translateY(-2px); box-shadow: 0 6px 20px var(--glow-color); }

.chat-suggestions { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: flex-start; animation: bubbleIn 0.3s ease; margin-top: -0.3rem; transition: opacity 0.25s ease; }
.chat-suggestions.centered { justify-content: center; }

.chat-suggestion {
  border: 1.5px solid transparent;
  background: linear-gradient(var(--c-surface-solid), var(--c-surface-solid)) padding-box,
    linear-gradient(var(--gradient-angle), #00e5cc66, #536dfe66, #b388ff66, #00e5cc66) border-box;
  border-radius: 100px; padding: 0.65rem 1.3rem; color: var(--c-text); font-family: inherit;
  font-size: 1.1rem; font-weight: 400; cursor: pointer;
  transition: transform var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out);
  white-space: nowrap; flex-shrink: 0; animation: borderFlow 10s linear infinite;
}
.chat-suggestion:hover {
  transform: translateY(-2px);
  background: linear-gradient(var(--c-surface-solid), var(--c-surface-solid)) padding-box,
    linear-gradient(var(--gradient-angle), #00e5cc, #536dfe, #b388ff, #00e5cc) border-box;
  box-shadow: 0 6px 20px var(--glow-color); color: var(--c-accent);
}

.scroll-hint {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  font-size: 0.75rem; letter-spacing: 0.2em; text-transform: uppercase;
  font-weight: 500; color: var(--c-text-muted); animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 0.7; } }

/* ==========================================================================
   BREATHING GAP
   ========================================================================== */
.breathing-gap {
  height: 100px; position: relative; display: flex; align-items: center;
  justify-content: center; z-index: 1;
}
.breathing-gap::after {
  content: ''; display: block; width: 100%; max-width: 700px; height: 2.5px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, #00e5cc, #536dfe, #b388ff, #536dfe, #00e5cc, transparent);
  background-size: 200% 100%; animation: dividerFlow 5s linear infinite;
}

/* --- Sections --- */
.section-padded { padding: var(--space-2xl) 0; background: transparent; position: relative; z-index: 1; }

/* ==========================================================================
   SERVICES (unified with approach)
   ========================================================================== */
.services-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md);
}

.service-card {
  contain: content;
  padding: var(--space-lg) var(--space-md); border: 2.5px solid transparent;
  background: linear-gradient(var(--c-surface), var(--c-surface)) padding-box,
    linear-gradient(var(--gradient-angle), #00e5cc, #536dfe, #b388ff, #00e5cc) border-box;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-radius: 12px;
  transition: transform var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out);
  position: relative; overflow: hidden; animation: borderFlow 8s linear infinite;
}
.service-card:nth-child(2) { animation-delay: -2s; }
.service-card:nth-child(3) { animation-delay: -4s; }
.service-card:nth-child(4) { animation-delay: -6s; }
.service-card:hover { transform: translateY(-4px); box-shadow: 0 8px 28px var(--c-shadow-hover); }

.service-card__number {
  position: absolute; top: var(--space-sm); right: var(--space-md);
  font-family: var(--f-display); font-size: 5rem; font-weight: 300;
  background: var(--gradient-line); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text;
  opacity: 0.15; line-height: 1; transition: opacity var(--duration);
}
.service-card:hover .service-card__number { opacity: 0.3; }

.service-card__title {
  font-family: var(--f-display); font-size: 1.5rem; font-weight: 500;
  color: var(--c-text-heading); margin-bottom: var(--space-xs);
}
.service-card__desc { font-size: 0.875rem; color: var(--c-text-muted); line-height: 1.7; }

/* ==========================================================================
   INTEGRATIONS (marquee within services section)
   ========================================================================== */
.marquee-label {
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--c-text-light);
  margin-bottom: var(--space-sm);
}

.section-padded > .marquee {
  border-top: 2.5px solid transparent;
  border-bottom: 2.5px solid transparent;
  border-image: linear-gradient(90deg, transparent, #00e5cc, #536dfe, #b388ff, transparent) 1;
  padding: 1.5rem 0;
  margin-bottom: var(--space-lg);
}

.section-padded > .marquee .marquee__set img,
.section-padded > .marquee .marquee__icon {
  width: 40px;
  height: 40px;
}

.section-padded > .marquee .marquee__set {
  gap: 4rem;
  padding-right: 4rem;
}

/* ==========================================================================
   TEAM
   ========================================================================== */
.team-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }

.team-card {
  contain: content;
  padding: var(--space-lg) var(--space-md); border: 2.5px solid transparent;
  background: linear-gradient(var(--c-surface), var(--c-surface)) padding-box,
    linear-gradient(var(--gradient-angle), #00e5cc, #536dfe, #b388ff, #00e5cc) border-box;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-radius: 12px;
  transition: transform var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out);
  animation: borderFlow 9s linear infinite; text-align: left;
}
.team-card:nth-child(2) { animation-delay: -3s; }
.team-card:nth-child(3) { animation-delay: -6s; }
.team-card:hover { transform: translateY(-4px); box-shadow: 0 8px 28px var(--c-shadow-hover); }

.team-card__name { font-family: var(--f-display); font-size: 1.75rem; font-weight: 500; color: var(--c-text-heading); margin-bottom: 0.25rem; line-height: 1.15; }
.team-card__role { font-size: 0.8125rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--c-accent); font-weight: 600; margin-bottom: 1rem; }
.team-card__bio { font-size: 0.875rem; line-height: 1.7; color: var(--c-text-muted); }

/* ==========================================================================
   PRINCIPLES (Responsible Integration)
   ========================================================================== */
.principles-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.principle-card {
  contain: content;
  position: relative; overflow: hidden;
  padding: var(--space-lg) var(--space-md); border: 2.5px solid transparent;
  background: linear-gradient(var(--c-surface), var(--c-surface)) padding-box,
    linear-gradient(var(--gradient-angle), #00e5cc, #536dfe, #b388ff, #00e5cc) border-box;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-radius: 12px; animation: borderFlow 10s linear infinite;
  transition: transform var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out);
}
.principle-card:nth-child(2) { animation-delay: -2.5s; }
.principle-card:nth-child(3) { animation-delay: -5s; }
.principle-card:nth-child(4) { animation-delay: -7.5s; }
.principle-card:hover { transform: translateY(-4px); box-shadow: 0 8px 28px var(--c-shadow-hover); }

.principle-card__header {
  margin-bottom: var(--space-xs);
}

.principle-card__icon {
  position: absolute; top: var(--space-sm); right: var(--space-md);
  font-family: var(--f-display); font-size: 5rem; font-weight: 300;
  background: var(--gradient-line); -webkit-background-clip: text;
  -webkit-text-fill-color: transparent; background-clip: text;
  line-height: 1; opacity: 0.15;
  transition: opacity var(--duration);
}

.principle-card:hover .principle-card__icon { opacity: 0.3; }

.principle-card__title {
  font-family: var(--f-display); font-size: 1.5rem; font-weight: 500;
  color: var(--c-text-heading); margin: 0;
}
.principle-card__desc { font-size: 0.875rem; color: var(--c-text-muted); line-height: 1.7; }

.literacy-note {
  padding: var(--space-lg) var(--space-md); border: 2.5px solid transparent;
  background: linear-gradient(var(--c-surface), var(--c-surface)) padding-box,
    linear-gradient(var(--gradient-angle), #00e5cc, #536dfe, #b388ff, #00e5cc) border-box;
  border-radius: 12px; animation: borderFlow 11s linear infinite;
  text-align: center; max-width: 800px; margin: 0 auto;
}
.literacy-note h3 { font-family: var(--f-display); font-size: 1.25rem; font-weight: 500; color: var(--c-text-heading); margin-bottom: var(--space-xs); }
.literacy-note p { font-size: 0.9375rem; color: var(--c-text-muted); line-height: 1.7; max-width: 640px; margin: 0 auto; }

/* ==========================================================================
   CONTACT
   ========================================================================== */
.contact-layout { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2xl); align-items: start; }
.contact-text { padding-top: var(--space-sm); }
.contact-text .section-desc { margin-top: var(--space-sm); color: var(--c-text-muted); }

.contact-form {
  display: flex; flex-direction: column; gap: 1.2rem; border: 2.5px solid transparent;
  background: linear-gradient(var(--c-surface), var(--c-surface)) padding-box,
    linear-gradient(var(--gradient-angle), #00e5cc, #536dfe, #b388ff, #00e5cc) border-box;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-radius: 12px; padding: var(--space-lg) var(--space-md); animation: borderFlow 10s linear infinite;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.6875rem; letter-spacing: 0.18em; text-transform: uppercase; font-weight: 600; color: var(--c-text-muted); }

.form-group input, .form-group textarea, .form-group select {
  width: 100%; padding: 0.875rem 1rem; background: var(--c-surface-solid);
  border: 1px solid var(--c-input-border); border-radius: 8px; color: var(--c-text-heading);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
  -webkit-appearance: none; outline: none;
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--c-text-light); }
.form-group select { color: var(--c-text-light); }
.form-group select option { background: var(--c-surface-solid); color: var(--c-text-heading); }

.form-group input:focus, .form-group textarea:focus, .form-group select:focus {
  border-color: transparent;
  background: linear-gradient(var(--c-surface-solid), var(--c-surface-solid)) padding-box, var(--gradient-line) border-box;
  border: 1px solid transparent; box-shadow: 0 0 0 3px var(--c-shadow-hover);
}
.form-group textarea { resize: vertical; min-height: 120px; }
.btn--submit { align-self: flex-start; margin-top: var(--space-xs); border-radius: 100px; }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer {
  padding: var(--space-lg) 0; background: var(--c-footer-bg);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); color: var(--c-text);
  position: relative; z-index: 1; border-top: 2.5px solid transparent;
  border-image: linear-gradient(90deg, transparent, #00e5cc, #536dfe, #b388ff, transparent) 1;
}
.footer__top {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding-bottom: var(--space-lg); margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--c-border);
}
.footer__logo { font-family: var(--f-body); font-size: 0.9rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--c-text-heading); }
.footer__tagline { font-size: 0.6875rem; color: var(--c-footer-muted); margin-top: 2px; }

.footer__nav { display: flex; gap: 2rem; align-items: center; }
.footer__nav a {
  font-size: 0.8125rem; color: var(--c-text-muted);
  transition: color var(--duration-fast);
}
.footer__nav a:hover { color: var(--c-accent); }

.footer__bottom a { color: var(--c-text-muted); transition: color var(--duration-fast); }
.footer__bottom a:hover { color: var(--c-accent); }

.footer__bottom { display: flex; align-items: center; justify-content: space-between; }
.footer__copy { font-size: 0.6875rem; color: var(--c-footer-faint); }

/* ==========================================================================
   SUCCESS TOAST
   ========================================================================== */
.toast {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  opacity: 0;
  transform: translateY(-12px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.35s var(--ease-out), transform 0.35s var(--ease-out);
}

.toast.toast--visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.toast__inner {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem 1.5rem;
  border: 2px solid transparent;
  background:
    linear-gradient(var(--c-surface-solid), var(--c-surface-solid)) padding-box,
    linear-gradient(var(--gradient-angle), #00e5cc, #536dfe, #b388ff, #00e5cc) border-box;
  border-radius: 12px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
  animation: borderFlow 8s linear infinite;
}

.toast__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-line);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
}

.toast__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.toast__text strong {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-text-heading);
}

.toast__text span {
  font-size: 0.75rem;
  color: var(--c-text-muted);
}

/* ==========================================================================
   SCROLL REVEAL
   ========================================================================== */
[data-reveal] { opacity: 0; transform: translateY(20px); transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out); }
[data-reveal].revealed { opacity: 1; transform: translateY(0); }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-layout { grid-template-columns: 1fr; gap: var(--space-xl); }
  .principles-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  :root { --space-xl: 3.5rem; --space-2xl: 5rem; }

  .nav__links {
    position: fixed;
    top: var(--space-xs);
    right: var(--space-sm);
    width: auto;
    height: auto;
    flex-direction: column;
    align-items: stretch;
    padding: 0.6rem 1.25rem;
    gap: 0;
    border: 1.5px solid var(--c-border);
    background: var(--c-surface);
    border-radius: 10px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    z-index: 100;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  .nav__links.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .nav__actions { display: flex; }
  .nav__toggle { display: flex; z-index: 101; }
  .nav__toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
  .nav__toggle.active span:nth-child(2) { opacity: 0; }
  .nav__toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

  .nav__links li {
    list-style: none;
    border-bottom: 1px solid var(--c-border);
  }
  .nav__links li:last-child { border-bottom: none; }

  .nav__links a {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--c-text-heading);
    letter-spacing: 0.02em;
    padding: 0.6rem 0;
    transition: color var(--duration-fast);
  }
  .nav__links a:hover { color: var(--c-accent); }
  .nav__links a::after { display: none; }

  .nav__links .nav-cta {
    display: block;
    margin-top: 0.3rem;
    padding: 0.5rem 1.25rem;
    font-size: 0.75rem;
    text-align: center;
    border-radius: 100px;
  }

  body { overscroll-behavior: none; }

  /* =============================================================
     MOBILE: Hero is a normal section showing chat preview.
     When user engages, chat becomes a full-screen overlay modal.
     This is how every production chat widget works.
     ============================================================= */
  .hero {
    min-height: 100vh;
    min-height: 100svh;
    padding: 3.5rem var(--space-sm) 1rem;
  }

  .hero__content { margin-bottom: 0.2rem; transition: none; }
  .hero__title { font-size: clamp(1.75rem, 10vw, 2.75rem); margin-bottom: 0.2rem; }
  .hero__subtitle { font-size: 0.7rem; }
  .scroll-hint { display: none; }

  /* Nullify desktop chat-active overrides */
  .hero.chat-active { padding-top: 3.5rem; }
  .hero.chat-active .chat-container { max-width: none; }
  .hero.chat-active .chat-bubble { max-width: 88%; font-size: 0.9rem; }
  .hero.chat-active .hero__content { display: none; }

  .chat-container {
    max-width: none;
    width: 100%;
    padding-bottom: 0;
  }
  .chat-messages { overscroll-behavior-y: contain; }
  .chat-input { font-size: 1rem; padding: 0.75rem 1.2rem; }
  .chat-send { width: 40px; height: 40px; }
  .chat-bubble {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 88%;
    border-radius: 16px;
  }
  .chat-bubble--ai { border-width: 1.5px; }
  .chat-typing { padding: 0.7rem 1rem; border-width: 1.5px; }
  .chat-suggestions { gap: 0.35rem; margin-top: 0; flex-wrap: wrap; justify-content: center; }
  .chat-suggestion { font-size: 0.85rem; padding: 0.4rem 0.7rem; white-space: nowrap; }

  /* =============================================================
     CHAT OVERLAY — completely isolated full-screen takeover.
     Every property is explicitly set. Nothing inherited leaks in.
     Same text size as the hero chat so it feels like one context.
     ============================================================= */

  /* Hide page content but keep metaball canvas visible behind overlay */
  .chat-overlay-active .content-layer {
    visibility: hidden;
  }

  .chat-overlay-active .chat-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    visibility: visible;

    display: flex;
    flex-direction: column;
    /* Translucent — metaball canvas shows through */
    background: rgba(245, 245, 243, 0.75);
    backdrop-filter: blur(1px);
    -webkit-backdrop-filter: blur(1px);
    width: 100%;
    max-width: none;
    padding: 2.25rem var(--space-sm) 0;
    gap: 0;
  }

  .chat-overlay-active .chat-messages {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    overflow-y: auto;
    overscroll-behavior-y: contain;
    gap: 0.6rem;
    padding: 0.5rem 0;
  }

  .chat-overlay-active .chat-input-row {
    flex: 0 0 auto;
    padding: 0.5rem 0;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  }

  /* Same text size as hero — no jarring change */
  .chat-overlay-active .chat-bubble {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    line-height: 1.6;
    max-width: 88%;
    border-radius: 16px;
  }

  .chat-overlay-active .chat-suggestions { display: none; }

  /* Back button */
  .chat-back { display: none; }
  .chat-overlay-active .chat-back {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    position: fixed;
    top: 0.5rem;
    left: var(--space-sm);
    z-index: 10000;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--c-text-muted);
    padding: 0.3rem 0.65rem;
    background: var(--c-bg);
    border-radius: 100px;
    border: 1px solid var(--c-border);
    cursor: pointer;
    touch-action: manipulation;
  }
  .services-grid { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: 1fr; }
  .principles-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .container { padding: 0 var(--space-sm); }

  /* Performance: skip rendering off-screen sections */
  .section-padded,
  .integrations-inline,
  .footer {
    content-visibility: auto;
    contain-intrinsic-size: auto 500px;
  }
  .footer__top { flex-direction: column; gap: var(--space-lg); }
  .footer__nav { flex-wrap: wrap; gap: 1rem; }
  .footer__bottom { flex-direction: column; gap: 0.4rem; text-align: center; }
  .breathing-gap { height: 70px; }

  /* Replace em dashes with commas on mobile to avoid awkward line wrapping */
  .service-card__desc,
  .principle-card__desc,
  .literacy-note p,
  .section-desc { word-break: normal; overflow-wrap: break-word; }
  .marquee__set img, .marquee__icon { width: 28px; height: 28px; }
  .marquee__set { gap: 2.5rem; padding-right: 2.5rem; }
  .marquee::before, .marquee::after { width: 60px; }
  .marquee__desktop { display: none; }
}

@media (max-width: 480px) {
  .hero__title { font-size: clamp(1.5rem, 9vw, 2rem); }
}

/* ==========================================================================
   DARK MODE TWEAKS
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  /* Dark logos need to be lightened */
  .marquee__icon--openai { background-color: #7b6dbe; }
  .marquee__icon--aws { background-color: #FF9900; }

  /* Invert dark-colored CDN logos so they're visible on dark bg */
  .marquee__set img[alt="Vercel"],
  .marquee__set img[alt="LangChain"] {
    filter: invert(1);
  }

  /* Mobile nav sidebar */
  .nav__links { box-shadow: -8px 0 32px rgba(0,0,0,0.3); }

  /* Chat overlay translucent background */
  .chat-overlay-active .chat-container { background: rgba(17, 17, 19, 0.78); }

  /* Scope tags in case studies (if re-added) */
  .case-card__scope span { background: var(--c-accent-subtle); }
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
  [data-reveal] { opacity: 1; transform: none; }
  .is-loading .nav, .is-loading .hero__title, .is-loading .hero__subtitle,
  .is-loading .chat-container, .is-loading .scroll-hint { opacity: 1; transform: none; }
  .marquee__track { animation: none; }
  .marquee__set:last-child { display: none; }
  .marquee__set { flex-wrap: wrap; justify-content: center; }
}
