/* ===== DESIGN TOKENS ===== */
:root {
  --accent: #3a8fa3;
  --accent-hover: #2e7a8c;
  --warm: #8e7867;
  --dark: #1e1e1e;
  --text: #333333;
  --bg: #F7F5F2;
  --ease-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-quad: cubic-bezier(0.455, 0.03, 0.515, 0.955);
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { /* scroll handled by GSAP ScrollToPlugin */ }
body {
  font-family: 'DM Sans', sans-serif;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  letter-spacing: -0.02em;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* Native cursor hidden only when custom cursor is active */
body.has-custom-cursor,
body.has-custom-cursor a,
body.has-custom-cursor button,
body.has-custom-cursor input,
body.has-custom-cursor textarea,
body.has-custom-cursor .product-card { cursor: none; }
ul { list-style: none; }

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar { width: 0; }
html { scrollbar-width: none; overflow-x: hidden; }

/* ===== PRELOADER ===== */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s var(--ease-expo), visibility 0.6s;
}
.preloader.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.preloader-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}
.preloader-logo {
  display: flex;
  align-items: center;
  gap: 14px;
}
.preloader-text {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text);
}
.preloader-bar {
  width: 160px;
  height: 2px;
  background: rgba(0,0,0,0.06);
  border-radius: 2px;
  overflow: hidden;
}
.preloader-bar-fill {
  width: 0%;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s var(--ease-expo);
}

/* ===== CUSTOM CURSOR ===== */
.cursor-dot {
  position: fixed;
  top: 0;
  left: 0;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  mix-blend-mode: difference;
  transition: width 0.3s var(--ease-expo), height 0.3s var(--ease-expo),
              margin 0.3s var(--ease-expo), background 0.3s;
}
.cursor-dot.hovering {
  width: 32px;
  height: 32px;
  margin: -12px 0 0 -12px;
  background: rgba(58, 143, 163, 0.3);
  border: 1.5px solid var(--accent);
}

@media (pointer: coarse) {
  body, a, button { cursor: auto; }
  .cursor-dot { display: none; }
}

/* ===== SCROLL PROGRESS ===== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  width: 0%;
  z-index: 9999;
  box-shadow: 0 0 8px rgba(58, 143, 163, 0.5);
}

/* ===== HEADER =====
   NOTE: opacity/transform are owned by GSAP (entrance + .header-hidden auto-hide).
   Do NOT add CSS transitions for those properties — they fight GSAP frames and
   cause the "semi-transparent header stuck mid-screen" glitch. .header-hidden
   gets its own transition rule below so the auto-hide still animates. */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  padding: 0 clamp(24px, 5vw, 72px);
  height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  transition: background 0.4s, border-color 0.4s;
  border-bottom: 1px solid transparent;
}
.header.scrolled {
  background: rgba(247, 245, 242, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom-color: rgba(0, 0, 0, 0.06);
}
/* CSS transitions for opacity/transform activate ONLY after GSAP entrance is done.
   The .entrance-done class is added by GSAP's onComplete in animations.js. */
.header.entrance-done {
  transition: background 0.4s, border-color 0.4s,
              opacity 0.4s var(--ease-expo),
              transform 0.4s var(--ease-expo),
              visibility 0.4s;
}
.header.header-hidden {
  opacity: 0;
  transform: translateY(-100%);
  pointer-events: none;
  visibility: hidden;
}
.header:not(.header-hidden) {
  visibility: visible;
  pointer-events: auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  justify-self: start;
}
.logo-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.logo-badge svg { width: 24px; height: 24px; }
.logo-img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 50%;
  background: #fff;
  display: block;
  flex-shrink: 0;
}
.preloader-logo .logo-img {
  width: 64px;
  height: 64px;
}
.footer .logo-img {
  width: 72px;
  height: 72px;
}
.logo-text {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text);
}
.header.scrolled .logo-text { color: var(--text); }

/* Centered nav */
.nav-center {
  display: flex;
  align-items: center;
  gap: 44px;
  justify-self: center;
  pointer-events: auto;
  position: relative;
  z-index: 2;
}
.nav-center a {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: color 0.4s var(--ease-expo);
  position: relative;
  pointer-events: auto;
}
.nav-center a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width 0.6s var(--ease-expo);
}
.nav-center a:hover { color: var(--accent); }
.nav-center a:hover::after { width: 100%; }

/* CTA right-aligned */
.header-cta { justify-self: end; }

