/* Мобильная вёрстка Baglybook (Figma), брейкпоинт ≤900px.
   Единый источник правды: legacy @media в styles.css сюда не дублируем.
   Практика: безопасные зоны, ≥44px hit area, читаемый минимум шрифта, без hover-only. */

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

body {
  font-size: 16px;
  line-height: 1.45;
}

.page {
  width: calc(100% - 48px);
  max-width: 560px;
  margin: 24px auto;
}

.inset {
  margin-left: 0;
  margin-right: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.45;
  text-wrap: balance;
}

h2 {
  font-size: 24px;
  line-height: 1.45;
  text-wrap: balance;
}

h3 {
  font-size: 19px;
  line-height: 1.45;
}

/* Пять ссылок навигации: 2 колонки + последняя на всю ширину. Бургер не нужен. */
.site-header {
  display: block;
  min-height: 0;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) 48px
    max(24px, env(safe-area-inset-left, 0px));
  background: var(--green);
}

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

.desktop-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  max-width: 560px;
}

.nav-link {
  min-height: 48px;
  padding: 8px 10px 12px;
  font-size: 16px;
  line-height: 1.2;
}

.nav-0 {
  padding-left: 31px;
}

.nav-4 {
  grid-column: 1 / -1;
}

.free-label {
  right: -16px;
  top: 24px;
  width: 86px;
  height: 48px;
  padding: 8px;
  font-size: 12px;
}

/* Главная: заголовок, обложка и флажок в одной композиции. */
.home .page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding-bottom: 24px;
}

.home .hero {
  display: grid;
  grid-template-columns: minmax(0, 210fr) minmax(0, 132fr);
  gap: 18px 0;
  align-items: center;
  min-height: 0;
  padding: 24px max(24px, env(safe-area-inset-right, 0px)) 24px max(24px, env(safe-area-inset-left, 0px));
  background: var(--pink);
  overflow: hidden;
}

.home .hero-content {
  display: contents;
}

.home .hero-backdrop,
.home .hero-lettering {
  display: none;
}

.home .hero h1 {
  position: static;
  grid-column: 1 / -1;
  grid-row: 1;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  overflow: visible;
  clip-path: none;
  white-space: normal;
  font-size: clamp(1.25rem, 5.5vw, 1.375rem);
  line-height: 1.35;
  text-align: center;
}

.home .hero-heading {
  position: static;
  grid-column: 1 / -1;
  grid-row: 2;
  align-self: center;
  width: auto;
  height: auto;
  margin: 0;
  padding: 5px 0;
  overflow: visible;
  clip-path: none;
  white-space: normal;
  color: #64a0aa;
  font-size: clamp(2rem, 10vw, 2.5rem);
  line-height: 1.1;
  text-align: center;
  text-wrap: balance;
}

.home .hero-heading span {
  display: block;
  color: #e76975;
  font-size: clamp(2.25rem, 11vw, 2.75rem);
  line-height: 1.1;
}

.home .hero-cover {
  position: relative;
  grid-column: 1;
  grid-row: 3;
  order: initial;
  width: 100%;
  max-width: 330px;
  margin: 0;
}

.home .hero-book {
  width: 100%;
  height: auto;
  max-height: none;
  object-fit: contain;
  filter: drop-shadow(2.12px 2.65px 2.12px #0005);
}

.home .hello {
  display: grid;
  left: 73.33%;
  top: 21.9%;
  width: 29.02%;
  height: 22.55%;
  padding: 4.5% 3%;
  font-size: clamp(0.6875rem, 2.175vw, 0.75rem);
  line-height: 1.15;
}

.home .hero-note {
  display: grid;
  position: relative;
  grid-column: 2;
  grid-row: 3;
  justify-self: end;
  top: auto;
  right: -24px;
  width: 120px;
  min-height: 91px;
  padding: 20px 25px 20px 16px;
  background: url('../assets/83ef5.svg') center / 100% 100% no-repeat;
  filter: none;
}

.home .hero-note::before {
  display: none;
}

.home .hero-note p {
  font-size: clamp(0.6875rem, 2.7vw, 0.75rem);
  line-height: 1.2;
}

.home .hero-note p span {
  display: block;
}

.home .hero-description {
  grid-column: 1 / -1;
  grid-row: 4;
  order: initial;
  font-size: 18px;
  line-height: 1.35;
  text-align: center;
  text-wrap: pretty;
}

.home .hero-actions {
  grid-column: 1 / -1;
  grid-row: 5;
  display: flex;
  flex-direction: row;
  gap: 16px;
  width: 100%;
  max-width: none;
  margin: 0;
}

.home .paint-button,
.about-final .paint-button {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  color: #dc851c;
  isolation: isolate;
  font-weight: 400;
}

.home .paint-button::before,
.about-final .paint-button::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: -3.5px -8.94px -8.95px -3.5px;
  background: url('../assets/b5542.svg') center / 100% 100% no-repeat;
}

