/* Разберёмся — сайт.
   Идея: страница — это тетрадь в клетку. Шаг клетки 24px, и весь текст стоит на этой сетке
   (межстрочные интервалы кратны 24px). Синяя ручка — действия, красная ручка учителя — проверка. */

@font-face {
  font-family: "Golos Text";
  src: url("fonts/golos-text.woff") format("woff");
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: "Caveat";
  src: url("fonts/caveat.woff") format("woff");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #FBFCFE;
  --grid: #D5E3F3;
  --grid-strong: #BCD2EA;
  --field-line: #6F89AE;   /* рамки полей формы: контраст ≥ 3:1 */
  --ink: #2340B0;          /* синяя шариковая ручка */
  --ink-deep: #1A2F86;
  --red: #D7262E;          /* красная ручка учителя */
  --margin-line: #E9878B;  /* поля тетради */
  --graphite: #23272E;
  --pencil: #5B6270;       /* второстепенный текст */
  --tape: rgba(250, 236, 170, .78);
  --cell: 24px;
  --gutter: 16px;
  --margin-x: 64px;        /* где проходит красная линия полей */
  --max: 1120px;
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --text: "Golos Text", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--text);
  font-size: 17px;
  line-height: var(--cell);
  color: var(--graphite);
  background-color: var(--paper);
  background-image:
    linear-gradient(to right, transparent calc(var(--margin-x) - 2px), var(--margin-line) calc(var(--margin-x) - 2px),
                    var(--margin-line) var(--margin-x), transparent var(--margin-x)),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 100% 100%, var(--cell) var(--cell), var(--cell) var(--cell);
  background-attachment: local;
  font-feature-settings: "kern", "liga";
  text-rendering: optimizeLegibility;
}

a { color: var(--ink); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink-deep); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

.wrap {
  max-width: calc(var(--max) + var(--margin-x));
  margin: 0 auto;
  padding: 0 var(--gutter) 0 calc(var(--margin-x) + 24px);
}

