/* КаФоТека · картотека практик. Цвета бренда и интерфейса заданы токенами; цвет метода приходит на элемент через --m и его тона. */
:root {
  --bg: #F6F2EE; --surface: #FFFFFF; --surface-2: #FBF8F5; --fg: #23201F; --muted: #6A625F; --line: #E6DED8;
  --brand: #E8742A; --brand-ink: #B4561A; --focus: #2C5AA0;
  --f-display: "Unbounded", "Golos Text", system-ui, sans-serif;
  --f-body: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --r: 14px; --shadow: 0 1px 2px rgba(60,35,20,.06), 0 6px 24px rgba(60,35,20,.08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171514; --surface: #221F1E; --surface-2: #1C1A19; --fg: #EFEAE6; --muted: #A79F9A; --line: #37312E;
    --brand: #F08A45; --brand-ink: #F5A672; --focus: #8FB3EE; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #171514; --surface: #221F1E; --surface-2: #1C1A19; --fg: #EFEAE6; --muted: #A79F9A; --line: #37312E;
  --brand: #F08A45; --brand-ink: #F5A672; --focus: #8FB3EE; --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 16px; line-height: 1.55; }
a { color: inherit; }
img, svg { max-width: 100%; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 16px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

/* шапка */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
@media (min-width: 720px) { .top-in { padding: 12px 32px; } }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo picture, .logo img { display: block; height: 40px; width: auto; }
.logo span { display: grid; line-height: 1.1; }
.logo b { font-family: var(--f-display); font-weight: 700; font-size: 18px; color: var(--brand-ink); }
.logo small { font-size: 12px; color: var(--muted); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { text-decoration: none; font-size: 14px; font-weight: 500; padding: 6px 10px; border-radius: 999px; color: var(--muted); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--fg); background: var(--surface-2); }

/* первый экран */
.hero { padding: 40px 0 28px; display: grid; gap: 12px; max-width: 760px; }
.hero.small { padding-bottom: 12px; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-ink); }
h1 { overflow-wrap: break-word; hyphens: auto; -webkit-hyphens: auto; font-family: var(--f-display); font-weight: 600; font-size: clamp(26px, 4.6vw, 42px); line-height: 1.12; margin: 0; text-wrap: balance; }
.lead { margin: 0; font-size: 17px; color: var(--muted); max-width: 64ch; }
.search { position: relative; margin-top: 8px; }
.search svg { position: absolute; left: 16px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.search input { width: 100%; font: inherit; font-size: 17px; padding: 14px 16px 14px 46px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.search input:focus { outline: 2px solid var(--focus); outline-offset: 1px; }

/* фильтры + результаты */
.layout { display: grid; gap: 28px; padding-bottom: 64px; }
@media (min-width: 960px) { .layout { grid-template-columns: 300px 1fr; align-items: start; } .filters { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow: auto; padding-right: 4px; } }
.filters { display: grid; gap: 22px; }
.filters h2 { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font: inherit; font-size: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 999px; padding: 5px 11px; cursor: pointer; text-decoration: none; }
.tag:hover { border-color: var(--brand); }
.tag[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.fams { display: grid; gap: 6px; }
.fbtn { width: 100%; font: inherit; font-size: 14px; font-weight: 500; text-align: left; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; }
.fbtn[aria-pressed="true"] { border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
.fbtn .sw { display: flex; flex: none; }
.fbtn .sw span { width: 10px; height: 22px; }
.fbtn .sw span:first-child { border-radius: 5px 0 0 5px; } .fbtn .sw span:last-child { border-radius: 0 5px 5px 0; }
.fname { flex: 1; line-height: 1.25; }
.n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mlist { display: grid; gap: 4px; padding: 6px 0 4px 12px; }
.mbtn { font: inherit; font-size: 14px; display: flex; align-items: center; gap: 8px; text-align: left; padding: 6px 10px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--fg); cursor: pointer; }
.mbtn .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.mbtn .n { margin-left: auto; }
.mbtn:hover:not(:disabled) { background: var(--surface); }
.mbtn[aria-pressed="true"] { background: var(--c); color: #fff; }
.mbtn[aria-pressed="true"] .n { color: #fff; }
.mbtn:disabled { color: var(--muted); cursor: default; opacity: .75; }

.res-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; min-height: 32px; }
.res-head p { margin: 0; font-weight: 600; }
.active { display: flex; flex-wrap: wrap; gap: 6px; }
.active button { font: inherit; font-size: 13px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--fg); cursor: pointer; }
.active button::after { content: " ✕"; color: var(--muted); }
.active .clear { border: none; background: none; text-decoration: underline; color: var(--muted); }
.active .clear::after { content: ""; }

.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); }
.tile a { display: grid; grid-template-columns: 1fr 92px; min-height: 230px; height: 100%; text-decoration: none; background: var(--surface); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); border-top: 5px solid var(--m); transition: transform .15s ease, box-shadow .15s ease; }
.tile a:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(60,35,20,.08), 0 12px 32px rgba(60,35,20,.14); }
.tile-text { padding: 16px 14px 16px 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.tile h3 { font-family: var(--f-display); font-weight: 600; font-size: 18px; line-height: 1.2; margin: 0; color: var(--m-deep); }
.tile-when { margin: 0; font-size: 14px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tile-when span { font-weight: 600; color: var(--fg); }
.tile-tags { list-style: none; margin: auto 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 8px; font-size: 13px; color: var(--m-deep); }
.tile-art { background: var(--m-tint); }
.tile-art svg, .k-art svg { width: 100%; height: 100%; display: block; }
.empty { padding: 32px; background: var(--surface); border-radius: var(--r); text-align: center; }
.empty p { margin: 0 0 12px; }

/* плашка метода */
.mchip { align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; background: var(--c); color: #fff; border-radius: 999px; padding: 3px 11px 3px 9px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; line-height: 1.5; }
.mchip .dot { width: 7px; height: 7px; border-radius: 50%; background: #fff !important; opacity: .85; }

/* svg тона из цвета метода (как в печатной карточке) */
.c0 { fill: var(--m-tint); } .c1 { fill: var(--a1); } .c2 { fill: var(--m-soft); } .c3 { fill: var(--a3); }
.cm { fill: var(--m); } .cd { fill: var(--m-deep); } .cw { fill: #fff; }
.s2 { fill: none; stroke: var(--m-soft); } .sm { fill: none; stroke: var(--m); } .sd { fill: none; stroke: var(--m-deep); }

/* кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-size: 15px; font-weight: 600; padding: 10px 18px; border-radius: 999px; border: 1px solid var(--brand); background: var(--brand); color: #fff; text-decoration: none; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--brand-ink); }

/* страница карточки */
.card-page { padding-top: 20px; padding-bottom: 64px; display: grid; gap: 20px; }
.crumbs { font-size: 14px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.kcard { display: grid; gap: 16px; }
.k-front, .k-back { background: #fff; color: #23201F; border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.k-front { display: grid; border-top: 6px solid var(--m); }
@media (min-width: 820px) { .k-front { grid-template-columns: 1fr 240px; } }
.k-text { padding: 24px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (min-width: 720px) { .k-text { padding: 32px 36px; } }
.k-text h1 { color: var(--m-deep); font-size: clamp(26px, 4vw, 38px); }
.k-sub { margin: -4px 0 0; color: #5C5452; }
.k-purpose { background: var(--m-tint); border-radius: 12px; padding: 14px 16px; display: grid; gap: 6px; }
.k-purpose p { margin: 0; }
.lbl { font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--m-deep); margin: 0 6px 0 0; }
h2.lbl { margin: 6px 0 0; }
.k-steps { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 10px; }
@media (min-width: 1100px) { .k-steps { display: block; columns: 2; column-gap: 32px; } .k-steps li { break-inside: avoid; margin-bottom: 10px; } }
.k-steps li { counter-increment: s; position: relative; padding-left: 36px; }
.k-steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--m); color: #fff; font-size: 13px; font-weight: 700; line-height: 26px; text-align: center; }
.k-steps i { color: #5C5452; }
.k-art { background: var(--m-tint); min-height: 220px; }
@media (max-width: 819px) { .k-art { display: none; } }
.k-back { display: grid; }
@media (min-width: 820px) { .k-back { grid-template-columns: 1fr 1fr; } .k-notes { border-left: 2px dashed var(--m-soft); } }
@media (max-width: 819px) { .k-notes { border-top: 2px dashed var(--m-soft); } }
.k-example, .k-notes { padding: 24px 20px; display: grid; gap: 10px; align-content: start; }
@media (min-width: 720px) { .k-example, .k-notes { padding: 28px 36px; } }
.who { margin: 0; color: #5C5452; font-size: 14px; }
.quote { display: grid; gap: 10px; }
.quote p { margin: 0; padding-left: 12px; border-left: 3px solid var(--m-soft); }
.k-notes textarea { width: 100%; min-height: 200px; font: inherit; font-size: 15px; padding: 12px 14px; border-radius: 10px; border: 1px solid #E6DED8; background: #FDFBF9; color: #23201F; resize: vertical; }
.k-notes textarea:focus { outline: 2px solid var(--m); outline-offset: 1px; }
.hint { margin: 0; font-size: 13px; color: #6A625F; }
.k-meta { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.prevnext { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; }
.pn { display: grid; gap: 2px; padding: 14px 18px; background: var(--surface); border-radius: var(--r); text-decoration: none; font-weight: 600; border: 1px solid var(--line); }
.pn small { font-weight: 400; color: var(--muted); font-size: 13px; }
.pn.next { text-align: right; }

/* методы */
.mfams { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); padding: 20px 0 64px; }
.mfam { background: var(--surface); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }
.mfam h2 { margin: 0; font-size: 18px; }
.mfam > p { margin: 2px 0 12px; color: var(--muted); font-size: 14px; }
.mfam ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mfam li { display: flex; align-items: center; gap: 12px; }
.sw2 { display: flex; flex: none; }
.sw2 span { width: 22px; height: 34px; }
.sw2 span:first-child { background: var(--c); border-radius: 8px 0 0 8px; }
.sw2 span:last-child { background: var(--t); border-radius: 0 8px 8px 0; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
.mt { display: grid; flex: 1; line-height: 1.3; min-width: 0; }
.mt b { font-weight: 600; font-size: 15px; }
.mt small { color: var(--muted); font-size: 13px; }
.mc { font-size: 13px; white-space: nowrap; }
.mc a { color: var(--brand-ink); }
.soon { color: var(--muted); }

/* текстовые страницы */
.prose { max-width: 760px; padding-top: 40px; padding-bottom: 64px; }
.prose h1 { margin: 8px 0 16px; }
.prose h2 { font-size: 20px; margin: 28px 0 8px; }
.prose a { color: var(--brand-ink); }

.foot { border-top: 1px solid var(--line); background: var(--surface); }
.foot-in { max-width: 1240px; margin: 0 auto; padding: 16px 16px 20px; font-size: 14px; color: var(--muted); display: grid; gap: 4px; }
@media (min-width: 720px) { .foot-in { padding: 18px 32px 22px; } }
.foot p { margin: 0; }

@media print {
  .totop, .ftoggle { display: none !important; }
  .top, .foot, .crumbs, .k-meta, .prevnext, .skip, .hint { display: none !important; }
  body { background: #fff; }
  .k-front, .k-back { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .k-notes textarea { border: none; min-height: 120px; resize: none; }
}

/* контакты */
.contacts { display: grid; gap: 48px; padding-top: 32px; padding-bottom: 64px; }
.me { display: grid; gap: 28px; align-items: center; }
@media (min-width: 820px) { .me { grid-template-columns: minmax(260px, 400px) 1fr; gap: 48px; } }
.me-photo { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 20%; border-radius: 24px; box-shadow: var(--shadow); max-width: 420px; }
@media (max-width: 819px) { .me-photo { justify-self: center; max-width: 360px; } }
.me-text { display: grid; gap: 12px; min-width: 0; }
.me-text h1 { font-size: clamp(30px, 5vw, 48px); }
.me-role { margin: -4px 0 0; font-weight: 600; color: var(--brand-ink); }
.me-cta { margin-top: 6px; padding: 18px 20px; border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); display: grid; gap: 6px; max-width: 520px; }
.me-cta-h { margin: 0; font-family: var(--f-display); font-weight: 600; font-size: 20px; color: var(--brand-ink); }
.me-cta-sub { margin: 0; color: var(--muted); font-size: 15px; }
.me-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.medalon { margin: 48px auto 72px; display: grid; justify-items: center; }
.medalon img { width: 200px; height: 200px; }
.become { margin-top: 32px; padding: 22px 24px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.become h2 { margin-top: 0; }
.wm-back { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin: 16px 0 0; font-size: 12px; color: var(--muted); }
.wm-back img.wm { height: 40px; width: auto; }
@media (prefers-color-scheme: dark) { .wm-back img.wm { background: #fff; border-radius: 8px; padding: 4px; } }
.totop { position: fixed; right: 16px; bottom: 16px; z-index: 40; width: 56px; height: 56px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line); display: grid; place-items: center; transition: transform .2s; }
.totop:hover { transform: translateY(-3px); }
.totop:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.totop img { width: 40px; height: 40px; display: block; }
.totop[hidden] { display: none !important; }
.ftoggle { justify-self: start; font: inherit; font-size: 14px; font-weight: 600; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--brand-ink); cursor: pointer; }
.layout.searching .filters.collapsed { display: none; }
@media (min-width: 960px) { .layout.searching { grid-template-columns: 1fr; } .layout.searching .filters { position: static; max-height: none; } }
.me-small { margin: 0; font-size: 14px; color: var(--muted); }
.me-small a { color: var(--brand-ink); }
.contacts h2 { font-family: var(--f-display); font-weight: 600; font-size: clamp(22px, 3vw, 28px); margin: 0 0 16px; }
.req-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.req-list li { background: var(--surface); border-radius: 12px; padding: 14px 16px 14px 44px; position: relative; box-shadow: var(--shadow); }
.req-list li::before { content: ""; position: absolute; left: 18px; top: 22px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.muted { color: var(--muted); margin: -8px 0 16px; font-size: 14px; }
.diplomas { display: grid; gap: 0; }
.dip { display: grid; gap: 8px 24px; padding: 24px 0; border-top: 1px solid var(--line); }
@media (min-width: 720px) { .dip { grid-template-columns: 80px 1fr; } }
.dip-year { margin: 0; font-family: var(--f-display); font-weight: 600; font-size: 22px; color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.dip-body { display: grid; gap: 8px; min-width: 0; }
.dip h3 { margin: 0; font-size: 19px; }
.dip-org { margin: 0; color: var(--muted); }
.dip ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.scans { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.scans a { display: grid; gap: 6px; text-decoration: none; font-size: 13px; color: var(--muted); width: 150px; max-width: 45%; }
.scans img { width: 100%; height: 110px; object-fit: cover; object-position: top; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.scans a:hover img { border-color: var(--brand); }

/* подвал: права; документы */
.rights { display: grid; gap: 6px; font-size: 13px; line-height: 1.5; }
.rights p { margin: 0; }
.rights a, .foot a { color: inherit; }
.doc-date { margin: -8px 0 8px; color: var(--muted); font-size: 14px; }
.doc h2 { font-size: 19px; }
.doc p, .doc li { max-width: 72ch; }

/* окно о cookie */
.cookie { position: fixed; z-index: 20; left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); max-width: 720px; margin: 0 auto; background: var(--surface); color: var(--fg); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 8px 40px rgba(40,25,20,.22); padding: 16px 18px; display: grid; gap: 12px; font-size: 14px; }
.cookie p { margin: 0; }
.cookie a { color: var(--brand-ink); }
.cookie-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.cookie .btn { padding: 8px 18px; font-size: 14px; }
.linkbtn { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
@media print { .cookie { display: none !important; } }
.prose a.btn { color: #fff; text-decoration: none; }