.home .paint-button.light::before {
  background-image: url('../assets/31861.svg');
}

.home .hero-actions .paint-button {
  flex: 1 1 0;
  width: 0;
  min-width: 0;
  min-height: 44px;
  padding: 8px 4px 10px;
  font-size: clamp(0.875rem, 4.85vw, 1.4375rem);
  line-height: 1.2;
}

.home .reader,
.home .stories,
.home .benefits,
.home .faq,
.home .center-cta,
.home .book-stats {
  width: calc(100% - 48px);
  max-width: 560px;
  margin: 40px auto 0;
}

.home .reader {
  margin-top: 24px;
  text-align: center;
}

.home .reader h2,
.home .stories h2,
.home .faq h2 {
  font-size: 28px;
  line-height: 1.35;
  text-align: center;
}

.reader-stage {
  height: auto;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  gap: 18px 12px;
  margin-top: 18px;
  padding: 0;
}

.reader-book {
  grid-column: 1 / -1;
  grid-row: 1;
  width: 100%;
  max-height: none;
  aspect-ratio: 1.434;
}

.reader-arrow {
  width: 48px;
  height: 48px;
  grid-row: 2;
}

.reader-arrow.previous {
  grid-column: 1;
}

.reader-arrow.next {
  grid-column: 3;
}

.reader-count {
  position: relative;
  margin: -48px 58px 0;
  min-height: 48px;
  display: grid;
  place-items: start center;
  padding-top: 0;
  font-size: 14px;
  line-height: 1.35;
  pointer-events: none;
}

.home .stories .section-intro {
  margin-top: 20px;
  font-size: 17px;
  line-height: 1.35;
  text-align: center;
}

.home .story-grid {
  grid-template-columns: 1fr;
  width: 100%;
  max-width: 100%;
  gap: 20px;
  margin: 20px 0 0;
}

.home .story-card {
  display: block;
  position: relative;
  aspect-ratio: 432 / 452;
  height: auto;
  padding: 0;
  border-radius: 0;
  background: none;
}

.home .story-illustration {
  position: absolute;
  inset: 0;
  align-self: stretch;
  width: 100%;
  max-width: none;
  height: 100%;
  aspect-ratio: auto;
}

.home .story-illustration picture {
  display: block;
  position: absolute;
  left: -0.695%;
  top: -0.664%;
  width: 104.862%;
}

.home .card-8314 .story-illustration picture {
  left: -3.472%;
  width: 106.945%;
}

.home .story-illustration > picture > img {
  display: block;
  width: 100%;
  height: auto;
  max-width: none;
}

.home .story-card figcaption {
  position: absolute;
  left: 7.2%;
  top: 84.69%;
  width: 82.82%;
  transform: translateY(-50%);
  font-size: clamp(0.8125rem, 4.15vw, 1.25rem);
  line-height: 1.2;
  text-align: center;
}

.home .card-8852 figcaption {
  top: 84.23%;
}

.home .card-9707 figcaption {
  top: 82%;
}

.home .story-card strong {
  display: inline;
  color: inherit;
  margin: 0;
  font-size: inherit;
  line-height: inherit;
}

.home .professions {
  inset: 0;
  width: 100%;
  height: 100%;
  font-size: clamp(0.6875rem, 3.55vw, 1.0625rem);
  line-height: 1.2;
}

.home .professions span:nth-child(1) {
  left: 37.55%;
  top: 13.27%;
}

.home .professions span:nth-child(2) {
  left: 67.48%;
  top: 17.26%;
}

.home .professions span:nth-child(3) {
  left: 35.75%;
  top: 42.26%;
}

.home .professions span:nth-child(4) {
  left: 70.25%;
  top: 55.53%;
}