/* ---------- шапка ---------- */
.top {
  height: calc(var(--cell) * 4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 21px; letter-spacing: -.01em;
  color: var(--graphite); text-decoration: none;
}
.brand svg { width: 30px; height: 30px; flex: none; }
.nav { display: flex; gap: 24px; font-size: 16px; }
.nav a { color: var(--graphite); text-decoration: none; padding: 10px 0; }
.nav a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- первый экран ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: calc(var(--cell) * 2);
  align-items: start;
  padding: var(--cell) 0 calc(var(--cell) * 2);
}
.hero h1 {
  font-size: clamp(40px, 4.6vw, 60px);
  line-height: 1.12;
  font-weight: 780;
  letter-spacing: -.025em;
  margin: 0 0 var(--cell);
  text-wrap: balance;
}
.lead { font-size: 20px; line-height: 30px; margin: 0 0 calc(var(--cell) * 1.5); max-width: 33em; color: var(--graphite); }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: var(--cell); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  font: 600 17px/1 var(--text);
  border-radius: 10px;
  border: 2px solid var(--ink);
  text-decoration: none; cursor: pointer;
  transition: background-color .15s, color .15s, transform .1s;
}
.btn:active { transform: translateY(1px); }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: var(--ink-deep); border-color: var(--ink-deep); color: #fff; }
.btn-line { background: var(--paper); color: var(--ink); }
.btn-line:hover { background: #EEF3FC; color: var(--ink-deep); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn[aria-disabled="true"], .btn:disabled { opacity: .55; cursor: not-allowed; }
.note { font-size: 15px; color: var(--pencil); margin: 0; }

/* тетрадный лист с заданием */
.sheet { position: relative; padding-top: var(--cell); }
.task {
  position: relative;
  background: #fff;
  padding: 18px 22px 20px;
  margin: 0 12px calc(var(--cell) * 1.5) 0;
  box-shadow: 0 1px 0 rgba(35, 39, 46, .06), 0 8px 18px -10px rgba(35, 39, 46, .25);
  transform: rotate(-1.4deg);
  font-family: "Times New Roman", "PT Serif", Georgia, serif;
  font-size: 18px; line-height: 28px; color: #222;
}
.task::before, .task::after {
  content: ""; position: absolute; top: -12px; width: 74px; height: 24px; background: var(--tape);
}
.task::before { left: 26px; transform: rotate(-4deg); }
.task::after { right: 30px; transform: rotate(5deg); }
.task b { font-weight: 700; }
.task .sys { display: inline-grid; grid-template-columns: auto auto; column-gap: 8px; margin: 8px 0 4px 24px; }
.task .brace { grid-row: span 2; font-size: 46px; line-height: 52px; font-weight: 200; transform: scaleY(1.05); }

.hand {
  font-family: var(--hand);
  color: var(--ink);
  font-size: 27px;
  line-height: var(--cell);
  margin: 0;
  padding: 0 0 0 4px;
  list-style: none;
}
.hand li { height: calc(var(--cell) * 1.5); display: flex; align-items: center; white-space: nowrap; }
.hand .ans { font-weight: 700; }
.hand .ans u { text-decoration-thickness: 2px; text-underline-offset: 5px; }
.solution { position: relative; }
.grade-mark {
  position: absolute; right: 4%; bottom: 4px;
  width: 112px; height: 112px;
  color: var(--red);
}
.grade-mark svg { width: 100%; height: 100%; overflow: visible; }
.sheet figcaption { margin-top: calc(var(--cell) * 1.5); font-size: 15px; color: var(--pencil); max-width: 30em; }

/* единственная анимация: решение «пишется» по строкам, учитель ставит отметку */
@media (prefers-reduced-motion: no-preference) {
  .js .hand li { clip-path: inset(0 100% 0 0); animation: write .7s steps(18, end) forwards; }
  .js .hand li:nth-child(1) { animation-delay: .5s; }
  .js .hand li:nth-child(2) { animation-delay: 1.3s; }
  .js .hand li:nth-child(3) { animation-delay: 2.1s; }
  .js .hand li:nth-child(4) { animation-delay: 2.9s; }
  .js .hand li:nth-child(5) { animation-delay: 3.7s; }
  .js .grade-mark path { stroke-dasharray: 400; stroke-dashoffset: 400; animation: draw .55s ease-out forwards; }
  .js .grade-mark path.tick { animation-delay: 4.6s; }
  .js .grade-mark path.five { animation-delay: 5.1s; animation-duration: .8s; }
}
@keyframes write { to { clip-path: inset(0 0 0 0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- разделы ---------- */
section { padding: calc(var(--cell) * 3) 0; scroll-margin-top: var(--cell); }
h2 {
  font-size: clamp(30px, 3.6vw, 42px);
  line-height: calc(var(--cell) * 2);
  font-weight: 750;
  letter-spacing: -.02em;
  margin: 0 0 var(--cell);
  text-wrap: balance;
}
.section-lead { max-width: 38em; margin: 0 0 calc(var(--cell) * 2); font-size: 18px; }

/* шаги — настоящая последовательность, поэтому с номерами */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: calc(var(--cell) * 2); }
.steps li { position: relative; padding-left: 52px; }
.steps .n {
  position: absolute; left: 0; top: -6px;
  font-family: var(--hand); font-weight: 700; font-size: 46px; line-height: 48px; color: var(--red);
}
.steps h3 { font-size: 20px; line-height: var(--cell); margin: 0 0 12px; font-weight: 700; }
.steps p { margin: 0; color: var(--graphite); }

/* режимы — страница дневника */
.diary {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, .72);
  border: 2px solid var(--graphite);
  font-size: 16px;
}
.diary caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.diary th, .diary td { text-align: left; vertical-align: top; padding: 12px 16px; border-bottom: 1px solid var(--grid-strong); line-height: var(--cell); }
.diary thead th { font-weight: 600; font-size: 15px; color: var(--pencil); border-bottom: 2px solid var(--graphite); }
.diary tbody th { font-weight: 700; width: 24%; border-right: 1px solid var(--margin-line); }
.diary td.ex { font-family: var(--hand); font-size: 23px; color: var(--ink); width: 34%; }
.diary tr:last-child th, .diary tr:last-child td { border-bottom: 0; }

/* родителям — замечание красной ручкой на полях */
.parents { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: calc(var(--cell) * 2); }
.remark {
  font-family: var(--hand); color: var(--red); font-size: 30px; line-height: 32px;
  margin: 0; padding-top: 6px; transform: rotate(-2deg); max-width: 13em;
}
.facts { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--cell); }
.facts li { padding-left: 34px; position: relative; }
.facts li::before {
  content: ""; position: absolute; left: 2px; top: 4px; width: 18px; height: 12px;
  border-left: 3px solid var(--red); border-bottom: 3px solid var(--red);
  transform: rotate(-48deg); border-radius: 1px;
}
.facts b { font-weight: 700; }

/* тарифы */
.prices { border-top: 2px solid var(--graphite); max-width: 760px; }
.price-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: baseline;
  padding: 18px 0 17px; border-bottom: 1px solid var(--grid-strong);
}
.price-row .name { font-size: 20px; font-weight: 700; }
.price-row .sum { font-size: 26px; font-weight: 750; letter-spacing: -.01em; white-space: nowrap; }
.price-row .desc { grid-column: 1 / -1; color: var(--pencil); font-size: 16px; margin-top: -6px; }
.price-row.best .sum { color: var(--ink); }
.price-row .hint { font-family: var(--hand); color: var(--red); font-size: 24px; font-weight: 600; margin-left: 10px; white-space: nowrap; }

