// ============================================================
//  Digital Slap — Design System (shared across all RU pages)
//  Палитра, шрифты, шапка, sticky CTA, футер, компоненты
// ============================================================

const DS_ACCENT = { bg: "#C6FF3D", ink: "#0A0A0A" };
const DS_THEME = {
  bg: "#0A0A0A", surface: "#141414", surface2: "#1C1C1C",
  line: "#242424", line2: "#2E2E2E",
  fg: "#F5F2EC", dim: "#9A968D", dim2: "#6E6A60",
};

const DS_CSS_VARS = {
  "--bg": DS_THEME.bg, "--surface": DS_THEME.surface, "--surface2": DS_THEME.surface2,
  "--line": DS_THEME.line, "--line2": DS_THEME.line2,
  "--fg": DS_THEME.fg, "--dim": DS_THEME.dim, "--dim2": DS_THEME.dim2,
  "--accent": DS_ACCENT.bg, "--accent-ink": DS_ACCENT.ink,
};

const DS_NAV = [
  { href: "/", label: "Главная" },
  { href: "/reels.html", label: "Reels под ключ" },
  { href: "/meta-target.html", label: "Meta таргет" },
  { href: "/google-reklama.html", label: "Google реклама" },
  { href: "/landings.html", label: "Лендинги" },
];

const DS_CONTACTS = {
  whatsapp: "+420 777 199 116",
  whatsappLink: "https://wa.me/420777199116",
  telegram: "@LappoS",
  telegramLink: "https://t.me/LappoS",
  email: "info@lappo.online",
  emailLink: "mailto:info@lappo.online",
  calendly: "https://calendly.com/lappo-stepan/introductory-call",
};

const DS_CTA = {
  primary: "Бесплатная консультация",
  short: "Получить консультацию",
};

// ---------- primitives ----------
function DSArrow({ size = 16 }) {
  return (
    <svg width={size} height={size} viewBox="0 0 24 24" fill="none" style={{ flex: "none" }}>
      <path d="M5 12h14M13 6l6 6-6 6" stroke="currentColor" strokeWidth="2" strokeLinecap="square"/>
    </svg>
  );
}

function DSCheck() {
  return (
    <svg width="22" height="22" viewBox="0 0 24 24" fill="none" style={{ flex: "none", marginTop: 3 }}>
      <circle cx="12" cy="12" r="11" fill={DS_ACCENT.bg}/>
      <path d="M7 12.5l3.5 3.5L17 9" stroke={DS_ACCENT.ink} strokeWidth="2.5" strokeLinecap="square" fill="none"/>
    </svg>
  );
}

function DSLogo({ size = 32 }) {
  return (
    <div style={{ display: "flex", alignItems: "center", gap: 10 }}>
      <div style={{
        width: size, height: size, borderRadius: 9, background: DS_ACCENT.bg,
        color: DS_ACCENT.ink, display: "grid", placeItems: "center",
        fontFamily: "'Archivo', sans-serif", fontWeight: 900, fontSize: size * 0.55, letterSpacing: "-.05em"
      }}>D</div>
      <div style={{ fontFamily: "'Archivo', sans-serif", fontWeight: 800, letterSpacing: "-.02em", fontSize: 15 }}>
        DIGITAL SLAP
      </div>
    </div>
  );
}