.home .benefits > h2 {
  font-size: 24px;
  line-height: 1.35;
  text-align: center;
}

.benefit-grid {
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}

.advantage {
  padding: 20px;
  border-radius: 20px;
}

.advantage h3 {
  gap: 10px;
  font-size: 18px;
  line-height: 1.35;
}

.advantage h3 img {
  width: 28px;
  height: 28px;
}

.advantage p {
  margin-top: 12px;
  font-size: 16px;
  line-height: 1.375;
}

.faq-toggle {
  min-height: 44px;
  margin: 14px 0 14px auto;
  font-size: 14px;
  line-height: 1.35;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

.faq details,
.faq details + details {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.faq summary {
  min-height: 44px;
  padding: 16px 52px 16px 16px;
  font-size: 17px;
  line-height: 1.35;
}

.faq details > p {
  padding: 0 16px 16px;
  font-size: 16px;
  line-height: 1.375;
}

.faq-sign {
  right: 16px;
  width: 26px;
  height: 26px;
}

.home .center-cta {
  display: block;
  padding: 4px 0;
}

.home .center-cta .paint-button,
.about-final .paint-button {
  width: 260px;
  min-height: 56px;
  padding: 10px 18px 14px;
  font-size: clamp(1.25rem, 7vw, 1.875rem);
  line-height: 1.2;
}

.stats-backdrop {
  display: none;
}

.home .book-stats {
  min-height: 0;
  padding: 0;
  background: none;
  border-radius: 0;
}

.stats-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0;
  font-size: 18px;
  line-height: 1.35;
}

.stats-grid > div {
  display: grid;
  grid-template-columns: 122px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  min-height: 126px;
  text-align: left;
}

.stats-grid p {
  margin: 0;
}

.badge {
  width: 122px;
  height: 126px;
  margin: 0;
}

.badge span {
  top: 30px;
  font-size: 12px;
}

.badge b {
  font-size: 28px;
}

.badge-format span {
  top: 22px;
}

.badge-pages span {
  top: 17px;
}

/* Подвал без фиксированных высот, с учётом safe-area. */
.site-footer {
  min-height: 0;
  margin-top: 0 !important;
  padding: 24px 0 max(24px, env(safe-area-inset-bottom, 0px));
  background: var(--teal-ink);
}

.footer-wave {
  display: none;
}

.footer-inner {
  width: calc(100% - 48px);
  max-width: 560px;
}

.footer-top {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 0;
}

.footer-book h2 {
  font-size: 27px;
  line-height: 1.35;
}

.footer-book p,
.footer-book p + p {
  margin-top: 24px;
  font-size: 17px;
  line-height: 1.35;
}

.footer-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  width: 100%;
}

.footer-nav h3 {
  display: block;
  grid-column: 1 / -1;
  font-size: 18px;
  line-height: 1.35;
}

.footer-nav a {
  width: auto;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 8px 0;
  font-size: 17px;
  line-height: 1.35;
}

.footer-contact {
  gap: 24px;
}

.footer-contact h3 {
  display: block;
  font-size: 18px;
  line-height: 1.35;
}

.footer-contact .mail {
  font-size: 18px;
  line-height: 1.35;
}

.social-links {
  gap: 27px;
}

.social-links a {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.footer-contact .wb-button {
  order: initial;
}

.wb-footer {
  width: 229px;
  min-height: 60px;
  padding: 16px 20px;
  font-size: 20px;
}

.footer-bottom {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 24px;
  padding-top: 0;
  border: 0;
  font-size: 14px;
  line-height: 1.35;
}

.footer-bottom p + p {
  margin-top: 24px;
}

.footer-bottom > div:last-child {
  gap: 24px;
}

.footer-bottom button,
.footer-bottom a {
  min-height: 44px;
  font-size: 14px;
  line-height: 1.35;
}

/* О книге */
.about-flow {
  gap: 24px;
  padding: 0;
  color: #010101;
}

.about-flow h1 {
  font-size: 28px;
  line-height: 1.45;
  text-align: left;
}

.about-flow > p,
.about-details > p {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
}

.about-flow > p:first-of-type {
  color: var(--ink);
  text-align: left;
}

.about-flow h2,
.about-flow .step-title {
  display: block;
  margin: 0;
  color: var(--teal-ink);
  font-size: 24px;
  line-height: 1.45;
}

.step-title::before,
.about-flow .about-detail-heading,
.about-invitation {
  display: none;
}

.about-specs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  background: none;
  border-radius: 0;
}

