/* Wayfare — оформление. Системные шрифты: ни одного внешнего запроса. */

:root {
  --paper:        #fbfaf8;
  --surface:      #ffffff;
  --surface-alt:  #f3f1ec;
  --ink:          #16181c;
  --ink-soft:     #5b6068;
  --ink-faint:    #8d939c;
  --rule:         #e4e0d8;
  --rule-strong:  #cfcabf;
  --accent:       #0f5f5a;
  --accent-soft:  #e3f0ee;
  --shadow:       0 1px 2px rgba(20, 22, 26, .05), 0 8px 24px -12px rgba(20, 22, 26, .18);
  --radius:       10px;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:       #0e1013;
    --surface:     #16191e;
    --surface-alt: #1d2127;
    --ink:         #e9eaec;
    --ink-soft:    #a2a8b2;
    --ink-faint:   #757c87;
    --rule:        #262b32;
    --rule-strong: #39404a;
    --accent:      #5ecfc2;
    --accent-soft: #10302e;
    --shadow:      0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -14px rgba(0, 0, 0, .8);
  }
}

:root[data-theme="dark"] {
  --paper:       #0e1013;
  --surface:     #16191e;
  --surface-alt: #1d2127;
  --ink:         #e9eaec;
  --ink-soft:    #a2a8b2;
  --ink-faint:   #757c87;
  --rule:        #262b32;
  --rule-strong: #39404a;
  --accent:      #5ecfc2;
  --accent-soft: #10302e;
  --shadow:      0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -14px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }

/* Правило браузера [hidden]{display:none} слабее любого класса с display,
   поэтому закрепляем его явно — иначе скрытые элементы остаются видимыми. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

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

button { font: inherit; color: inherit; cursor: pointer; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ---------------------------------------------------------------- шапка */

.masthead {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--rule);
}

.masthead__bar {
  max-width: 1240px; margin: 0 auto;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 16px;
}

.brand { display: flex; align-items: baseline; gap: 8px; flex-shrink: 0; }
.brand__mark { color: var(--accent); font-size: 18px; line-height: 1; }
.brand__name {
  font-family: var(--serif);
  font-size: 25px; font-weight: 600; letter-spacing: -.02em;
}

.masthead__tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search { position: relative; display: flex; align-items: center; }
.search__icon {
  position: absolute; left: 10px; width: 16px; height: 16px;
  fill: none; stroke: var(--ink-faint); stroke-width: 1.9; stroke-linecap: round;
  pointer-events: none;
}
.search input {
  width: 190px; padding: 8px 30px 8px 32px;
  font-size: 14px; font-family: inherit; color: var(--ink);
  background: var(--surface-alt);
  border: 1px solid transparent; border-radius: 999px;
  transition: width .18s ease, border-color .18s ease, background .18s ease;
}
.search input::placeholder { color: var(--ink-faint); }
.search input:focus { width: 250px; outline: none; background: var(--surface); border-color: var(--rule-strong); }
.search input::-webkit-search-cancel-button { display: none; }
.search__clear {
  position: absolute; right: 6px;
  width: 22px; height: 22px; padding: 0; line-height: 20px;
  font-size: 18px; color: var(--ink-faint);
  background: none; border: 0; border-radius: 50%;
}
.search__clear:hover { color: var(--ink); background: var(--surface-alt); }

@media (max-width: 600px) {
  .masthead__tools { flex: 1 1 auto; min-width: 0; }
  .search { flex: 1 1 auto; min-width: 0; }
  .search input,
  .search input:focus { width: 100%; }
  .brand__name { font-size: 22px; }
}

.icon-btn {
  display: grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  background: none; border: 1px solid var(--rule); border-radius: 999px;
}
.icon-btn:hover { background: var(--surface-alt); }
.icon-btn svg {
  width: 17px; height: 17px;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

/* -------------------------------------------------------------- рубрики */

.rubrics {
  max-width: 1240px; margin: 0 auto;
  padding: 0 16px 10px;
  display: flex; gap: 6px;
  overflow-x: auto; scrollbar-width: none;
}
.rubrics::-webkit-scrollbar { display: none; }

.rubric {
  flex-shrink: 0;
  padding: 6px 13px;
  font-size: 13.5px; font-weight: 500; white-space: nowrap;
  color: var(--ink-soft);
  background: none; border: 1px solid transparent; border-radius: 999px;
  transition: color .15s, background .15s;
}
.rubric:hover { color: var(--ink); background: var(--surface-alt); }
.rubric[aria-current="true"] { color: var(--accent); background: var(--accent-soft); font-weight: 600; }

/* -------------------------------------------------------- «есть новое» */

.update-pill {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px 9px 18px;
  font-size: 14px;
  background: var(--ink); color: var(--paper);
  border-radius: 999px; box-shadow: var(--shadow);
  animation: rise .25s ease;
}
.update-pill button {
  padding: 5px 12px; font-size: 13px; font-weight: 600;
  color: var(--ink); background: var(--paper);
  border: 0; border-radius: 999px;
}
@keyframes rise { from { opacity: 0; transform: translate(-50%, 12px); } }

/* --------------------------------------------------------------- макет */

main { max-width: 1240px; margin: 0 auto; padding: 0 16px 56px; }

.section-head {
  display: flex; align-items: baseline; gap: 12px;
  margin: 40px 0 18px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
}
.section-head__title {
  margin: 0;
  font-family: var(--serif); font-size: 21px; font-weight: 600; letter-spacing: -.01em;
}
.section-head__meta { margin: 0 0 0 auto; font-size: 13px; color: var(--ink-faint); }

/* ------------------------------------------------------------- главное */

.lead {
  display: grid; gap: 24px;
  padding: 28px 0 0;
}
@media (min-width: 900px) {
  .lead { grid-template-columns: 1.55fr 1fr; gap: 36px; }
}

.lead__main { display: block; }
.lead__figure {
  position: relative;
  aspect-ratio: 16 / 9;
  margin-bottom: 16px;
  overflow: hidden;
  background: var(--surface-alt);
  border-radius: var(--radius);
}
.lead__figure img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s cubic-bezier(.2, .7, .3, 1);
}
.lead__main:hover .lead__figure img { transform: scale(1.03); }

