/* Сайт «Тандем DA». v3 — «тушь и бумага», два учителя. */
/* Светлая бежевая тема (по умолчанию) */
:root {
  color-scheme: light;
  --paper: #f5ecdc;
  --paper-2: #ecdfc7;
  --ink: #2a2119;
  --muted: #6e604f;
  --rule: #d8c6a6;
  --seal: #b8371f;          /* киноварь, цвет печати */
  --seal-ink: #ffffff;
  --grid: #e2a48f;          /* красная сетка прописей */
  --max: 1120px;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Golos Text", "Segoe UI", Roboto, Arial, sans-serif;
  --cjk: "Noto Serif SC", "Noto Serif TC", "Songti SC", "SimSun", serif;
}
/* Тёмная тема: выбрана вручную или системная (если вручную не выбрана светлая) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #15130f; --paper-2: #1d1a15; --ink: #efe8dc; --muted: #a59c8d;
  --rule: #3a342b; --seal: #e0583d; --grid: #6e3a2f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --paper: #15130f; --paper-2: #1d1a15; --ink: #efe8dc; --muted: #a59c8d;
    --rule: #3a342b; --seal: #e0583d; --grid: #6e3a2f;
  }
}

/* Переключатель темы */
.theme-toggle {
  display: none; width: 40px; height: 40px; place-items: center; flex: none; cursor: pointer;
  background: transparent; color: var(--muted); border: 0; border-radius: 50%; padding: 0;
}
.js .theme-toggle { display: inline-grid; }
.theme-toggle:hover { color: var(--ink); background: var(--paper-2); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
/* Иконка показывает, какая тема будет следующей: бежевая → серая → тёмная → бежевая */
.theme-toggle svg { display: none; }
.theme-toggle .i-gray { display: block; }
:root[data-theme="gray"] .theme-toggle .i-gray { display: none; }
:root[data-theme="gray"] .theme-toggle .i-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .i-gray { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .theme-toggle .i-gray { display: none; }
  :root:not([data-theme]) .theme-toggle .i-sun { display: block; }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.65 var(--sans); }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3 { margin: 0 0 .5em; font-weight: 700; }
h1, h2 { font-family: var(--serif); line-height: 1.08; letter-spacing: -.015em; }
h1 { font-size: clamp(2.5rem, 6.2vw, 4.6rem); }
h2 { font-size: clamp(1.9rem, 3.8vw, 2.9rem); }
h3 { font-size: 1.1rem; line-height: 1.3; font-weight: 600; }
p { margin: 0 0 1em; }
[lang|="zh"], .cjk { font-family: var(--cjk); font-weight: 600; }
::selection { background: var(--seal); color: var(--seal-ink); }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.section { padding: 96px 0; border-top: 1px solid var(--rule); }
.section--tint { background: var(--paper-2); }
.muted { color: var(--muted); }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 44ch; }

/* Заголовок секции: номер слева, текст справа */
.sec-head { display: grid; grid-template-columns: 200px 1fr; gap: 24px; margin-bottom: 56px; }
.sec-num {
  font-size: .78rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--seal); padding-top: .9em;
}
.sec-num b { font-family: var(--serif); font-size: 1rem; letter-spacing: 0; margin-right: 8px; }
.sec-head h2 { max-width: 18ch; }
.sec-head p { color: var(--muted); max-width: 56ch; margin: 0; }
.body-col { margin-left: 224px; }
@media (max-width: 860px) {
  .section { padding: 64px 0; }
  .sec-head { grid-template-columns: 1fr; gap: 6px; margin-bottom: 36px; }
  .sec-num { padding-top: 0; }
  .body-col { margin-left: 0; }
}

/* Печать-логотип */
.seal {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  background: var(--seal); color: var(--seal-ink); border-radius: 3px;
  font: 600 20px/1 var(--cjk);
}

/* Шапка */
.header {
  position: sticky; top: 0; z-index: 10; background: var(--paper);
  border-bottom: 1px solid var(--rule); transition: box-shadow .2s ease, background-color .2s ease;
}
.header .wrap { display: flex; align-items: center; gap: 20px; height: 68px; transition: height .2s ease; }
/* При прокрутке шапка становится ниже, полупрозрачной и с лёгкой тенью */
.header.is-scrolled { background: color-mix(in srgb, var(--paper) 88%, transparent); box-shadow: 0 2px 14px rgb(0 0 0 / .07);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.header.is-scrolled .wrap { height: 56px; }
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; white-space: nowrap; flex: none; }
.logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.logo-text b { font-weight: 600; font-size: 1.05rem; }
.logo-text small { font-size: .75rem; color: var(--muted); letter-spacing: .02em; }
.nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav a { position: relative; padding: 12px 10px; white-space: nowrap; text-decoration: none; font-size: 1rem;
  color: color-mix(in srgb, var(--ink) 78%, var(--muted)); }
.nav a::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 6px; height: 2px; background: var(--seal);
  transform: scaleX(0); transform-origin: left; transition: transform .2s ease; }
