/* ============================================
   TATI LABS, SHARED STYLES
   Light theme · Inter · Violet/Blue/Pink gradients
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* --- RESET & BASE --- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Core palette */
  --deep-indigo: #4A3FBF;
  --soft-violet: #8B6CF0;
  --electric-blue: #5DA8F7;
  --crystal-pink: #E48ACB;
  --bright-cyan: #4FD1FF;
  --glow-pink: #FF9BD8;

  /* Surfaces */
  --glass-blue: #EAF3FF;
  --purple-tint: #EFE9FF;
  --bg-white: #FFFFFF;
  --bg-light: #F5F7FB;
  --bg-lavender: #F2F0FF;

  /* Text */
  --text-primary: #2A2A2F;
  --text-secondary: #6B6F8A;
  --text-muted: #9AA0B5;

  /* Gradients */
  --gradient-main: linear-gradient(135deg, #4A3FBF 0%, #8B6CF0 55%, #E48ACB 100%);
  --gradient-tech: linear-gradient(135deg, #4A3FBF 0%, #5DA8F7 100%);
  --gradient-soft: linear-gradient(135deg, #F2F0FF 0%, #EAF3FF 100%);

  /* Spacing */
  --section-pad: clamp(4rem, 8vw, 7rem);
  --container-max: 1200px;

  /* Lines, structural identity element */
  --line-color: rgba(30, 30, 47, 0.08);
  --line-color-strong: rgba(30, 30, 47, 0.15);

  /* Fixed header height, used to offset slide content so it doesn't slip under the nav. */
  --nav-height: 90px;

  /* Vertical scale factor, used to shrink vertically-heavy content on short viewports.
     Formula factors in the nav height because the usable area is (100vh - nav-height),
     not the full viewport.
     At 1080px tall: stays at 1 (no effect).
     Between ~585px and 1080px: scales down linearly.
     Below ~585px: clamps at 0.5 so typography stays readable.
     Note: dividing lengths gives a truly unitless number. */
  --vscale: clamp(0.5, calc((100vh - 90px) / 990px), 1);
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  background: var(--bg-white);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }

/* --- CONTAINER --- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
}

/* --- TYPOGRAPHY --- */
h1, h2, h3, h4 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  letter-spacing: -0.01em;
}

h3 {
  font-size: clamp(1.25rem, 2vw, 1.5rem);
  font-weight: 600;
}

p {
  color: var(--text-secondary);
  font-size: clamp(1rem, 1.1vw, 1.125rem);
}

.text-gradient {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  border-radius: 50px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.35s ease;
}

.btn-primary {
  background: var(--gradient-tech);
  color: #fff;
  box-shadow: 0 4px 20px rgba(74, 63, 191, 0.25);
}
.btn-primary:hover {
  box-shadow: 0 6px 30px rgba(74, 63, 191, 0.4);
  transform: translateY(-2px);
}

.btn-secondary {
  background: transparent;
  color: var(--deep-indigo);
  border: 1.5px solid rgba(74, 63, 191, 0.25);
}
.btn-secondary:hover {
  border-color: var(--deep-indigo);
  background: var(--purple-tint);
}

.btn-get-started,
.nav-cta.btn-primary {
  background: linear-gradient(135deg, var(--soft-violet) 0%, var(--electric-blue) 100%) !important;
  color: #fff;
  box-shadow: 0 4px 20px rgba(139, 108, 240, 0.3) !important;
}
.btn-get-started:hover,
.nav-cta.btn-primary:hover {
  background: linear-gradient(135deg, var(--electric-blue) 0%, var(--soft-violet) 100%) !important;
  box-shadow: 0 6px 30px rgba(139, 108, 240, 0.45) !important;
  transform: translateY(-2px);
}

.btn-arrow::after {
  content: '→';
  transition: transform 0.3s ease;
}
.btn-arrow:hover::after {
  transform: translateX(4px);
}

/* --- NAVIGATION --- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: all 0.35s ease;
  padding-top: 14px;
  --nav-opacity: 1;
}

/* Mobile-only: opacity driven by scroll via --nav-opacity (set in main.js).
   Short transition keeps it smooth while still tracking the finger. */
@media (max-width: 768px) {
  .site-nav {
    opacity: var(--nav-opacity, 1);
    transition: opacity 120ms linear, background 0.35s ease, border-bottom-color 0.35s ease, box-shadow 0.35s ease;
    will-change: opacity;
  }
  .site-nav.nav-hidden {
    pointer-events: none;
  }
}

/* Scrolled state, frosted glass for inner pages (not homepage) */
.site-nav.scrolled {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom-color: rgba(30, 30, 47, 0.06);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.04);
}

/* Dark page scrolled variant */
.site-nav.nav-dark.scrolled {
  background: rgba(42, 42, 47, 0.75);
  border-bottom-color: rgba(255, 255, 255, 0.06);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.15);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
}

.nav-logo img {
  height: 48px;
  width: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2.25rem;
}

.nav-links a {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  position: relative;
  transition: color 0.3s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-main);
  border-radius: 1px;
}

.nav-cta {
  padding: 0.625rem 1.5rem !important;
  font-size: 0.875rem !important;
  color: #fff !important;
}

