/* Сайт Ивана Кузьмича. Палитра — как в «Большой книге заготовок» (tools/cheatsheet.py). Без фреймворков. */

@font-face {
  font-family: "PT Sans";
  src: url("../fonts/pt-sans-regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "PT Sans";
  src: url("../fonts/pt-sans-bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Roboto Slab";
  src: url("../fonts/roboto-slab.woff") format("woff");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f5eedf;          /* кремовый лист книги */
  --bg-alt: #ece2cc;      /* бежевая подложка */
  --card: #fffcf5;
  --line: #e2d6bd;
  --ink: #2b2620;         /* основной текст, ≈14:1 к карточке */
  --ink-soft: #5c5246;    /* второстепенный текст, ≈7:1 к фону */
  --green: #3a5a27;       /* «хвоя»: кнопки и плашки, белый текст ≈7,9:1 */
  --green-dark: #2c4620;
  --gold: #f6e2a0;
  --brick: #963e26;
  --radius: 14px;
  --shadow: 0 2px 0 rgba(43, 38, 32, .06), 0 8px 24px rgba(43, 38, 32, .07);
  --wrap: 1080px;
  --text: 760px;
  --serif: "Roboto Slab", Georgia, "Times New Roman", serif;
  --sans: "PT Sans", "Segoe UI", Roboto, Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 19px;
  line-height: 1.6;
}
@media (min-width: 900px) { body { font-size: 20px; } }

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.2; margin: 0 0 .5em; color: var(--ink); }
h1 { font-size: clamp(2.3rem, 7vw, 3.4rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.75rem, 5vw, 2.4rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
strong { font-weight: 700; }

a { color: var(--green); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--green-dark); }
:focus-visible { outline: 3px solid var(--brick); outline-offset: 3px; border-radius: 4px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: var(--text); }

.skip {
  position: absolute; left: 12px; top: -80px; z-index: 10;
  background: var(--green); color: #fff; padding: 12px 18px; border-radius: 10px; font-weight: 700;
}
.skip:focus { top: 12px; color: #fff; }

/* ---------- шапка ---------- */
.site-head { background: var(--card); border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 24px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--serif); font-weight: 700; font-size: 1.3rem; min-height: 48px; }
.brand svg { flex: none; }
.nav { display: flex; flex-wrap: wrap; gap: 0 4px; margin: 0 -10px; }
.nav a { display: inline-flex; align-items: center; min-height: 48px; padding: 0 10px; color: var(--ink); text-decoration: none; font-size: 18px; font-weight: 700; border-radius: 8px; }
.nav a:hover { color: var(--green); text-decoration: underline; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 58px; padding: 12px 26px;
  background: var(--green); color: #fff; border: 2px solid var(--green);
  border-radius: 12px; font-family: var(--sans); font-size: 20px; font-weight: 700; line-height: 1.25;
  text-align: center; text-decoration: none; cursor: pointer; touch-action: manipulation;
  transition: background-color .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn--ghost { background: transparent; color: var(--green); }
.btn--ghost:hover { background: var(--green); color: #fff; }
.btn--wide { width: 100%; }
.btn svg { flex: none; }

/* ---------- секции ---------- */
.section { padding: 56px 0; }
.section--alt { background: var(--bg-alt); }
.section__lead { font-size: 1.1em; color: var(--ink-soft); max-width: var(--text); }
@media (min-width: 900px) { .section { padding: 80px 0; } }

/* ---------- первый экран ---------- */
.hero { padding: 28px 0 48px; }
.hero__grid { display: grid; gap: 24px; align-items: center; }
.hero__photo { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); max-height: 420px; }
.hero__photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; max-height: 420px; }
.hero__kicker { font-weight: 700; color: var(--green); text-transform: uppercase; letter-spacing: .06em; font-size: 17px; margin-bottom: .4em; }
.hero__text p { font-size: 1.12em; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.hero__actions .btn { width: 100%; }
@media (min-width: 600px) { .hero__actions .btn { width: auto; } }
@media (min-width: 900px) {
  .hero { padding: 56px 0 72px; }
  .hero__grid { grid-template-columns: 1.15fr .85fr; gap: 56px; }
  .hero__photo, .hero__photo img { max-height: 560px; }
  .hero__text { order: -1; }
}

/* ---------- кто я ---------- */
.about { display: grid; gap: 28px; align-items: start; }
.about__photo { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); max-width: 420px; }
.about__photo img { width: 100%; max-height: 380px; object-fit: cover; object-position: 50% 20%; }
@media (min-width: 900px) { .about__photo img { max-height: none; } }
.about__sign { font-family: var(--serif); font-size: 1.2em; color: var(--green); margin-top: .2em; }
@media (min-width: 900px) { .about { grid-template-columns: 360px 1fr; gap: 56px; } }

/* ---------- карточка книги ---------- */
.product {
  background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  padding: 20px; display: grid; gap: 24px;
}
.product__cover { border-radius: 10px; overflow: hidden; border: 1px solid var(--line); max-width: 440px; }
.product__label { display: inline-block; background: var(--green); color: var(--gold); font-weight: 700; font-size: 17px; letter-spacing: .05em; text-transform: uppercase; padding: 4px 12px; border-radius: 999px; margin-bottom: 12px; }
.product h3 { font-size: clamp(1.55rem, 4.5vw, 2rem); }
.product__facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.product__facts li { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 14px; font-size: 17px; font-weight: 700; }
.product__buy { border-top: 1px dashed var(--line); padding-top: 18px; margin-top: 8px; }
.price { font-family: var(--serif); font-weight: 700; font-size: 2.4rem; line-height: 1; color: var(--green); margin: 0 0 6px; font-variant-numeric: tabular-nums; }
.price small { font-family: var(--sans); font-size: 18px; color: var(--ink-soft); font-weight: 400; }
.price-note { font-size: 17px; color: var(--ink-soft); margin: 10px 0 0; }
@media (min-width: 900px) {
  .product { grid-template-columns: 400px 1fr; padding: 36px; gap: 44px; align-items: start; }
  .product__cover { position: sticky; top: 24px; }
}

.ticks { list-style: none; padding: 0; margin: 0 0 18px; }
.ticks li { position: relative; padding-left: 36px; margin-bottom: 10px; }
.ticks li::before {
  content: ""; position: absolute; left: 0; top: .32em; width: 24px; height: 24px; border-radius: 50%;
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center / 16px no-repeat;
}

/* главы книги */
.chapters { margin: 32px 0 0; padding: 22px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.chapters h3 { margin-bottom: .6em; }
.chapters ol { margin: 0; padding-left: 1.6em; columns: 1; }
.chapters li { margin-bottom: 6px; break-inside: avoid; }
.chapters li span { color: var(--ink-soft); }
@media (min-width: 760px) { .chapters ol { columns: 2; column-gap: 40px; } .chapters { padding: 28px 32px; } }

/* страницы книги */
.pages { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 24px 0 0; }
.pages a { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); }
.pages figcaption { grid-column: 1 / -1; font-size: 17px; color: var(--ink-soft); }
@media (min-width: 900px) { .pages { max-width: 760px; gap: 20px; } }

/* ---------- гайды ---------- */
.guides { display: grid; gap: 16px; margin-top: 28px; }
.guide {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; display: grid; grid-template-columns: 84px 1fr; gap: 14px 14px; align-content: start;
}
.guide img { border-radius: 8px; border: 1px solid var(--line); width: 84px; }
.guide h3 { font-size: 1.15rem; margin-bottom: .3em; }
.guide p { font-size: 17px; margin: 0 0 6px; color: var(--ink-soft); }
.guide__meta { font-size: 17px; color: var(--ink-soft); }
.guide__buy { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px dashed var(--line); padding-top: 12px; }
.guide__price { font-family: var(--serif); font-weight: 700; font-size: 1.7rem; color: var(--green); white-space: nowrap; font-variant-numeric: tabular-nums; }
.guide .btn { min-height: 54px; padding: 10px 20px; font-size: 19px; }
@media (min-width: 760px) { .guides { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1040px) {
  .guides { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .guide { display: flex; flex-direction: column; padding: 20px; }
  .guide img { width: 100%; }
  .guide__buy { margin-top: auto; }
}

.bundle {
  margin-top: 24px; background: var(--green); color: #fff; border-radius: 18px; padding: 24px 20px;
  display: grid; gap: 16px; align-items: center;
}
.bundle h3 { color: #fff; font-size: clamp(1.45rem, 4vw, 1.8rem); }
.bundle p { margin: 0 0 8px; }
.bundle .price { color: var(--gold); }
.bundle .price-note { color: #f0e9d8; }
.bundle .btn { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.bundle .btn:hover { background: #fff; border-color: #fff; color: var(--ink); }
@media (min-width: 900px) { .bundle { grid-template-columns: 1fr auto; padding: 32px 36px; gap: 40px; } }

/* ---------- как купить ---------- */
.steps { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 16px; counter-reset: step; }
.steps li {
  counter-increment: step; position: relative; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 20px 20px 84px; min-height: 96px;
}
.steps li::before {
  content: counter(step); position: absolute; left: 20px; top: 20px; width: 48px; height: 48px; border-radius: 50%;
  background: var(--green); color: #fff; font-family: var(--serif); font-weight: 700; font-size: 1.5rem;
  display: flex; align-items: center; justify-content: center;
}
.steps h3 { font-size: 1.2rem; margin-bottom: .3em; }
.steps p { margin: 0; }
.steps p + p { margin-top: .5em; }
@media (min-width: 900px) {
  .steps { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .steps li { padding: 88px 24px 24px; }
  .steps li::before { left: 24px; top: 24px; }
}

.paynote { display: flex; gap: 12px; align-items: flex-start; margin: 24px 0 0; padding: 16px 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); max-width: var(--text); }
.paynote svg { flex: none; margin-top: 3px; }

/* ---------- вопросы ---------- */
.faq { margin-top: 24px; max-width: var(--text); }
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; }
.faq summary {
  list-style: none; cursor: pointer; min-height: 60px; padding: 16px 56px 16px 20px; position: relative;
  font-weight: 700; font-size: 1.05em; line-height: 1.4;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 50%; background: var(--bg); border: 1px solid var(--line);
  color: var(--green); font-size: 24px; line-height: 29px; text-align: center; font-weight: 700;
}
.faq details[open] summary::after { content: "−"; }
.faq summary:hover { color: var(--green); }
.faq .answer { padding: 0 20px 16px; }
.faq .answer p:last-child { margin-bottom: 0; }

/* ---------- подвал ---------- */
.site-foot { background: var(--green-dark); color: #f0e9d8; padding: 40px 0 48px; font-size: 17px; line-height: 1.6; }
.site-foot a { color: var(--gold); }
.site-foot a:hover { color: #fff; }
.site-foot .brand { color: #fff; margin-bottom: 8px; }
.foot-grid { display: grid; gap: 22px; }
.foot-grid p { margin: 0 0 6px; }
.foot-links { list-style: none; margin: 0; padding: 0; }
.foot-links li { margin-bottom: 4px; }
.foot-links a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
.foot-pay { border-top: 1px solid rgba(240, 233, 216, .25); margin-top: 24px; padding-top: 18px; }
@media (min-width: 900px) { .foot-grid { grid-template-columns: 1.2fr 1fr 1fr; gap: 40px; } }

/* ---------- юридические страницы ---------- */
.doc { padding: 36px 0 64px; }
.doc h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); }
.doc h2 { font-size: 1.45rem; margin-top: 1.6em; }
.doc .doc-meta { color: var(--ink-soft); }
.doc ol, .doc ul { padding-left: 1.4em; margin: 0 0 1em; }
.doc li { margin-bottom: .4em; }
.doc .back { display: inline-flex; align-items: center; min-height: 48px; font-weight: 700; margin-bottom: 8px; }
.doc .card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 1em; }
.table-wrap { overflow-x: auto; margin: 0 0 1em; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 18px; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px; border-bottom: 1px solid var(--line); }
th { background: var(--green); color: #fff; font-weight: 700; }
tr:last-child td { border-bottom: 0; }
td.num { white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; }
.toc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin: 0 0 1.5em; }
.toc ol { margin: 0; }
.toc a { display: inline-block; padding: 4px 0; vertical-align: top; }

/* ---------- магазин: покупка, «Спасибо», скачивание (страницы отдаёт бэкенд shop/) ---------- */
.shop { padding: 32px 0 64px; }
.shop h1 { font-size: clamp(1.9rem, 6vw, 2.5rem); }
.doc .back, .shop .back { display: inline-flex; align-items: center; min-height: 48px; font-weight: 700; margin-bottom: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.order-card {
  display: grid; grid-template-columns: 96px 1fr; gap: 16px; align-items: start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin: 8px 0 24px;
}
.order-card img { width: 96px; border-radius: 8px; border: 1px solid var(--line); }
.order-card .product__label { font-size: 14px; letter-spacing: .03em; padding: 3px 10px; margin-bottom: 8px; }
.order-card__title { font-size: 1.25rem; margin-bottom: .3em; }
.order-card__meta { font-size: 17px; color: var(--ink-soft); margin: 0 0 8px; }
.order-card .price { font-size: 2rem; margin: 0; }
.order-card > div:only-child { grid-column: 1 / -1; }
@media (min-width: 600px) { .order-card { grid-template-columns: 120px 1fr; padding: 20px; gap: 22px; } .order-card img { width: 120px; } }

.form-errors { background: #fbeae4; border: 2px solid var(--brick); border-radius: var(--radius); padding: 14px 18px; margin: 0 0 20px; }
.form-errors p { margin: 0 0 6px; }
.form-errors ul { margin: 0; padding-left: 1.2em; }
.form-errors a { color: #7a2f1b; }

.buy-form { margin: 0 0 8px; }
.field { margin: 0 0 22px; }
.field > label { display: block; font-weight: 700; font-size: 1.05em; margin-bottom: 4px; }
.field__hint { font-size: 17px; color: var(--ink-soft); margin: 0 0 8px; }
.field input[type=email], .field input[type=text] {
  display: block; width: 100%; min-height: 58px; padding: 12px 16px;
  font: inherit; font-size: 20px; color: var(--ink); background: #fff;
  border: 2px solid #b9ab8f; border-radius: 12px;
}
.field input::placeholder { color: #8a7f70; }
.field input:focus { outline: 3px solid var(--brick); outline-offset: 2px; border-color: var(--green); }
.field--error input[type=email] { border-color: var(--brick); background: #fffaf8; }
.field__error { color: #7a2f1b; font-weight: 700; font-size: 17px; margin: 8px 0 0; }
.field > label.check { display: flex; gap: 14px; align-items: flex-start; cursor: pointer; font-size: 18px; font-weight: 400; line-height: 1.5; padding: 4px 0; margin: 0; }
.check input { flex: none; width: 28px; height: 28px; margin: 2px 0 0; accent-color: var(--green); cursor: pointer; }
.field--error .check input { outline: 3px solid var(--brick); outline-offset: 2px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.btn--busy { opacity: .7; cursor: progress; }
.buy-notes { list-style: none; padding: 0; margin: 20px 0 0; font-size: 17px; color: var(--ink-soft); }
.buy-notes li { position: relative; padding-left: 22px; margin-bottom: 8px; }
.buy-notes li::before { content: ""; position: absolute; left: 4px; top: .65em; width: 8px; height: 8px; border-radius: 50%; background: var(--green); }

.status { display: flex; gap: 16px; align-items: flex-start; margin: 0 0 20px; }
.status svg, .status .spinner { flex: none; margin-top: 4px; }
.status h1 { margin-bottom: .2em; }
.status p { margin: 0; color: var(--ink-soft); }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 5px solid var(--line); border-top-color: var(--green); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; border-top-color: var(--line); border-left-color: var(--green); } }

.h-sub { font-size: 1.35rem; margin: 8px 0 12px; }
.dl { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 12px; }
.dl__item {
  display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; justify-content: space-between;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
.dl__name { flex: 1 1 220px; }
.dl__name b { display: block; line-height: 1.35; }
.dl__name span { font-size: 17px; color: var(--ink-soft); }
.dl__item .btn { min-height: 54px; padding: 10px 22px; flex: 0 0 auto; }
@media (max-width: 480px) { .dl__item .btn { width: 100%; } }
.dl__dead { font-size: 17px; color: #7a2f1b; }

.notice { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--green); border-radius: 12px; padding: 14px 18px; margin: 0 0 20px; }
.notice p { margin: 0 0 8px; }
.notice p:last-child { margin-bottom: 0; }
.howto { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 20px; }
.howto summary { cursor: pointer; min-height: 56px; padding: 14px 18px; font-weight: 700; }
.howto .answer { padding: 0 18px 14px; }
.howto .answer p:last-child { margin-bottom: 0; }
.btn:disabled, .btn[aria-disabled="true"]:disabled { background: #8a9a80; border-color: #8a9a80; color: #fff; cursor: not-allowed; }