// ---------- CTA button ----------
// По умолчанию ведёт к форме внизу страницы (секция id="Контакты").
// Если передан href с http(s) — открывается в новой вкладке как внешняя ссылка.
function DSButton({ href = "#Контакты", children = DS_CTA.primary, size = "md", variant = "primary", target }) {
  const sizes = {
    sm: { pad: "12px 18px", fs: 13, gap: 10, arrowBox: 22, arrowSize: 10 },
    md: { pad: "16px 24px", fs: 14, gap: 12, arrowBox: 28, arrowSize: 12 },
    lg: { pad: "20px 30px", fs: 16, gap: 14, arrowBox: 32, arrowSize: 14 },
  };
  const s = sizes[size] || sizes.md;
  const primary = variant === "primary";
  const isExternal = /^https?:\/\//.test(href);
  const isAnchor = href && href.startsWith("#");

  function onClick(e) {
    if (!isAnchor) return;
    const id = decodeURIComponent(href.slice(1));
    // секции обёрнуты в <section id="..."> через DSSection; fallback на форму внутри
    const el = document.getElementById(id)
            || document.querySelector(`[id="${id}"]`)
            || document.querySelector(`a[name="${id}"]`);
    if (!el) return;
    e.preventDefault();
    const header = document.querySelector("[data-ds-header]");
    const offset = (header ? header.getBoundingClientRect().height : 0) + 16;
    const top = el.getBoundingClientRect().top + window.scrollY - offset;
    window.scrollTo({ top, behavior: "smooth" });
    history.replaceState(null, "", href);
  }

  return (
    <a href={href}
       onClick={onClick}
       target={target || (isExternal ? "_blank" : undefined)}
       rel={isExternal ? "noopener" : undefined}
       className={`ds-btn ds-btn-${size} ${primary ? "ds-btn-primary" : "ds-btn-ghost"}`}
       style={{
      display: "inline-flex", alignItems: "center", gap: s.gap,
      padding: s.pad, borderRadius: 999,
      background: primary ? DS_ACCENT.bg : "transparent",
      color: primary ? DS_ACCENT.ink : DS_THEME.fg,
      border: primary ? "none" : `1px solid ${DS_THEME.line2}`,
      fontFamily: "'Archivo', sans-serif", fontWeight: 800,
      fontSize: s.fs, letterSpacing: ".04em", textTransform: "uppercase",
      whiteSpace: "nowrap",
      boxShadow: primary ? `0 10px 30px -8px ${DS_ACCENT.bg}66` : "none",
    }}>
      {children}
      <span className="ds-btn-arrow" style={{
        width: s.arrowBox, height: s.arrowBox, borderRadius: 999,
        background: primary ? DS_ACCENT.ink : DS_THEME.fg,
        color: primary ? DS_ACCENT.bg : DS_THEME.bg,
        display: "grid", placeItems: "center", flexShrink: 0,
      }}>
        <DSArrow size={s.arrowSize}/>
      </span>
    </a>
  );
}

// ---------- Eyebrow label ----------
function DSEyebrow({ children }) {
  return (
    <div style={{
      display: "inline-flex", alignItems: "center", gap: 10,
      fontFamily: "'Archivo', sans-serif", fontSize: 12, fontWeight: 600,
      letterSpacing: ".22em", textTransform: "uppercase", color: DS_THEME.dim,
    }}>
      <span style={{ width: 24, height: 1, background: DS_ACCENT.bg }}/>
      <span>{children}</span>
    </div>
  );
}

// ---------- Reveal on scroll ----------
function DSReveal({ children, delay = 0, as = "div", style = {}, ...rest }) {
  const ref = React.useRef(null);
  const [shown, setShown] = React.useState(false);
  React.useEffect(() => {
    const el = ref.current; if (!el) return;
    const obs = new IntersectionObserver(entries => {
      entries.forEach(e => { if (e.isIntersecting) { setShown(true); obs.disconnect(); } });
    }, { rootMargin: "-8% 0px" });
    obs.observe(el);
    return () => obs.disconnect();
  }, []);
  const Tag = as;
  return (
    <Tag ref={ref} style={{
      opacity: shown ? 1 : 0,
      transform: shown ? "translateY(0)" : "translateY(16px)",
      transition: `opacity .7s cubic-bezier(.2,.6,.2,1) ${delay}s, transform .7s cubic-bezier(.2,.6,.2,1) ${delay}s`,
      ...style,
    }} {...rest}>{children}</Tag>
  );
}

// ---------- Section wrapper ----------
function DSSection({ id, children, style = {}, pad = "clamp(60px, 9vh, 120px)", bg = "transparent" }) {
  return (
    <section id={id} data-screen-label={id} style={{
      background: bg, padding: `${pad} clamp(32px, 7vw, 120px)`,
      borderTop: `1px solid ${DS_THEME.line}`, ...style,
    }}>
      <div style={{ maxWidth: 1320, margin: "0 auto" }}>
        {children}
      </div>
    </section>
  );
}

