/* Quar — layout, генератор, секции */

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

:root {
  --ink: #0f172a;
  --ink-soft: #475569;
  --surface: #ffffff;
  --radius: 18px;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
  --accent: #0ea5e9;
  --accent-hover: #0284c7;
  --font: "DM Sans", system-ui, sans-serif;
  --header-h: 4.25rem;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background: #e8ecf1;
  line-height: 1.5;
}

/* Фон под контентом */
.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  --dot-color: rgba(15, 23, 42, 0.05);
  --dot-step: 22px;
  background-color: #e9ecef;
  background-image:
    radial-gradient(circle at 1px 1px, var(--dot-color) 0.85px, transparent 0.9px),
    radial-gradient(
      ellipse 86% 72% at 50% 42%,
      rgba(255, 255, 255, 0.9) 0%,
      rgba(255, 255, 255, 0.32) 50%,
      transparent 75%
    );
  background-size: var(--dot-step) var(--dot-step), 100% 100%;
  background-position: 0 0, center;
}

.layout {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 clamp(1rem, 4vw, 2rem) clamp(2rem, 5vw, 3rem);
  padding-top: calc(var(--header-h) + 0.75rem);
}

/* Доступность */
.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;
}

.skip-link {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 0.85rem;
  border-radius: 8px;
  transform: translateY(-120%);
  transition: transform 0.2s ease;
  /* Не перехватывать тапы по шапке под «невидимой» ссылкой (iOS / WebKit) */
  pointer-events: none;
}

.skip-link:focus,
.skip-link:focus-visible {
  pointer-events: auto;
}

.skip-link:focus {
  z-index: 300;
  transform: translateY(0);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Шапка */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  /* isolate — корректные слои для кликов по fixed на iOS */
  isolation: isolate;
}

.site-header__bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  min-height: var(--header-h);
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  padding-left: max(env(safe-area-inset-left, 0px), clamp(0.75rem, 4vw, 1.25rem));
  padding-right: max(env(safe-area-inset-right, 0px), clamp(0.75rem, 4vw, 1.25rem));
  box-sizing: border-box;
}

.shell {
  width: 100%;
  max-width: min(920px, 100%);
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}

.shell--wide {
  max-width: min(1040px, 100%);
}

.shell--narrow {
  max-width: min(720px, 100%);
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
  min-width: 0;
  flex-shrink: 1;
}

.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 6px);
  grid-template-rows: repeat(3, 6px);
  gap: 2px;
  flex-shrink: 0;
  width: calc(3 * 6px + 2 * 2px);
  height: calc(3 * 6px + 2 * 2px);
}

.brand-mark span {
  background: var(--ink);
  border-radius: 1px;
  opacity: 0.92;
}

.brand-mark span:nth-child(2),
.brand-mark span:nth-child(4),
.brand-mark span:nth-child(8) {
  opacity: 0.35;
}

.site-brand__text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.15;
  min-width: 0;
}

