/* Safron Studio product page stylesheet.
 * Palette aligned with safron-app/src/lib/ui/theme.dart (Pal.night & Pal.day),
 * tuned so every text/background pair passes WCAG AA (>= 4.5:1).
 * Mobile-first (360px primary, 1280px desktop), zero external resources.
 */

:root {
  /* Dark theme default (Pal.night) */
  --bg: #0A0C0B;
  --glow-a: #123A25;
  --glow-b: #14202A;
  --card: #141917;
  --card-2: #1C2220;
  --line: rgba(255, 255, 255, 0.12);
  --text: #F2F5F3;
  --sub: #97A09A;
  --accent: #3BE07F;
  --accent-text: #3BE07F;
  --on-accent: #04150B;
  --accent-soft: rgba(59, 224, 127, 0.14);
  --accent-border: rgba(59, 224, 127, 0.36);
  --btn-secondary-bg: #1C2220;
  --btn-secondary-text: #F2F5F3;
  --btn-secondary-border: rgba(255, 255, 255, 0.22);
  --header-bg: rgba(10, 12, 11, 0.88);
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.38);
  --radius-card: 22px;
  --radius-pill: 999px;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    /* Light theme (Pal.day, AA-verified contrast >= 4.5:1 for all text) */
    --bg: #ECEBE6;
    --glow-a: #DDEFDF;
    --glow-b: #F4E6DA;
    --card: #FFFFFF;
    --card-2: #F4F3EF;
    --line: rgba(20, 22, 21, 0.12);
    --text: #141615;
    --sub: #4A514C;
    --accent: #0C6F37;
    --accent-text: #0C6F37;
    --on-accent: #FFFFFF;
    --accent-soft: rgba(23, 169, 87, 0.12);
    --accent-border: rgba(12, 111, 55, 0.32);
    --btn-secondary-bg: #FFFFFF;
    --btn-secondary-text: #141615;
    --btn-secondary-border: rgba(20, 22, 21, 0.24);
    --header-bg: rgba(236, 235, 230, 0.92);
    --shadow: 0 10px 28px rgba(28, 42, 34, 0.09);
  }
}

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

html {
  font-size: 16px;
  line-height: 1.5;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(640px 420px at 8% 0%, var(--glow-a), transparent 70%),
    radial-gradient(560px 380px at 94% 6%, var(--glow-b), transparent 72%);
  background-repeat: no-repeat;
  min-height: 100vh;
  overflow-x: clip;
}

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

a {
  color: var(--accent-text);
  text-underline-offset: 0.2em;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 12px 16px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  left: 12px;
  top: 12px;
  border-radius: 12px;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 16px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding-block: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.125rem;
  min-height: 44px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 10px;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
}

.nav-link:hover {
  background: var(--card-2);
}

/* Hero (first screen) */
.hero {
  padding-block: 36px 40px;
}

.hero-inner {
  max-width: 780px;
}

.hero-badge {
  display: inline-block;
  margin: 0 0 16px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent-text);
  font-weight: 700;
  font-size: 1rem;
}

h1 {
  margin: 0 0 16px;
  font-size: clamp(1.85rem, 6vw, 3rem);
  line-height: 1.16;
  letter-spacing: -0.025em;
  font-weight: 700;
}

h2 {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 4.5vw, 2.15rem);
  line-height: 1.22;
  letter-spacing: -0.02em;
  font-weight: 700;
}

h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  line-height: 1.3;
  font-weight: 700;
}

.hero-lead {
  margin: 0 0 12px;
  font-size: clamp(1.1rem, 3.2vw, 1.35rem);
  line-height: 1.42;
  color: var(--text);
  font-weight: 500;
}