.about-specs h2 {
  grid-column: 1 / -1;
  color: var(--ink);
}

.about-specs ul {
  grid-column: 1 / -1;
  grid-row: auto;
  font-size: 16px;
  line-height: 1.45;
}

.about-specs li + li {
  margin-top: 24px;
}

.about-specs > img {
  display: block;
  position: static;
  grid-column: auto;
  grid-row: auto;
  width: 100%;
  max-width: none;
  max-height: none;
  height: auto;
  object-fit: contain;
}

.about-specs > img:nth-last-child(2) {
  grid-column: 1;
  grid-row: 3;
}

.about-specs > img:last-child {
  grid-column: 2;
  grid-row: 3;
}

.about-flow .book-spread {
  width: 100%;
  height: auto;
  margin: 0;
}

.about-details {
  gap: 24px;
  padding: 0;
  background: none;
}

.about-final {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  min-height: 0;
  width: 100%;
  padding: 0;
}

.about-final .about-slogan {
  display: block;
  order: 0;
  width: 100%;
  height: auto;
}

.about-final .about-giraffe {
  display: block;
  order: 1;
  position: static;
  width: 268px;
  max-width: 100%;
  height: auto;
}

.about-final .paint-button {
  order: 2;
  margin: 0;
}

/* Об авторе */
.author-story {
  margin: 0;
  padding: 0;
  color: #010101;
  background: none;
  border-radius: 0;
}

.author-story h1 {
  margin-bottom: 20px;
  font-size: 28px;
  line-height: 1.45;
  text-align: left;
}

.author-story p {
  margin-top: 20px;
  font-size: 16px;
  line-height: 1.45;
}

.author-after {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
  margin: 24px 0 0;
  min-height: 0;
}

.author-link {
  order: 0;
  width: 100%;
  padding: 0;
  color: #010101;
  background: none;
  border-radius: 0;
}

.author-link h2 {
  margin-bottom: 20px;
  color: #010101;
  font-size: 24px;
  line-height: 1.45;
}

.author-link p {
  font-size: 16px;
  line-height: 1.45;
}

.author-photo {
  order: 1;
  align-self: center;
  width: 256px;
  max-width: 100%;
  height: auto;
  margin: 0;
}

/* Купить */
.buy-page .page > h1 {
  margin-bottom: 24px;
  font-size: 28px;
  line-height: 1.45;
}

.purchase {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.purchase-book {
  padding: 20px;
  border-radius: 24px;
}

.purchase-book > img {
  width: 260px;
  max-width: 100%;
  height: 330px;
  object-fit: contain;
  margin: 0 auto 16px;
}

.purchase-book strong {
  font-size: 16px;
  line-height: 1.45;
}

.purchase-book figcaption span {
  font-size: 16px;
  line-height: 1.45;
}

.purchase-info h2 {
  margin-bottom: 20px;
  font-size: 24px;
  line-height: 1.45;
}

.purchase-info p {
  margin: 20px 0;
  font-size: 20px;
  line-height: 1.45;
}

.purchase-specs {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin: 20px 0;
  padding: 0;
  font-size: 18px;
  line-height: 1.45;
}

.purchase-specs li {
  padding: 0;
  background: none;
  border: 0;
}

.purchase-info h3 {
  font-size: 22px;
  line-height: 1.45;
}

.purchase-info p.price-note {
  margin: 20px 0;
  font-size: 18px;
  line-height: 1.45;
}

.purchase-info .small {
  margin: 20px 0;
  font-size: 16px;
  line-height: 1.45;
}

.purchase-info > a:last-child {
  font-size: 18px;
}

.purchase-info .wb-button {
  min-height: 52px;
  padding: 14px;
  font-size: 17px;
  line-height: 1.45;
}

.how-to-buy {
  margin-top: 24px;
  padding: 0;
  border: 0;
  border-radius: 0;
}

.how-to-buy h2 {
  font-size: 24px;
  line-height: 1.45;
}

.how-to-buy p {
  margin-top: 20px;
  font-size: 16px;
  line-height: 1.45;
}

/* Бонус */
.bonus-page .page {
  gap: 24px;
}

.bonus-intro,
.download-card,
.game-card {
  padding: 20px;
  border-radius: 28px;
}

.bonus-intro h1 {
  margin-bottom: 16px;
  font-size: 28px;
  line-height: 1.45;
}

.bonus-intro p,
.download-card p,
.game-card p {
  font-size: 16px;
  line-height: 1.45;
}

.download-grid {
  grid-template-columns: 1fr;
  gap: 24px;
}

.download-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
  border-radius: 30px;
}