.site-brand__name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-brand__tag {
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.nav-toggle {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  padding: 0;
  border: 1px solid rgba(15, 23, 42, 0.15);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.nav-toggle__bars {
  display: block;
  width: 1.25rem;
  height: 2px;
  background: var(--ink);
  box-shadow: 0 -6px 0 var(--ink), 0 6px 0 var(--ink);
  border-radius: 1px;
}

@media (min-width: 880px) {
  .nav-toggle {
    display: none;
  }

  .site-brand {
    flex-shrink: 0;
  }
}

.site-nav {
  display: none;
  flex-direction: column;
  gap: 0.25rem;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin-top: 0.35rem;
  padding: 0.75rem;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(15, 23, 42, 0.08);
  z-index: 60;
}

.site-nav.is-open {
  display: flex;
}

@media (min-width: 880px) {
  .site-nav {
    display: flex !important;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.35rem 1rem;
    position: static;
    padding: 0;
    background: transparent;
    box-shadow: none;
    border: none;
  }
}

.site-nav__link {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
}

.site-nav__link:hover {
  color: var(--ink);
  background: rgba(15, 23, 42, 0.05);
}

/* Герой */
.hero {
  padding-top: 0.5rem;
  padding-bottom: 1.5rem;
}

.hero__inner {
  display: grid;
  gap: 1.75rem;
  align-items: center;
}

@media (min-width: 768px) {
  .hero__inner {
    grid-template-columns: 1fr minmax(200px, 280px);
    gap: 2rem;
  }
}

.hero__intro h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.hero__lead {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 52ch;
}

.hero-visual {
  display: flex;
  justify-content: center;
}

.hero-visual__phone {
  width: min(100%, 220px);
  aspect-ratio: 10 / 19;
  background: linear-gradient(165deg, #1e293b 0%, #0f172a 100%);
  border-radius: 28px;
  padding: 0.65rem;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35);
  position: relative;
}

.hero-visual__notch {
  position: absolute;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 28%;
  height: 5px;
  background: #0f172a;
  border-radius: 0 0 8px 8px;
}

.hero-visual__qr {
  margin-top: 1.25rem;
  height: 42%;
  border-radius: 10px;
  background-color: #fff;
  background-image:
    linear-gradient(90deg, #e2e8f0 1px, transparent 1px),
    linear-gradient(#e2e8f0 1px, transparent 1px);
  background-size: 10px 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

.hero-visual__cap {
  margin: 0.75rem 0 0;
  font-size: 0.72rem;
  color: #94a3b8;
  text-align: center;
}

/* Секции */
.section {
  scroll-margin-top: calc(var(--header-h) + 0.5rem);
  padding: 2.5rem 0;
}

.section--muted {
  background: rgba(255, 255, 255, 0.55);
  margin-left: calc(-1 * clamp(1rem, 4vw, 2rem));
  margin-right: calc(-1 * clamp(1rem, 4vw, 2rem));
  padding-left: clamp(1rem, 4vw, 2rem);
  padding-right: clamp(1rem, 4vw, 2rem);
  border-radius: var(--radius);
}

.section__lead {
  margin: 0 0 1.5rem;
  color: var(--ink-soft);
  font-size: 1rem;
  max-width: 52ch;
}

.section h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  font-weight: 700;
}

.section--article h2 {
  margin-bottom: 1rem;
}

/* Карточка генератора — одна колонка, без старой сетки 1fr 280px */
.card,
.generator-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.25rem, 3vw, 1.85rem);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.generator-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.generator-hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.type-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.type-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #f8fafc;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.type-chip:hover {
  border-color: rgba(14, 165, 233, 0.45);
  color: var(--ink);
}

.type-chip.is-active {
  background: rgba(14, 165, 233, 0.12);
  border-color: var(--accent);
  color: var(--ink);
}

.type-chip__ico {
  font-size: 1rem;
  line-height: 1;
}

.generator-main {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}

@media (min-width: 768px) {
  .generator-main {
    grid-template-columns: 1fr minmax(240px, 280px);
  }
}

.generator-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.generator-panels {
  min-height: 2rem;
}

.type-panel:not(.is-visible) {
  display: none;
}

.type-panel.is-visible {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.input-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.text-field {
  width: 100%;
  padding: 0.75rem 0.9rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.14);
  background: #fafbfc;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-field:hover {
  border-color: rgba(15, 23, 42, 0.2);
}

.text-field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
  background: #fff;
}

select.text-field {
  cursor: pointer;
  appearance: auto;
}

.text-field--area {
  min-height: 100px;
  resize: vertical;
  line-height: 1.45;
}

.generator-controls .row {
  margin-top: 0;
}

.panel .row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.15rem;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn:hover {
  background: var(--accent-hover);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.35);
}

.btn--ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid rgba(15, 23, 42, 0.14);
}

.btn--ghost:hover {
  background: rgba(15, 23, 42, 0.04);
  color: var(--ink);
}

.hint {
  font-size: 0.8rem;
  color: var(--ink-soft);
  flex: 1 1 12rem;
}

.generator-preview {
  justify-self: center;
  width: 100%;
  max-width: 300px;
}

@media (min-width: 768px) {
  .generator-preview {
    justify-self: stretch;
    max-width: none;
  }
}

.preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.frame {
  position: relative;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  aspect-ratio: 1;
  padding: 1.25rem;
  background:
    linear-gradient(var(--ink) 0 0) 0 0 / 22px 3px no-repeat,
    linear-gradient(var(--ink) 0 0) 0 0 / 3px 22px no-repeat,
    linear-gradient(var(--ink) 0 0) 100% 0 / 22px 3px no-repeat,
    linear-gradient(var(--ink) 0 0) 100% 0 / 3px 22px no-repeat,
    linear-gradient(var(--ink) 0 0) 0 100% / 22px 3px no-repeat,
    linear-gradient(var(--ink) 0 0) 0 100% / 3px 22px no-repeat,
    linear-gradient(var(--ink) 0 0) 100% 100% / 22px 3px no-repeat,
    linear-gradient(var(--ink) 0 0) 100% 100% / 3px 22px no-repeat;
  opacity: 0.95;
}

.frame-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: repeating-linear-gradient(
      0deg,
      rgba(15, 23, 42, 0.04) 0 1px,
      transparent 1px 8px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(15, 23, 42, 0.04) 0 1px,
      transparent 1px 8px
    );
  background-size: 8px 8px;
  border-radius: 8px;
}

#qr-preview.qr-preview {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  background: #fff;
}

.preview-wrap.is-empty #qr-preview {
  visibility: hidden;
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.placeholder {
  position: absolute;
  inset: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.45;
  pointer-events: none;
}

.preview-wrap:not(.is-empty) .placeholder {
  display: none;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

/* Шаги */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 640px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
  }
}

.steps__item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem;
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}

.steps__icon {
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.steps__title {
  font-size: 1rem;
  display: block;
}

.steps__text {
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* Доверие */
.trust__grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .trust__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.trust__card {
  padding: 1.35rem;
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.trust__ico {
  display: block;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.trust__card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.trust__card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

/* Текст SEO */
.prose {
  font-size: 1rem;
  color: var(--ink-soft);
  line-height: 1.65;
}

.prose p {
  margin: 0 0 1rem;
}

.prose p:last-child {
  margin-bottom: 0;
}

.prose code {
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  background: rgba(15, 23, 42, 0.06);
  border-radius: 4px;
}

.prose--compact {
  font-size: 0.95rem;
}

/* Карточки типов (описание) */
.grid-expl {
  display: grid;
  gap: 1rem;
}

@media (min-width: 560px) {
  .grid-expl {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .grid-expl {
    grid-template-columns: repeat(3, 1fr);
  }
}

.expl-card {
  padding: 1.15rem 1.25rem;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.06);
}

.expl-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}

.expl-card p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* FAQ */
.faq .faq-item {
  margin-bottom: 0.5rem;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.faq summary {
  padding: 0.9rem 1rem;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  float: right;
  font-weight: 400;
  color: var(--ink-soft);
}

.faq details[open] summary::after {
  content: "−";
}

.faq .faq-item p {
  margin: 0;
  padding: 0 1rem 1rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

.section--privacy {
  padding-bottom: 0;
}

/* Подвал */
.site-footer {
  margin-top: auto;
  padding-top: 2rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.site-footer__row {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}

@media (min-width: 640px) {
  .site-footer__row {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.site-footer__copy {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  font-size: 0.88rem;
}

.site-footer__links a {
  color: var(--accent);
  text-decoration: none;
}

.site-footer__links a:hover {
  text-decoration: underline;
}

.site-footer__lang {
  color: var(--ink-soft);
}

.site-footer__fine {
  margin: 1rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.45;
}

.site-footer__fine code {
  font-size: 0.85em;
}

/* Страница политики */
.legal-doc {
  padding-top: 0.5rem;
  padding-bottom: 2rem;
  max-width: 42rem;
}

.legal-doc__header {
  margin-bottom: 1.75rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
}

.legal-doc__eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.legal-doc h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.5rem, 3.5vw, 1.85rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.legal-doc__meta {
  margin: 0;
  font-size: 0.88rem;
  color: var(--ink-soft);
}

.legal-doc__body h2 {
  margin: 1.75rem 0 0.65rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.legal-doc__body h2:first-of-type {
  margin-top: 1.25rem;
}

.legal-doc__body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-doc__body a:hover {
  color: var(--accent-hover);
}

.legal-doc__back {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.legal-doc__back a {
  font-weight: 600;
  text-decoration: none;
}

.legal-doc__back a:hover {
  text-decoration: underline;
}
