:root {
  color-scheme: light;
  --ink: #253c38;
  --muted: #586a64;
  --paper: #fffcf6;
  --green: #23634e;
  --green-hover: #184b3a;
  --line: #dce3da;
  --shadow: 0 20px 60px rgb(46 64 46 / 9%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Nunito", sans-serif;
  font-size: 18px;
  line-height: 1.65;
}

a { color: inherit; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.15; }
h1, h2 { letter-spacing: -.035em; }
h1 { font-size: clamp(2.6rem, 5.2vw, 4.6rem); font-weight: 900; }
h2 { font-size: clamp(2rem, 3.4vw, 3rem); font-weight: 800; }
h3 { font-size: 1.4rem; }
p { text-wrap: pretty; }

.container { width: min(1160px, calc(100% - 48px)); margin-inline: auto; }
.section { padding-block: 80px; }

.header, .footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 28px;
}

.logo { font-size: 1.15rem; font-weight: 900; text-decoration: none; }
.logo > span { color: #a75427; margin-right: 6px; }
.header-link { font-size: 1rem; font-weight: 800; text-underline-offset: 5px; }

.hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 64px;
  align-items: center;
  padding-block: 64px 96px;
}

.eyebrow {
  color: var(--green);
  font-size: .8rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 18px;
}

.intro { margin-block: 26px; color: var(--muted); max-width: 540px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  min-height: 58px;
  padding: 16px 25px;
  border: 0;
  border-radius: 16px;
  background: var(--green);
  color: white;
  font-weight: 800;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 8px 20px rgb(35 99 78 / 16%);
  transition: background .2s, transform .2s, box-shadow .2s;
}

.button:disabled { opacity: .65; cursor: wait; }
.small-note { margin-top: 14px; color: var(--muted); font-size: .85rem; }

.story {
  position: relative;
  padding: 28px;
  border: 1px solid #e8dfcc;
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--shadow);
  transform: rotate(2deg);
}

.story-top { display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; }
.story h2 { font-size: 1.65rem; letter-spacing: -.02em; }
.story-text { margin-top: 18px; font-size: 1.5rem; line-height: 1.8; }
.story-text .preview-word { padding: 1px 6px; border: 0; border-radius: 7px; background: #fff0b9; color: #66470f; font: inherit; font-weight: 800; cursor: pointer; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 5px; }

.illustration {
  height: 180px;
  position: relative;
  display: grid;
  place-items: center;
  margin-block: 20px;
  border-radius: 18px;
  background: #f0f4e8;
  overflow: hidden;
}

.illustration::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 70px;
  bottom: -30px;
  border-radius: 50%;
  background: #d4dfbe;
}

.bun {
  position: relative;
  z-index: 1;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: #f5c35b;
  box-shadow: inset -10px -10px 0 #eeb04a, 0 12px 18px rgb(95 87 40 / 12%);
  transform: rotate(-10deg);
}