.nav a:hover, .nav a.is-active { color: var(--ink); }
.nav a:hover::after, .nav a.is-active::after { transform: scaleX(1); }
/* Служебное: язык и тема — одной тихой группой */
.tools { display: flex; align-items: center; gap: 2px; flex: none; }
.lang { display: flex; align-items: center; font-size: .85rem; font-weight: 600; letter-spacing: .06em; }
.lang b { color: var(--ink); padding: 12px 4px; }
.lang i { font-style: normal; color: var(--rule); }
.lang a { color: var(--muted); text-decoration: none; padding: 12px 4px; }
.lang a:hover { color: var(--seal); }
.header .btn--sm { flex: none; }
/* Ссылка «к содержанию» — видна только при переходе клавишей Tab */
.skip { position: absolute; left: 16px; top: -100px; z-index: 30; padding: 10px 16px; background: var(--ink); color: var(--paper); text-decoration: none; }
.skip:focus { top: 12px; }
main:focus { outline: none; }
/* Заголовки разделов не прячутся под шапкой после перехода по меню */
section[id] { scroll-margin-top: 60px; }
/* Кнопка меню (бургер) — только на узких экранах */
.nav-toggle { display: none; width: 44px; height: 44px; flex: none; place-items: center; padding: 0; margin-right: -10px;
  background: none; border: 0; color: var(--ink); cursor: pointer; }
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block; width: 22px; height: 2px; background: currentColor; transition: transform .2s ease, background-color .2s ease; }
.nav-toggle span { position: relative; }
.nav-toggle span::before, .nav-toggle span::after { content: ""; position: absolute; left: 0; }
.nav-toggle span::before { top: -7px; }
.nav-toggle span::after { top: 7px; }
.nav-open .nav-toggle span { background: transparent; }
.nav-open .nav-toggle span::before { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle span::after { transform: translateY(-7px) rotate(-45deg); }
@media (max-width: 1179px) { .logo-text small { display: none; } }
@media (max-width: 1023px) {
  .logo-text small { display: block; }
  .tools { margin-left: auto; }
  .js .nav-toggle { display: inline-grid; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0; margin: 0; flex-direction: column; align-items: stretch;
    gap: 0; padding: 8px 20px 16px; background: var(--paper); border-bottom: 1px solid var(--rule); box-shadow: 0 12px 24px rgb(0 0 0 / .08); }
  .nav-open .nav { display: flex; }
  .nav a { padding: 14px 0; font-size: 1.1rem; border-bottom: 1px solid var(--rule); }
  .nav a:last-child { border-bottom: 0; }
  .nav a::after { left: 0; right: auto; width: 32px; bottom: 8px; }
}
@media (max-width: 860px) { .header .btn--sm { display: none; } }
@media (max-width: 560px) { .logo-text small { display: none; } }

/* Кнопки */
/* Все кнопки записи — контурная печать «чжувэнь»: красный текст в двойной красной рамке
   с лёгкой неровностью линии (фильтр #line-ink). При наведении печать «заливается» краской. */
.btn {
  position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 24px; font: 600 1rem/1 var(--sans); text-decoration: none; border: 0; border-radius: 0;
  background: var(--paper); color: var(--seal); cursor: pointer; transition: color .15s ease, transform .12s ease;
}
.btn::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border: 1.5px solid currentColor; box-shadow: inset 0 0 0 3.5px transparent, inset 0 0 0 4.5px currentColor;
  filter: url(#line-ink); transition: background-color .15s ease;
}
.btn:hover { color: var(--seal-ink); }
.btn:hover::before { background: var(--seal); border-color: var(--seal);
  box-shadow: inset 0 0 0 3.5px var(--seal), inset 0 0 0 4.5px rgb(255 255 255 / .8); }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.btn--sm { padding: 11px 16px; font-size: .9rem; }
/* в тёмном блоке записи — светлее, чтобы текст читался на фоне цвета туши */
.cta .btn { background: transparent; color: color-mix(in srgb, var(--seal) 60%, var(--paper)); }
.cta .btn:hover { color: var(--seal-ink); }
/* серая тема: оранжевый на голубовато-сером слишком светлый для текста — темнее */
:root[data-theme="gray"] .btn { color: color-mix(in srgb, var(--seal) 65%, var(--ink)); }
:root[data-theme="gray"] .cta .btn { color: color-mix(in srgb, var(--seal) 60%, var(--paper)); }
:root[data-theme="gray"] .btn:hover { color: var(--seal-ink); }
.link-arrow { font-weight: 600; text-decoration: none; border-bottom: 1.5px solid currentColor; padding-bottom: 2px; }
.link-arrow:hover { color: var(--seal); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 28px; margin-top: 36px; }

/* Hero */
.hero { padding: 72px 0 0; }
.hero-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 56px; align-items: center; }
.hello { font-size: .85rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 18px; }
.hello span { color: var(--seal); }
.hero h1 em { font-style: italic; color: var(--seal); }

