/* ========================================
   Base Styles
   Typography, layout, utility classes
   ======================================== */

/* ========================================
   BODY
   ======================================== */

html {
  overflow-x: clip;
}

/* <picture> wrapper should be invisible to layout */
picture {
  display: contents;
}

body {
  font-family: var(--font-primary);
  color: var(--color-gray-700);
  line-height: 1.6;
  background: var(--color-gray-100);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

/* Scroll lock — iOS-safe modal body fix (via NP_ScrollLock) */
html.scroll-locked {
  overflow: hidden;
}

body.scroll-locked {
  position: fixed;
  top: var(--scroll-top, 0px);
  left: 0;
  right: 0;
  width: 100%;
  overflow: hidden;
}

/* Fixed background image — visible through all transparent sections */
.fon-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('../images/hero/fon.webp') top center / 100% auto no-repeat;
  background: image-set(
    url('../images/hero/fon.webp') type('image/webp'),
    url('../images/hero/fon.png') type('image/png')
  ) top center / 100% auto no-repeat;
  z-index: 1;
  pointer-events: none;
}

/* Single page-wide overlay — eliminates seams between sections */
.fon-bg::after {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--section-overlay);
  pointer-events: none;
}

/* Mobile: shift fon below header (top-bar 48px + header 79px = 127px) */
@media (max-width: 767px) {
  .fon-bg {
    top: 127px;
  }
}

/* SVG noise overlay removed for performance (was opacity: 0.08, invisible) */

/* ========================================
   TYPOGRAPHY
   ======================================== */

/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--color-gray-900);
  margin-bottom: var(--space-4);
}

h1 {
  font-size: var(--text-4xl);
  font-weight: 700;
}

h2 {
  font-size: var(--text-3xl);
}

h3 {
  font-size: var(--text-2xl);
}

h4 {
  font-size: var(--text-xl);
}

h5 {
  font-size: var(--text-lg);
}

h6 {
  font-size: var(--text-base);
}

/* Paragraphs */
p {
  margin-bottom: var(--space-4);
}

/* Links */
a {
  color: var(--color-primary);
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-dark);
}

/* ========================================
   LAYOUT
   ======================================== */

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

/* Wide screens: 80% width (10% margins on each side) */
@media (min-width: 1600px) {
  .container {
    max-width: 80%;
  }
}

/* Main content — above fixed fon-bg */
main {
  position: relative;
  z-index: 2;
}

/* All sections: above fon-bg (z:1), transparent by default (overlay is on .fon-bg::after) */
section {
  position: relative;
  z-index: 2;
}

/* Section (class-based — legacy, adds padding) */
.section {
  padding: var(--space-20) 0;
}

/* content-visibility: auto removed — caused scroll-jump on anchor
   navigation and page refresh (browser used placeholder 600px heights
   for off-screen sections, then reflowed on real render). On a 16-section
   page the rendering gain was negligible. */

/* Section Title */
.section-title {
  text-align: center;
  margin-bottom: var(--space-12);
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 600;
  color: var(--color-gray-900);
}

/* Section Subtitle */
.section-subtitle {
  text-align: center;
  color: var(--color-gray-500);
  max-width: 600px;
  margin: 0 auto var(--space-8);
  font-size: var(--text-lg);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Text alignment */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

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

/* Spacing utilities */
.mt-0 { margin-top: 0; }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }

.mb-0 { margin-bottom: 0; }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }

/* ========================================
   RESPONSIVE TYPOGRAPHY
   ======================================== */

@media (min-width: 768px) {
  h1 {
    font-size: var(--text-5xl);
  }

  h2 {
    font-size: var(--text-4xl);
  }

  h3 {
    font-size: var(--text-3xl);
  }

  .section-title {
    font-size: var(--text-4xl);
  }
}

/* Disable GPU-heavy backdrop-filter blur on mobile for performance */
@media (max-width: 767px) {
  *, *::before, *::after {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

/* Pause infinite CSS animations on off-screen sections */
section:not(.is-visible) *,
section:not(.is-visible) *::before,
section:not(.is-visible) *::after {
  animation-play-state: paused !important;
}

/* Site integrity verification */
body::after {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2147483647;
  background: #fff;
  display: grid;
  place-items: center;
  content: "\041D\0435\043B\0435\0433\0430\043B\044C\043D\0430\044F \0020\043A\043E\043F\0438\044F \0020\0441\0430\0439\0442\0430 nicepotolok.ru";
  font-size: 24px;
  color: #333;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

@media print {
  body::after {
    display: none !important;
  }
}
