/* Base layout — reset, typography, header, sections, hero, footer */

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

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

body {
  min-height: 100vh;
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image: var(--gradient-hero-glow);
  background-repeat: no-repeat;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

ul,
ol {
  list-style: none;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
}

button {
  cursor: pointer;
}

/* ========== Container ========== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad-x);
}

/* ========== Typography ========== */
h1,
h2,
h3,
h4 {
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  color: var(--color-text);
}

h1 {
  font-size: var(--font-size-hero);
}

h2 {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  margin-bottom: var(--space-6);
}

h3 {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0;
  line-height: var(--line-height-snug);
  margin-bottom: var(--space-3);
}

p {
  color: var(--color-text-soft);
  max-width: 42rem;
}

p + p {
  margin-top: var(--space-4);
}

strong {
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
}

/* Gold accent utility for key phrases if needed later */
.text-gold {
  color: var(--color-gold);
}

/* ========== Base interactive buttons (green-gold, soft sheen + glow) ========== */
.header__cta,
.hero__cta,
.hero__actions .hero__cta,
.cta__submit {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-button);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-nav);
  line-height: 1.2;
  color: var(--color-text);
  background-image: var(--gradient-button);
  background-size: 160% 160%;
  background-position: 0% 50%;
  box-shadow: var(--shadow-button);
  border: 1px solid rgba(232, 200, 114, 0.28);
  overflow: hidden;
  isolation: isolate;
  transition:
    background-position var(--transition-base),
    background-image var(--transition-base),
    box-shadow var(--transition-base),
    transform var(--transition-fast),
    filter var(--transition-fast),
    border-color var(--transition-base);
}

.header__cta::before,
.hero__cta::before,
.cta__submit::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--gradient-button-sheen);
  background-size: 220% 100%;
  background-position: 120% 0;
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  transition:
    background-position var(--transition-sheen),
    opacity var(--transition-base);
}

.header__cta:hover,
.hero__cta:hover,
.cta__submit:hover {
  background-image: var(--gradient-button-hover);
  background-position: 100% 50%;
  box-shadow: var(--shadow-button-hover);
  border-color: rgba(240, 215, 140, 0.45);
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.header__cta:hover::before,
.hero__cta:hover::before,
.cta__submit:hover::before {
  opacity: 1;
  background-position: -40% 0;
}

.header__cta:active,
.hero__cta:active,
.cta__submit:active {
  transform: translateY(0);
  filter: brightness(0.97);
}

/* ========== Header (fixed) ========== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header);
  height: var(--header-height);
  display: flex;
  align-items: center;
  background: var(--color-bg-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  width: 100%;
}

.header__logo {
  flex-shrink: 0;
  font-family: var(--font-family-sans);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: lowercase;
  color: var(--color-gold-soft);
  text-shadow: var(--shadow-logo);
  transition:
    color var(--transition-fast),
    text-shadow var(--transition-base),
    filter var(--transition-base);
}

.header__logo:hover {
  color: var(--color-gold-bright);
  text-shadow:
    0 0 14px rgba(240, 215, 140, 0.55),
    0 0 36px rgba(212, 175, 55, 0.3);
  filter: brightness(1.06);
}

.header__nav {
  flex: 1;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.header__nav-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-1) var(--space-5);
}

.header__nav-link {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-nav);
  color: var(--color-text-muted);
  white-space: nowrap;
  transition: color var(--transition-fast);
}

.header__nav-link:hover {
  color: var(--color-text);
}

.header__cta {
  flex-shrink: 0;
  padding: 0.65rem 1.25rem;
  font-size: var(--font-size-xs);
}

/* Offset fixed header for in-page anchors */
main {
  padding-top: var(--header-height);
}

/* ========== Sections (shared base) ========== */
section {
  padding-block: var(--section-padding-y);
  position: relative;
}

section + section {
  border-top: 1px solid var(--color-border);
}

section .container > h2:first-child,
section .container > [class$="__title"]:first-of-type {
  max-width: 20ch;
}

/* Section leads */
.problem__lead,
.what-is-cos__lead,
.scheme__lead,
.scenarios__lead,
.how-we-work__lead,
.for-whom__lead,
.cta__lead {
  font-size: var(--font-size-md);
  color: var(--color-text-muted);
  max-width: 40rem;
  margin-bottom: var(--space-10);
  line-height: var(--line-height-relaxed);
}

/* Subtle gold underline accent under section titles */
.problem__title,
.what-is-cos__title,
.scheme__title,
.scenarios__title,
.how-we-work__title,
.for-whom__title,
.cta__title {
  position: relative;
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-6);
}

