:root {
  --bg: #050506;
  --bg-2: #0c0c0e;
  --fg: #f5f5f5;
  --muted: rgba(255, 255, 255, 0.68);
  --border: rgba(255, 255, 255, 0.09);
  --accent: #e63946;
  --accent-2: #3498db;

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

  --scroll-duration: 700ms;
  --scroll-ease: cubic-bezier(0.22, 1, 0.36, 1);

  --page-padding: clamp(16px, 3.5vw, 44px);
  --radius: 18px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

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

html, body {
  height: 100%;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 15% 10%, rgba(230, 57, 70, 0.08), transparent 60%),
    radial-gradient(800px 500px at 85% 90%, rgba(52, 152, 219, 0.07), transparent 60%),
    var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  overflow: hidden; /* Desktop scroller manages scroll */
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Global noise / film-grain overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  opacity: 0.04;
  pointer-events: none;
  z-index: 999;
}

::selection {
  background: var(--accent);
  color: #ffffff;
}

/* Initial load fade-in */
body.is-loading {
  opacity: 0;
}

/* Page exit fade */
body.fade-out {
  opacity: 0;
  transition: opacity 450ms ease;
  pointer-events: none;
}

.scroll-container {
  height: 100svh;
  width: 100%;
  transition: transform var(--scroll-duration) var(--scroll-ease);
  will-change: transform;
}

.scroll-container.no-transition {
  transition: none !important;
}

/* Fullscreen sections */
.page {
  height: 100svh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--page-padding);
  position: relative;
  overflow: hidden;
}

/* Free scroll mode (small screens / narrow viewports) */
html.free-scroll,
html.free-scroll body {
  height: auto;
}

html.free-scroll body {
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 100%;
}

html.free-scroll .scroll-container {
  height: auto;
  transform: none !important;
  transition: none;
}

html.free-scroll .page {
  height: auto;
  min-height: 100svh;
  overflow: visible;
}

html.free-scroll #home {
  min-height: 100svh;
}

@media (max-width: 520px) {
  html.free-scroll .page {
    padding-bottom: 84px;
  }
}

/* Custom scrollbar for free-scroll mode */
html.free-scroll {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.22) var(--bg);
}

html.free-scroll::-webkit-scrollbar {
  width: 8px;
}

html.free-scroll::-webkit-scrollbar-track {
  background: var(--bg);
}

html.free-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
}

html.free-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

/* Shared section inner container */
.section-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* Eyebrow label */
.eyebrow {
  font-family: var(--font-heading);
  font-size: clamp(0.72rem, 1.2vw, 0.82rem);
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--accent);
  text-transform: uppercase;
  margin: 0 0 8px 0;
  display: block;
}

/* Headings and labels typography */
h1, h2, .eyebrow, button, .btn, .badge, label, .engine-box span, .manyak-btn {
  font-family: var(--font-heading);
}

h2 {
  margin: 0 0 8px 0;
  letter-spacing: clamp(3px, 1vw, 6px);
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1.15;
}

.section-inner h2::after {
  content: "";
  display: block;
  width: 54px;
  height: 3px;
  margin: 12px auto 0;
  background: linear-gradient(90deg, var(--accent), transparent);
  border-radius: 999px;
  opacity: 0.9;
}

.section-inner > p {
  max-width: 640px;
  margin: 12px auto 0;
  font-size: clamp(0.92rem, 1.3vw, 1.02rem);
}

p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

/* CTA buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-decoration: none;
  padding: 12px 26px;
  border-radius: 999px;
  transition: transform 250ms var(--scroll-ease), box-shadow 250ms ease, background 250ms ease, border-color 250ms ease, color 250ms ease;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border: 1px solid var(--accent);
  box-shadow: 0 8px 24px rgba(230, 57, 70, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  background: #d62839;
  box-shadow: 0 12px 30px rgba(230, 57, 70, 0.55);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.btn-ghost:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Section reveal animation (only hidden when JS is active) */
html.js .page:not(#home) .section-inner > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 600ms var(--scroll-ease), transform 600ms var(--scroll-ease);
  will-change: opacity, transform;
}

html.js .page.is-visible:not(#home) .section-inner > * {
  opacity: 1;
  transform: translateY(0);
}

html.js .page.is-visible:not(#home) .section-inner > *:nth-child(1) { transition-delay: 60ms; }
html.js .page.is-visible:not(#home) .section-inner > *:nth-child(2) { transition-delay: 140ms; }
html.js .page.is-visible:not(#home) .section-inner > *:nth-child(3) { transition-delay: 220ms; }
html.js .page.is-visible:not(#home) .section-inner > *:nth-child(4) { transition-delay: 300ms; }
html.js .page.is-visible:not(#home) .section-inner > *:nth-child(5) { transition-delay: 380ms; }

/* Focus outlines */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
  border-radius: 6px;
}

/* Accessible screen-reader text */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Reduced motion overrides */
@media (prefers-reduced-motion: reduce) {
  .scroll-container {
    transition: none !important;
  }
  body.fade-out {
    transition: none !important;
  }
  html.js .page:not(#home) .section-inner > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .btn {
    transition: none !important;
    transform: none !important;
  }
}