/* PenFlow · концепт В · ОБЩИЕ КОМПОНЕНТЫ
   Подключается на всех страницах после tokens.css.
   Описание каждого блока — в DESIGN.md (тот же порядок разделов). */

/* ============ 1. База ============ */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-x: clip; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; interpolate-size: allow-keywords; scroll-padding-top: calc(var(--header-h) + 12px); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--fs-body)/1.6 var(--font); overflow-x: clip; /* clip, а не hidden: hidden делает body прокручиваемым блоком, и шапка перестаёт быть липкой */
  -webkit-font-smoothing: antialiased;
  transition: background-color .6s var(--ease), color .6s var(--ease);
}
img, svg, canvas, video { display: block; max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; color: inherit; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
::selection { background: var(--accent-soft); color: var(--ink); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 200; background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: 10px; text-decoration: none; font-weight: 700; }
.skip:focus { top: 12px; }

/* ============ 2. Сетка и секции ============ */
.wrap { width: 100%; max-width: calc(var(--maxw) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
section { position: relative; }
.section { padding: var(--sec-y) 0; }
.section.alt { background: var(--stage); }
.section.flush-top { padding-top: 0; }
.section.tight { padding: calc(var(--sec-y) * .6) 0; }
.section-head { display: grid; max-width: 760px; }
.section-head.center { margin: 0 auto; text-align: center; justify-items: center; }
.section-head.center .lead { margin-inline: auto; }
.center { text-align: center; }
.nw { white-space: nowrap; }
.mt-s { margin-top: 16px; } .mt { margin-top: 32px; } .mt-l { margin-top: clamp(36px, 5vw, 60px); }

/* ============ 3. Типографика ============ */
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font: 700 13px/1 var(--font); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.eyebrow::before { content: ""; width: 26px; height: 2px; background: currentColor; border-radius: 2px; }
h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -.025em; line-height: 1.05; text-wrap: balance; }
h1 { font-size: var(--fs-h1); letter-spacing: -.035em; }
h2 { font-size: var(--fs-h2); margin-top: 14px; }
h3 { font-size: var(--fs-h3); letter-spacing: -.015em; line-height: 1.2; }
.lead { font-size: var(--fs-lead); color: var(--muted); max-width: 42ch; margin-top: 18px; text-wrap: pretty; }
.hand { font-family: var(--hand); font-weight: 600; letter-spacing: 0; }
.script { font-family: var(--script); font-weight: 400; letter-spacing: 0; }
/* рукописное слово в заголовке, с подчёркиванием, которое «дописывается» */
.ink-word { position: relative; display: inline-block; white-space: nowrap; color: var(--accent); font-family: var(--hand); font-weight: 700; font-size: 1.12em; letter-spacing: 0; padding: 0 .06em; }
.ink-word > svg { position: absolute; left: -2%; bottom: -.14em; width: 104%; height: .32em; overflow: visible; }
.draw path { stroke-dasharray: var(--len, 320); stroke-dashoffset: var(--len, 320); transition: stroke-dashoffset 1.3s var(--ease) .25s; }
.in .draw path, .draw.in path { stroke-dashoffset: 0; }
/* шутка с двойным дном — одна на блок, всегда после пользы */
.joke { font: 600 var(--fs-hand)/1.22 var(--hand); color: var(--accent); margin-top: 26px; max-width: 34ch; transform: rotate(-1.2deg); transform-origin: left; text-wrap: pretty; }
.joke::before { content: "— "; }
.joke.center { margin-inline: auto; text-align: center; transform-origin: center; }
.fine { font-size: var(--fs-small); color: var(--muted); margin-top: 16px; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.fine > span { display: inline-flex; align-items: center; gap: 7px; }
.fine > span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .75; }
.example-note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 22px; }
.more-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 28px; font-weight: 700; text-decoration: none; color: var(--accent); }
.more-link svg { width: 18px; height: 18px; transition: transform .3s var(--spring); }
.more-link:hover svg { transform: translateX(4px); }
.more-link:hover span { text-decoration: underline; text-decoration-thickness: 1.5px; }

/* ============ 4. Кнопки ============ */
.btn {
  --bg: var(--accent); --fg: var(--accent-ink); --blot: var(--accent-2);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 24px; border-radius: var(--r-pill); border: 0;
  background: var(--bg); color: var(--fg); font-weight: 700; font-size: 16px; text-decoration: none; white-space: nowrap;
  cursor: pointer; overflow: hidden; isolation: isolate;
  transition: transform .25s var(--spring), box-shadow .25s var(--ease);
  box-shadow: 0 8px 22px -8px color-mix(in srgb, var(--accent) 70%, transparent);
}
.btn::before { /* чернильная клякса растекается от точки входа курсора */
  content: ""; position: absolute; z-index: -1; left: var(--bx, 50%); top: var(--by, 50%);
  width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: var(--blot); transform: scale(0); transition: transform .55s var(--ease);
}
.btn:hover::before { transform: scale(42); }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn .arrow { transition: transform .3s var(--spring); }
.btn:hover .arrow { transform: translateX(4px); }
.btn.ghost { --bg: transparent; --fg: var(--ink); --blot: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.small { min-height: 44px; padding: 0 18px; font-size: 15px; }
.btn.block { width: 100%; }
/* кнопка на листе бумаги: цвета листа не зависят от темы */
.btn.on-sheet { --bg: #2a44c8; --fg: #fff; --blot: #4f68e8; }
.btn.on-sheet.ghost { --bg: transparent; --fg: #1e2440; --blot: #e4e8fb; box-shadow: inset 0 0 0 1.5px #d6cdb8; }
@media (max-width: 420px) { .btn { white-space: normal; text-align: center; line-height: 1.25; padding: 10px 20px; } }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.cta-row.center { justify-content: center; }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 700; cursor: pointer; padding: 6px 2px; text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1.5px; font-size: 15px; display: inline-flex; gap: 6px; align-items: center; }
.link-btn svg { width: 16px; height: 16px; }

/* ============ 5. Шапка ============ */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 120; pointer-events: none; }
.progress i { position: absolute; inset: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform-origin: left; transform: scaleX(var(--p, 0)); border-radius: 0 3px 3px 0; }
.progress::after { /* капля на кончике чернильной полосы */
  content: ""; position: absolute; left: 0; top: -2px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); transform: translateX(calc(var(--p, 0) * (100vw - 7px))); }