.problem__title::after,
.what-is-cos__title::after,
.scheme__title::after,
.scenarios__title::after,
.how-we-work__title::after,
.for-whom__title::after,
.cta__title::after {
  content: "";
  display: block;
  width: 3rem;
  height: 2px;
  margin-top: var(--space-4);
  background: var(--color-gold);
  border-radius: 1px;
  box-shadow: 0 0 12px var(--color-gold-glow);
}

/* ========== Hero ========== */
.hero {
  position: relative;
  min-height: calc(100vh - var(--header-height));
  display: flex;
  align-items: center;
  padding-block: clamp(4rem, 12vh, 8rem);
  border-top: none;
  overflow: hidden;
  background-color: var(--color-bg);
}

/* Chaos → Order atmospheric background (must be clearly visible) */
.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 60% at 12% 40%, rgba(90, 70, 30, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse 65% 70% at 88% 55%, rgba(31, 77, 58, 0.38) 0%, transparent 58%),
    radial-gradient(ellipse 40% 35% at 70% 20%, rgba(212, 175, 55, 0.1) 0%, transparent 50%),
    #050506;
}

.hero__bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(28px);
}

.hero__bg-glow--chaos {
  width: min(80vw, 36rem);
  height: min(80vw, 36rem);
  top: -10%;
  left: -8%;
  opacity: 0.9;
  background: radial-gradient(
    circle,
    rgba(212, 175, 55, 0.28) 0%,
    rgba(120, 90, 30, 0.12) 40%,
    transparent 68%
  );
}

.hero__bg-glow--order {
  width: min(85vw, 42rem);
  height: min(85vw, 42rem);
  top: 0%;
  right: -8%;
  bottom: auto;
  opacity: 1;
  background: radial-gradient(
    circle,
    rgba(45, 107, 79, 0.5) 0%,
    rgba(212, 175, 55, 0.2) 40%,
    transparent 70%
  );
}