// ---------- Header ----------
function DSHeader({ active }) {
  const [scrolled, setScrolled] = React.useState(false);
  React.useEffect(() => {
    const onScroll = () => setScrolled(window.scrollY > 20);
    onScroll();
    window.addEventListener("scroll", onScroll, { passive: true });
    return () => window.removeEventListener("scroll", onScroll);
  }, []);

  const [menuOpen, setMenuOpen] = React.useState(false);

  return (
    <>
      <header data-ds-header style={{
        position: "sticky", top: 0, zIndex: 50,
        background: scrolled ? "rgba(10,10,10,.85)" : "transparent",
        backdropFilter: scrolled ? "blur(14px) saturate(1.2)" : "none",
        WebkitBackdropFilter: scrolled ? "blur(14px) saturate(1.2)" : "none",
        borderBottom: scrolled ? `1px solid ${DS_THEME.line}` : "1px solid transparent",
        transition: "background .25s ease, border-color .25s ease",
      }}>
        <div style={{
          maxWidth: 1400, margin: "0 auto",
          padding: "18px clamp(32px, 7vw, 120px)",
          display: "flex", alignItems: "center", justifyContent: "space-between", gap: 24,
        }}>
          <a href="/" style={{ display: "flex", alignItems: "center" }}>
            <DSLogo/>
          </a>

          {/* desktop nav */}
          <nav className="ds-nav-desktop" style={{
            display: "flex", alignItems: "center", gap: 28,
          }}>
            {DS_NAV.map(item => {
              const isActive = active === item.href;
              return (
                <a key={item.href} href={item.href} style={{
                  fontFamily: "'Archivo', sans-serif", fontSize: 13, fontWeight: 500,
                  letterSpacing: "-.005em",
                  color: isActive ? DS_THEME.fg : DS_THEME.dim,
                  borderBottom: isActive ? `1px solid ${DS_ACCENT.bg}` : "1px solid transparent",
                  paddingBottom: 2,
                }}>{item.label}</a>
              );
            })}
          </nav>

          <div className="ds-cta-desktop" style={{ display: "flex", alignItems: "center", gap: 14 }}>
            <DSButton size="sm">{DS_CTA.short}</DSButton>
          </div>

          {/* mobile CTA — появляется при скролле */}
          <div className={`ds-cta-mobile ${scrolled ? "scrolled-visible" : ""}`} style={{
            display: "none", alignItems: "center",
          }}>
            <DSButton size="sm">{DS_CTA.short}</DSButton>
          </div>

          {/* mobile burger */}
          <button className="ds-burger" onClick={() => setMenuOpen(true)} style={{
            display: "none",
            background: "transparent", border: `1px solid ${DS_THEME.line2}`,
            width: 44, height: 44, borderRadius: 10, color: DS_THEME.fg, cursor: "pointer",
            padding: 0,
          }} aria-label="Открыть меню">
            <svg width="20" height="20" viewBox="0 0 24 24" fill="none" style={{ margin: "0 auto", display: "block" }}>
              <path d="M4 7h16M4 12h16M4 17h16" stroke="currentColor" strokeWidth="2" strokeLinecap="square"/>
            </svg>
          </button>
        </div>
      </header>

      {/* mobile fullscreen menu */}
      {menuOpen && (
        <div
          onClick={(e) => {
            /* Закрываем меню когда кликнули по ссылке или кнопке внутри:
               тогда пользователь сразу видит, куда его перенесло (форма, раздел) */
            if (e.target.closest("a, button")) setMenuOpen(false);
          }}
          style={{
          position: "fixed", inset: 0, zIndex: 200,
          background: DS_THEME.bg,
          display: "flex", flexDirection: "column",
          padding: "24px clamp(20px, 5vw, 40px)",
        }}>
          <div style={{ display: "flex", alignItems: "center", justifyContent: "space-between" }}>
            <DSLogo/>
            <button onClick={() => setMenuOpen(false)} style={{
              background: "transparent", border: `1px solid ${DS_THEME.line2}`,
              width: 44, height: 44, borderRadius: 10, color: DS_THEME.fg, cursor: "pointer", padding: 0,
            }} aria-label="Закрыть меню">
              <svg width="20" height="20" viewBox="0 0 24 24" fill="none" style={{ margin: "0 auto", display: "block" }}>
                <path d="M6 6l12 12M18 6L6 18" stroke="currentColor" strokeWidth="2" strokeLinecap="square"/>
              </svg>
            </button>
          </div>
          <nav style={{
            marginTop: 56, display: "flex", flexDirection: "column", gap: 0,
            fontFamily: "'Archivo', sans-serif",
          }}>
            {DS_NAV.map(item => (
              <a key={item.href} href={item.href} style={{
                fontSize: 32, fontWeight: 700, letterSpacing: "-.02em",
                color: active === item.href ? DS_ACCENT.bg : DS_THEME.fg,
                padding: "18px 0", borderBottom: `1px solid ${DS_THEME.line}`,
              }}>{item.label}</a>
            ))}
          </nav>
          <div style={{ marginTop: "auto", paddingTop: 32 }}>
            <DSButton size="lg">{DS_CTA.primary}</DSButton>
          </div>
        </div>
      )}
    </>
  );
}