/* оплата */
.pay { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: calc(var(--cell) * 2); align-items: start; }
.form {
  background: #fff;
  border: 2px solid var(--graphite);
  border-radius: 14px;
  padding: calc(var(--cell) * 1.25);
  box-shadow: 6px 6px 0 var(--grid-strong);
}
.account {
  margin: 0 0 var(--cell); padding: 12px 16px; border-radius: 10px;
  background: #EEF3FC; border: 1px solid #C9D7F4; color: var(--ink-deep); font-size: 16px;
}
fieldset { border: 0; margin: 0 0 var(--cell); padding: 0; }
legend { font-weight: 700; margin-bottom: 12px; padding: 0; }
.plan {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 2px solid var(--field-line); border-radius: 10px;
  margin-bottom: 8px; cursor: pointer; background: var(--paper);
}
.plan:has(input:checked) { border-color: var(--ink); background: #F3F6FD; }
.plan input { width: 20px; height: 20px; accent-color: var(--ink); margin: 0; flex: none; }
.plan .t { flex: 1; font-weight: 600; }
.plan .s { font-weight: 700; white-space: nowrap; }
.plan .m { display: block; font-weight: 400; color: var(--pencil); font-size: 14px; line-height: 18px; }
label.field { display: block; font-weight: 700; margin-bottom: 8px; }
input[type=email] {
  width: 100%; height: 48px; padding: 0 14px;
  font: 17px var(--text); color: var(--graphite);
  border: 2px solid var(--field-line); border-radius: 10px; background: var(--paper);
}
input[aria-invalid="true"] { border-color: var(--red); }
input[type=email]:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px rgba(35, 64, 176, .2); }
.field-note { font-size: 14px; color: var(--pencil); margin: 6px 0 var(--cell); line-height: 20px; }
.agree { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 22px; margin-bottom: var(--cell); }
.agree input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--ink); flex: none; }
.form .btn { width: 100%; }
.error { color: var(--red); font-weight: 600; margin: 12px 0 0; font-size: 15px; line-height: 22px; }
.error:empty { display: none; }
.pay-notes { margin: 0; padding: 0; list-style: none; display: grid; gap: calc(var(--cell) * 1); }
.pay-notes b { display: block; }

/* вопросы */
.faq { max-width: 780px; border-top: 2px solid var(--graphite); }
.faq details { border-bottom: 1px solid var(--grid-strong); }
.faq summary {
  cursor: pointer; list-style: none; padding: 16px 40px 16px 0; font-weight: 700; font-size: 18px; position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 6px; top: 12px;
  font-family: var(--hand); font-size: 34px; color: var(--ink); line-height: 32px;
}
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 18px; max-width: 40em; }