/* Scattered stars / dust = chaos (left) */
.hero__bg-field--chaos {
  position: absolute;
  inset: 0;
  opacity: 0.95;
  background-image:
    radial-gradient(2px 2px at 6% 18%, rgba(240, 215, 140, 0.85), transparent),
    radial-gradient(1.5px 1.5px at 12% 42%, rgba(255, 255, 255, 0.45), transparent),
    radial-gradient(2.5px 2.5px at 18% 14%, rgba(212, 175, 55, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 22% 68%, rgba(255, 255, 255, 0.35), transparent),
    radial-gradient(2px 2px at 9% 78%, rgba(232, 200, 114, 0.55), transparent),
    radial-gradient(1.5px 1.5px at 28% 32%, rgba(255, 255, 255, 0.3), transparent),
    radial-gradient(3px 3px at 15% 55%, rgba(168, 137, 42, 0.65), transparent),
    radial-gradient(1.5px 1.5px at 4% 50%, rgba(255, 255, 255, 0.4), transparent),
    radial-gradient(2px 2px at 32% 88%, rgba(212, 175, 55, 0.45), transparent),
    radial-gradient(1.5px 1.5px at 25% 8%, rgba(255, 255, 255, 0.28), transparent),
    radial-gradient(2px 2px at 11% 30%, rgba(240, 215, 140, 0.5), transparent),
    radial-gradient(1.5px 1.5px at 35% 48%, rgba(255, 255, 255, 0.22), transparent);
  mask-image: linear-gradient(100deg, #000 0%, #000 42%, transparent 68%);
  -webkit-mask-image: linear-gradient(100deg, #000 0%, #000 42%, transparent 68%);
}

/* Ordered lattice = system (right) */
.hero__bg-field--order {
  position: absolute;
  inset: 0;
  opacity: 0.75;
  background-image:
    linear-gradient(rgba(212, 175, 55, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(212, 175, 55, 0.14) 1px, transparent 1px),
    radial-gradient(circle at 78% 38%, rgba(61, 143, 106, 0.28) 0%, transparent 32%),
    radial-gradient(circle at 86% 72%, rgba(212, 175, 55, 0.18) 0%, transparent 26%);
  background-size:
    42px 42px,
    42px 42px,
    100% 100%,
    100% 100%;
  mask-image: linear-gradient(100deg, transparent 28%, rgba(0, 0, 0, 0.55) 48%, #000 62%, #000 100%);
  -webkit-mask-image: linear-gradient(100deg, transparent 28%, rgba(0, 0, 0, 0.55) 48%, #000 62%, #000 100%);
}

.hero__bg-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 1;
  z-index: 1;
}

/* Keep text readable without killing the network visual */
.hero__bg-veil {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(
      105deg,
      rgba(5, 5, 6, 0.28) 0%,
      rgba(5, 5, 6, 0.62) 36%,
      rgba(5, 5, 6, 0.55) 52%,
      rgba(5, 5, 6, 0.22) 78%,
      rgba(5, 5, 6, 0.12) 100%
    ),
    linear-gradient(
      180deg,
      rgba(5, 5, 6, 0.25) 0%,
      transparent 22%,
      transparent 78%,
      rgba(5, 5, 6, 0.35) 100%
    );
}

.hero .container {
  position: relative;
  z-index: 3;
  max-width: 54rem;
}

/* Soft labels for the metaphor (CSS only, decorative) */
.hero__bg::after {
  content: "AV Engine · ядро системы";
  position: absolute;
  right: clamp(1rem, 4vw, 2.5rem);
  bottom: clamp(1.25rem, 4vh, 2.5rem);
  z-index: 2;
  font-family: var(--font-family-sans);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(232, 200, 114, 0.42);
  text-shadow: 0 0 18px rgba(212, 175, 55, 0.25);
}

.hero__bg::before {
  content: "хаос переписок";
  position: absolute;
  left: clamp(1rem, 4vw, 2.5rem);
  top: clamp(1.25rem, 4vh, 2.5rem);
  z-index: 2;
  font-family: var(--font-family-sans);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(210, 200, 170, 0.3);
}

@media (prefers-reduced-motion: reduce) {
  .hero__bg-canvas {
    opacity: 0.95;
  }
}

.hero__eyebrow {
  margin-bottom: var(--space-5);
  max-width: none;
  font-family: var(--font-family-sans);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-gold);
}

.hero__title {
  margin-bottom: var(--space-6);
  max-width: 14ch;
  font-weight: var(--font-weight-regular);
  letter-spacing: -0.03em;
  line-height: 1.08;
  text-shadow:
    0 2px 28px rgba(0, 0, 0, 0.65),
    0 0 40px rgba(212, 175, 55, 0.08);
}

.hero__subtitle,
.hero__note {
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.55);
}

.hero__subtitle {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--color-text-soft);
  line-height: var(--line-height-relaxed);
  max-width: 40rem;
  margin-bottom: var(--space-6);
}

.hero__note {
  max-width: 40rem;
  margin-bottom: var(--space-10);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  line-height: var(--line-height-relaxed);
  border-left: 2px solid rgba(212, 175, 55, 0.45);
  padding-left: var(--space-4);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
}

/* Scheme board spacing handled in components.css */

/* ========== Footer ========== */
.footer {
  padding-block: var(--space-12) var(--space-10);
  border-top: 1px solid var(--color-border);
  background: var(--color-bg-deep);
}

.footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

.footer__brand {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-wide);
  color: var(--color-gold-soft);
  text-shadow: var(--shadow-logo);
}

.footer__nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-6);
}

.footer__nav-link {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.footer__nav-link:hover {
  color: var(--color-text);
}

.footer__copy {
  width: 100%;
  margin-top: var(--space-6);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  font-size: var(--font-size-sm);
  color: var(--color-text-subtle);
  max-width: none;
}

/* ========== Focus (accessibility) ========== */
:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 3px;
}

/* ========== Responsive ========== */
@media (max-width: 960px) {
  .header__nav {
    display: none;
  }

  .header .container {
    justify-content: space-between;
  }

  .hero__title {
    max-width: none;
  }
}

@media (max-width: 640px) {
  :root {
    --header-height: 3.75rem;
  }

  .header__cta {
    padding: 0.55rem 1rem;
  }

  .hero {
    min-height: auto;
    padding-block: var(--space-16) var(--space-12);
  }

  .hero__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero__cta {
    width: 100%;
    text-align: center;
  }

  .hero__title {
    letter-spacing: -0.02em;
  }

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
