/* ============================================================
   SmartStack — theme.css
   Variables globales, reset, keyframes, utilitaires partagés
   ============================================================ */

/* ─── 1. CUSTOM PROPERTIES ─────────────────────────────────── */
:root {
  /* Brand colors */
  --color-navy: #0d1b2a;
  --color-navy-mid: #1a2e44;
  --color-blue: #2563eb;
  --color-blue-light: #3b82f6;
  --color-blue-dim: rgba(37, 99, 235, 0.08);
  --color-blue-border: rgba(37, 99, 235, 0.2);
  --color-bg: #f8f9fb;
  --color-white: #ffffff;
  --color-text: #0f172a;
  --color-muted: #64748b;
  --color-border: #e2e8f0;
  --color-slate-50: #f8fafc;
  --color-slate-200: #e2e8f0;
  --color-slate-600: #475569;

  /* Semantic aliases */
  --color-green: #10b981;
  --color-green-dim: rgba(16, 185, 129, 0.1);
  --color-orange: #f59e0b;
  --color-orange-dim: rgba(245, 158, 11, 0.1);
  --color-indigo: #6366f1;
  --color-indigo-dim: rgba(99, 102, 241, 0.1);

  /* Typography */
  --font-serif: "Newsreader", Georgia, serif;
  --font-sans: "Inter", system-ui, sans-serif;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  --space-4xl: 6rem;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 32px;
  --radius-pill: 999px;

  /* Shadows */
  --shadow-sm:
    0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md:
    0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.05);
  --shadow-lg:
    0 12px 40px rgba(15, 23, 42, 0.12), 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 24px 64px rgba(15, 23, 42, 0.16);
  --shadow-blue: 0 8px 32px rgba(37, 99, 235, 0.25);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Nav height */
  --nav-height: 72px;
}

/* ─── 2. RESET ──────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

svg {
  display: block;
}

em {
  font-style: italic;
}

blockquote {
  quotes: none;
}

/* ─── 3. KEYFRAME ANIMATIONS ────────────────────────────────── */

/* SVG chart line draw */
@keyframes drawLine {
  from {
    stroke-dashoffset: 900;
  }
  to {
    stroke-dashoffset: 0;
  }
}

/* SVG chart fill fade */
@keyframes fadeInArea {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Infinite vertical scroll for service cards */
@keyframes verticalScroll {
  0% {
    transform: translateY(0);
  }
  100% {
    transform: translateY(-50%);
  }
}

/* Maintenance widget swap — widget 1 visible first, then hidden */
@keyframes widgetSwap1 {
  0% {
    opacity: 1;
    transform: translateY(0);
    z-index: 2;
  }
  40% {
    opacity: 1;
    transform: translateY(0);
    z-index: 2;
  }
  50% {
    opacity: 0;
    transform: translateY(-8px);
    z-index: 1;
  }
  90% {
    opacity: 0;
    transform: translateY(8px);
    z-index: 1;
  }
  100% {
    opacity: 1;
    transform: translateY(0);
    z-index: 2;
  }
}

/* Maintenance widget swap — widget 2 hidden first, then visible */
@keyframes widgetSwap2 {
  0% {
    opacity: 0;
    transform: translateY(8px);
    z-index: 1;
  }
  40% {
    opacity: 0;
    transform: translateY(8px);
    z-index: 1;
  }
  50% {
    opacity: 1;
    transform: translateY(0);
    z-index: 2;
  }
  90% {
    opacity: 1;
    transform: translateY(0);
    z-index: 2;
  }
  100% {
    opacity: 0;
    transform: translateY(8px);
    z-index: 1;
  }
}

/* Hero decorative floating elements */
@keyframes floatSlow {
  0% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-12px);
  }
  100% {
    transform: translateY(0px);
  }
}

@keyframes floatSlowAlt {
  0% {
    transform: translateY(0px) rotate(3deg);
  }
  50% {
    transform: translateY(-8px) rotate(-2deg);
  }
  100% {
    transform: translateY(0px) rotate(3deg);
  }
}

