/*
 * Стили лендинга. Разметку страниц собирает генератор site/ — классы здесь
 * соответствуют компонентам из site/html.ts и site/layout.ts.
 */

:root {
  color-scheme: light;
  --bg: #f5efe4;
  --surface: rgba(255, 250, 242, 0.8);
  --surface-strong: #fffdf8;
  --text: #21160f;
  --muted: #675748;
  --line: rgba(84, 57, 31, 0.12);
  --accent: #c95c2b;
  --accent-strong: #9f3b1b;
  --shadow: 0 30px 80px rgba(59, 35, 14, 0.12);
  --radius-xl: 36px;
  --radius-lg: 26px;
  --radius-md: 18px;
  --container: min(1180px, calc(100% - 40px));
  --serif: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
}

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

/* Скрытые скриптом блоки не должны всплывать из-за display у классов */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: 'Avenir Next', 'Segoe UI', 'Helvetica Neue', sans-serif;
  line-height: 1.65;
}

a {
  color: inherit;
  text-decoration: none;
}

p,
h1,
h2,
h3,
ul,
ol,
figure {
  margin: 0;
}

h1,
h2 {
  font-family: var(--serif);
  letter-spacing: -0.03em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.2rem, 4.6vw, 3.6rem);
  line-height: 1.04;
}

h2 {
  font-size: clamp(1.7rem, 3.2vw, 2.5rem);
  line-height: 1.1;
}

h3 {
  font-size: 1.2rem;
  line-height: 1.3;
}

.page {
  width: var(--container);
  margin: 0 auto;
  padding: 16px 0 56px;
}

/* Шапка */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 28px;
  padding: 10px 4px 18px;
}

.site-header__brand {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.site-header__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin-right: auto;
  font-size: 0.97rem;
  font-weight: 600;
  color: var(--muted);
}

.site-header__nav a:hover,
.text-link:hover,
.crumbs a:hover,
.site-footer a:hover {
  color: var(--accent);
}

.crumbs {
  padding: 0 4px 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.crumbs a {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Кнопки и ссылки */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.98rem;
  font-weight: 700;
  text-align: center;
}

.button--small {
  min-height: 42px;
  padding: 0 18px;
  font-size: 0.92rem;
}

.button--primary {
  color: #fff9f4;
  background: var(--accent);
  box-shadow: 0 14px 28px rgba(159, 59, 27, 0.2);
}

.button--primary:hover {
  background: var(--accent-strong);
}

.button--ghost {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.48);
}

.text-link,
.section p a,
.faq a {
  color: var(--accent-strong);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Скриншот приложения */

.phone img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-strong);
  box-shadow: 0 18px 36px rgba(42, 24, 10, 0.14);
}

.phone figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

/* Первый экран */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 36px;
  align-items: center;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero__lead,
.section__lead {
  color: var(--muted);
  font-size: 1.12rem;
}

.hero__lead {
  margin-top: 20px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.hero__note {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.93rem;
}

.hero__shots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.hero__shots .phone:nth-child(2) {
  margin-top: 28px;
}

.hero__shots .phone:only-child,
.hero__shots:has(.phone:nth-child(2):last-child) .phone {
  max-width: 260px;
}

.hero__shots:has(.phone:nth-child(2):last-child) {
  grid-template-columns: repeat(2, minmax(0, 260px));
  justify-content: center;
}

/* Секции */

.section,
.cta {
  margin-top: 22px;
  padding: 36px 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: rgba(255, 252, 246, 0.82);
}

.section > * + *,
.split__copy > * + * {
  margin-top: 16px;
}

.section > p,
.section > .plain-list,
.split__copy {
  max-width: 68ch;
}

.section > .split,
.section > .shots,
.section > .link-cards,
.section > .topic-list,
.section > .steps,
.section > .voices,
.section > .faq {
  margin-top: 26px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 40px;
  align-items: center;
}

.split + .split {
  padding-top: 30px;
  border-top: 1px solid var(--line);
}

.split--reverse {
  grid-template-columns: 300px minmax(0, 1fr);
}

.split--reverse .split__copy {
  order: 2;
}

/* В паре с текстом и в ряду заданий скриншот обрезается снизу: важна верхняя часть экрана. */
.split .phone img,
.shots .phone img {
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: top center;
}

.split__copy p,
.section > p {
  color: var(--muted);
}

.split__copy h3 {
  font-size: 1.45rem;
}

.plain-list {
  padding-left: 1.3em;
  color: var(--muted);
}

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

.plain-list b {
  color: var(--text);
}

/* Шаги темы */

.steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff9f4;
  font-size: 0.9rem;
  font-weight: 700;
}

.steps p,
.topic-list p,
.link-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.55;
}

/* Сетки карточек */

.link-cards,
.topic-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.link-card,
.topic-list article {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
}

.link-card {
  transition: border-color 160ms ease;
}

.link-card:hover {
  border-color: var(--accent);
}

.link-card h3 {
  color: var(--accent-strong);
}

.shots {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

/* FAQ */

.faq__item {
  border-top: 1px solid var(--line);
}

.faq__item:last-child {
  border-bottom: 1px solid var(--line);
}

.faq__item summary {
  padding: 16px 0;
  font-size: 1.08rem;
  font-weight: 700;
  cursor: pointer;
}

.faq__item p {
  max-width: 72ch;
  padding-bottom: 18px;
  color: var(--muted);
}

/* Голоса озвучки: карточки рисует src/voices.js */

.voices > * + * {
  margin-top: 14px;
}

.voice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.voice-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
}

.voice-card__name {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
}

.voice-card__gender {
  color: var(--muted);
  font-size: 0.92rem;
}

.voice-card .button {
  width: 100%;
  margin-top: 12px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
}