.sheet { justify-self: end; }
.hanzi { display: flex; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.hanzi svg { width: min(200px, 40vw); height: auto; display: block; }
.hanzi svg + svg { margin-left: -1.5px; }
.hanzi .cell { fill: none; stroke: var(--seal); stroke-width: 1.5; }
.hanzi .guide { fill: none; stroke: var(--grid); stroke-width: .8; stroke-dasharray: 3 3; }
.hanzi .stroke { fill: none; stroke: var(--ink); stroke-width: 7.5; stroke-linecap: round; stroke-linejoin: round; }
.sheet-caption { margin-top: 14px; font-size: .9rem; color: var(--muted); display: flex; gap: 10px; align-items: baseline; }
.sheet-caption b { font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--ink); font-weight: 600; }
.js .hanzi .stroke { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .hanzi.is-visible .stroke { animation: draw .5s cubic-bezier(.5,0,.3,1) forwards; animation-delay: calc(.3s + var(--i) * .45s); }
@keyframes draw { to { stroke-dashoffset: 0; } }

.stats {
  list-style: none; margin: 72px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--rule);
}
.stats li { padding: 24px 20px 28px; border-left: 1px solid var(--rule); color: var(--muted); font-size: .95rem; line-height: 1.4; }
.stats li:first-child { border-left: 0; padding-left: 0; }
.stats b { display: block; font: 700 2.6rem/1 var(--serif); color: var(--ink); margin-bottom: 8px; }
@media (max-width: 860px) {
  .hero { padding-top: 44px; }
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .sheet { justify-self: start; }
  .stats { grid-template-columns: 1fr 1fr; margin-top: 48px; }
  .stats li:nth-child(3) { border-left: 0; padding-left: 0; }
  .stats li:nth-child(n+3) { border-top: 1px solid var(--rule); }
}

/* Подбор учителя (первый экран) */
.match { border-top: 2px solid var(--ink); padding-top: 20px; }
.match-title { font: 700 1.5rem/1.2 var(--serif); margin-bottom: 18px; }
.q { margin-bottom: 16px; }
.q-lab { display: block; font-size: .78rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.chips { display: none; flex-wrap: wrap; gap: 8px; }
.js .chips { display: flex; }
.q { display: none; }
.js .q { display: block; }
.chips button {
  font: 500 .92rem var(--sans); color: var(--ink); background: transparent; cursor: pointer;
  border: 1.5px solid var(--rule); border-radius: 2px; padding: 7px 14px;
}
.chips button:hover { border-color: var(--ink); }
/* выбранный вариант — как печать «чжувэнь»: красный текст в двойной красной рамке */
.chips button[aria-pressed="true"] { border-color: var(--seal); color: var(--seal);
  box-shadow: inset 0 0 0 2.5px var(--paper), inset 0 0 0 3.5px var(--seal); }
.match-result { border-top: 1px solid var(--rule); margin-top: 20px; padding-top: 16px; }
.why { color: var(--muted); font-size: .95rem; margin-bottom: 12px; min-height: 1.5em; }
.minis { display: flex; flex-direction: column; gap: 10px; }
.mini { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.mini:last-child { border-bottom: 0; }
.mini[hidden] { display: none; }
.mini .seal { width: 44px; height: 44px; font-size: 26px; }
.mini b { display: block; font: 700 1.15rem/1.2 var(--serif); }
.mini small { color: var(--muted); font-size: .85rem; }
.mini .btn { margin-left: auto; padding: 10px 14px; font-size: .88rem; }
.mini.is-best b::after { content: attr(data-best); font: 700 .65rem var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--seal); border: 1.5px solid var(--seal); padding: 1px 6px; margin-left: 8px; vertical-align: 3px; border-radius: 2px; }

/* Прописи в разделе занятий */
.writing { display: grid; grid-template-columns: auto 1fr; gap: 32px; align-items: center; margin-top: 56px; }
.writing .hanzi svg { width: min(150px, 38vw); }
.writing p { color: var(--muted); max-width: 40ch; margin: 0; }
.writing b { display: block; font: 700 1.4rem/1.2 var(--serif); color: var(--ink); margin-bottom: 8px; }
@media (max-width: 640px) { .writing { grid-template-columns: 1fr; gap: 16px; } }

/* Учителя */
.teachers { display: grid; grid-template-columns: 1fr 1fr; gap: 0 56px; }
.teacher { border-top: 2px solid var(--ink); padding-top: 28px; scroll-margin-top: 80px; }
.t-head { display: flex; align-items: center; gap: 20px; margin-bottom: 20px; }
.t-mark { position: relative; flex: none; }
.t-mark .seal { width: 88px; height: 88px; font-size: 54px; border-radius: 4px; transform: rotate(-3deg); }
.t-mark img { width: 96px; height: 96px; object-fit: cover; border-radius: 2px; }
.t-mark img + .seal { position: absolute; right: -10px; bottom: -10px; width: 36px; height: 36px; font-size: 21px; }
.t-name { font: 700 2rem/1.1 var(--serif); margin: 0 0 4px; }
.t-langs { font-weight: 600; margin: 0; }
.t-explains { color: var(--muted); font-size: .9rem; margin: 2px 0 0; }
.t-quote { font: italic 600 1.2rem/1.45 var(--serif); margin: 0 0 14px; }
.t-tags { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 8px; padding: 0; list-style: none; font-size: .88rem; color: var(--seal); font-weight: 600; }
.teacher .record { margin: 18px 0 24px; }
.teacher .record b { font-size: 1.1rem; }
@media (max-width: 860px) { .teachers { grid-template-columns: 1fr; gap: 48px; } }

.packs .crew { color: var(--muted); font-size: .9rem; margin: 14px 0 0; }

/* Кому подойду: иероглиф вместо иконки */
.audience { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 56px; }
.audience article { display: grid; grid-template-columns: 64px 1fr; gap: 0 20px; padding: 28px 0; border-top: 1px solid var(--rule); }
.glyph { font: 600 2.8rem/1 var(--cjk); color: var(--seal); }
.audience p { color: var(--muted); margin: 0; }
@media (max-width: 860px) { .audience { grid-template-columns: 1fr; } }

/* Шаги */
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 56px; }
.steps li { counter-increment: s; padding: 26px 0 26px 76px; border-top: 1px solid var(--rule); position: relative; }
.steps li::before {
  content: counter(s, decimal-leading-zero); position: absolute; left: 0; top: 18px;
  font: italic 700 2.4rem/1 var(--serif); color: var(--seal);
}
.steps p { color: var(--muted); margin: 0; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } }

/* Тоны */
.tones-block { margin-top: 72px; }
.tones-block h3 { font: 700 1.6rem/1.2 var(--serif); }
.tabs { display: flex; gap: 28px; margin: 24px 0 0; border-bottom: 1px solid var(--rule); }
.tabs button {
  font: 600 .95rem var(--sans); color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: 0 0 12px; margin-bottom: -1px; border-bottom: 2px solid transparent;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-color: var(--seal); }
.tones { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); border-bottom: 1px solid var(--rule); }
.tones[hidden] { display: none; }
.tone { padding: 24px 18px; border-left: 1px solid var(--rule); }
.tone:first-child { border-left: 0; padding-left: 0; }
.tone svg { width: 100%; max-width: 140px; height: 56px; margin-bottom: 14px; overflow: visible; display: block; }
.tone .lvl { stroke: var(--rule); stroke-width: 1; }
.tone .curve { fill: none; stroke: var(--seal); stroke-width: 3.5; stroke-linecap: round; }
.tone .ch { font-size: 2.2rem; line-height: 1.1; }
.tone .rom { font-weight: 600; margin-top: 4px; }
.tone p { font-size: .85rem; color: var(--muted); margin: 2px 0 0; }
.js .tone .curve { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .tones.is-visible .curve { animation: draw .7s ease-out forwards; animation-delay: calc(var(--i) * .15s); }
@media (max-width: 560px) {
  .tones { grid-template-columns: 1fr 1fr; }
  .tone:nth-child(odd) { border-left: 0; padding-left: 0; }
  .tone:nth-child(n+3) { border-top: 1px solid var(--rule); }
}

/* Опыт */
.about { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; }
.photo {
  width: 88px; height: 88px; border-radius: 2px; background: var(--paper-2); border: 1px solid var(--rule);
  display: grid; place-items: center; font: 700 2rem var(--serif); color: var(--seal); margin-bottom: 24px; object-fit: cover;
}
.section--tint .photo { background: var(--paper); }
.record { list-style: none; margin: 0; padding: 0; }
.record li { padding: 22px 0; border-top: 1px solid var(--rule); }
.record b { display: block; font-family: var(--serif); font-size: 1.25rem; margin-bottom: 4px; }
.record span { color: var(--muted); }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; gap: 24px; } }

/* Цены — прайс-лист с точками */
.pricelist { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.pricelist li { display: flex; align-items: baseline; gap: 14px; padding: 20px 0; border-bottom: 1px solid var(--rule); }
.pricelist .name { font-weight: 600; font-size: 1.1rem; }
.pricelist .name small { display: block; font-weight: 400; font-size: .88rem; color: var(--muted); }
.pricelist .dots { flex: 1; border-bottom: 1.5px dotted var(--muted); transform: translateY(-5px); min-width: 24px; opacity: .6; }
.pricelist .amount { font: 700 1.6rem/1 var(--serif); white-space: nowrap; }
.pricelist .free .amount { color: var(--seal); }
.pricelist .package { border-left: 4px solid var(--seal); padding-left: 18px; background: color-mix(in srgb, var(--seal) 7%, transparent); }
.badge {
  display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--seal); border: 1.5px solid var(--seal); padding: 2px 7px; margin-left: 8px; vertical-align: 3px; border-radius: 2px;
}
.note { color: var(--muted); font-size: .95rem; margin-top: 24px; max-width: 60ch; }
@media (max-width: 560px) {
  .pricelist li { flex-wrap: wrap; }
  .pricelist .dots { display: none; }
  .pricelist .amount { margin-left: auto; }
}

/* Пакеты занятий */
.packs { margin-top: 40px; }
.packs .tabs { margin-top: 0; }
.pack-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--rule); }
.pack-grid[hidden] { display: none; }
.pack { padding: 28px 24px 30px; border-left: 1px solid var(--rule); }
.pack:first-child { border-left: 0; padding-left: 0; }
.pack h3 { font-size: 1rem; color: var(--muted); font-weight: 600; margin-bottom: 14px; }
.pack .amount { font: 700 2.2rem/1 var(--serif); margin-bottom: 10px; }
.pack .per { font-weight: 600; }
.pack .save { color: var(--seal); font-size: .9rem; font-weight: 600; margin-top: 4px; }
.pack--best { box-shadow: inset 0 3px 0 var(--seal); }
.pack--best .badge { margin-left: 10px; vertical-align: 1px; }
@media (max-width: 640px) {
  .pack-grid { grid-template-columns: 1fr; }
  .pack { border-left: 0; padding: 22px 0; border-top: 1px solid var(--rule); }
  .pack:first-child { border-top: 0; }
  .pack--best { box-shadow: inset 3px 0 0 var(--seal); padding-left: 16px; }
}