.hero-sub {
  margin: 0 0 24px;
  font-size: 1rem;
  color: var(--sub);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  min-width: 156px;
  padding: 12px 24px;
  border-radius: 16px;
  font-size: 1.0625rem;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  flex: 1 1 180px;
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-secondary {
  background: var(--btn-secondary-bg);
  color: var(--btn-secondary-text);
  border-color: var(--btn-secondary-border);
}

.btn-secondary:hover {
  border-color: var(--accent);
}

.hero-note {
  margin: 16px 0 0;
  font-size: 1rem;
  color: var(--sub);
}

/* Sections */
.section {
  padding-block: 36px;
}

.section-head {
  max-width: 740px;
  margin-bottom: 24px;
}

.section-subtitle {
  margin: 0;
  color: var(--sub);
  font-size: 1.05rem;
}

/* Grids & Cards */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card p {
  margin: 0;
  color: var(--sub);
}

.card-tag {
  display: inline-block;
  margin: 0 0 10px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 700;
  font-size: 1rem;
}

/* Screenshots gallery */
.screens-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

.screens-grid--single {
  max-width: 780px;
}

.screen-card {
  margin: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.screen-frame {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  padding: 12px;
}

.screen-img {
  border-radius: 12px;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.screen-card--portrait .screen-img {
  max-width: 290px;
}

.screen-caption h3 {
  margin-bottom: 6px;
}

.screen-caption p {
  margin: 0;
  color: var(--sub);
}

/* Steps */
.steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.step-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.step-num {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  font-size: 1.125rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.step-body p {
  margin: 0;
  color: var(--sub);
}

/* Data safety & RU node live callout */
.ru-callout {
  margin-top: 20px;
  background: var(--card);
  border: 2px solid var(--accent-border);
  border-radius: var(--radius-card);
  padding: 22px;
}

.ru-callout-list {
  margin: 12px 0 0;
  padding-left: 22px;
  color: var(--text);
}

.ru-callout-list li + li {
  margin-top: 8px;
}

/* FAQ (pure HTML details/summary, zero JS) */
.faq-list {
  display: grid;
  gap: 12px;
  max-width: 860px;
}

.faq-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 20px;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-weight: 700;
  font-size: 1.0625rem;
}

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

.faq-item summary::after {
  content: "+";
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
}

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

.faq-answer {
  padding: 0 20px 18px;
  color: var(--sub);
}

.faq-answer p {
  margin: 0;
}

/* Bottom CTA card */
.cta-card {
  background: var(--card);
  border: 1px solid var(--accent-border);
  border-radius: 26px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: var(--shadow);
}

.cta-copy p {
  margin: 0;
  color: var(--sub);
}

/* Footer */
.site-footer {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  background: var(--card);
  padding-block: 28px 36px;
}

.footer-inner {
  display: grid;
  gap: 18px;
}

.footer-operator {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 1.0625rem;
}

.footer-meta {
  margin: 0 0 4px;
  color: var(--sub);
}

.footer-contacts p {
  margin: 0 0 8px;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
}

.footer-legal-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 4px;
}

.footer-privacy {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--sub);
}

/* Tablet & Desktop breakpoints (>= 720px and >= 1024px / 1280px) */
@media (min-width: 640px) {
  .container {
    padding-inline: 24px;
  }

  .btn {
    flex: 0 0 auto;
  }

  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .screens-grid--single .screen-card--portrait {
    flex-direction: row;
    align-items: center;
    gap: 28px;
    padding: 24px;
  }

  .screens-grid--single .screen-card--portrait .screen-frame {
    flex: 0 0 260px;
  }

  .screens-grid--multi {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 960px) {
  .hero {
    padding-block: 60px 56px;
  }

  .section {
    padding-block: 48px;
  }

  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .steps-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cta-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 32px 36px;
  }

  .cta-copy {
    max-width: 620px;
  }

  .footer-inner {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .footer-privacy {
    grid-column: 1 / -1;
  }
}

@media print {
  .site-header,
  .cta-row,
  .skip-link {
    display: none;
  }

  body {
    background: #FFFFFF;
    color: #000000;
  }
}

/* Review N178 (Claude): on a phone the menu took three rows above the first screen — keep it one scrollable row */
@media (max-width: 640px) {
  .site-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .site-nav::-webkit-scrollbar {
    display: none;
  }
  .nav-link {
    white-space: nowrap;
  }
}

/* Screens open in full size on tap (review N178) */
a.screen-frame {
  display: block;
  cursor: zoom-in;
}
@media (max-width: 640px) {
  .screen-card--landscape .screen-caption h3::after {
    content: " · нажмите, чтобы увеличить";
    font-weight: 400;
    font-size: 0.85em;
    color: var(--sub);
  }
}