/* Nav, logo variants */
.nav-logo .logo-light { display: none; }

/* Nav dark mode (for dark sections/pages), swap colors only */
.site-nav.nav-dark .nav-logo .logo-dark { display: none; }
.site-nav.nav-dark .nav-logo .logo-light { display: block; }
.site-nav.nav-dark .nav-links a:not(.nav-cta) { color: rgba(255, 255, 255, 0.6); }
.site-nav.nav-dark .nav-links a:not(.nav-cta):hover,
.site-nav.nav-dark .nav-links a:not(.nav-cta).active { color: #fff; }
.site-nav.nav-dark .nav-links a.active::after { background: linear-gradient(135deg, #8B6CF0, #5DA8F7); }
.site-nav.nav-dark .nav-toggle span { background: #fff; }

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  width: 32px;
  height: 32px;
  position: relative;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform 0.32s cubic-bezier(.23,1,.32,1), opacity 0.2s ease, background 0.3s ease;
  transform-origin: center;
}
/* Hamburger → X when menu open */
.nav-toggle.active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle.active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.nav-toggle.active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --- SECTIONS --- */
section {
  padding: var(--section-pad) 0;
}

.section-light { background: var(--bg-white); }
.section-tint { background: var(--bg-light); }
.section-lavender { background: var(--gradient-soft); }

.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 3.5rem;
}

.section-header p {
  margin-top: 1rem;
}

/* Structural line divider */
.line-divider {
  width: 60px;
  height: 1px;
  background: var(--line-color-strong);
  margin: 0 auto;
}

/* --- CARDS --- */
.card {
  background: var(--bg-white);
  border: 1px solid var(--line-color);
  border-radius: 16px;
  padding: 2rem;
  transition: all 0.35s ease;
}

.card:hover {
  border-color: rgba(139, 108, 240, 0.2);
  box-shadow: 0 8px 32px rgba(74, 63, 191, 0.08);
  transform: translateY(-4px);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--gradient-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.card-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--deep-indigo);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.card h3 {
  margin-bottom: 0.75rem;
}

/* --- GRID LAYOUTS --- */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

/* --- FOOTER --- */
.site-footer {
  background: var(--text-primary);
  color: rgba(255, 255, 255, 0.7);
  padding: 3.5rem 0 2rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 3rem;
  margin-bottom: 2.5rem;
}

.footer-brand img {
  height: 28px;
  margin-bottom: 1rem;
  filter: brightness(0) invert(1);
}

.footer-brand p {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.875rem;
  max-width: 320px;
  line-height: 1.6;
}

.footer-links {
  display: flex;
  gap: 3rem;
}

.footer-links a {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.3s ease;
}

.footer-links a:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.35);
}

/* --- STRUCTURAL LINES (brand identity) --- */
.structural-line {
  position: absolute;
  background: var(--line-color);
}
.structural-line.vertical {
  width: 1px;
  height: 100%;
  top: 0;
}
.structural-line.horizontal {
  height: 1px;
  width: 100%;
  left: 0;
}

/* --- FADE-IN ANIMATIONS --- */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-up-delay-1 { transition-delay: 0.1s; }
.fade-up-delay-2 { transition-delay: 0.2s; }
.fade-up-delay-3 { transition-delay: 0.3s; }
.fade-up-delay-4 { transition-delay: 0.4s; }

/* --- RESPONSIVE --- */
@media (max-width: 968px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }

  .site-nav { padding-top: 0; }

  .nav-inner {
    height: 64px;
    padding: 0 1rem 0 0.9rem;
  }
  .nav-logo img {
    height: 38px;
    width: auto;
    max-width: none;
    object-fit: contain;
  }

  .nav-links { display: none; }
  .nav-toggle { display: flex; }

  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #FAFAF8;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 1.75rem 1.75rem 2rem;
    border-bottom: 1px solid rgba(30, 30, 47, 0.08);
    box-shadow: 0 12px 40px rgba(30, 30, 47, 0.08);
    gap: 1.25rem;
  }

  .nav-links.open a:not(.nav-cta) {
    color: var(--text-secondary);
    font-size: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(30, 30, 47, 0.06);
  }

  .nav-links.open a:not(.nav-cta):hover,
  .nav-links.open a:not(.nav-cta).active {
    color: var(--text-primary);
  }

  .nav-links.open a.active::after {
    background: linear-gradient(135deg, #8B6CF0, #5DA8F7);
  }

  .nav-links.open .nav-cta {
    margin-top: 0.5rem;
    text-align: center;
  }

  .nav-dark .nav-links.open {
    background: #FAFAF8;
    border-bottom-color: rgba(30, 30, 47, 0.08);
  }

  .nav-dark .nav-links.open a:not(.nav-cta) {
    color: var(--text-secondary);
    border-bottom-color: rgba(30, 30, 47, 0.06);
  }

  .nav-dark .nav-links.open a:not(.nav-cta):hover,
  .nav-dark .nav-links.open a:not(.nav-cta).active {
    color: var(--text-primary);
  }

  .footer-inner {
    flex-direction: column;
    gap: 2rem;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 0.75rem;
    text-align: center;
  }
}

@media (max-width: 640px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr; }
}