/* Отзывы: истории учеников */
.stories { display: grid; gap: 0; }
.story { display: grid; grid-template-columns: 260px 1fr; gap: 40px; padding: 36px 0; border-top: 1px solid var(--rule); }
.story:last-child { border-bottom: 1px solid var(--rule); }
.story .who { font: 700 1.4rem/1.2 var(--serif); margin: 6px 0 16px; }
.story dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 18px; font-size: .92rem; }
.story dt { color: var(--muted); }
.story dd { margin: 0; font-weight: 500; }
.result { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .92rem; padding: 14px 0 0; border-top: 1px dashed var(--rule); }
.result span { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--seal); padding-top: 2px; }
.story-text { margin: 0; position: relative; padding-left: 44px; }
.story-text::before { content: "“"; position: absolute; left: 0; top: -6px; font: 700 4.4rem/1 var(--serif); color: var(--seal); }
.story-text p { font-size: 1.08rem; line-height: 1.7; }
.story-text p:last-child { margin-bottom: 0; }
.placeholder-tag { font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
@media (max-width: 860px) {
  .story { grid-template-columns: 1fr; gap: 20px; }
}
.video {
  aspect-ratio: 16 / 9; margin-top: 56px; border: 1px solid var(--rule); display: grid; place-items: center;
  color: var(--muted); background: var(--paper); text-align: center; padding: 20px;
}
.play { width: 0; height: 0; border-left: 26px solid var(--seal); border-top: 16px solid transparent; border-bottom: 16px solid transparent; margin: 0 auto 14px; }
@media (max-width: 860px) { .quotes { grid-template-columns: 1fr; gap: 28px; } }

/* FAQ */
.faq details { border-top: 1px solid var(--rule); padding: 22px 0; }
.faq details:last-child { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; font-weight: 600; font-size: 1.1rem; list-style: none; position: relative; padding-right: 36px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 0; top: -6px; font: 400 1.8rem var(--serif); color: var(--seal); }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 12px 0 0; color: var(--muted); max-width: 64ch; }

/* Запись — тёмный блок, текст слева, печать справа */
.cta { background: var(--ink); color: var(--paper); border-top: 0; }
.cta-grid { display: grid; grid-template-columns: 1fr auto; gap: 48px; align-items: center; }
.cta h2 { color: var(--paper); max-width: 16ch; }
.cta p { color: color-mix(in srgb, var(--paper) 72%, transparent); max-width: 50ch; }
.cta .link-arrow { color: var(--paper); }
.stamp {
  width: 180px; height: 180px; display: grid; place-items: center; background: var(--seal); color: #fff;
  font: 600 110px/1 var(--cjk); transform: rotate(-4deg); border-radius: 4px;
  box-shadow: inset 0 0 0 6px var(--seal), inset 0 0 0 8px rgba(255,255,255,.85);
}
@media (max-width: 860px) {
  .cta-grid { grid-template-columns: 1fr; }
  .stamp { width: 96px; height: 96px; font-size: 58px; order: -1; }
}

/* Подвал */
.footer { padding: 32px 0 48px; color: var(--muted); font-size: .9rem; border-top: 1px solid var(--rule); }
.footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }

/* Мобильная кнопка записи */
.sticky-cta { display: none; }
@media (max-width: 860px) {
  .sticky-cta { display: flex; justify-content: center; position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 20; box-shadow: 0 6px 20px rgb(0 0 0 / .12); }
  .footer { padding-bottom: 100px; }
}

/* Плавное появление */
.js [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .7s ease, transform .7s ease; }
.js [data-reveal].is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .js .hanzi .stroke, .js .tone .curve { stroke-dashoffset: 0; animation: none !important; }
}
.nowrap { white-space: nowrap; }
.tone-phrase { grid-column: 1 / -1; margin: 0; padding: 18px 0; border-top: 1px solid var(--rule); color: var(--muted); }
.tone-phrase b { font-size: 1.3rem; color: var(--ink); margin-right: 6px; }

/* Настоящие отзывы */
.story-meta .who { margin-top: 0; }
.rv-line { font-size: .9rem; font-weight: 600; color: var(--seal); margin: 0 0 4px; }
.rv-date { font-size: .88rem; color: var(--muted); margin: 0; }
.tr { display: block; font-size: .78rem; color: var(--muted); font-style: italic; margin-top: 6px; }
.quotes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 56px; margin-top: 8px; }
.quote { margin: 0; padding: 26px 0; border-top: 1px solid var(--rule); }
.quote blockquote { margin: 0 0 14px; font-size: 1.02rem; line-height: 1.65; }
.quote blockquote::before { content: "“"; font: 700 2.4rem/0 var(--serif); color: var(--seal); vertical-align: -14px; margin-right: 4px; }
.quote figcaption { font-size: .9rem; color: var(--muted); }
.quote figcaption b { color: var(--ink); }
.quote figcaption span { color: var(--seal); font-weight: 600; font-size: .85rem; }
@media (max-width: 860px) { .quotes { grid-template-columns: 1fr; } }
.reviews .tabs { margin: 0 0 8px; }
.rv-sum { list-style: none; margin: 24px 0 8px; padding: 0; }
.rv-sum li { display: flex; align-items: baseline; gap: 14px; color: var(--muted); }
.rv-sum b { font: 700 2.4rem/1 var(--serif); color: var(--ink); }
.rv-tags { margin-top: 28px; padding-top: 22px; border-top: 2px solid var(--ink); }
.rv-tags p { font-weight: 600; margin-bottom: 12px; }
.rv-tags ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.rv-tags li { border: 1.5px solid var(--rule); border-radius: 2px; padding: 6px 12px; font-size: .92rem; }
.rv-tags li span { color: var(--seal); font-weight: 700; margin-left: 6px; }