/* Blob pulse */
@keyframes blobPulse {
  0%,
  100% {
    transform: scale(1) translate(0, 0);
  }
  33% {
    transform: scale(1.05) translate(20px, -15px);
  }
  66% {
    transform: scale(0.97) translate(-10px, 10px);
  }
}

/* Online dot pulse */
@keyframes onlinePulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.4);
    opacity: 0.6;
  }
}

/* Nav mobile menu slide */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── 4. SCROLL REVEAL ──────────────────────────────────────── */
/* GSAP owns all transforms/opacity/filter — this only hides elements if JS is detected */
.js .js-reveal {
  opacity: 0;
}

/* ─── 5. UTILITY / SHARED ───────────────────────────────────── */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  border-radius: var(--radius-md);
  transition:
    background-color var(--transition-base),
    border-color var(--transition-base),
    color var(--transition-base),
    transform var(--transition-fast),
    box-shadow var(--transition-base);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  border: 1.5px solid transparent;
}

.btn:hover {
  transform: translateY(-1px);
}
.btn:active {
  transform: translateY(0);
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Dark button (navy) */
.btn--dark {
  background-color: var(--color-navy);
  color: var(--color-white);
  border-color: var(--color-navy);
}

.btn--dark:hover {
  background-color: var(--color-navy-mid);
  box-shadow: var(--shadow-md);
}

/* Outline button */
.btn--outline {
  background-color: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn--outline:hover {
  border-color: var(--color-blue);
  color: var(--color-blue);
}

/* Outline dark (footer on dark bg) */
.btn--outline-dark {
  background-color: transparent;
  color: var(--color-white);
  border-color: rgba(255, 255, 255, 0.3);
}

.btn--outline-dark:hover {
  border-color: rgba(255, 255, 255, 0.7);
  background-color: rgba(255, 255, 255, 0.08);
}

/* Large */
.btn--large {
  padding: 0.875rem 1.75rem;
  font-size: 0.9375rem;
  border-radius: var(--radius-lg);
}

.btn--large svg {
  width: 18px;
  height: 18px;
}

/* Rounded */
.btn--rounded {
  border-radius: var(--radius-pill);
}

/* Pill (small tag-style) */
.btn--pill {
  border-radius: var(--radius-pill);
  background-color: var(--color-blue-dim);
  color: var(--color-blue);
  border-color: var(--color-blue-border);
  font-size: 0.75rem;
}

.btn--pill:hover {
  background-color: var(--color-blue);
  color: var(--color-white);
}

/* Small */
.btn--sm {
  padding: 0.375rem 0.875rem;
  font-size: 0.75rem;
}

/* White button */
.btn--white {
  background-color: var(--color-white);
  color: var(--color-navy);
  border-color: var(--color-white);
}

.btn--white:hover {
  background-color: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow-blue);
}

/* Outline white */
.btn--outline-white {
  background-color: transparent;
  color: rgba(255, 255, 255, 0.88);
  border-color: rgba(255, 255, 255, 0.35);
}

.btn--outline-white:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--color-white);
  border-color: rgba(255, 255, 255, 0.6);
}

/* Section header (shared between sections) */
.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto var(--space-3xl);
}

.section-header__badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.section-header__number {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-muted);
  letter-spacing: 0.05em;
}

.section-header__line {
  display: block;
  width: 48px;
  height: 1.5px;
  background: linear-gradient(90deg, var(--color-blue), transparent);
  border-radius: 2px;
}

.section-header__line--orange {
  background: linear-gradient(90deg, var(--color-orange), transparent);
}

.section-header__title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.2;
  margin-bottom: var(--space-md);
}

.section-header__subtitle {
  font-size: 1rem;
  color: var(--color-muted);
  line-height: 1.7;
  margin-bottom: var(--space-lg);
}

.section-header__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-blue);
  transition: gap var(--transition-base);
}

.section-header__link:hover {
  gap: var(--space-sm);
}

.section-header__link svg {
  width: 16px;
  height: 16px;
}

/* ─── 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;
  }

  .js-reveal {
    opacity: 1;
    transform: none;
    filter: none;
  }
}