// sticky CTA removed — header already has a fixed CTA

// ---------- Footer ----------
function DSFooter() {
  return (
    <footer style={{
      borderTop: `1px solid ${DS_THEME.line}`,
      padding: "clamp(60px, 8vh, 96px) clamp(32px, 7vw, 120px) 32px",
      background: DS_THEME.bg,
    }}>
      <div style={{ maxWidth: 1320, margin: "0 auto" }}>

        {/* grid */}
        <div style={{
          display: "grid", gridTemplateColumns: "1.2fr 1fr 1fr 1fr", gap: 40,
        }} className="ds-footer-grid">
          <div>
            <DSLogo/>
            <p style={{
              fontFamily: "'Archivo', sans-serif", fontSize: 14, lineHeight: 1.55,
              color: DS_THEME.dim, margin: "18px 0 0", maxWidth: 320,
            }}>
              Приводим клиентов бизнесу в Чехии и&nbsp;Европе. Реклама, контент, сайты.
            </p>
          </div>
          <FooterCol title="Страницы" items={[
            { href: "/", label: "Главная" },
            { href: "/reels.html", label: "Reels под ключ" },
            { href: "/meta-target.html", label: "Meta таргет" },
            { href: "/google-reklama.html", label: "Google реклама" },
            { href: "/landings.html", label: "Лендинги" },
          ]}/>
          <FooterCol title="Контакты" items={[
            { href: DS_CONTACTS.whatsappLink, label: "WhatsApp · " + DS_CONTACTS.whatsapp, ext: true },
            { href: DS_CONTACTS.telegramLink, label: "Telegram · " + DS_CONTACTS.telegram, ext: true },
            { href: DS_CONTACTS.emailLink, label: DS_CONTACTS.email },
          ]}/>
          <FooterCol title="Юридическое" items={[
            { href: "/policy.html", label: "Политика конфиденциальности" },
            { href: "/vop.html", label: "VOP · Договор оферты" },
          ]}/>
        </div>

        <div style={{
          marginTop: 56, paddingTop: 24, borderTop: `1px solid ${DS_THEME.line}`,
          display: "flex", justifyContent: "space-between", alignItems: "center", flexWrap: "wrap", gap: 16,
          fontFamily: "'JetBrains Mono', monospace", fontSize: 11, letterSpacing: ".14em",
          textTransform: "uppercase", color: DS_THEME.dim2,
        }}>
          <div>© 2026 Vzdělávací Hub s.r.o. · IČO 23590939</div>
          <div>Digital-slap.com · RU · CZ · EN</div>
        </div>
      </div>
    </footer>
  );
}

function FooterCol({ title, items }) {
  return (
    <div>
      <div style={{
        fontFamily: "'JetBrains Mono', monospace", fontSize: 10.5,
        letterSpacing: ".2em", textTransform: "uppercase", color: DS_THEME.dim2,
        marginBottom: 16,
      }}>{title}</div>
      <ul style={{ listStyle: "none", padding: 0, margin: 0, display: "flex", flexDirection: "column", gap: 10 }}>
        {items.map(i => (
          <li key={i.href + i.label}>
            <a href={i.href} target={i.ext ? "_blank" : undefined} rel={i.ext ? "noopener" : undefined} style={{
              fontFamily: "'Archivo', sans-serif", fontSize: 14, fontWeight: 500,
              color: DS_THEME.fg, opacity: .85,
            }}>{i.label}</a>
          </li>
        ))}
      </ul>
    </div>
  );
}

