/* Посадочная /kniga-pro-rebenka: заголовок и форма сборки книги. Всё остальное —
   блоки главной. Цвета из токенов, светлая тема переопределяет их ниже. */

.page-child-book .hero h1 .book-line {
  display: block;
  white-space: nowrap;
}

.page-child-book .book-short {
  display: none;
}

@media (min-width: 781px) {
  .page-child-book .hero h1 {
    font-size: clamp(40px, 4.9vw, 66px);
    max-width: 980px;
  }
}

@media (max-width: 780px) {
  .page-child-book .book-long {
    display: none;
  }

  .page-child-book .book-short {
    display: inline;
  }
}

.book-builder {
  margin: 72px auto 0;
  scroll-margin-top: 90px;
  width: min(100% - 48px, 1120px);
}

.book-builder-heading {
  margin-bottom: 24px;
}

.book-builder-heading p:not(.eyebrow) {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  margin: 8px 0 0;
}

.book-form {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: grid;
  gap: 28px;
  padding: 28px;
}

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

.book-field {
  display: grid;
  gap: 6px;
  margin: 0;
  min-width: 0;
}

.book-field--name,
.book-field--wide {
  grid-column: span 2;
}

.book-field--full {
  grid-column: 1 / -1;
}

.book-label,
.book-legend {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.book-optional {
  color: var(--muted);
  font-weight: 400;
}

.book-input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  min-height: 44px;
  padding: 10px 12px;
  width: 100%;
}

.book-input::placeholder {
  color: var(--soft);
}

.book-input:focus-visible,
.book-segment input:focus-visible + span,
.book-theme input:focus-visible + .book-theme-card {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Подсказка, а не сбой: как в окне входа, без красного. */
.book-error {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  margin: 0;
}

.book-segments {
  display: flex;
  gap: 8px;
}

.book-segment {
  flex: 1;
  min-width: 0;
  position: relative;
}

.book-segment input,
.book-theme input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.book-segment span {
  align-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  font-size: 15px;
  justify-content: center;
  min-height: 44px;
  padding: 8px 10px;
}

.book-segment input:checked + span {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.book-themes {
  border: 0;
  margin: 0;
  min-width: 0;
  padding: 0;
}

.book-legend {
  margin-bottom: 12px;
  padding: 0;
}

.book-theme-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.book-theme {
  display: block;
  position: relative;
}

.book-theme-card {
  border: 2px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  display: grid;
  gap: 8px;
  height: 100%;
  overflow: hidden;
  padding-bottom: 10px;
}

.book-theme-card img {
  aspect-ratio: 3 / 4;
  display: block;
  height: auto;
  object-fit: cover;
  width: 100%;
}

.book-theme-card strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.3;
  padding: 0 10px;
}

.book-theme input:checked + .book-theme-card {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}

.book-submit-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  justify-content: space-between;
}

.book-summary {
  margin: 0;
  min-width: 0;
}

.book-summary strong {
  color: var(--ink);
  display: block;
  font-size: 17px;
  line-height: 1.3;
}

.book-summary span {
  color: var(--muted);
  display: block;
  font-size: 14px;
  line-height: 1.5;
  margin-top: 4px;
}

.book-submit {
  border: 0;
  cursor: pointer;
  font: inherit;
}

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

.book-steps li {
  color: var(--muted);
  counter-increment: book-step;
  font-size: 15px;
  line-height: 1.55;
  padding-left: 40px;
  position: relative;
}

.book-steps li::before {
  align-items: center;
  background: var(--blue);
  border-radius: 50%;
  color: #fff;
  content: counter(book-step);
  display: flex;
  font-size: 14px;
  font-weight: 700;
  height: 28px;
  justify-content: center;
  left: 0;
  position: absolute;
  top: 0;
  width: 28px;
}

.book-steps strong {
  color: var(--ink);
  display: block;
}

.book-cost {
  margin: 72px auto 0;
  width: min(100% - 48px, 1120px);
}

.book-cost h2 {
  margin: 0 0 8px;
}

.book-cost > p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  margin: 0 0 16px;
}

.book-cost-table-wrap {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow-x: auto;
}

.book-cost-table {
  border-collapse: collapse;
  font-size: 15px;
  width: 100%;
}

.book-cost-table th,
.book-cost-table td {
  border-top: 1px solid var(--line);
  color: var(--ink);
  padding: 12px 16px;
  text-align: left;
}

.book-cost-table thead th {
  border-top: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.book-cost-table tbody td:nth-child(n + 2) {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 980px) {
  .book-theme-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 780px) {
  .book-builder,
  .book-cost {
    margin-top: 54px;
    width: calc(100% - 24px);
  }

  .book-form {
    border-radius: 12px;
    gap: 22px;
    padding: 16px;
  }

  .book-fields {
    gap: 14px;
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
  }

  .book-segment span {
    padding: 8px 6px;
    text-align: center;
  }

  .book-field--name,
  .book-field--wide {
    grid-column: 1 / -1;
  }

  .book-input {
    font-size: 16px;
  }

  .book-theme-grid {
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .book-submit-row {
    align-items: stretch;
    flex-direction: column;
  }

  .book-submit {
    justify-content: center;
    width: 100%;
  }

  .book-steps {
    gap: 12px;
    grid-template-columns: minmax(0, 1fr);
  }

  .book-cost-table {
    font-size: 13px;
  }

  .book-cost-table th,
  .book-cost-table td {
    padding: 10px 12px;
  }
}

html[data-theme="light"] body.page-home .book-form {
  background: var(--sheet);
  border-color: var(--line);
  box-shadow: 0 1px 2px rgba(48, 38, 28, 0.06);
}

html[data-theme="light"] body.page-home .book-input {
  background: #fff;
  border-color: var(--line);
}

html[data-theme="light"] body.page-home .book-segment span {
  border-color: var(--line);
  color: var(--pencil);
}

html[data-theme="light"] body.page-home .book-segment input:checked + span {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: #fff;
}

html[data-theme="light"] body.page-home .book-theme-card {
  background: var(--sheet);
  border-color: var(--line);
}

html[data-theme="light"] body.page-home .book-theme input:checked + .book-theme-card {
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 1px var(--brand-blue);
}

html[data-theme="light"] body.page-home :is(.book-label, .book-legend, .book-theme-card strong, .book-summary strong, .book-steps strong, .book-cost-table td) {
  color: var(--ink);
}

html[data-theme="light"] body.page-home :is(.book-builder-heading p:not(.eyebrow), .book-summary span, .book-steps li, .book-cost > p, .book-cost-table thead th, .book-optional) {
  color: var(--pencil);
}

html[data-theme="light"] body.page-home :is(.book-cost-table th, .book-cost-table td) {
  border-top-color: var(--line);
}

html[data-theme="light"] body.page-home .book-cost-table-wrap {
  background: var(--sheet);
  border-color: var(--line);
}

html[data-theme="light"] body.page-home .book-steps li::before {
  background: var(--brand-blue);
}

html[data-theme="light"] body.page-home .book-error {
  color: var(--ink);
}