/* подвал */
.foot {
  margin-top: calc(var(--cell) * 2);
  padding: calc(var(--cell) * 2) 0 calc(var(--cell) * 3);
  border-top: 2px solid var(--graphite);
  font-size: 15px; color: var(--pencil);
  display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--cell);
}
.foot p { margin: 0 0 6px; }
.foot nav { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* страница после оплаты и документы */
.narrow { max-width: 720px; padding-top: var(--cell); padding-bottom: calc(var(--cell) * 4); }
.status { font-size: 19px; line-height: 30px; }
.code-box {
  display: inline-block; margin: var(--cell) 0;
  padding: 10px 24px 6px;
  border: 3px solid var(--red); border-radius: 12px;
  font-family: var(--hand); font-weight: 700; font-size: 58px; line-height: 64px; letter-spacing: .06em;
  color: var(--red); background: #fff; transform: rotate(-1.5deg);
}
.copy-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: var(--cell); }
.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid var(--grid-strong); border-top-color: var(--ink); border-radius: 50%; vertical-align: -3px; margin-right: 10px; }
@media (prefers-reduced-motion: no-preference) { .spinner { animation: spin .9s linear infinite; } }
@keyframes spin { to { transform: rotate(360deg); } }

.doc h1 { font-size: 34px; line-height: 48px; letter-spacing: -.02em; margin: 0 0 var(--cell); }
.doc h2 { font-size: 22px; line-height: var(--cell); margin: calc(var(--cell) * 1.5) 0 12px; }
.doc p, .doc li { max-width: 44em; }
.doc .draft { border: 2px dashed var(--red); border-radius: 10px; padding: 12px 16px; color: var(--red); background: #fff; }

/* сравнение с обычной нейросетью: наша колонка — с красной «галочкой учителя» */
.versus { width: 100%; border-collapse: collapse; background: rgba(255, 255, 255, .72); border: 2px solid var(--graphite); font-size: 16px; }
.versus caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.versus th, .versus td { text-align: left; vertical-align: top; padding: 12px 16px; border-bottom: 1px solid var(--grid-strong); line-height: var(--cell); }
.versus thead th { font-weight: 600; font-size: 15px; color: var(--pencil); border-bottom: 2px solid var(--graphite); }
.versus thead th.ours { color: var(--ink); font-weight: 700; }
.versus tbody th { font-weight: 700; width: 22%; border-right: 1px solid var(--margin-line); }
.versus td { width: 39%; color: var(--pencil); }
.versus td.ours { color: var(--graphite); background: #F3F6FD; position: relative; padding-left: 44px; }
.versus td.ours::before {
  content: ""; position: absolute; left: 16px; top: 17px; width: 14px; height: 8px;
  border-left: 3px solid var(--red); border-bottom: 3px solid var(--red); transform: rotate(-48deg);
}
.versus tr:last-child th, .versus tr:last-child td { border-bottom: 0; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media (max-width: 640px) {
  .versus, .versus tbody, .versus tr, .versus th, .versus td { display: block; width: auto !important; }
  .versus thead { display: none; }
  .versus tr { border-bottom: 1px solid var(--grid-strong); padding: 10px 14px 12px; }
  .versus tr:last-child { border-bottom: 0; }
  .versus th, .versus td { border: 0 !important; padding: 2px 0; }
  .versus td:not(.ours)::before { content: "В обычном чате: "; font-weight: 600; }
  .versus td.ours { margin-top: 6px; padding: 6px 10px 6px 34px; border-radius: 8px; }
  .versus td.ours::before { left: 10px; top: 12px; }
}

/* ---------- узкие экраны ---------- */
@media (max-width: 900px) {
  :root { --margin-x: 28px; }
  .wrap { padding-left: calc(var(--margin-x) + 16px); }
  .hero, .parents, .pay, .foot { grid-template-columns: 1fr; }
  .hero { gap: var(--cell); padding-bottom: calc(var(--cell) * 2); }
  .steps { grid-template-columns: 1fr; gap: calc(var(--cell) * 1.5); }
  .nav { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .hero h1 { font-size: 38px; line-height: 48px; }
  .lead { font-size: 18px; line-height: 28px; }
  .hand { font-size: 23px; }
  .grade-mark { width: 88px; height: 88px; }
  .diary, .diary tbody, .diary tr, .diary th, .diary td { display: block; width: auto !important; }
  .diary thead { display: none; }
  .diary tr { border-bottom: 1px solid var(--grid-strong); padding: 10px 14px; }
  .diary tr:last-child { border-bottom: 0; }
  .diary th, .diary td { border: 0 !important; padding: 2px 0; }
  .code-box { font-size: 44px; line-height: 52px; }
  section { padding: calc(var(--cell) * 2) 0; }
  .btn { width: 100%; }
}