// ---------- Page shell ----------
function DSPage({ active, children }) {
  return (
    <div style={{ ...DS_CSS_VARS, background: DS_THEME.bg, color: DS_THEME.fg, minHeight: "100vh" }}>
      <DSHeader active={active}/>
      <main>{children}</main>
      <DSFooter/>
    </div>
  );
}

// ---------- Contact form (shared between Home & Stub pages) ----------
const DS_FORM_ENDPOINT = "https://script.google.com/macros/s/AKfycbxS7L3UWdXIh3wWR5iipaGLKOcQiBjp7Y52k5O4tf2vfT9btx-IqW1JDcACfQYPxZSI7g/exec";

function DSFormField({ label, name, type = "text", required, textarea, rows, placeholder }) {
  const [focus, setFocus] = React.useState(false);
  const shared = {
    width: "100%", padding: "14px 16px",
    background: DS_THEME.surface, border: `1px solid ${focus ? DS_ACCENT.bg : DS_THEME.line2}`,
    borderRadius: 10,
    color: DS_THEME.fg, fontFamily: "'Archivo', sans-serif", fontSize: 15,
    outline: "none", resize: textarea ? "vertical" : "none",
    transition: "border-color .2s ease",
  };
  return (
    <label style={{ display: "flex", flexDirection: "column", gap: 8 }}>
      <span style={{
        fontFamily: "'Archivo', sans-serif", fontSize: 12, fontWeight: 600,
        letterSpacing: ".16em", textTransform: "uppercase", color: DS_THEME.dim,
      }}>{label}{required && <span style={{ color: DS_ACCENT.bg }}> *</span>}</span>
      {textarea
        ? <textarea name={name} rows={rows || 3} placeholder={placeholder} required={required}
                    style={shared} onFocus={() => setFocus(true)} onBlur={() => setFocus(false)}/>
        : <input name={name} type={type} placeholder={placeholder} required={required}
                 style={shared} onFocus={() => setFocus(true)} onBlur={() => setFocus(false)}/>}
    </label>
  );
}