.voice-card .button[aria-pressed='true'] {
  border-color: var(--accent);
  color: var(--accent-strong);
}

/* Финальный блок */

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 40px;
  background: var(--surface-strong);
}

.cta p {
  margin-top: 8px;
  color: var(--muted);
}

/* Футер */

.site-footer {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 24px 32px;
  margin-top: 36px;
  padding: 28px 4px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}

.site-footer__brand,
.site-footer__title {
  color: var(--text);
  font-weight: 700;
}

.site-footer__brand {
  font-size: 1.05rem;
}

.site-footer ul {
  padding: 0;
  list-style: none;
}

.site-footer li,
.site-footer__column p + p {
  margin-top: 8px;
}

.site-footer a {
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.site-footer__brand {
  text-decoration: none !important;
}

.site-footer__copy {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.88rem;
}

.site-footer__social {
  display: flex;
  gap: 12px;
}

.site-footer__social a {
  display: inline-flex;
  color: var(--muted);
  text-decoration: none !important;
}

.site-footer__social a:hover {
  color: var(--text);
}

.site-footer__requisites {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.site-footer__name {
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

.site-footer__meta,
.site-footer__contacts {
  margin: 0;
}

.site-footer__contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

/* Документы: /privacy, /terms, /offer, /refund, /api-docs */

.page--legal main,
.page--legal .crumbs {
  max-width: 44rem;
  margin-left: auto;
  margin-right: auto;
}

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

.legal__eyebrow {
  color: var(--accent-strong);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.76rem;
  font-weight: 700;
}

.legal-card h1 {
  margin-top: 12px;
  font-family: var(--serif);
  font-size: clamp(2rem, 4.3vw, 3.1rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.legal__updated {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.95rem;
}

.legal-card h2 {
  margin-top: 1.7em;
  font-size: 1.28rem;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.legal-card h3 {
  margin-top: 1.2em;
  font-size: 1.05rem;
  line-height: 1.35;
}

.legal-card p,
.legal-card ul,
.legal-card ol {
  margin-top: 0.85em;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.legal-card ul,
.legal-card ol {
  padding-left: 1.35em;
  list-style: disc;
}

.legal-card ol {
  list-style: decimal;
}

.legal-card li + li {
  margin-top: 0.4em;
}

.legal-card a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.legal-table-wrap {
  overflow-x: auto;
  margin-top: 0.85em;
}

.legal-card table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.legal-card th,
.legal-card td {
  border: 1px solid var(--line);
  padding: 0.45em 0.65em;
  text-align: left;
  vertical-align: top;
}

.legal-card code {
  font-size: 0.92em;
  color: var(--text);
}

/* Блоки кода и таблицы — страница «API для разработчиков» (/api-docs). */

.legal-card pre {
  margin-top: 0.85em;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md, 10px);
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
  overflow-x: auto;
}

.legal-card pre code {
  font-size: 0.85rem;
  line-height: 1.55;
}

.legal-card table {
  margin-top: 0.85em;
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.legal-card th,
.legal-card td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
}

.legal-card th {
  color: var(--text);
  font-weight: 700;
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

.legal-card td {
  color: var(--muted);
}

/* Адаптив */

@media (max-width: 1000px) {
  .hero {
    grid-template-columns: 1fr;
  }

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

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

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

@media (max-width: 720px) {
  :root {
    --container: calc(100% - 32px);
  }

  .hero,
  .section,
  .cta,
  .legal-card {
    padding: 24px 20px;
    border-radius: 26px;
  }

  .site-header .button {
    display: none;
  }

  .hero__shots {
    grid-template-columns: repeat(3, 62%);
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x proximity;
  }

  .hero__shots .phone {
    scroll-snap-align: start;
  }

  .hero__shots .phone:nth-child(2) {
    margin-top: 0;
  }

  .hero__actions .button {
    width: 100%;
  }

  .split,
  .split--reverse {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .split--reverse .split__copy {
    order: 0;
  }

  .split .phone {
    width: min(100%, 300px);
    margin: 0 auto;
  }

  .steps {
    grid-template-columns: 1fr;
  }

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

/* Баннер cookie (MEM-33) */

.cookie-banner {
  position: fixed;
  right: 0;
  bottom: 16px;
  left: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  align-items: center;
  justify-content: space-between;
  width: var(--container);
  margin: 0 auto;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
  color: var(--text);
}

.cookie-banner__text {
  margin: 0;
}

.cookie-banner__text a {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cookie-banner__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 720px) {
  .cookie-banner {
    width: calc(100% - 24px);
    bottom: 12px;
    padding: 14px 16px;
  }

  .cookie-banner__actions {
    width: 100%;
  }
}

/* Блог: карточки на главной и общие стили карточек (без тени). */

.section > .blog-cards {
  margin-top: 26px;
}

.blog-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.blog-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff8c;
}

.blog-card > a {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.blog-card__cover {
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-radius: 14px;
  background: rgba(84, 57, 31, 0.06);
}

.blog-card h3 {
  margin-top: 16px;
  color: var(--accent);
}

.blog-card__date {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.blog-card__excerpt {
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 0.96rem;
}

.article-card {
  max-width: 44rem;
  margin: 0 auto;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
}

.article-card > * + * {
  margin-top: 16px;
}

.article__cover {
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.article__date {
  color: var(--muted);
  font-size: 0.95rem;
}

.article__body {
  color: var(--muted);
  max-width: 68ch;
}

.article__body :is(h2, h3) {
  color: var(--text);
  margin-top: 28px;
}

.article__body img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

.article__body p + p {
  margin-top: 12px;
}

.article__body ul,
.article__body ol {
  padding-left: 1.3em;
}

@media (max-width: 900px) {
  .blog-cards {
    grid-template-columns: 1fr;
  }
}