.header { position: sticky; top: 0; z-index: 100; background: linear-gradient(var(--header-bg), var(--header-bg)), color-mix(in srgb, var(--paper) 94%, transparent); border-bottom: 1px solid transparent; transition: border-color .3s, background-color .6s; view-transition-name: pf-header; }
.header.scrolled { border-bottom-color: var(--line); }
.header .wrap { display: flex; align-items: center; gap: 14px; height: var(--header-h); max-width: 1600px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 20px; letter-spacing: -.02em; flex: none; }
.logo svg { width: 34px; height: 34px; transition: transform .5s var(--spring); }
.logo:hover svg { transform: rotate(-14deg) translateY(-2px); }
.logo .l-bg { fill: #2a44c8; } .logo .l-pen { fill: #f7f0e2; } .logo .l-cut { stroke: #2a44c8; } .logo .l-wave { stroke: #9fb0ff; }
.nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav > a, .nav-drop > button { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; padding: 8px 11px; border-radius: 10px; position: relative; border: 0; background: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.nav > a::after, .nav-drop > button::after { content: ""; position: absolute; left: 11px; right: 11px; bottom: 3px; height: 2px; background: var(--accent); border-radius: 2px; transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease); }
.nav > a:hover::after, .nav > a[aria-current="page"]::after, .nav-drop > button:hover::after, .nav-drop.open > button::after { transform: scaleX(1); }
.nav-drop { position: relative; }
.nav-drop > button svg { width: 14px; height: 14px; transition: transform .3s var(--ease); }
.nav-drop.open > button svg { transform: rotate(180deg); }
.drop-panel { position: absolute; left: -10px; top: calc(100% + 10px); width: 300px; padding: 10px; border-radius: 16px; background: var(--sheet); color: var(--on-sheet); box-shadow: var(--shadow-3); opacity: 0; visibility: hidden; transform: translateY(-8px) rotate(-1deg); transform-origin: 30px 0; transition: opacity .25s, transform .35s var(--spring), visibility 0s .35s; }
.drop-panel::before { content: ""; position: absolute; top: -9px; left: 50%; width: 60px; height: 18px; margin-left: -30px; background: var(--tape); transform: rotate(-3deg); }
.nav-drop.open .drop-panel { opacity: 1; visibility: visible; transform: none; transition: opacity .25s, transform .35s var(--spring), visibility 0s; }
.drop-panel a { display: grid; grid-template-columns: 34px 1fr; gap: 2px 10px; align-items: center; padding: 10px; border-radius: 10px; text-decoration: none; color: #1e2440; }
.drop-panel a:hover, .drop-panel a:focus-visible { background: #ece2cc; }
.drop-panel a svg { grid-row: span 2; width: 30px; height: 30px; color: #2a44c8; }
.drop-panel a b { font-size: 15px; }
.drop-panel a small { color: #6a6f85; font-size: 13px; line-height: 1.3; }
.header-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.header-actions .login { color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px; padding: 8px 10px; border-radius: 10px; }
.header-actions .login:hover { color: var(--accent); }
.header-actions .member-link { display: inline-flex; align-items: center; gap: 8px; min-width: 0; padding: 4px; }
.member-initial { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 15px; }
.member-name { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-logout { margin: 0; }
.header-actions .site-message-menu { order: 0; }

/* шнурок ночной лампы — переключатель темы */
.cord { position: relative; width: 40px; height: 44px; border: 0; background: none; cursor: pointer; padding: 0; flex: none; }
.cord .c-line { position: absolute; left: 50%; top: -14px; width: 2px; height: 42px; margin-left: -1px; background: repeating-linear-gradient(var(--muted) 0 3px, transparent 3px 5px); transform-origin: top; transition: transform .5s var(--spring); }
.cord .c-bead { position: absolute; left: 50%; top: 26px; width: 14px; height: 18px; margin-left: -7px; border-radius: 7px 7px 8px 8px; background: radial-gradient(circle at 35% 30%, #ffe7a8, #e3a33c 70%); box-shadow: 0 3px 6px rgba(0, 0, 0, .25); transition: transform .5s var(--spring), background .4s; }
.cord .c-tip { position: absolute; right: 36px; top: 16px; font: 600 1.15rem/1 var(--hand); color: var(--muted); white-space: nowrap; opacity: 0; transform: translateX(6px); transition: opacity .25s, transform .3s var(--ease); pointer-events: none; }
.cord:hover .c-tip, .cord:focus-visible .c-tip { opacity: 1; transform: none; }
.cord:hover .c-bead { transform: translateY(2px) rotate(6deg); }
.cord.pull .c-line { transform: scaleY(1.32); }
.cord.pull .c-bead { transform: translateY(14px); }
:root[data-theme="dark"] .cord .c-bead { background: radial-gradient(circle at 35% 30%, #fff8e0, #ffcf6a 60%, #ffb84e); box-shadow: 0 0 14px 4px rgba(255, 200, 120, .45); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cord .c-bead { background: radial-gradient(circle at 35% 30%, #fff8e0, #ffcf6a 60%, #ffb84e); box-shadow: 0 0 14px 4px rgba(255, 200, 120, .45); } }

/* меню на телефоне: лист из блокнота */
.menu-btn { display: none; width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: transparent; cursor: pointer; place-items: center; }
.menu-btn i { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; position: relative; transition: background .2s; }
.menu-btn i::before, .menu-btn i::after { content: ""; position: absolute; left: 0; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .3s var(--ease); }
.menu-btn i::before { top: -6px; } .menu-btn i::after { top: 6px; }
.menu-btn[aria-expanded="true"] i { background: transparent; }
.menu-btn[aria-expanded="true"] i::before { transform: translateY(6px) rotate(45deg); }
.menu-btn[aria-expanded="true"] i::after { transform: translateY(-6px) rotate(-45deg); }
.menu-panel { position: fixed; inset: var(--header-h) 0 auto 0; z-index: 99; max-height: calc(100dvh - var(--header-h)); overflow: auto; padding: 18px var(--gutter) 28px; background: var(--sheet); color: var(--on-sheet);
  background-image: linear-gradient(90deg, transparent 38px, var(--margin-red) 38px 39.5px, transparent 39.5px), repeating-linear-gradient(transparent 0 35px, var(--rule) 35px 36px);
  box-shadow: var(--shadow-3); transform-origin: top; transform: perspective(900px) rotateX(-70deg); opacity: 0; visibility: hidden; transition: transform .5s var(--ease-io), opacity .3s, visibility 0s .5s; }
.menu-panel.open { transform: none; opacity: 1; visibility: visible; transition: transform .5s var(--ease-io), opacity .3s, visibility 0s; }
.menu-panel h4 { margin: 14px 0 0 30px; font: 700 12px/36px var(--font); letter-spacing: .12em; text-transform: uppercase; color: #6a6f85; }
.menu-panel a { display: block; padding-left: 30px; line-height: 36px; font: 600 1.45rem/36px var(--hand); color: #1e2a7a; text-decoration: none; }
.menu-panel .cta-row { padding-left: 30px; }
.menu-panel .menu-logout { display: block; padding: 0 0 0 30px; border: 0; background: none; font: 600 1.45rem/36px var(--hand); color: #1e2a7a; cursor: pointer; text-align: left; }
@media (max-width: 1360px) { .nav { display: none; } .menu-btn { display: grid; } .header-actions { margin-left: auto; } }
@media (max-width: 560px) { .header-actions .login { display: none; } .header .btn.small { padding: 0 14px; } .cord .c-tip { display: none; } }
@media (max-width: 1600px) { .header-actions .member-name, .header-actions .member-logout { display: none; } }
@media (max-width: 560px) { .header-actions { gap: 6px; } .header-actions .member-link { display: inline-flex; padding: 0; } .header-actions .member-name, .header-actions > .btn.small { display: none; } }
@media (max-width: 370px) { .logo span { display: none; } }

/* ============ 6. Поля, ползунки, переключатели ============ */
.field { margin-bottom: 24px; }
.field label, .field .label { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-weight: 700; margin-bottom: 8px; }
.field output { font: 700 1.6rem/1 var(--hand); color: var(--accent); }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.field .error { font-size: 13px; color: var(--stamp); margin-top: 6px; }
.input { width: 100%; min-height: 50px; padding: 12px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink); transition: border-color .2s, box-shadow .2s; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input[aria-invalid="true"] { border-color: var(--stamp); }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.5; }
/* поле «на линейке»: ввод рукописным шрифтом на строке тетради */
.input.lined { border: 0; border-radius: 0; background: transparent; border-bottom: 2px solid var(--rule); font: 600 1.5rem/1.3 var(--hand); padding: 6px 2px; color: var(--accent); }
.input.lined:focus { box-shadow: none; border-bottom-color: var(--accent); }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 36px; background: transparent; cursor: pointer; --v: 50%; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--accent) var(--v), var(--line) var(--v)); }
.range::-moz-range-track { height: 6px; border-radius: 6px; background: var(--line); }
.range::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--accent); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%; background: var(--paper); border: 3px solid var(--accent); box-shadow: 0 4px 10px color-mix(in srgb, var(--accent) 40%, transparent); transition: transform .2s var(--spring); }
.range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--paper); border: 3px solid var(--accent); }
.range:active::-webkit-slider-thumb { transform: scale(1.18); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 0 16px; border-radius: var(--r-pill); border: 1.5px solid var(--line); background: transparent; cursor: pointer; font-weight: 600; font-size: 15px; transition: background .25s, border-color .25s, color .25s, transform .3s var(--spring); }
.chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.chip[aria-pressed="true"], .chip[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.f-hand { font: 600 1.2rem/1 var(--hand); }
.chip.f-script { font: 400 1.05rem/1 var(--script); }
/* переключатель срока с бегущей «пилюлей» */
.seg { position: relative; display: inline-flex; padding: 4px; border-radius: var(--r-pill); background: var(--stage); border: 1px solid var(--line); }
.seg .seg-pill { position: absolute; left: 0; top: 4px; bottom: 4px; width: 0; border-radius: var(--r-pill); background: var(--accent); box-shadow: 0 6px 14px -6px var(--accent); transition: transform .45s var(--spring), width .45s var(--spring); }
.seg button { position: relative; z-index: 1; border: 0; background: none; padding: 10px 18px; border-radius: var(--r-pill); font-weight: 700; cursor: pointer; color: var(--ink); transition: color .3s; }
.seg button[aria-pressed="true"] { color: var(--accent-ink); }
/* образцы чернил */
.inks { display: flex; gap: 10px; align-items: center; }
.ink { width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; background: var(--c, #1e2f9a); box-shadow: 0 0 0 3px var(--paper), 0 0 0 4.5px var(--line); transition: transform .3s var(--spring), box-shadow .25s; flex: none; }
.ink:hover { transform: scale(1.1); }
.ink[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5.5px var(--c); }
.ink.c-blue { --c: #1e2f9a; } .ink.c-black { --c: #1b1d26; } .ink.c-violet { --c: #5b2d9e; } .ink.c-green { --c: #1f6b45; }
:root[data-theme="dark"] .ink.c-black { box-shadow: 0 0 0 3px var(--paper), 0 0 0 4.5px #4a5276; }
/* вкладки (вертикальные карточки) */
.tabs { display: grid; gap: 8px; }
.tab { text-align: left; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line); background: transparent; cursor: pointer; transition: border-color .25s, background .25s, transform .3s var(--spring); }
.tab b { display: block; font-size: 16px; }
.tab small { color: var(--muted); font-size: 13px; }
.tab:hover { transform: translateX(4px); border-color: var(--accent); }
.tab[aria-selected="true"] { border-color: var(--accent); background: var(--accent-soft); }

/* ============ 7. Карточки, стикеры, скотч ============ */
.card { position: relative; padding: clamp(22px, 3vw, 32px); border-radius: var(--r-l); background: var(--stage); border: 1px solid var(--line); }
.card.paper { background: var(--sheet); color: var(--on-sheet); border-color: transparent; box-shadow: var(--shadow-2); border-radius: 6px; }
.tape::before { content: ""; position: absolute; top: -11px; left: 50%; width: 84px; height: 22px; margin-left: -42px; background: var(--tape); transform: rotate(-3deg); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.note { position: relative; display: block; padding: 30px 26px 26px; border-radius: 4px; background: var(--sheet); color: var(--on-sheet); box-shadow: var(--shadow-2); transform: rotate(var(--rot, 0deg)); transition: transform .45s var(--spring), box-shadow .45s; text-decoration: none; }
.note.n-yellow { background: var(--note); } .note.n-pink { background: var(--note-2); } .note.n-blue { background: var(--note-3); }
.note.tilt-l { --rot: -1.3deg; } .note.tilt-r { --rot: 1.1deg; } .note.tilt-s { --rot: .6deg; }
a.note:hover, a.note:focus-visible, .note:focus-within { transform: rotate(0) translateY(-8px); box-shadow: var(--shadow-3); }
.note h3 { color: #141a33; }
.note p { color: #4a4f66; margin-top: 10px; font-size: 16px; }
.note .q { font: 600 1.35rem/1.2 var(--hand); color: #2a44c8; margin-top: 16px; }
.note .ic { width: 50px; height: 50px; margin-bottom: 14px; color: #2a44c8; }
.note .go { display: inline-flex; align-items: center; gap: 6px; margin-top: 16px; font-weight: 700; color: #2a44c8; font-size: 15px; }
.note .go svg { width: 16px; height: 16px; transition: transform .3s var(--spring); }
a.note:hover .go svg { transform: translateX(4px); }
.badge { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 13px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px; }
.pill svg { width: 16px; height: 16px; }
.honest { display: inline-flex; gap: 10px; align-items: center; padding: 10px 16px; border-radius: 12px; border: 1px dashed var(--accent); color: var(--ink); font-size: 14px; }
/* рваный лист: «Проба пера» и другие предложения */
.torn { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center; padding: 26px 28px 22px; background: var(--sheet); color: var(--on-sheet); box-shadow: var(--shadow-2);
  clip-path: polygon(0 7%, 3% 0, 7% 5%, 12% 0, 18% 4%, 25% 0, 33% 5%, 41% 1%, 50% 5%, 58% 0, 66% 4%, 74% 0, 82% 5%, 89% 1%, 95% 5%, 100% 0, 100% 100%, 0 100%); transform: rotate(-.4deg); }
.torn .t-name { font: 400 2.3rem/1 var(--script); color: #2a44c8; }
.torn p { color: #4a4f66; }
.torn p b { color: #1e2440; }
@media (max-width: 760px) { .torn { grid-template-columns: 1fr; gap: 10px; } }
/* Карточка «Проба пера»: название · условия · кнопка в одну строку, описание и состав пробы — ниже на всю ширину */
#trial.torn { grid-template-columns: auto 1fr auto; row-gap: 10px; }
#trial.torn > .t-name { grid-column: 1; grid-row: 1; }
#trial.torn > p:first-of-type { grid-column: 2; grid-row: 1; }
#trial.torn > .btn { grid-column: 3; grid-row: 1; white-space: nowrap; justify-self: end; }
#trial.torn > p:nth-of-type(2), #trial.torn > details { grid-column: 1 / -1; }
@media (max-width: 760px) { #trial.torn > * { grid-column: 1 / -1 !important; grid-row: auto !important; } #trial.torn > .btn { justify-self: start; } }
/* стикер-пакет */
.pack { position: relative; display: block; padding: 24px 22px 20px; background: var(--note); color: var(--note-ink); box-shadow: 0 16px 24px -14px rgba(20, 26, 51, .45); transform: rotate(var(--r, -1deg)); transition: transform .4s var(--spring); }
.pack:nth-child(3n+2) { --r: 1deg; background: var(--note-3); color: var(--note-3-ink); }
.pack:nth-child(3n) { --r: -.5deg; background: var(--note-2); color: var(--note-2-ink); }
.pack:hover { transform: rotate(0) translateY(-6px); }
.pack h3 { font-size: 1.15rem; }
.pack .p-price { font: 700 1.9rem/1 var(--hand); margin-top: 10px; }
.pack p { margin-top: 8px; font-size: 14px; opacity: .85; }
.pack::after { content: ""; position: absolute; right: 0; bottom: 0; border-width: 0 0 22px 22px; border-style: solid; border-color: transparent transparent var(--paper) rgba(0, 0, 0, .08); transition: border-width .3s; }
.pack:hover::after { border-width: 0 0 34px 34px; }

/* ============ 8. Вопросы (аккордеон) ============ */
.faq { max-width: 860px; margin: clamp(32px, 5vw, 50px) auto 0; border-radius: 20px; overflow: hidden; background: var(--stage); border: 1px solid var(--line); }
.faq.on-alt { background: var(--paper); }
.faq details { border-bottom: 1px solid var(--line); }
.faq details:last-child { border-bottom: 0; }
.faq summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 22px clamp(18px, 3vw, 30px); font-weight: 700; font-size: 1.08rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary:hover { color: var(--accent); }
.faq .pm { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1.5px solid var(--line); position: relative; transition: transform .4s var(--spring), background .3s, border-color .3s; }
.faq .pm::before, .faq .pm::after { content: ""; position: absolute; left: 50%; top: 50%; width: 12px; height: 2px; margin: -1px 0 0 -6px; background: var(--ink); border-radius: 2px; transition: transform .3s; }
.faq .pm::after { transform: rotate(90deg); }
.faq details[open] .pm { transform: rotate(180deg); background: var(--accent); border-color: var(--accent); }
.faq details[open] .pm::before, .faq details[open] .pm::after { background: var(--accent-ink); }
.faq details[open] .pm::after { transform: rotate(0); }
.faq details::details-content { block-size: 0; overflow: hidden; transition: block-size .4s var(--ease), content-visibility .4s allow-discrete; }
.faq details[open]::details-content { block-size: auto; }
.faq .a { padding: 0 clamp(18px, 3vw, 30px) 22px; color: var(--muted); max-width: 66ch; }

/* ============ 9. Тетради-тарифы (обложка откидывается ВВЕРХ) ============ */
/* Полка: над тетрадями оставлено место «стола», куда встаёт откинутая обложка. */
.shelf { --nb-h: 470px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3vw, 40px); padding-top: calc(var(--nb-h) * .62); margin-top: 28px; align-items: end; }
.shelf + .example-note { margin-top: 58px; }
.nb { position: relative; --thick: 6; --cv: var(--cover-1); perspective: 2600px; perspective-origin: 50% 10%; z-index: 1; }
.nb[data-size="2"] { --thick: 12; --cv: var(--cover-2); }
.nb[data-size="3"] { --thick: 20; --cv: var(--cover-3); }
.nb.is-open, .nb.is-closing { z-index: 3; }
.nb-hint { position: absolute; left: 0; right: 0; bottom: calc(100% + 18px); text-align: center; font: 600 1.35rem/1.1 var(--hand); color: var(--muted); transition: opacity .4s; pointer-events: none; }
.nb-hint svg { width: 44px; height: 40px; margin: 6px auto 0; }
.nb.is-open .nb-hint { opacity: 0; }
.nb-body { position: relative; transform-style: preserve-3d; padding-bottom: calc(var(--thick) * 1px); transition: transform .6s var(--spring); }
.nb-edge { position: absolute; left: 5px; right: 0; bottom: 0; height: calc(var(--thick) * 1px + 16px); border-radius: 0 0 10px 6px; background: repeating-linear-gradient(var(--sheet) 0 2px, var(--sheet-edge) 2px 3px); box-shadow: 0 18px 30px -12px rgba(20, 26, 51, .45); }
.nb-page { position: relative; height: var(--nb-h); padding: 50px 26px 24px; border-radius: 6px 6px 12px 12px; color: var(--on-sheet);
  background-color: var(--sheet); background-image: linear-gradient(90deg, transparent 18px, var(--margin-red) 18px 19.5px, transparent 19.5px), repeating-linear-gradient(transparent 0 29px, var(--rule) 29px 30px); background-position: 0 0, 0 42px; box-shadow: var(--shadow-1); display: flex; flex-direction: column; }
.nb-page::after { /* тень от поднятой обложки на первой странице */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; background: linear-gradient(rgba(20, 26, 51, .42), rgba(20, 26, 51, .1) 26%, transparent 58%); }
.nb.is-open .nb-page::after { animation: nb-page-shade 1.3s var(--ease-io) forwards; }
.nb.is-closing .nb-page::after { animation: nb-page-shade-out .9s var(--ease-io) forwards; }
.nb-kind { font: 700 11px/1 var(--font); letter-spacing: .14em; text-transform: uppercase; color: #8b8fa4; }
.nb-name { font: 400 2.2rem/1 var(--script); color: #2a44c8; letter-spacing: 0; margin-top: 8px; }
.nb-sub { color: #6a6f85; font-size: 14px; margin-top: 4px; }
.nb-price { font: 800 2.3rem/1 var(--font); letter-spacing: -.03em; margin-top: 14px; color: #141a33; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.nb-price small { font-size: 14px; font-weight: 600; color: #6a6f85; letter-spacing: 0; }
.nb-pages { font: 600 1.35rem/1.2 var(--hand); color: #2a44c8; margin-top: 6px; }
.nb-feats { list-style: none; padding: 0; margin: 12px 0 18px; }
.nb-feats li { display: flex; gap: 10px; align-items: center; min-height: 30px; font-size: 15px; color: #2b3150; }
.nb-feats li::before { content: "✓"; font: 700 1.25rem/1 var(--hand); color: #2a44c8; width: 14px; flex: none; }
.nb-feats li.no { color: #9aa0b6; }
.nb-feats li.no::before { content: "–"; color: #9aa0b6; }
.nb.is-open .nb-feats li { animation: nb-li .5s var(--ease) both; }
.nb.is-open .nb-feats li:nth-child(1) { animation-delay: .7s; } .nb.is-open .nb-feats li:nth-child(2) { animation-delay: .78s; }
.nb.is-open .nb-feats li:nth-child(3) { animation-delay: .86s; } .nb.is-open .nb-feats li:nth-child(4) { animation-delay: .94s; }
.nb.is-open .nb-feats li:nth-child(5) { animation-delay: 1.02s; } .nb.is-open .nb-feats li:nth-child(6) { animation-delay: 1.1s; }
.nb-page .btn { margin-top: auto; }
.nb-ppp { font-size: 12.5px; color: #6a6f85; margin-top: 10px; text-align: center; }
.nb-close { position: absolute; right: 14px; top: 22px; border: 0; background: none; font: 600 1.15rem/1 var(--hand); color: #6a6f85; cursor: pointer; padding: 4px 6px; border-radius: 8px; display: inline-flex; gap: 4px; align-items: center; }
.nb-close:hover { color: #2a44c8; }
.nb-close svg { width: 14px; height: 14px; }
/* спираль сверху — шарнир обложки */
.nb-spiral { position: absolute; top: -11px; left: 20px; right: 20px; height: 24px; z-index: 6; display: flex; justify-content: space-between; pointer-events: none; transform: translateZ(3px); }
.nb-spiral i { width: 9px; height: 24px; border-radius: 6px; border: 2.5px solid #9aa3c0; border-bottom-color: #6f7795; background: linear-gradient(90deg, rgba(255, 255, 255, .5), transparent 60%); }
/* обложка: две половины, нижняя гнётся с запаздыванием — картон, а не стекло */
.nb-lid { position: absolute; left: 0; right: 0; top: 0; height: calc(var(--nb-h) / 2); transform-origin: 50% 0; transform-style: preserve-3d; z-index: 5; transform: translateZ(1px) rotateX(0deg); transition: transform .5s var(--spring); cursor: pointer; }
.nb-lid-low { position: absolute; left: 0; right: 0; top: calc(100% - 1px); height: calc(100% + 1px); transform-origin: 50% 0; transform-style: preserve-3d; }
.nb-face { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.nb-face.back { transform: translateZ(1px) rotateX(180deg); }
.nb-lid > .nb-face { border-radius: 6px 6px 0 0; }
.nb-lid-low > .nb-face.front { border-radius: 0 0 12px 12px; }
.nb-lid-low > .nb-face.back { border-radius: 12px 12px 0 0; }
.nb-lid > .nb-face.back { border-radius: 0 0 6px 6px; }
.nb-face::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.nb-face.front::after { background: linear-gradient(rgba(0, 0, 0, .55), rgba(0, 0, 0, .25)); }
.nb-face.back::after { background: rgba(10, 14, 30, .55); opacity: .6; }
.nb-cv, .nb-in { position: absolute; left: 0; right: 0; height: 200%; }
.nb-lid > .front .nb-cv { top: 0; } .nb-lid-low > .front .nb-cv { top: calc(-100% + 1px); height: calc(200% - 2px); }
.nb-lid > .back .nb-in { top: -100%; } .nb-lid-low > .back .nb-in { top: 0; }
/* лицевая сторона обложки */
.nb-cv { padding: 40px 26px 30px; display: flex; flex-direction: column; color: #fff; background: radial-gradient(130% 80% at 15% 0%, color-mix(in srgb, var(--cv) 62%, #fff), var(--cv) 58%, color-mix(in srgb, var(--cv) 80%, #000)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.nb-cv::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(-45deg, rgba(255, 255, 255, .04) 0 2px, transparent 2px 7px); pointer-events: none; }
.nb-cv .top { position: relative; z-index: 1; display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .88; }
.nb-cv .big { position: relative; z-index: 1; font: 800 3rem/1 var(--font); letter-spacing: -.04em; margin-top: 26px; }
.nb-cv .big small { font-size: .34em; font-weight: 600; opacity: .8; letter-spacing: 0; }
.nb-cv .lbl { position: relative; z-index: 1; margin-top: auto; background: #fbf6ea; color: #1d2a7a; padding: 16px 18px 14px; border-radius: 8px; transform: rotate(-1.5deg); box-shadow: 0 8px 16px -8px rgba(0, 0, 0, .5); }
.nb-cv .lbl b { font: 400 2.3rem/1 var(--script); display: block; }
.nb-cv .lbl span { display: block; font-size: 13px; color: #6a6f85; margin-top: 6px; }
.nb-cv .lbl i { display: block; height: 1px; background: #d9d3c3; margin-top: 8px; }
.nb-cv .peek { position: relative; z-index: 1; margin-top: 16px; font: 600 1.3rem/1 var(--hand); opacity: .9; display: flex; align-items: center; gap: 8px; }
.nb-cv .peek svg { width: 22px; height: 22px; }
.nb-cv .stamp { position: absolute; z-index: 2; right: 16px; top: 74px; width: 92px; height: 92px; color: #ffcf4a; transform: rotate(14deg); }
/* внутренняя сторона обложки: картон с надписью от руки */
.nb-in { background: linear-gradient(color-mix(in srgb, var(--cv) 9%, #eadcbf), color-mix(in srgb, var(--cv) 5%, #f1e6cf)); color: #3a3f58; padding: 34px 28px 40px; display: flex; flex-direction: column; justify-content: space-between; }
.nb-in::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(120, 100, 60, .05) 0 1px, transparent 1px 5px); }
.nb-in .sched { position: relative; display: grid; gap: 0; padding: 12px 14px 8px; border: 1.5px solid rgba(90, 80, 60, .35); border-radius: 4px; background: repeating-linear-gradient(transparent 0 27px, rgba(90, 80, 60, .22) 27px 28px); background-position: 0 30px; }
.nb-in .sched span { font: 800 11px/1 var(--font); letter-spacing: .16em; text-transform: uppercase; color: #7d7764; padding-bottom: 8px; }
.nb-in .sched i { font: 600 1.3rem/28px var(--hand); font-style: normal; color: #24308a; }
.nb-in .sched i.ok { color: #b0303e; }
.nb-in .own { position: relative; font: 600 1.55rem/1.25 var(--hand); color: #24308a; transform: rotate(-2deg); }
.nb-in .own span { display: block; font: 700 11px/1 var(--font); letter-spacing: .14em; text-transform: uppercase; color: #7d7764; margin-bottom: 8px; transform: rotate(2deg); }
.nb-in .line { position: relative; display: block; height: 1px; background: #a99f86; margin-top: 30px; width: 70%; }
.nb-in .line::after { content: "владелец"; position: absolute; left: 0; top: 6px; font: 600 11px/1 var(--font); letter-spacing: .1em; text-transform: uppercase; color: #8d866f; }
/* открытие: сначала край приподнимается, низ отстаёт (изгиб), потом обложка встаёт и чуть пружинит */
.nb:not(.is-open):not(.is-closing):hover .nb-lid { transform: translateZ(1px) rotateX(10deg); }
.nb:not(.is-open):not(.is-closing):hover .nb-body { transform: translateY(-6px); }
.nb.is-open .nb-lid { animation: nb-lid-open 1.3s var(--ease-io) forwards; }
.nb.is-open .nb-lid-low { animation: nb-lid-bend 1.3s var(--ease-io) forwards; }
.nb.is-open .nb-face.front::after { animation: nb-front-shade 1.3s var(--ease-io) forwards; }
.nb.is-open .nb-face.back::after { animation: nb-back-shade 1.3s var(--ease-io) forwards; }
.nb.is-closing .nb-lid { animation: nb-lid-close .95s cubic-bezier(.55, 0, .75, .4) forwards; }
.nb.is-closing .nb-lid-low { animation: nb-lid-bend-close .95s linear forwards; }
.nb.is-closing .nb-face.front::after { animation: nb-front-shade-out .95s forwards; }
.nb.is-closing .nb-face.back::after { animation: nb-back-shade-out .95s forwards; }
@keyframes nb-lid-open { 0% { transform: translateZ(1px) rotateX(0deg); } 16% { transform: translateZ(1px) rotateX(16deg); } 52% { transform: translateZ(1px) rotateX(98deg); } 74% { transform: translateZ(1px) rotateX(124deg); } 88% { transform: translateZ(1px) rotateX(113deg); } 100% { transform: translateZ(1px) rotateX(117deg); } }
@keyframes nb-lid-bend { 0% { transform: translateZ(1px) rotateX(0deg); } 14% { transform: translateZ(1px) rotateX(-14deg); } 40% { transform: translateZ(1px) rotateX(-12deg); } 64% { transform: translateZ(1px) rotateX(4deg); } 80% { transform: translateZ(1px) rotateX(9deg); } 100% { transform: translateZ(1px) rotateX(5deg); } }
@keyframes nb-front-shade { 0% { opacity: 0; } 50% { opacity: .9; } 100% { opacity: 1; } }
@keyframes nb-back-shade { 0% { opacity: .9; } 45% { opacity: .75; } 100% { opacity: 0; } }
@keyframes nb-page-shade { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: .3; } }
@keyframes nb-lid-close { 0% { transform: translateZ(1px) rotateX(117deg); } 82% { transform: translateZ(1px) rotateX(-1.5deg); } 92% { transform: translateZ(1px) rotateX(1.5deg); } 100% { transform: translateZ(1px) rotateX(0deg); } }
@keyframes nb-lid-bend-close { 0% { transform: translateZ(1px) rotateX(5deg); } 45% { transform: translateZ(1px) rotateX(14deg); } 80% { transform: translateZ(1px) rotateX(-6deg); } 100% { transform: translateZ(1px) rotateX(0deg); } }
@keyframes nb-front-shade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes nb-back-shade-out { from { opacity: .06; } 60% { opacity: .8; } to { opacity: .9; } }
@keyframes nb-page-shade-out { from { opacity: .3; } 70% { opacity: .9; } to { opacity: 0; } }
@keyframes nb-li { from { opacity: 0; transform: translateX(-8px); } }
.nb-toggle { position: absolute; inset: 0 0 calc(var(--thick) * 1px) 0; z-index: 7; border: 0; background: transparent; cursor: pointer; border-radius: 6px 6px 12px 12px; transform: translateZ(4px); }
.nb.is-open .nb-toggle { display: none; }
.nb-shadow { position: absolute; left: 8%; right: 8%; bottom: -24px; height: 22px; border-radius: 50%; background: radial-gradient(closest-side, rgba(20, 26, 51, .28), transparent); }
/* без JS: обложек нет, состав виден сразу */
html:not(.js) .nb-lid, html:not(.js) .nb-toggle, html:not(.js) .nb-hint { display: none; }
html:not(.js) .shelf { padding-top: 0; }
@media (max-width: 960px) {
  .shelf { grid-template-columns: minmax(0, 420px); justify-content: center; gap: calc(var(--nb-h) * .62 + 56px); }
}
@media (max-width: 420px) { .shelf { --nb-h: 450px; } .nb-cv .big { font-size: 2.6rem; } }

/* ============ 10. Подвал с фразами ============ */
.footer { background: var(--paper); border-top: 1px solid var(--line); padding: 56px 0 40px; font-size: 15px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(4, 1fr); gap: 32px; }
.footer h4 { margin: 0 0 12px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.footer a { color: var(--ink); text-decoration: none; }
.footer a:hover { color: var(--accent); }
.footer .about { color: var(--muted); font-size: 14px; margin-top: 14px; max-width: 36ch; }
.phrase-box { position: relative; margin-bottom: 44px; padding: 12px 70px 10px 22px; border-radius: 6px; background: var(--sheet); box-shadow: var(--shadow-2); color: var(--on-sheet);
  background-image: linear-gradient(90deg, transparent 12px, var(--margin-red) 12px 13.5px, transparent 13.5px); }
.phrase-box canvas { width: 100%; height: 96px; }
.phrase-box .more { position: absolute; right: 14px; bottom: 14px; border: 0; background: #2a44c8; color: #fff; width: 42px; height: 42px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; transition: transform .5s var(--spring); }
.phrase-box .more:hover { transform: rotate(180deg); }
.phrase-box .more svg { width: 20px; height: 20px; }
.phrase-box .label { position: absolute; left: 22px; top: -11px; padding: 3px 10px; border-radius: 6px; background: var(--tape); font: 700 11px/1.4 var(--font); letter-spacing: .12em; text-transform: uppercase; color: #3a3f58; transform: rotate(-2deg); }
.copy-row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
@media (max-width: 960px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }
@media (max-width: 400px) { .footer-grid { grid-template-columns: 1fr; } }

/* ============ 11. Появление ============ */
.reveal { opacity: 0; translate: 0 26px; transition: opacity .9s var(--ease), translate .9s var(--ease), transform .9s var(--ease); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; translate: none; }
/* «как страница тетради»: заголовок секции перелистывается от верхнего края */
.reveal.page-in { transform: translateY(16px) skewX(-1deg) scaleY(.97); transform-origin: 50% 0; }
.reveal.page-in.in { transform: none; }
.d1 { --d: .08s; } .d2 { --d: .16s; } .d3 { --d: .24s; } .d4 { --d: .32s; } .d5 { --d: .4s; } .d6 { --d: .48s; }
html:not(.js) .reveal { opacity: 1; translate: none; transform: none; }
/* первый визит: строки «дописываются» слева направо */
.first-visit .write-in { clip-path: inset(-20% 100% -20% 0); transition: clip-path 1.1s var(--ease-io); transition-delay: var(--d, 0s); }
.first-visit .write-in.in { clip-path: inset(-20% -2% -20% 0); }

/* ============ 12. Чернильный след курсора и ночная лампа ============ */
.ink-trail { position: fixed; inset: 0; z-index: 90; pointer-events: none; width: 100vw; height: 100vh; }
[data-ink-zone] { cursor: url("../img/nib-cursor.svg") 4 28, crosshair; }
[data-ink-zone] a, [data-ink-zone] button, [data-ink-zone] input, [data-ink-zone] textarea, [data-ink-zone] label { cursor: pointer; }
[data-ink-zone] textarea, [data-ink-zone] input[type="text"] { cursor: text; }
/* Ночная лампа (ui.js): мягкое CSS-пятно и абажур у края экрана.
   Работает только в тёмной теме. Важные места страницы отмечаются атрибутом data-lamp
   (data-lamp="2" — важнее соседей); источник света на сцене — data-lamp-source. */
.lamp-night { position: fixed; inset: var(--header-h) 0 0; z-index: 88; pointer-events: none; overflow: hidden; contain: strict; background: var(--lamp-dim); opacity: 0; transition: opacity .9s var(--ease); }
.lamp-night.on { opacity: 1; }
.lamp-track { position: absolute; inset: 0; }
.lamp-glow { position: absolute; left: 0; top: 0; width: 120vw; height: 125vh;
  background: radial-gradient(ellipse closest-side, rgba(var(--lamp-warm), .10) 0%, rgba(var(--lamp-warm), .096) 12%, rgba(var(--lamp-warm), .08) 25%, rgba(var(--lamp-warm), .055) 40%, rgba(var(--lamp-warm), .027) 58%, rgba(var(--lamp-warm), .008) 76%, rgba(var(--lamp-warm), 0) 100%);
  transition: transform var(--lamp-move) var(--lamp-ease); }
.lamp-night:not(.on) .lamp-glow, .lamp-night.suspended .lamp-glow { transition: none; }
.lamp-night.suspended, .lamp-edge.suspended { visibility: hidden; transition: none; }
.lamp-edge.suspended .le-shade { transition: none; }
/* абажур выглядывает из-за правого края, раструбом к пятну; шарнир — сама точка .lamp-edge */
.lamp-edge { position: fixed; right: clamp(26px, 3.2vw, 46px); top: calc(var(--header-h) + 30px); width: 0; height: 0; z-index: 95; pointer-events: none; opacity: 0; transform: translateX(200px); transition: transform 1.1s var(--ease-io), opacity .6s var(--ease); }
.lamp-edge.on { opacity: 1; transform: none; }
.lamp-edge.on.away { opacity: 0; transform: translateX(200px); }
.le-arm { position: absolute; left: -3px; top: -3px; width: 240px; height: 6px; border-radius: 3px; background: linear-gradient(#5a6188, #2c3150); transform: rotate(-24deg); transform-origin: 3px 3px; box-shadow: 0 6px 10px -4px rgba(0, 0, 0, .5); }
.le-arm::before { content: ""; position: absolute; left: -6px; top: -5px; width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #7a82a8, #2c3150); }
.le-shade { position: absolute; left: -36px; top: -6px; width: 72px; height: 66px; transform-origin: 36px 6px; transform: rotate(45deg); transition: transform var(--lamp-move) var(--lamp-ease); }
.le-shade::before { content: ""; position: absolute; inset: 0; clip-path: polygon(30% 0, 70% 0, 100% 100%, 0 100%); background: linear-gradient(90deg, #141b3f, #3b51c0 42%, #24308a 70%, #141b3f); }
.le-rim { position: absolute; left: -3px; right: -3px; bottom: -5px; height: 11px; border-radius: 50%; background: radial-gradient(closest-side, #fffbe9, #ffd98c 55%, rgba(255, 196, 110, 0)); }
.le-bulb { position: absolute; left: 50%; bottom: -34px; width: 70px; height: 50px; margin-left: -35px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 226, 170, .7), rgba(255, 200, 120, 0)); }
@media (max-width: 560px) { .lamp-edge { right: 2px; top: calc(var(--header-h) + 14px); } .le-shade { scale: .55; } .le-arm { width: 60px; } }
/* фрагмент, на котором сейчас свет (крючок для страниц; по умолчанию без своего оформления) */
/* фрагмент под лампой: второстепенный текст в нём светлее — свет помогает читать */
:root[data-theme="dark"] .lamp-lit { --muted: #b3b9d1; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lamp-lit { --muted: #b3b9d1; } }

/* ============ 13. Перелистывание между страницами ============ */
@view-transition { navigation: auto; }
::view-transition-group(root) { animation-duration: .7s; }
::view-transition-old(root) { animation: pf-turn-out .7s var(--ease-io) both; transform-origin: 0 50%; z-index: 2; }
::view-transition-new(root) { animation: pf-turn-under .7s var(--ease) both; z-index: 1; }
@keyframes pf-turn-out { 0% { transform: perspective(2200px) rotateY(0); filter: brightness(1); } 100% { transform: perspective(2200px) rotateY(-96deg); filter: brightness(.82); } }
@keyframes pf-turn-under { 0% { transform: scale(.985); filter: brightness(.86); } 100% { transform: none; filter: none; } }
/* перелистывание к разделу на этой же странице */
html.turning-section::view-transition-old(root) { animation: pf-flip-up .55s var(--ease-io) both; transform-origin: 50% 0; }
html.turning-section::view-transition-new(root) { animation: pf-turn-under .55s var(--ease) both; }
@keyframes pf-flip-up { to { transform: perspective(1800px) rotateX(70deg) translateY(-6%); opacity: 0; } }
/* На телефоне остаются появления разделов, без двух полноэкранных снимков. */
@media (max-width: 760px), (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

/* ============ 14. Бережное движение ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; transition-delay: 0s !important; }
  .reveal, .reveal.page-in { opacity: 1; translate: none; transform: none; }
  .first-visit .write-in { clip-path: none; }
  .ink-trail { display: none; }
  .lamp-night { transition: none; }
  [data-ink-zone] { cursor: auto; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}

/* фильтр «чернила»: цвет заливки берётся из чернил сайта */
.inkflood { flood-color: var(--pen-ink); }

/* Декорации работают только в видимой активной сцене. */
.js .motion-scope { --motion-play: paused; }
.js .motion-scope.motion-active { --motion-play: running; }
.js .motion-scope, .js .motion-scope *, .js .motion-scope::before, .js .motion-scope::after,
.js .motion-scope *::before, .js .motion-scope *::after { animation-play-state: var(--motion-play); }
.js .motion-reset, .js .motion-reset * { animation-name: none !important; }
.js .motion-scope:not(.motion-visible), .js .motion-scope:not(.motion-visible) * { transition: none !important; }
.motion-hidden *, .motion-hidden *::before, .motion-hidden *::after { animation-play-state: paused !important; transition: none !important; }
.motion-economy *, .motion-economy *::before, .motion-economy *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0ms !important; }
.motion-reduced .motion-scope { --motion-play: running; }
.motion-reduced :is(.steam,.cover-ring,.caret,.tape-track,.art-doc,.art-tune,.art-out,.printer-out,.cone,.stars),
.motion-reduced :is(.steam,.cover-ring,.caret,.tape-track,.art-doc,.art-tune,.art-out,.printer-out,.cone,.stars) * { animation-name: none !important; }
.motion-economy .lamp-glow { transition: none; }
/* Закрытая обложка остаётся плоской до наведения или открытия. */
.nb:not(.is-open):not(.is-closing):not(:hover):not(:focus-within) { perspective: none; }
.nb:not(.is-open):not(.is-closing):not(:hover):not(:focus-within) .nb-body,
.nb:not(.is-open):not(.is-closing):not(:hover):not(:focus-within) .nb-lid,
.nb:not(.is-open):not(.is-closing):not(:hover):not(:focus-within) .nb-lid-low { transform-style: flat; }
.nb:not(.is-open):not(.is-closing):not(:hover):not(:focus-within) .nb-lid,
.nb:not(.is-open):not(.is-closing):not(:hover):not(:focus-within) .nb-spiral { transform: none; }
.nb:not(.is-open):not(.is-closing):not(:hover):not(:focus-within) .nb-face.back { display: none; }
.js .nb.motion-scope:not(.motion-visible) { content-visibility: hidden; contain-intrinsic-block-size: calc(var(--nb-h) + var(--thick) * 1px); }
.js :is(.steam,.cover-ring,.caret,.tape-track,.art-doc,.art-tune,.art-out,.printer-out,.cone,.stars).motion-scope:not(.motion-visible),
.js :is(.steam,.cover-ring,.caret,.tape-track,.art-doc,.art-tune,.art-out,.printer-out,.cone,.stars).motion-scope:not(.motion-visible) * { animation-name: none !important; }
/* Форма берётся из готовой маски вместо SVG-фильтра на каждом листе. */
img.ink-raster { object-position: -100000px -100000px; background-color: var(--pen-ink); mask-size: 100% 100%; mask-position: center; mask-repeat: no-repeat; filter: none !important; }
.compare .hw img.ink-raster { mask-size: contain; }