function DSContactSection({ sourceLabel = "digital-slap.com" }) {
  const [status, setStatus] = React.useState("idle"); // idle | sending | sent | error
  const [errMsg, setErrMsg] = React.useState("");
  const formRef = React.useRef(null);

  async function onSubmit(e) {
    e.preventDefault();
    if (status === "sending") return;
    const fd = new FormData(formRef.current);
    if (fd.get("website")) { setStatus("sent"); return; } // honeypot
    const payload = {
      name:   fd.get("name")  || "",
      phone:  fd.get("phone") || "",
      email:  fd.get("email") || "",
      url:    fd.get("url")   || "",
      about:  fd.get("about") || "",
      source: sourceLabel,
      ua:     navigator.userAgent,
      ts:     new Date().toISOString(),
    };
    setStatus("sending"); setErrMsg("");
    if (!DS_FORM_ENDPOINT || DS_FORM_ENDPOINT.startsWith("__")) {
      setTimeout(() => setStatus("sent"), 600);
      return;
    }
    try {
      const body = new URLSearchParams();
      Object.entries(payload).forEach(([k, v]) => body.append(k, v));
      await fetch(DS_FORM_ENDPOINT, { method: "POST", mode: "no-cors", body });
      setStatus("sent");
    } catch (err) {
      console.error(err);
      setErrMsg("Не удалось отправить. Напишите, пожалуйста, в WhatsApp или Telegram — мы ответим в течение дня.");
      setStatus("error");
    }
  }

  const contactsList = [
    { label: "WhatsApp", val: DS_CONTACTS.whatsapp, href: DS_CONTACTS.whatsappLink, ext: true },
    { label: "Telegram", val: DS_CONTACTS.telegram, href: DS_CONTACTS.telegramLink, ext: true },
    { label: "Email",    val: DS_CONTACTS.email,    href: DS_CONTACTS.emailLink },
  ];

  return (
    <DSSection id="Контакты" bg={DS_THEME.surface} pad="clamp(80px, 12vh, 160px)">
      <div style={{ display: "grid", gridTemplateColumns: "1fr 1fr", gap: 72, alignItems: "start" }} className="contact-grid">
        <div style={{ position: "sticky", top: 120 }} className="contact-left">
          <DSReveal delay={0.05}>
            <h2 style={{
              fontFamily: "'Archivo', sans-serif", fontWeight: 800,
              fontSize: "clamp(38px, 5.2vw, 84px)", lineHeight: .92, letterSpacing: "-.045em",
              wordSpacing: ".15em", textTransform: "uppercase", margin: "20px 0 0",
            }}>
              Записаться на<br/>
              <em style={{
                fontFamily: "'Instrument Serif', 'EB Garamond', Georgia, serif", fontStyle: "italic", fontWeight: 400,
                textTransform: "none", letterSpacing: "-.02em",
              }}>бесплатную</em><br/>
              консультацию
            </h2>
          </DSReveal>
          <DSReveal delay={0.1}>
            <p style={{
              marginTop: 28, fontFamily: "'Archivo', sans-serif",
              fontSize: "clamp(15px, 1.2vw, 18px)", lineHeight: 1.6, maxWidth: 460,
              color: DS_THEME.dim, margin: "28px 0 0",
            }}>
              Встретимся с вами на 30 минут по видеозвонку. Разберём вашу ситуацию в цифрах,
              покажу слабые места в маркетинге и варианты, как их починить.
            </p>
          </DSReveal>
          <DSReveal delay={0.15} className="contacts-inline">
            <div style={{
              marginTop: 40, display: "flex", flexDirection: "column",
              fontFamily: "'Archivo', sans-serif", fontSize: 15,
            }}>
              {contactsList.map((c, i, arr) => (
                <a key={i} href={c.href} target={c.ext ? "_blank" : undefined} rel={c.ext ? "noopener" : undefined} style={{
                  display: "flex", alignItems: "center", gap: 12, padding: "18px 0",
                  borderTop: `1px solid ${DS_THEME.line2}`,
                  borderBottom: i === arr.length - 1 ? `1px solid ${DS_THEME.line2}` : "none",
                }}>
                  <span style={{
                    fontFamily: "'Archivo', sans-serif", fontSize: 12, fontWeight: 600,
                    letterSpacing: ".16em", textTransform: "uppercase", color: DS_THEME.dim, width: 120,
                  }}>{c.label}</span>
                  <span style={{ color: DS_THEME.fg }}>{c.val}</span>
                </a>
              ))}
            </div>
          </DSReveal>
        </div>

        <DSReveal delay={0.1}>
          <form ref={formRef} onSubmit={onSubmit} style={{
            display: "flex", flexDirection: "column", gap: 18,
            background: DS_THEME.bg, padding: "clamp(32px, 3.5vw, 48px)",
            borderRadius: 20, border: `1px solid ${DS_THEME.line2}`,
            boxShadow: "0 20px 60px -20px rgba(0,0,0,.5)",
          }}>
            {status === "sent" ? (
              <div style={{
                padding: "40px 0", textAlign: "center",
                display: "flex", flexDirection: "column", alignItems: "center", gap: 20,
              }}>
                <div style={{
                  width: 64, height: 64, borderRadius: 999, background: DS_ACCENT.bg,
                  display: "grid", placeItems: "center",
                }}>
                  <svg width="28" height="28" viewBox="0 0 24 24" fill="none">
                    <path d="M5 12l5 5L20 7" stroke={DS_ACCENT.ink} strokeWidth="2.5" strokeLinecap="square"/>
                  </svg>
                </div>
                <h3 style={{
                  fontFamily: "'Archivo', sans-serif", fontWeight: 700, fontSize: 24,
                  letterSpacing: "-.02em", textTransform: "uppercase",
                }}>Заявка отправлена</h3>
                <p style={{
                  fontFamily: "'Archivo', sans-serif", color: DS_THEME.dim,
                  margin: 0, maxWidth: 360, lineHeight: 1.55,
                }}>
                  Свяжемся с вами в течение рабочего дня, чтобы согласовать время консультации.
                </p>
              </div>
            ) : (
              <>
                <input type="text" name="website" tabIndex={-1} autoComplete="off"
                       style={{ position: "absolute", left: "-10000px", width: 1, height: 1, opacity: 0, pointerEvents: "none" }}/>
                <DSFormField label="Ваше имя" name="name" required/>
                <DSFormField label="Телефон" name="phone" type="tel" required/>
                <DSFormField label="Email" name="email" type="email"/>
                <DSFormField label="Сайт или Instagram бизнеса" name="url"/>
                <DSFormField label="Расскажите о вашей ситуации" name="about"
                             placeholder="Кто в команде, какие есть проблемы, какие инструменты используете"
                             textarea rows={4}/>
                {status === "error" && (
                  <div style={{
                    padding: "12px 14px", borderRadius: 10,
                    background: "rgba(255,122,92,.08)", border: "1px solid rgba(255,122,92,.4)",
                    fontFamily: "'Archivo', sans-serif", fontSize: 13, color: "#FF9A80", lineHeight: 1.5,
                  }}>{errMsg}</div>
                )}
                <button type="submit" disabled={status === "sending"} style={{
                  marginTop: 12, width: "100%", padding: "20px",
                  background: status === "sending" ? "#9BD12E" : DS_ACCENT.bg,
                  color: DS_ACCENT.ink, border: "none", borderRadius: 999,
                  fontFamily: "'Archivo', sans-serif", fontWeight: 800, fontSize: 15,
                  letterSpacing: ".04em", textTransform: "uppercase",
                  cursor: status === "sending" ? "wait" : "pointer",
                  display: "inline-flex", justifyContent: "center", alignItems: "center", gap: 12,
                  opacity: status === "sending" ? .8 : 1,
                  transition: "background .2s ease, opacity .2s ease",
                }}>
                  {status === "sending" ? "Отправляем…" : "Записаться на консультацию"}
                  {status !== "sending" && (
                    <span style={{
                      width: 30, height: 30, borderRadius: 999,
                      background: DS_ACCENT.ink, color: DS_ACCENT.bg,
                      display: "grid", placeItems: "center",
                    }}><DSArrow size={14}/></span>
                  )}
                </button>
                <p style={{
                  fontFamily: "'Archivo', sans-serif", fontSize: 12, fontWeight: 500,
                  color: DS_THEME.dim2, margin: 0, textAlign: "center", lineHeight: 1.5,
                }}>
                  Нажимая кнопку, вы соглашаетесь с <a href="/policy.html" style={{
                    color: DS_THEME.dim, borderBottom: `1px solid ${DS_THEME.dim2}`,
                  }}>политикой конфиденциальности</a>
                </p>
              </>
            )}
          </form>
        </DSReveal>

        {/* Mobile-only: дубликат контактов под формой */}
        <DSReveal delay={0.2} className="contacts-mobile">
          <div style={{
            display: "flex", flexDirection: "column",
            fontFamily: "'Archivo', sans-serif", fontSize: 15,
          }}>
            <div style={{
              fontFamily: "'Archivo', sans-serif", fontSize: 12, fontWeight: 600,
              letterSpacing: ".18em", textTransform: "uppercase", color: DS_THEME.dim,
              marginBottom: 16,
            }}>Или напишите нам напрямую</div>
            {contactsList.map((c, i, arr) => (
              <a key={i} href={c.href} target={c.ext ? "_blank" : undefined} rel={c.ext ? "noopener" : undefined} style={{
                display: "flex", alignItems: "center", gap: 12, padding: "18px 0",
                borderTop: `1px solid ${DS_THEME.line2}`,
                borderBottom: i === arr.length - 1 ? `1px solid ${DS_THEME.line2}` : "none",
              }}>
                <span style={{
                  fontFamily: "'Archivo', sans-serif", fontSize: 12, fontWeight: 600,
                  letterSpacing: ".16em", textTransform: "uppercase", color: DS_THEME.dim, width: 120,
                }}>{c.label}</span>
                <span style={{ color: DS_THEME.fg }}>{c.val}</span>
              </a>
            ))}
          </div>
        </DSReveal>
      </div>
    </DSSection>
  );
}

// export to window so page scripts can use them
Object.assign(window, {
  DS_ACCENT, DS_THEME, DS_CSS_VARS, DS_NAV, DS_CONTACTS, DS_CTA,
  DSArrow, DSCheck, DSLogo, DSButton, DSEyebrow, DSSection,
  DSHeader, DSFooter, DSPage, DSReveal, DSContactSection, DSFormField,
});