.eyes { position: absolute; top: 40px; left: 31px; width: 8px; height: 12px; border-radius: 50%; background: #594326; box-shadow: 36px 0 #594326; }
.smile { position: absolute; top: 59px; left: 42px; width: 28px; height: 17px; border-bottom: 4px solid #594326; border-radius: 50%; }
.spark { position: absolute; color: #5b7456; font-size: 35px; }
.spark-one { top: 18px; left: 18%; }
.spark-two { bottom: 26px; right: 17%; font-size: 23px; }

.words { display: flex; flex-wrap: wrap; gap: 8px 16px; list-style: none; padding: 0; margin-block: 20px; font-size: .85rem; color: var(--muted); }
.story-caption { border-top: 1px dashed var(--line); padding-top: 15px; font-size: .9rem; color: var(--muted); }

.method { background: #edf3e8; }
.method-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 70px; }
.method-copy p + p { margin-top: 18px; }
.method-note { color: var(--muted); font-size: .95rem; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 36px; }
.card { padding: 30px; background: white; border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 10px 30px rgb(46 64 46 / 4%); }
.card p { margin-top: 16px; color: var(--muted); font-size: 1rem; }
.card-icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 24px; border-radius: 17px; font-size: 1.8rem; }
.peach { background: #ffe5cf; }
.lavender { background: #ebe4fc; }
.mint { background: #e1efdb; }

.signup { padding: 52px; border-radius: 32px; background: #f8ead7; }
.signup-step { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 64px; }
.signup-intro > p:last-child { margin-top: 20px; color: var(--muted); }
.form { min-width: 0; }
.field + .field { margin-top: 18px; }
label { display: block; margin-bottom: 7px; font-size: .95rem; font-weight: 800; }
input { width: 100%; min-height: 56px; padding: 13px 16px; border: 1px solid #a3ada3; border-radius: 12px; background: #fffefa; color: var(--ink); }
input::placeholder { color: #70766e; }
.form .button { width: 100%; margin-top: 24px; }
.form-status { margin-top: 14px; font-size: .95rem; font-weight: 800; overflow-wrap: anywhere; }
.form-status:empty { margin: 0; }
.form-status[data-state="error"] { color: #a32929; }
.form-status[data-state="success"] { color: #205b43; }

/* Состояние после получения сказки */
.signup-success.is-entering { animation: signup-in .45s ease both; }
.signup-success h2:focus:not(:focus-visible) { outline: none; }
.signup-actions { min-width: 0; }
.action-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.button-secondary { background: #fffefa; color: var(--green); box-shadow: inset 0 0 0 2px var(--green); }
.more-books { display: grid; justify-items: start; gap: 14px; margin-top: 28px; padding-top: 24px; border-top: 1px dashed rgb(37 60 56 / 22%); }
.more-books p { font-weight: 700; }
.more-books .button { min-width: 160px; }

@keyframes signup-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }

:focus-visible { outline: 3px solid #8255b5; outline-offset: 5px; }
.skip-link { position: absolute; top: 8px; left: 16px; padding: 12px; background: white; z-index: 10; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

@media (hover: hover) {
  .button:not(:disabled):hover { background: var(--green-hover); transform: translateY(-2px); box-shadow: 0 12px 25px rgb(35 99 78 / 22%); }
  .button-secondary:not(:disabled):hover { background: #edf3e8; color: var(--green-hover); box-shadow: inset 0 0 0 2px var(--green-hover), 0 10px 22px rgb(35 99 78 / 12%); }
}

@media (max-width: 900px) {
  .hero { gap: 32px; }
  .method-grid { gap: 36px; }
  .cards { gap: 16px; }
  .card { padding: 22px; }
  .signup { padding: 36px; }
  .signup-step { gap: 32px; }
}

@media (max-width: 700px) {
  .container { width: calc(100% - 32px); }
  .header { flex-wrap: wrap; gap: 10px 20px; padding-block: 20px; }
  .header-link { font-size: .9rem; }
  .hero, .method-grid, .signup-step, .cards { grid-template-columns: 1fr; }
  .hero { padding-block: 36px 56px; gap: 40px; }
  .hero .button { width: 100%; }
  .story { transform: none; padding: 22px; }
  .section { padding-block: 48px; }
  .method-grid { gap: 24px; }
  .cards { gap: 18px; margin-top: 28px; }
  .signup { padding: 28px 22px; border-radius: 24px; }
  .signup-step { gap: 28px; }
  .more-books { justify-items: stretch; }
  .more-books .button { width: 100%; }
  .footer { flex-direction: column; align-items: flex-start; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .button { transition: none; }
  .signup-success.is-entering { animation: none; }
}

/* Навигация, интерактивный фрагмент и каталог */
[hidden] { display: none !important; }
.preview-token { white-space: nowrap; }
.header-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.story .words { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.story .words li { display: flex; align-items: center; gap: 8px; }
.preview-play { flex: none; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: var(--green); color: white; cursor: pointer; }
.preview-play svg { width: 14px; height: 14px; margin-left: 1px; }
.preview-play.is-playing { background: #a75427; }
.preview-status { margin-top: 12px; font-size: .85rem; color: var(--muted); }
.preview-status:empty { display: none; }
.preview-pop { position: fixed; z-index: 30; max-width: min(300px, calc(100vw - 24px)); padding: 12px 18px; border: 1px solid #e8dfcc; border-radius: 14px; background: white; color: var(--ink); line-height: 1.3; box-shadow: 0 14px 34px rgb(46 64 46 / 18%); }
.preview-pop::after { content: ""; position: absolute; left: var(--arrow-x, 50%); width: 12px; height: 12px; margin-left: -6px; background: white; border: solid #e8dfcc; transform: rotate(45deg); }
.preview-pop[data-side="top"]::after { bottom: -7px; border-width: 0 1px 1px 0; }
.preview-pop[data-side="bottom"]::after { top: -7px; border-width: 1px 0 0 1px; }
.preview-pop__word { color: var(--green); font-weight: 800; }
.preview-pop__ipa { color: var(--muted); font-size: .9rem; }
.preview-pop__ru { margin-top: 4px; font-size: 1.25rem; font-weight: 800; }
.catalog-main { padding-block: 48px 72px; min-height: 70vh; }
.catalog-main h1 { font-size: clamp(2.6rem, 5vw, 4rem); }
.catalog-intro { margin-top: 22px; max-width: 680px; color: var(--muted); }
.catalog-count { margin-top: 36px; font-size: .9rem; color: var(--muted); }
.book-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; margin-top: 16px; }
.book-card { display: flex; flex-direction: column; min-width: 0; border: 1px solid #e8dfcc; border-radius: 26px; background: white; box-shadow: var(--shadow); }
.book-cover { display: block; margin: 12px 12px 0; border-radius: 18px; overflow: hidden; }
.book-cover img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; }
.book-card__body { display: flex; flex-direction: column; flex: 1; gap: 16px; padding: 24px 28px 28px; }
.book-card h2 { font-size: 2rem; }
.book-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.book-badges span { padding: 4px 12px; border-radius: 20px; background: #edf3e8; color: var(--green); font-size: .8rem; font-weight: 800; }
.book-badges span + span { background: #f8ead7; color: var(--ink); }
.book-description { margin-bottom: 6px; color: var(--muted); font-size: 1rem; }
.book-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: auto; }
.book-actions .button { padding-inline: 14px; font-size: 1rem; }
.catalog-note { display: flex; align-items: center; gap: 22px; padding: 24px 28px; margin-top: 36px; border-radius: 22px; background: #edf3e8; font-size: 1rem; color: var(--muted); }
.catalog-note > span { color: var(--green); font-size: 2rem; }
@media (hover: hover) {
  .preview-play:hover { background: var(--green-hover); }
  .story-text .preview-word:hover { background: #ffe59b; }
}
@media (max-width: 900px) and (min-width: 701px) { .story .words { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
  .header-nav { gap: 12px 20px; }
  .story .words { grid-template-columns: 1fr; }
  .catalog-main { padding-block: 28px 48px; }
  .book-grid { grid-template-columns: 1fr; gap: 24px; }
  .book-card__body { padding: 22px; }
  .catalog-note { align-items: flex-start; padding: 22px; gap: 14px; }
}
@media (max-width: 380px) { .book-actions { grid-template-columns: 1fr; } }