.lead__title {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: clamp(27px, 4.4vw, 40px); line-height: 1.14; letter-spacing: -.022em; font-weight: 600;
}
.lead__main:hover .lead__title { color: var(--accent); }
.lead__summary {
  margin: 0 0 12px;
  font-size: 16.5px; line-height: 1.6; color: var(--ink-soft);
  max-width: 62ch;
}

.lead__side {
  display: flex; flex-direction: column;
  gap: 18px;
  padding-top: 2px;
}
@media (min-width: 900px) {
  .lead__side { border-left: 1px solid var(--rule); padding-left: 28px; }
}

.side-item {
  display: grid; grid-template-columns: 1fr 78px; gap: 14px; align-items: start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}
.side-item:last-child { border-bottom: 0; padding-bottom: 0; }
.side-item__title {
  margin: 6px 0 6px;
  font-family: var(--serif); font-size: 16.5px; line-height: 1.3; font-weight: 600; letter-spacing: -.01em;
}
.side-item:hover .side-item__title { color: var(--accent); }
.side-item__thumb {
  aspect-ratio: 1; overflow: hidden;
  background: var(--surface-alt); border-radius: 7px;
}
.side-item__thumb img { width: 100%; height: 100%; object-fit: cover; }

/* --------------------------------------------------------------- сетка */

.grid {
  display: grid; gap: 28px 24px;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
}

