/* whitepage-foundation */
/* whitepage-foundation — базовый слой перед стилями модели: адаптив, типографика, без «сломанной» ширины */

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

:where(*, *::before, *::after) {
  box-sizing: border-box;
}

:where(body) {
  margin: 0;
  overflow-x: clip;
  font-size: clamp(0.9375rem, 0.88rem + 0.25vw, 1.0625rem);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

:where(img, picture, video, canvas, svg) {
  max-width: 100%;
  height: auto;
  display: block;
}

:where(table) {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 48rem) {
  :where(table) {
    display: table;
    overflow-x: visible;
  }
}

/* Типографическая шкала (мягко; модель может перекрыть своими классами) */
:where(h1) {
  font-size: clamp(1.65rem, 1.1rem + 2.4vw, 2.65rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin: 0 0 0.65em;
}

:where(h2) {
  font-size: clamp(1.28rem, 1.05rem + 1.1vw, 1.85rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 1.35em 0 0.55em;
}

:where(h3) {
  font-size: clamp(1.08rem, 0.98rem + 0.45vw, 1.28rem);
  line-height: 1.25;
  margin: 1.2em 0 0.45em;
}

:where(p) {
  margin: 0 0 1em;
}

:where(article p, .prose p, .content p) {
  max-width: 65ch;
}

:where(ul, ol) {
  margin: 0 0 1em;
  padding-left: 1.25em;
}

/* Частые обёртки моделей — делаем предсказуемую ширину и отступы */
:where(.container, .wrap, .inner, .page, .layout) {
  width: min(100% - clamp(1rem, 4vw, 2.5rem), 72rem);
  margin-inline: auto;
}

/* Простая сетка, если классы .grid / .grid-2 / .grid-3 */
:where(.grid) {
  display: grid !important;
  gap: clamp(0.85rem, 2vw, 1.35rem);
  grid-template-columns: 1fr;
}

@media (min-width: 40rem) {
  :where(.grid.grid-2, .grid.cols-2, .grid-two) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 56rem) {
  :where(.grid.grid-3, .grid.cols-3, .grid-three) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Карточные ленты — часто модель называет класс .cards, а не .grid */
:where(.cards) {
  display: grid !important;
  gap: clamp(0.85rem, 2vw, 1.35rem);
  grid-template-columns: 1fr;
}

@media (min-width: 42rem) {
  :where(.cards.cols-2, .cards--2, .cards.two) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 56rem) {
  :where(.cards.cols-3, .cards--3, .cards.three) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Хедер / навигация: перенос и касание */
:where(header nav ul, .nav ul, nav ul) {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  align-items: center;
}

:where(header a, nav a, .nav a) {
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
}

/* Кнопки и инпуты — минимум для пальца */
:where(button, [type="submit"], .btn) {
  min-height: 2.75rem;
  padding-inline: 1rem;
}

/* Секции с воздухом */
:where(section) {
  padding-block: clamp(1.75rem, 4vw, 3.5rem);
}

:where(main) {
  padding-bottom: clamp(2rem, 5vw, 4rem);
}

@media (prefers-reduced-motion: reduce) {
  :where(*) {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* —— tema / modelo —— */

:root {
  --bg: #fbf8f6;
  --surface: #fffdfb;
  --surface-2: #f4eeea;
  --text: #151312;
  --muted: #5f5752;
  --accent: #6f1128;
  --accent-soft: #efe0e4;
  --border: #161312;
  --radius: 0;
  --shadow-1: none;
  --shadow-2: none;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --content: 64ch;
  --shell: 76rem;
  --toc: 15rem;
  --header-h: 4rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Work Sans", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(111,17,40,0.04), rgba(111,17,40,0.04)) 0 0 / 100% 5.5rem no-repeat,
    var(--bg);
  overflow-wrap: anywhere;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--text);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent);
}

button,
.button {
  min-height: 44px;
}

button,
input,
textarea,
select {
  font: inherit;
}

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

.shell {
  width: min(100% - 1.25rem, var(--shell));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(251, 248, 246, 0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: var(--space-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  font-weight: 600;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: "Cormorant Garamond", serif;
  font-size: 1.35rem;
  line-height: 1;
  background: var(--surface);
}

.brand-text {
  font-size: 0.95rem;
}

.nav-toggle {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.5rem 0.65rem;
  display: inline-grid;
  gap: 4px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 1px;
  background: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.site-nav {
  position: absolute;
  top: calc(100% - 1px);
  left: 0;
  right: 0;
  display: none;
  flex-direction: column;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-nav a {
  padding: 0.9rem 1rem;
  text-decoration: none;
  border-top: 1px solid var(--border);
}

.site-nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-open .site-nav {
  display: flex;
}

.nav-open .nav-toggle span:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}

.nav-open .nav-toggle span:nth-child(2) {
  opacity: 0;
}

.nav-open .nav-toggle span:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}

.page {
  padding: var(--space-6) 0 var(--space-8);
}

.with-aside {
  display: block;
}

.content {
  max-width: var(--content);
}

.page-intro,
.hero,
.section {
  margin-bottom: var(--space-7);
}

.eyebrow {
  margin: 0 0 var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 700;
}

h1,
h2,
h3,
h4 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  line-height: 0.96;
  margin: 0 0 0.6rem;
}

h1 {
  font-size: clamp(2.8rem, 7vw, 5.6rem);
  max-width: 12ch;
}

h2 {
  font-size: clamp(2rem, 4.6vw, 3.1rem);
}

h3 {
  font-size: clamp(1.3rem, 3vw, 1.7rem);
}

h4 {
  font-size: 1.1rem;
}

p,
ul,
ol {
  margin: 0 0 1rem;
  max-width: 68ch;
}

.lead {
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  color: var(--muted);
  max-width: 50ch;
}

.notice,
.muted,
.section-intro {
  color: var(--muted);
}

.numbered-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  align-items: start;
  border-top: 2px solid var(--border);
  padding-top: var(--space-5);
}

.hero-number {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(5rem, 20vw, 12rem);
  line-height: 0.8;
  color: var(--accent);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-5) 0 var(--space-4);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.1rem;
  border: 1px solid var(--border);
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.button:hover {
  background: #54101f;
  color: #fff;
}

.button-ghost {
  background: transparent;
  color: var(--text);
}

.button-ghost:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.section-heading {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  align-items: start;
  margin-bottom: var(--space-4);
}

.section-num {
  color: var(--accent);
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 0.9;
  padding-top: 0.15rem;
}

.strip {
  padding: var(--space-5);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.card,
.mini-note,
.toc-box,
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
}

.card,
.mini-note {
  padding: var(--space-4);
}

.card-link {
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.card-link:hover {
  background: var(--accent-soft);
  transform: translateY(-2px);
}

.editorial {
  background:
    linear-gradient(180deg, rgba(111,17,40,0.04), rgba(111,17,40,0)) ,
    var(--surface);
}

.grid,
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.list {
  padding-left: 1.2rem;
}

.ordered {
  list-style: decimal;
}

.mini-note h3,
.card h3 {
  margin-bottom: 0.35rem;
}

.faq-list {
  display: grid;
  gap: 0.75rem;
}

.faq-item {
  padding: 0;
}

.faq-item summary {
  cursor: pointer;
  list-style: none;
  padding: 1rem;
  font-weight: 600;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item p {
  padding: 0 1rem 1rem;
  margin: 0;
}

.toc {
  display: none;
}

.toc-box {
  padding: var(--space-4);
  position: sticky;
  top: calc(var(--header-h) + 1rem);
}

.toc-title,
.footer-title {
  font-weight: 700;
  margin-bottom: 0.6rem;
}

.toc-box a,
.footer-sitemap a {
  display: block;
  padding: 0.45rem 0;
  text-decoration: none;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: var(--space-6) 0 var(--space-7);
  background: var(--surface);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}

.footer-toggle {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  padding: 0.8rem 1rem;
}

.footer-sitemap {
  display: none;
  margin-top: var(--space-3);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
}

.footer-sitemap.open {
  display: block;
}

.footer-bottom {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.95rem;
}

.cookie-banner {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 30;
}

.cookie-inner {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: var(--space-4);
}

.cookie-inner p {
  margin-bottom: 0.8rem;
  max-width: none;
}

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.prose p {
  max-width: 68ch;
}

@media (min-width: 480px) {
  .shell {
    width: min(100% - 2rem, var(--shell));
  }

  .cookie-banner {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }

  .grid-2,
  .cards.cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 768px) {
  .page {
    padding-top: var(--space-7);
  }

  .numbered-hero {
    grid-template-columns: minmax(7rem, 10rem) 1fr;
    gap: var(--space-6);
  }

  .grid-3,
  .cards.cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .footer-grid {
    grid-template-columns: 1.2fr 0.8fr;

/* whitepage-polish */
/* whitepage-polish — после стилей модели: убираем «плывущую» вёрстку и горизонтальный скролл */

html {
  overflow-x: clip;
}

/* Жёсткие переполнения у гридов/флексов — классика flex-bug */
.grid > *,
[class*="grid"] > *,
.flex > *,
[class*="flex"] > *,
.row > *,
.cards > *,
[class*="cards"] > * {
  min-width: 0;
}

main,
section,
article,
header,
footer,
nav {
  max-width: 100%;
}

/* Длинные слова / URL в тексте */
p,
li,
td,
th {
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

iframe {
  max-width: 100%;
}

/* Картинки внутри figure */
figure {
  margin-inline: 0;
  max-width: 100%;
}