.file-tag {
  padding: 0;
  background: none;
  font-size: 16px;
  line-height: 1.45;
}

.download-card h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.45;
}

.download-preview {
  width: 220px;
  height: auto;
  margin: 0 auto;
}

.download-card p {
  margin: 0;
}

.download-card .flat-button {
  width: 100%;
  min-height: 48px;
  font-size: 17px;
  line-height: 1.45;
}

.game-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}

.qr-placeholder {
  align-items: flex-start;
  justify-content: flex-start;
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: auto;
  padding: 20px;
  gap: 16px;
  border: 2px dashed var(--teal-ink);
}

.qr-placeholder strong {
  font-size: 24px;
  line-height: 1.45;
}

.qr-placeholder span {
  font-size: 16px;
  line-height: 1.45;
}

.game-card h2 {
  gap: 10px;
  font-size: 24px;
  line-height: 1.45;
}

.game-card p {
  margin: 20px 0;
}

.game-card .flat-button,
.game-card > div:last-child {
  width: 100%;
}

.game-card .flat-button {
  min-height: 48px;
}

/* Политика и ошибки */
.policy {
  padding: 0;
  gap: 24px;
}

.policy-intro,
.policy-section {
  padding: 20px;
  border-radius: 28px;
}

.policy-intro h1 {
  font-size: 28px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.policy-intro > p:last-child,
.policy-section p,
.draft {
  font-size: 16px;
  line-height: 1.45;
}

.policy-section h2 {
  font-size: 24px;
  line-height: 1.45;
}

.policy-section p + p {
  margin-top: 16px;
}

.policy-section a {
  overflow-wrap: anywhere;
}

.error-card {
  margin: 0;
  padding: 20px;
  border-radius: 28px;
}

.error-code {
  font-size: 64px;
  line-height: 1.1;
  text-align: center;
}

.error-card h1 {
  margin-top: 16px;
  font-size: 28px;
  line-height: 1.45;
}

.error-card > p:not(.error-code) {
  margin-top: 16px;
  font-size: 22px;
  line-height: 1.45;
}

.error-actions {
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.error-actions .flat-button {
  width: 100%;
  min-height: 52px;
  padding: 14px;
  font-size: 17px;
  line-height: 1.45;
}

/* Cookie / согласие: не перекрывать жесты «домой» на iOS. */
.cookie-banner {
  left: max(16px, env(safe-area-inset-left, 0px));
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  width: auto;
  max-width: none;
  padding: 20px;
  border-radius: 20px;
}

.cookie-banner h2 {
  font-size: 18px;
  line-height: 1.35;
}

.cookie-banner p {
  font-size: 14px;
  line-height: 1.4;
}

.cookie-actions .flat-button {
  min-height: 48px;
  border-radius: 12px;
}

.consent-dialog {
  width: calc(100% - 32px);
  max-width: 560px;
  padding: 24px;
  margin: auto;
}

.consent-dialog h2 {
  font-size: 24px;
  line-height: 1.35;
}

.consent-dialog p {
  font-size: 16px;
  line-height: 1.45;
}

/* Крупный палец: чуть просторнее цели без смены макета. */
@media (pointer: coarse) {
  .nav-link {
    min-height: 52px;
  }

  .reader-arrow {
    width: 52px;
    height: 52px;
  }

  .faq summary {
    min-height: 48px;
  }
}

@media (min-width: 609px) {
  .home .hero {
    padding-left: max(24px, calc((100% - 560px) / 2));
    padding-right: max(24px, calc((100% - 560px) / 2));
  }
}

@media (max-width: 374px) {
  .home .hero-note {
    width: 104px;
    min-height: 79px;
    padding: 16px 20px 16px 14px;
  }

  .stats-grid > div {
    grid-template-columns: 106px minmax(0, 1fr);
    gap: 12px;
  }

  .badge {
    width: 106px;
  }
}