.card { display: flex; flex-direction: column; }
.card__figure {
  aspect-ratio: 3 / 2;
  margin-bottom: 13px;
  overflow: hidden;
  background: var(--surface-alt); border-radius: var(--radius);
}
.card__figure img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .45s cubic-bezier(.2, .7, .3, 1);
}
.card:hover .card__figure img { transform: scale(1.04); }
.card__title {
  margin: 7px 0 7px;
  font-family: var(--serif); font-size: 18.5px; line-height: 1.27; font-weight: 600; letter-spacing: -.012em;
}
.card:hover .card__title { color: var(--accent); }
.card__summary {
  margin: 0 0 11px;
  font-size: 14.5px; line-height: 1.5; color: var(--ink-soft);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card__foot { margin-top: auto; }

.figure--empty {
  display: grid; place-items: center;
  background: linear-gradient(135deg, hsl(var(--h) 30% 91%), hsl(var(--h) 24% 83%));
}
.figure--empty span {
  font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: .02em;
  color: hsl(var(--h) 38% 38%);
}
:root[data-theme="dark"] .figure--empty {
  background: linear-gradient(135deg, hsl(var(--h) 20% 19%), hsl(var(--h) 18% 13%));
}
:root[data-theme="dark"] .figure--empty span { color: hsl(var(--h) 42% 62%); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .figure--empty {
    background: linear-gradient(135deg, hsl(var(--h) 20% 19%), hsl(var(--h) 18% 13%));
  }
  :root:not([data-theme="light"]) .figure--empty span { color: hsl(var(--h) 42% 62%); }
}

/* ------------------------------------------------------ подпись/источник */

.kicker {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; letter-spacing: .04em; text-transform: uppercase; font-weight: 600;
  color: var(--ink-soft);
}
.kicker__badge {
  display: grid; place-items: center;
  width: 19px; height: 19px; flex-shrink: 0;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0; color: #fff;
  border-radius: 5px;
}
.kicker__time { color: var(--ink-faint); font-weight: 500; letter-spacing: .02em; text-transform: none; }
.kicker__time::before { content: "·"; margin-right: 7px; }

/* ------------------------------------------------------------- прочее */

.more { display: flex; justify-content: center; margin-top: 40px; }
.more button {
  padding: 11px 30px;
  font-size: 14.5px; font-weight: 600;
  background: none; border: 1px solid var(--rule-strong); border-radius: 999px;
}
.more button:hover { background: var(--surface-alt); border-color: var(--ink-soft); }
.more button[disabled] { opacity: .5; cursor: default; }

.empty {
  padding: 56px 16px; text-align: center;
  font-size: 15px; color: var(--ink-soft);
}

/* ------------------------------------------------------------ скелетон */

.skeleton { pointer-events: none; }
.skeleton .card__figure,
.skeleton .bone {
  background: linear-gradient(100deg, var(--surface-alt) 30%, color-mix(in srgb, var(--surface-alt) 60%, var(--paper)) 50%, var(--surface-alt) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.4s infinite linear;
  border-radius: 6px;
}
.bone { height: 13px; margin-bottom: 8px; }
.bone--title { height: 19px; width: 92%; }
.bone--short { width: 55%; }
@keyframes shimmer { to { background-position: -300% 0; } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* --------------------------------------------------------------- подвал */

.footer {
  margin-top: 40px;
  padding: 28px 0 44px;
  border-top: 1px solid var(--rule);
  background: var(--surface-alt);
}
.footer__inner { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.footer__note { margin: 0 0 16px; max-width: 70ch; font-size: 13.5px; color: var(--ink-soft); }

.sources summary {
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  color: var(--ink-soft);
}
.sources summary:hover { color: var(--ink); }
#sources-count { color: var(--ink-faint); font-weight: 400; }
.sources__list {
  margin: 14px 0 0; padding: 0; list-style: none;
  display: grid; gap: 4px 20px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  font-size: 13px;
}
.sources__list li { display: flex; gap: 8px; align-items: baseline; color: var(--ink-soft); }
.sources__list .ok { color: var(--accent); }
.sources__list .bad { color: #c0392b; }
:root[data-theme="dark"] .sources__list .bad { color: #ff8a7a; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sources__list .bad { color: #ff8a7a; }
}
.sources__list .num { margin-left: auto; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------- собственные материалы */

.kicker--own .kicker__badge {
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
}
.kicker--own { color: var(--accent); }

/* --------------------------------------------------- статьи и страницы */

.prose-wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px 56px; }

.prose {
  max-width: 44rem;
  margin: 0 auto;
  padding-top: 32px;
}

.prose__back { margin: 0 0 28px; font-size: 14px; }
.prose__back a { color: var(--ink-soft); }
.prose__back a:hover { color: var(--accent); }

.prose__kicker {
  margin: 0 0 10px;
  font-size: 12px; letter-spacing: .04em; text-transform: uppercase; font-weight: 600;
  color: var(--accent);
}

.prose__title {
  margin: 0 0 16px;
  font-family: var(--serif);
  font-size: clamp(30px, 5vw, 44px); line-height: 1.12; letter-spacing: -.024em; font-weight: 600;
}

.prose__lead {
  margin: 0 0 28px;
  font-size: 19px; line-height: 1.55; color: var(--ink-soft);
}

.prose__hero {
  margin: 0 0 32px;
  aspect-ratio: 16 / 9; overflow: hidden;
  background: var(--surface-alt); border-radius: var(--radius);
}
.prose__hero img { width: 100%; height: 100%; object-fit: cover; }

.prose__body { font-size: 17.5px; line-height: 1.68; }
.prose__body h2 {
  margin: 40px 0 12px;
  font-family: var(--serif); font-size: 25px; line-height: 1.22; letter-spacing: -.015em; font-weight: 600;
}
.prose__body h3 {
  margin: 32px 0 10px;
  font-family: var(--serif); font-size: 20px; font-weight: 600;
}
.prose__body p { margin: 0 0 20px; }
.prose__body a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.prose__body ul,
.prose__body ol { margin: 0 0 20px; padding-left: 22px; }
.prose__body li { margin-bottom: 8px; }
.prose__body blockquote {
  margin: 28px 0;
  padding: 2px 0 2px 20px;
  border-left: 3px solid var(--accent);
  color: var(--ink-soft); font-style: italic;
}
.prose__body blockquote p { margin: 0; }
.prose__body code {
  padding: 2px 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88em;
  background: var(--surface-alt); border-radius: 4px;
}
.prose__body hr { margin: 36px 0; border: 0; border-top: 1px solid var(--rule); }
.prose__body figure { margin: 28px 0; }
.prose__body figure img { width: 100%; border-radius: var(--radius); }
.prose__body strong { font-weight: 650; }

.related {
  max-width: 44rem; margin: 56px auto 0;
  padding-top: 24px; border-top: 2px solid var(--ink);
}
.related__title {
  margin: 0 0 16px;
  font-family: var(--serif); font-size: 19px; font-weight: 600;
}
.related__list { margin: 0; padding: 0; list-style: none; }
.related__list li {
  display: flex; gap: 16px; align-items: baseline;
  padding: 11px 0; border-bottom: 1px solid var(--rule);
}
.related__list li:last-child { border-bottom: 0; }
.related__list a { font-family: var(--serif); font-size: 17px; font-weight: 600; }
.related__list a:hover { color: var(--accent); }
.related__list span { margin-left: auto; flex-shrink: 0; font-size: 13px; color: var(--ink-faint); }

.footer__nav {
  display: flex; flex-wrap: wrap; gap: 8px 22px;
  margin-bottom: 18px;
  font-size: 13.5px; font-weight: 500;
}
.footer__nav a { color: var(--ink-soft); }
.footer__nav a:hover { color: var(--accent); }