/* ===== PILL BUTTONS (Props-style double text) ===== */
.btn-pill {
  --pill-h: 56px;
  display: inline-block;
  height: var(--pill-h);
  padding: 0 38px;
  border-radius: 100px;
  overflow: hidden;
  position: relative;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  transition: background 0.85s var(--ease-expo), border-color 0.85s var(--ease-expo);
}
.btn-pill:hover { background: var(--accent-hover); }
.btn-pill-inner {
  display: block;
  position: relative;
  transition: transform 0.85s var(--ease-expo);
}
.btn-pill:hover .btn-pill-inner {
  transform: translateY(calc(var(--pill-h) * -1));
}
.btn-pill-text {
  display: block;
  height: var(--pill-h);
  line-height: var(--pill-h);
  text-align: center;
}

/* Outline variant */
.btn-pill--outline {
  background: transparent;
  color: var(--text);
  border-color: var(--text);
}
.btn-pill--outline:hover {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}

/* Filled variant */
.btn-pill--filled {
  background: var(--accent);
  color: #fff;
}

/* Header CTA — slightly smaller */
.header-cta { --pill-h: 46px; padding: 0 28px; justify-self: end; }

/* ===== BURGER ===== */
.burger {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 28px;
  padding: 4px 0;
  z-index: 1001;
  justify-self: end;
}
.burger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.4s var(--ease-expo), opacity 0.3s;
}
.burger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger.active span:nth-child(2) { opacity: 0; }
.burger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ===== MOBILE MENU — fullscreen overlay ===== */
.mobile-menu {
  position: fixed;
  inset: 0;
  background: rgba(247, 245, 242, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s var(--ease-expo);
}
.mobile-menu.open { opacity: 1; pointer-events: all; }
.mobile-menu-link {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(32px, 8vw, 48px);
  font-weight: 400;
  color: var(--text);
  transition: color 0.4s var(--ease-expo);
  opacity: 0;
  transform: translateY(20px);
}
.mobile-menu.open .mobile-menu-link {
  opacity: 1;
  transform: translateY(0);
}
.mobile-menu-link:hover { color: var(--accent); }

/* ===== SECTION COMMON ===== */
.section {
  padding: 140px clamp(24px, 8vw, 120px);
  position: relative;
}
.section-header {
  margin-bottom: clamp(48px, 7vh, 80px);
}
.section-label {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-size: 17px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--warm);
  margin-bottom: 18px;
}
.section--dark .section-label { color: #7a6b5d; }
.section-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(42px, 5.5vw, 76px);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 18px;
  will-change: clip-path;
}
.section-subtitle {
  font-size: clamp(19px, 2vw, 24px);
  font-weight: 400;
  color: var(--warm);
  max-width: 540px;
  letter-spacing: -0.02em;
}

/* ===== SECTION BG LOGO — large semi-transparent watermark on every section ===== */
.section,
.hero {
  isolation: isolate;
}
.section::before,
.hero::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(900px, 85vmin);
  height: min(900px, 85vmin);
  background: url('../images/logo.png') center/cover no-repeat;
  border-radius: 50%;
  /* opacity halved (0.09 -> 0.045) to compensate for losing
     mix-blend-mode: multiply. mix-blend-mode forced full-viewport
     CPU recomposition every frame on iOS Safari (~120ms in "Other"),
     was the dominant cost in the per-frame profile. */
  opacity: 0.045;
  pointer-events: none;
  z-index: -1;
}
/* Mobile: bump the watermark size — vmin shrinks too aggressively on phones */
@media (max-width: 768px) {
  .section::before,
  .hero::before {
    width: min(640px, 115vmin);
    height: min(640px, 115vmin);
  }
}
/* Dark sections: previously used mix-blend-mode: screen to invert the
   logo's white background against the dark surface. Removed for the same
   per-frame composition cost reason as above. Opacity halved (0.07 -> 0.035)
   so the watermark still reads but doesn't punch a bright disc on dark bg. */
.section--dark::before {
  opacity: 0.035;
}
/* Footer skipped: keeps small inline brand logo, no watermark */

