/* ПравоРадар — база: системная типографика, layout, a11y */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-main);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, p, figure, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { max-width: 100%; display: block; }
strong, b { font-weight: 600; }

/* Публичная типографика */
.h1 { font-size: 30px; line-height: 36px; font-weight: 700; letter-spacing: 0; }
.h2 { font-size: 24px; line-height: 30px; font-weight: 700; letter-spacing: 0; }
.h3 { font-size: 18px; line-height: 24px; font-weight: 700; }
.lead { font-size: 16px; line-height: 24px; color: var(--text-secondary); }
.body { font-size: 16px; line-height: 24px; }
.small { font-size: 13px; line-height: 1.45; }
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--accent);
}
.text-secondary     { color: var(--text-secondary); }
.text-muted         { color: var(--text-muted); }
.text-accent        { color: var(--accent); }
.text-primary-color { color: var(--primary); }

@media (max-width: 768px) {
  .h1  { font-size: 28px; line-height: 34px; }
  .h2  { font-size: 20px; }
  .h3  { font-size: 17px; }
  .lead { font-size: 15px; }
}

/* Контейнер (публичная часть) */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* Section helpers */
.section        { padding-block: var(--space-10); }
.section--tight { padding-block: var(--space-6); }
.section--soft  { background: var(--surface-soft); }
.stack > * + *  { margin-top: var(--space-4); }

/* Доступность */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-4); top: -80px;
  background: var(--primary); color: #fff; padding: 10px 16px;
  border-radius: var(--radius-md); z-index: var(--z-modal);
  transition: top var(--transition);
}
.skip-link:focus { top: var(--space-4); color: #fff; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Утилиты */
.flow-page { display: flex; flex-direction: column; min-height: 100vh; }
.flow-page main { flex: 1; }
.text-center { text-align: center; }
.no-scroll { overflow: hidden; }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.d-flex { display: flex; }
.align-center { align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }

/* Портальная оболочка */
.portal-layout {
  display: grid;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  background: var(--page-bg);
}
.portal-topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--portal-pad);
  gap: var(--space-4);
}
.portal-sidebar {
  grid-column: 1;
  grid-row: 2;
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--space-3) 0;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  scrollbar-width: thin;
}
.portal-content {
  grid-column: 2;
  grid-row: 2;
  padding: var(--portal-pad);
  min-width: 0;
  min-height: calc(100vh - var(--topbar-h));
}

/* Мобиль */
@media (max-width: 768px) {
  .portal-layout {
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
    padding-bottom: 56px;
  }
  .portal-sidebar {
    display: none;
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    height: calc(100vh - var(--topbar-h));
    z-index: var(--z-sidebar);
    box-shadow: var(--shadow-modal);
  }
  .portal-sidebar.is-open { display: block; }
  .portal-content { grid-column: 1; padding: 16px; }
  .portal-topbar  { padding: 0 16px; }
}