/* Печати как настоящий оттиск: рамка внутри, неровный край, непропечатанные места */
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.seal, .stamp {
  box-shadow: inset 0 0 0 2px var(--seal), inset 0 0 0 3.5px var(--seal-ink);
  border-radius: 2px;
}
.t-mark .seal, .stamp { filter: url(#seal-ink); }
.t-mark .seal, .stamp { box-shadow: inset 0 0 0 5px var(--seal), inset 0 0 0 7.5px var(--seal-ink); }
.mini .seal { box-shadow: inset 0 0 0 3px var(--seal), inset 0 0 0 4.5px var(--seal-ink); }
.t-seal { font-size: .88rem; color: var(--muted); margin: -6px 0 16px; padding-left: 12px; border-left: 2px solid var(--seal); }
.teacher .actions { margin-top: 0; }

/* Первый экран компактнее */
h1 { font-size: clamp(2.3rem, 5vw, 3.9rem); }
.hero .lead { max-width: 40ch; }

/* Отзывы: часть скрыта до нажатия «Ещё отзывы» */
.js .reviews [data-panel]:not(.show-all) [data-more] { display: none; }
.more-btn {
  margin-top: 20px; font: 600 .95rem var(--sans); color: var(--ink); background: none; cursor: pointer;
  border: 0; border-bottom: 1.5px solid currentColor; padding: 0 0 2px; display: none;
}
.js .more-btn { display: inline-block; }
.more-btn:hover { color: var(--seal); }
.show-all .more-btn { display: none; }

/* Узкие экраны: в шапке без кнопки записи — её заменяет закреплённая кнопка внизу */
@media (max-width: 560px) { .header .wrap { gap: 12px; } }

/* Печати учителей — фото настоящих печатей */
.seal-img { display: block; width: 104px; height: 104px; transform: rotate(-2deg); }
.mini .seal-img { width: 44px; height: 44px; flex: none; transform: none; }
.t-mark .photo + .seal-img { position: absolute; right: -12px; bottom: -12px; width: 40px; height: 40px; }

/* Логотип и большая печать — печать «tandem DA» */
.logo-seal { width: 44px; height: 44px; flex: none; transition: width .2s ease, height .2s ease; }
.header.is-scrolled .logo-seal { width: 38px; height: 38px; }
@media (max-width: 560px) { .logo-seal, .header.is-scrolled .logo-seal { width: 38px; height: 38px; } }
.stamp-img { width: 180px; height: 180px; transform: rotate(-4deg); }
@media (max-width: 860px) { .stamp-img { width: 96px; height: 96px; order: -1; } }

/* Поле печатей прозрачное: на тёмном фоне красный осветляем, чтобы иероглиф читался */
.cta .stamp-img { filter: brightness(1.5) saturate(1.1); }
:root[data-theme="dark"] .seal-img, :root[data-theme="dark"] .logo-seal { filter: brightness(1.5) saturate(1.1); }
:root[data-theme="dark"] .cta .stamp-img { filter: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .seal-img, :root:not([data-theme]) .logo-seal { filter: brightness(1.5) saturate(1.1); }
  :root:not([data-theme]) .cta .stamp-img { filter: none; }
}

/* Иероглифы-«водяные знаки»: огромные, едва заметные, выплывают при прокрутке */
.hero, .section { position: relative; overflow: hidden; }
.hero > .wrap, .section > .wrap { position: relative; z-index: 1; }
.wm {
  position: absolute; top: 50%; z-index: 0; pointer-events: none; user-select: none;
  font: 600 clamp(260px, 44vw, 640px)/1 var(--cjk);
  color: color-mix(in srgb, var(--ink) 6%, transparent);
  transform: translate3d(0, -50%, 0); will-change: transform, opacity;
}
.wm--right { right: -3vw; }
.wm--left { left: -3vw; }
.cta .wm { display: none; }
.js .wm { opacity: 0; }
@media (max-width: 860px) { .wm { font-size: 72vw; } }
@media (prefers-reduced-motion: reduce) { .js .wm { opacity: 1; } }

/* Серая тема: серо-голубой фон, графитовый текст, оранжевые акценты и иероглифы */
:root[data-theme="gray"] {
  color-scheme: light;
  --paper: #ccd5de; --paper-2: #bec8d3; --ink: #1d2530; --muted: #4a5563;
  --rule: #a3afbd; --seal: #d04a1a; --grid: #f0a27f;
  --hz: #ee5a24;            /* яркий оранжевый для иероглифов */
}
:root[data-theme="gray"] [lang|="zh"],
:root[data-theme="gray"] .glyph,
:root[data-theme="gray"] .tone .ch { color: var(--hz); }
:root[data-theme="gray"] .hanzi .stroke { stroke: var(--hz); }
:root[data-theme="gray"] .wm { color: color-mix(in srgb, var(--hz) 10%, transparent); }
:root[data-theme="gray"] .t-mark .seal-img, :root[data-theme="gray"] .mini .seal-img,
:root[data-theme="gray"] .logo-seal { filter: hue-rotate(14deg) saturate(1.35) brightness(1.08); }
:root[data-theme="gray"] .cta .stamp-img { filter: hue-rotate(14deg) saturate(1.35) brightness(1.55); }

/* Учителя: все пункты двух карточек на одной высоте (общая сетка строк через subgrid).
   Строки: шапка, пояснение к печати, цитата, теги, описание, 4 пункта опыта, кнопки. */
.t-head { align-items: flex-start; }
.t-mark { width: 104px; height: 104px; }
@media (min-width: 861px) {
  .teachers { grid-template-rows: repeat(10, auto); }
  .teacher { display: grid; grid-row: span 10; grid-template-rows: subgrid; align-content: start; }
  .teacher > * { margin-top: 0; }
  .teacher .record { display: grid; grid-row: span 4; grid-template-rows: subgrid; margin: 18px 0 24px; }
  .teacher .record li:last-child { grid-row: 4; }   /* «Образование» — всегда в последней строке */
  .teacher .actions { align-self: start; }
}


/* ---------- Материалы ---------- */
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 32px; border-top: 2px solid var(--ink); }
.mat-card { display: flex; align-items: center; gap: 18px; padding: 22px 0; border-bottom: 1px solid var(--rule); text-decoration: none; color: inherit; }
.mat-ico { flex: none; display: grid; place-items: center; width: 56px; height: 56px; font: 600 30px/1 var(--cjk); color: var(--seal);
  border: 1.5px solid currentColor; box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4px currentColor; }
.section--tint .mat-ico { box-shadow: inset 0 0 0 3px var(--paper-2), inset 0 0 0 4px currentColor; }
.mat-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mat-body b { font: 700 1.2rem/1.2 var(--serif); }
.mat-body > span { color: var(--muted); font-size: .95rem; }
.mat-body small { color: var(--seal); font-weight: 600; font-size: .85rem; }
.mat-go { margin-left: auto; font-size: 1.3rem; color: var(--muted); transition: transform .15s ease, color .15s ease; }
.mat-card:hover .mat-go { transform: translateX(4px); color: var(--seal); }
.mat-card:hover b { color: var(--seal); }
.mat-all { margin-top: 28px; }
.mat-hero { padding: 48px 0 24px; }
.mat-hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); margin: 12px 0 14px; }
.mat-hero .lead { max-width: 60ch; color: var(--muted); }
.crumbs { font-size: .88rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--seal); }
.mat-main { padding: 16px 0 80px; }
.jump { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.jump a { display: grid; place-items: center; width: 44px; height: 44px; font: 600 22px/1 var(--cjk); text-decoration: none;
  color: var(--ink); border: 1.5px solid var(--rule); }
.jump a:hover { border-color: var(--seal); color: var(--seal); }
.entry { display: grid; grid-template-columns: 200px 1fr; gap: 40px; padding: 40px 0; border-top: 2px solid var(--ink); scroll-margin-top: 70px; }
.entry--wide { grid-template-columns: 1fr; }
.entry-mark { position: relative; width: 200px; height: 200px; }
.cell-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cell-svg .cell { fill: none; stroke: var(--seal); stroke-width: 1.5; }
.cell-svg .guide { fill: none; stroke: var(--grid); stroke-width: .8; stroke-dasharray: 3 3; }
.entry-mark .big { position: absolute; inset: 0; display: grid; place-items: center; font: 400 150px/1 var(--cjk); color: var(--ink); }
.entry-num { font-size: .78rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--seal); margin: 0 0 8px; }
.entry h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0 0 12px; }
.entry .py, .jp { font-style: italic; }
.entry .jp { font-size: 1.15rem; margin: 0 0 12px; }
.phrase { font-family: var(--cjk); font-size: 1.3em; }
.parts { color: var(--muted); }
.parts b { font-family: var(--cjk); color: var(--ink); font-size: 1.2em; }
.words { border-collapse: collapse; margin: 20px 0; width: 100%; max-width: 560px; }
.words caption { text-align: left; font-size: .78rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding-bottom: 8px; }
.words td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
.words td:first-child { font: 600 1.25rem/1.2 var(--cjk); white-space: nowrap; }
.words td:nth-child(2) { font-style: italic; white-space: nowrap; }
.ex { border-left: 3px solid var(--seal); padding: 4px 0 4px 16px; }
.ex span[lang] { font: 600 1.25rem/1.6 var(--cjk); }
.tip { background: var(--paper-2); padding: 14px 18px; }
.note { color: var(--muted); font-size: .92rem; max-width: 70ch; }
.mistakes { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.mistake { border-top: 2px solid var(--ink); padding-top: 18px; }
.mistake p { margin: 0 0 8px; }
.mistake .bad, .mistake .good { font: 600 1.35rem/1.4 var(--cjk); display: flex; gap: 10px; align-items: baseline; }
.mistake .bad { color: var(--muted); }
.mistake .bad s { text-decoration-color: var(--seal); text-decoration-thickness: 2px; }
.mistake .good { color: var(--ink); }
.mk { font: 700 1rem var(--sans); width: 1.2em; }
.mistake .bad .mk { color: var(--seal); }
.mistake .good .mk { color: #3d8b5a; }
.mistake .py { font-style: italic; color: var(--muted); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; }
.pager a { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; padding: 18px 20px; border: 1.5px solid var(--rule);
  text-decoration: none; color: var(--ink); font-weight: 600; }
.pager a:last-child { justify-content: flex-end; text-align: right; }
.pager a:hover { border-color: var(--seal); color: var(--seal); }
.pager small { flex-basis: 100%; color: var(--muted); font-weight: 400; }
.pager span[lang] { font-family: var(--cjk); color: var(--seal); }
/* тренажёр тонов */
.trainer { border-top: 2px solid var(--ink); padding-top: 28px; max-width: 720px; }
.trainer-top { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.score { margin: 0; color: var(--muted); }
.score b { color: var(--ink); }
.trainer-q { font: 700 1.3rem var(--serif); margin: 28px 0 12px; }
.tone-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tone-btns button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; cursor: pointer;
  background: transparent; color: var(--ink); border: 1.5px solid var(--rule); font: 600 .95rem var(--sans); }
.tone-btns button:hover:not(:disabled) { border-color: var(--seal); }
.tone-btns svg { width: 100%; max-width: 90px; height: auto; }
.tone-btns .lvl { stroke: var(--rule); stroke-width: 1; }
.tone-btns .curve { fill: none; stroke: var(--seal); stroke-width: 4; stroke-linecap: round; }
.tone-btns button.is-right { border-color: #3d8b5a; box-shadow: inset 0 0 0 2px #3d8b5a; }
.tone-btns button.is-wrong { border-color: var(--seal); opacity: .6; }
.tone-btns button:disabled { cursor: default; }
.trainer-fb { min-height: 1.6em; font-size: 1.1rem; margin: 18px 0 8px; }
.trainer-fb.ok { color: #3d8b5a; }
.trainer-fb span[lang] { font: 600 1.5rem var(--cjk); color: var(--ink); }
.trainer-next { background: none; border: 0; border-bottom: 1.5px solid currentColor; cursor: pointer; font-size: 1rem; color: var(--ink); padding: 0 0 2px; }
/* тест уровня */
.quiz { border-top: 2px solid var(--ink); padding-top: 24px; max-width: 720px; }
.quiz-bar { height: 4px; background: var(--rule); }
.quiz-bar span { display: block; height: 100%; width: 0; background: var(--seal); transition: width .3s ease; }
.quiz-count { color: var(--muted); font-size: .9rem; margin: 12px 0 20px; }
.quiz-q { border: 0; padding: 0; margin: 0; }
.quiz-q legend { font: 700 1.4rem/1.35 var(--serif); margin-bottom: 20px; padding: 0; }
.quiz-q legend span[lang], .quiz-opts span[lang] { font-family: var(--cjk); }
.quiz-opts { display: grid; gap: 10px; }
.quiz-opts button { text-align: left; padding: 14px 18px; font: 500 1.05rem var(--sans); color: var(--ink); background: transparent;
  border: 1.5px solid var(--rule); cursor: pointer; }
.quiz-opts button:hover, .quiz-opts button:focus-visible { border-color: var(--seal); color: var(--seal); }
.quiz-opts .skip-opt { color: var(--muted); border-style: dashed; }
.quiz-result h2 { font-size: clamp(2rem, 4vw, 2.8rem); margin: 0 0 12px; }
.quiz-result h2:focus { outline: none; }
.quiz-review { margin-top: 28px; }
.quiz-review summary { cursor: pointer; font-weight: 600; }
.quiz-review li { margin: 12px 0; }
@media (max-width: 700px) {
  .entry { grid-template-columns: 1fr; gap: 20px; }
  .entry-mark { width: 150px; height: 150px; }
  .entry-mark .big { font-size: 112px; }
  .tone-btns { grid-template-columns: repeat(2, 1fr); }
  .pager { grid-template-columns: 1fr; }
  .mat-grid { grid-template-columns: 1fr; }
}
/* в шапке теперь шесть пунктов — подпись под логотипом показываем только в мобильном меню */
@media (min-width: 1024px) { .logo-text small { display: none; } }
button.link-arrow { background: none; border: 0; border-bottom: 1.5px solid currentColor; padding: 0 0 2px; font: 600 1rem var(--sans); color: var(--ink); cursor: pointer; }
button.link-arrow:hover { color: var(--seal); }
.voice-switch { display: inline-flex; border: 1.5px solid var(--rule); }
.voice-switch button { padding: 10px 14px; font: 600 .88rem var(--sans); color: var(--muted); background: transparent; border: 0; cursor: pointer; }
.voice-switch button + button { border-left: 1.5px solid var(--rule); }
.voice-switch button[aria-pressed="true"] { color: var(--seal); box-shadow: inset 0 -2px 0 var(--seal); }
.slot-lab { font-size: .78rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.tone-btns button.is-picked { border-color: var(--seal); box-shadow: inset 0 0 0 2px var(--seal); }
.trainer-tabs .tabs { margin: 0 0 28px; }
.trainer-tabs [data-panel][hidden] { display: none; }
.words-intro { margin: 0 0 20px; }