/* ===== INTERSECTION OBSERVER BACKUP ===== */
.section {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease-expo), transform 0.8s var(--ease-expo);
}
.section.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== FOOTER ===== */
.footer {
  background: var(--dark);
  color: #aaa;
  padding: clamp(56px, 8vh, 96px) clamp(24px, 8vw, 120px) 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: clamp(32px, 4vw, 64px);
  padding-bottom: clamp(48px, 7vh, 72px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.footer-brand .logo-text { color: #eee; }
.footer-tagline {
  font-size: 17px;
  color: #777;
  font-weight: 400;
  margin-top: 12px;
  line-height: 1.6;
}
.footer-nav-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: #eee;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 20px;
}
.footer-nav a {
  display: block;
  font-size: 17px;
  color: var(--warm);
  font-weight: 400;
  padding: 6px 0;
  transition: color 0.4s var(--ease-expo);
}
.footer-nav a:hover { color: var(--accent); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 0;
  font-size: 15px;
  color: #555;
  font-weight: 400;
  flex-wrap: wrap;
  gap: 12px;
}
.footer-bottom a { color: #555; transition: color 0.4s var(--ease-expo); }
.footer-bottom a:hover { color: var(--accent); }

/* ===== ANIMATIONS BASE ===== */
.reveal {
  opacity: 0;
  transform: translateY(50px);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .section { padding: 100px clamp(20px, 6vw, 60px); }
  .about-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}
@media (max-width: 768px) {
  .nav-center, .header-cta { display: none; }
  .burger { display: flex; }
  .header {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
  .section { padding: 80px clamp(16px, 5vw, 40px); }

  /* iOS Safari memory-pressure mitigations.
     Prior incident: pages on iPhone reloaded ~once a minute. Suspected root
     cause is backdrop-filter compositor layers blowing the per-tab memory
     budget — the OS responds by killing and reloading the tab. These three
     decorative blurs are imperceptible on a phone screen but each holds a
     full-screen GPU layer for the lifetime of the page, so they're the
     cheapest win for stability on mobile. */
  .header.scrolled {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(247, 245, 242, 0.97);
  }
  .mobile-menu {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(247, 245, 242, 0.99);
  }
}
@media (max-width: 480px) {
  .product-grid {
    grid-template-columns: 1fr;
  }
  .hero-buttons { flex-direction: column; }
  .hero-buttons a { width: 100%; }
}

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

/* ===== MESSENGER LINKS (shared component) =====
   Used in both the main contact form and the product modal to offer
   alternative contact channels (Telegram, WhatsApp, Avito, MAX).
   • Main contact (#contactForm) — lives INSIDE the form, so the global form
     success swap naturally hides it.
   • Product modal — lives OUTSIDE #productModalForm as a sibling of
     .product-modal-cta, so it stays visible in both desc-state and form-state.
     Hidden only when [data-state="success"] is set on .product-modal-body
     (see product-modal.css). */
.messenger-links {
  margin-top: clamp(20px, 2.4vw, 28px);
  padding-top: clamp(20px, 2.4vw, 28px);
  border-top: 1px solid rgba(0, 0, 0, 0.08);
}
.messenger-links-title {
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  font-size: clamp(13px, 1.4vw, 15px);
  color: var(--warm);
  text-align: center;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}
.messenger-links-row {
  display: flex;
  justify-content: center;
  gap: clamp(10px, 1.4vw, 14px);
  flex-wrap: wrap;
}
.messenger-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(58, 143, 163, 0.08);
  color: var(--accent);
  border: 1px solid rgba(58, 143, 163, 0.25);
  text-decoration: none;
  transition: background 0.35s var(--ease-expo),
              border-color 0.35s var(--ease-expo),
              transform 0.3s var(--ease-expo),
              box-shadow 0.35s var(--ease-expo);
}
.messenger-link svg {
  width: 20px;
  height: 20px;
  display: block;
}
.messenger-link:hover {
  background: rgba(58, 143, 163, 0.16);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(58, 143, 163, 0.18);
}

/* Compact variant inside the product modal — modal body is tighter than the
   main contact form, so reduce vertical rhythm and icon size slightly.
   Selector targets .product-modal-body (not .product-modal-form) because the
   block now lives as a sibling of the CTA, not inside the form. */
.product-modal-body .messenger-links {
  margin-top: 12px;
  padding-top: 10px;
}
.product-modal-body .messenger-links-title {
  margin-bottom: 8px;
}
.product-modal-body .messenger-link {
  width: 40px;
  height: 40px;
}
.product-modal-body .messenger-link svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 480px) {
  .messenger-link {
    width: 40px;
    height: 40px;
  }
  .messenger-link svg {
    width: 18px;
    height: 18px;
  }
}
