/* Оболочка сайта макетов: оглавление и просмотрщик. Палитра совпадает с токенами NSR. */
:root {
  --primary: #199EDA; --link: #0E6E9C; --on-primary: #fff;
  --text: #202530; --muted: #5F656C; --dimmed: #8A9097;
  --bg: #FFFFFF; --bg-muted: #F5F7F9; --bg-elevated: #EDF0F3; --border: #E3E7EC;
  --focus: #199EDA; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --link: #4FB8E6; --text: #FFFFFF; --muted: #ACB5BE; --dimmed: #7E868F;
  --bg: #26282D; --bg-muted: #14161A; --bg-elevated: #31343B; --border: #31343B;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg-muted); color: var(--text); font: 14px/1.45 Roboto, system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.bar { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  padding: 8px 16px; min-height: 56px; background: var(--bg); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; min-width: 0; }
.brand-mark { flex: none; width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: var(--on-primary);
  display: grid; place-items: center; font-weight: 700; }
.brand b { display: block; font-weight: 500; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-elevated); border-radius: 8px; }
.seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 500;
  padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--bg); color: var(--text); box-shadow: var(--shadow); }
.sw { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text); user-select: none; }
.sw input { appearance: none; margin: 0; width: 32px; height: 18px; border-radius: 9px; background: var(--bg-elevated);
  border: 1px solid var(--border); position: relative; cursor: pointer; transition: background .15s; }
.sw input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
:root[data-theme="dark"] .sw input::after { background: #ACB5BE; }
.sw input:checked { background: var(--primary); border-color: var(--primary); }
.sw input:checked::after { transform: translateX(14px); background: #fff; }

.btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: 13px; font-weight: 500;
  text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--bg-elevated); }
.btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn svg { width: 16px; height: 16px; flex: none; }
.input { height: 32px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg);
  color: var(--text); font: inherit; min-width: 0; width: 240px; max-width: 100%; }
.input::placeholder { color: var(--dimmed); }

/* Оглавление */
.wrap { max-width: 1360px; margin: 0 auto; padding: 24px 16px 64px; }
.hero h1 { font-size: 28px; line-height: 1.2; margin: 8px 0 6px; font-weight: 600; }
.hero p { margin: 0; color: var(--muted); max-width: 760px; }
.toc { display: flex; flex-wrap: wrap; gap: 6px; margin: 20px 0 8px; }
.toc a { font-size: 13px; text-decoration: none; padding: 4px 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); color: var(--text); }
.toc a:hover { border-color: var(--primary); }
.section { margin-top: 32px; scroll-margin-top: 72px; }
.section h2 { font-size: 18px; margin: 0 0 12px; font-weight: 600; display: flex; gap: 8px; align-items: baseline; }
.section h2 span { color: var(--muted); font-weight: 400; font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; color: var(--text); text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--primary); transform: translateY(-1px); }
.thumb { aspect-ratio: 3 / 2; background: var(--bg-muted) center top / cover no-repeat; border-bottom: 1px solid var(--border); }
.thumb.natural { background-size: auto; background-position: center; }
.thumb.contain { background-size: contain; background-position: center; }
.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.card-title { font-weight: 500; }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.badge { font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: 4px; background: var(--bg-elevated); color: var(--muted); }
.badge.live { background: rgba(25,158,218,.14); color: var(--link); }
.empty { color: var(--muted); padding: 24px 0; }
.foot { margin-top: 48px; color: var(--muted); font-size: 12px; }

/* Просмотрщик */
body.viewer { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.crumbs { display: flex; flex-direction: column; min-width: 0; }
.crumbs small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; }
.stage iframe { border: 0; display: block; background: var(--bg-muted); }
.stage.fill iframe { width: 100%; height: 100%; }
.stage.fixed { padding: 32px 16px; }
.stage.fixed iframe { margin: 0 auto; flex: none; max-width: none; box-shadow: var(--shadow); border-radius: 6px; background: transparent; }
@media (max-width: 720px) { .hide-sm { display: none; } .input { width: 100%; } }
/* Переключатель версий макетов (v3 / v4) */
.ver { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-elevated); border-radius: 8px; margin-left: 12px; }
.ver a { padding: 3px 10px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--muted); text-decoration: none; }
.ver a:hover { color: var(--text); }
.ver a[aria-current="page"] { background: var(--bg); color: var(--text); box-shadow: var(--shadow); }
.hero p + p { margin-top: 8px; }
