/* ============================================================
   BLOCK LIBRARY · BASE
   Контейнерный контракт, типографика, кнопки, формы, a11y.
   ------------------------------------------------------------
   КОНТЕЙНЕРНЫЙ КОНТРАКТ (главное правило библиотеки):

     <section class="blk blk--<тип>">     ← на всю ширину вьюпорта
       <div class="wrap"> ... </div>      ← РОВНО ОДИН .wrap внутри
     </section>

   .wrap всегда даёт одну и ту же колонку (max 1280px + одинаковые
   поля), поэтому любые два блока подряд совпадают по левому и
   правому краю на ЛЮБОЙ ширине — от 320 до 1600+.

   Запрещено: .wrap внутри .wrap, блок без .wrap (кроме .blk--bleed),
   фиксированные width/max-width в пикселях на уровне блока.
   Проверяется скриптом build/validate_site.py.
   ============================================================ */

*, *::before, *::after{ box-sizing:border-box; }

html{ -webkit-text-size-adjust:100%; scroll-behavior:smooth; }

body{
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:var(--body);
  font-size:clamp(16px, .4vw + 15px, 17.5px);
  line-height:1.65;
}
body.is-locked{ overflow:hidden; }

img, svg, video, canvas, iframe{ display:block; max-width:100%; }
img, video{ height:auto; }
a{ color:var(--accent); }
button, input, select, textarea{ font:inherit; color:inherit; }
button{ cursor:pointer; }

/* --- контейнер --- */
.wrap{
  width:var(--wrap);
  margin-inline:auto;
  min-width:0;
}
/* Сужать НУЖНО содержимое, а не .wrap — иначе блоки разъедутся по краям. */
.measure{ max-width:840px; }
.measure--mid{ max-width:1040px; }

/* --- блок --- */
.blk{
  padding-block:var(--sect);
  position:relative;
}
.blk--tight{ padding-block:var(--sect-tight); }
.blk--flush{ padding-block:0; }
/* --raise — заливка «приподнятого» элемента внутри блока: карточки,
   панели, плашки. Она всегда отличается от фона своей секции, поэтому
   панель физически не может слиться с фоном, какую бы заливку
   планировщик ни назначил блоку. */
.blk--paper{ background:var(--paper); color:var(--ink); --raise:var(--surface); }
.blk--surface{ background:var(--surface); color:var(--ink); --raise:var(--tone); }
.blk--tone{ background:var(--tone); color:var(--ink); --raise:var(--surface); }
.blk--brand{ background:var(--brand); color:var(--on-brand); }
.blk--dark{ background:var(--dark); color:var(--on-dark); }
:root{ --raise:var(--surface); }

/* ------------------------------------------------------------
   ИНВЕРСИЯ НА ТЁМНОМ ФОНЕ — через переопределение токенов, а не
   через погоню за отдельными селекторами.

   Любой блок библиотеки можно поставить на тёмную заливку: внутри
   .blk--dark / .blk--brand токены перевязываются, поэтому ВСЁ, что
   опирается на --ink, --ink-soft, --accent, --line, --brand,
   становится читаемым автоматически. Новые блоки чинить не нужно —
   низкоконтрастный текст на тёмном здесь структурно невозможен.

   Переопределение висит на ПОТОМКАХ (> *), а не на самом блоке:
   иначе .blk--brand{background:var(--brand)} подхватил бы уже
   перевязанный --brand и залил бы секцию светлым.
   ------------------------------------------------------------ */
.blk--dark > *, .blk--brand > *,
.site-foot > *{
  --ink:        var(--on-dark);
  --ink-soft:   var(--on-dark-soft);
  --accent:     var(--accent-bright);
  --line:       rgba(255,255,255,.20);
  --surface:    rgba(255,255,255,.06);
  --tone:       rgba(255,255,255,.09);
  --brand:      var(--on-dark);
  --brand-deep: var(--paper);
  --brand-soft: rgba(255,255,255,.24);
  --on-brand:   var(--dark);
  --raise:      rgba(255,255,255,.07);
}
.blk--brand :is(h1,h2,h3,h4),
.blk--dark  :is(h1,h2,h3,h4){ color:inherit; }

/* --- типографика --- */
h1, h2, h3, h4{
  font-family:var(--display);
  font-weight:var(--display-weight);
  line-height:var(--display-leading);
  letter-spacing:var(--display-tracking);
  margin:0 0 .5em;
  /* Датские составные слова длиннее колонки: без переноса по слогам
     браузер рвёт слово в произвольном месте и без дефиса — в заголовке
     это читается как опечатка («Ruderudskiftnin / g»). hyphens:auto с
     lang="da" переносит по правилам языка, anywhere остаётся крайней
     мерой, чтобы страница не поехала на 320px. */
  hyphens:auto;
  overflow-wrap:anywhere;
  text-wrap:balance;
}
h1{ font-size:clamp(2.1rem, 5.2vw, 4.4rem); }
h2{ font-size:clamp(1.7rem, 3.6vw, 3.1rem); }
h3{ font-size:clamp(1.2rem, 1.6vw + .55rem, 1.65rem); }
h4{ font-size:clamp(1.02rem, .8vw + .7rem, 1.2rem); }

p{ margin:0 0 1.1em; hyphens:auto; overflow-wrap:break-word; }
p:last-child{ margin-bottom:0; }

.lede{
  font-size:clamp(1.05rem, .6vw + .95rem, 1.32rem);
  line-height:1.5;
  color:var(--ink-soft);
  max-width:62ch;
}

.eyebrow{
  display:flex; align-items:center; gap:10px;
  font-family:var(--body);
  font-size:.75rem; font-weight:800; letter-spacing:.14em; text-transform:uppercase;
  color:var(--accent);
  margin:0 0 1.1em;
}
.eyebrow::before{ content:""; width:30px; height:1px; background:currentColor; flex:none; }
.eyebrow--plain::before{ display:none; }

.muted{ color:var(--ink-soft); }
.rule{ border:0; border-top:1px solid var(--line); margin:0; }

/* --- кнопки --- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:9px;
  min-height:48px; padding:12px 24px;
  border:1px solid var(--brand); border-radius:var(--btn-radius);
  background:var(--brand); color:var(--on-brand);
  font-family:var(--body); font-weight:700; font-size:.92rem; line-height:1.2;
  text-decoration:none; text-align:center;
  transition:background .2s ease, border-color .2s ease, color .2s ease, transform .2s ease;
  min-width:0; max-width:100%;
}
.btn:hover{ background:var(--brand-deep); border-color:var(--brand-deep); color:var(--on-brand); transform:translateY(-2px); }
.btn--ghost{ background:transparent; color:var(--brand); }
.btn--ghost:hover{ background:var(--brand); color:var(--on-brand); }
/* Светлая кнопка живёт только на тёмных и брендовых поверхностях, где --ink
   перевязан в светлый. Поэтому её текст берётся из --dark, который не
   перевязывается никогда — иначе получается светлое на светлом. */
.btn--light{ background:var(--paper); border-color:var(--paper); color:var(--dark); }
.btn--light:hover{ background:var(--surface); border-color:var(--surface); color:var(--dark); }
.btn--outline-light{ background:transparent; border-color:var(--on-dark-soft); color:var(--on-dark); }
.btn--outline-light:hover{ background:var(--on-dark); border-color:var(--on-dark); color:var(--dark); }
.btn--sm{ min-height:42px; padding:9px 17px; font-size:.86rem; }

.actions{ display:flex; flex-wrap:wrap; gap:12px; margin-top:1.8em; }
.actions .btn{ flex:0 1 auto; }

.textlink{
  display:inline-flex; align-items:center; min-height:40px;   /* зона нажатия на мобильном */
  font-weight:700; text-decoration:none;
  color:var(--accent); box-shadow:inset 0 -2px 0 currentColor;
}
.textlink:hover{ color:var(--brand); }

/* --- section-head (общий заголовок секции) --- */
.section-head{ margin-bottom:clamp(32px, 4vw, 64px); max-width:72ch; }
.section-head h2{ margin-bottom:.35em; }
.section-head p{ color:var(--ink-soft); max-width:62ch; margin:0; }
.blk--brand .section-head p, .blk--dark .section-head p{ color:var(--on-dark-soft); }
.section-head--split{
  display:grid; grid-template-columns:repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap:var(--gap); max-width:none; align-items:end;
}
.section-head--center{ margin-inline:auto; text-align:center; max-width:60ch; }
.section-head--center .eyebrow{ justify-content:center; }

/* --- медиа-рамка (единое поведение для всех картинок в блоках) --- */
.frame{
  margin:0; overflow:hidden; background:var(--tone);
  border-radius:var(--radius-lg); min-width:0;
}
.frame img{ width:100%; height:100%; object-fit:cover; }
.frame--tall{ aspect-ratio:4/5; }
.frame--portrait{ aspect-ratio:3/4; }
.frame--square{ aspect-ratio:1/1; }
.frame--wide{ aspect-ratio:3/2; }
.frame--cinema{ aspect-ratio:16/9; }
.frame figcaption{ padding:10px 2px 0; font-size:.82rem; color:var(--ink-soft); }

/* --- формы --- */
.field{ display:block; min-width:0; margin:0; }   /* поля часто верстаются как <p> — гасим его отступ */
.field > label{
  display:block; font-size:.8rem; font-weight:800; letter-spacing:.04em;
  margin-bottom:6px; color:var(--ink);
}
.field input, .field select, .field textarea{
  width:100%; min-width:0; min-height:52px;
  padding:13px 15px;
  border:1px solid var(--line); border-radius:var(--radius);
  background:var(--surface); color:var(--ink);
}
.field textarea{ min-height:150px; resize:vertical; }
.field input:focus, .field select:focus, .field textarea:focus{
  outline:2px solid var(--brand); outline-offset:1px; border-color:var(--brand);
}
.field--wide{ grid-column:1 / -1; }
.field .err{ display:block; min-height:1.15em; margin-top:5px; font-size:.78rem; font-weight:700; color:#A3231F; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"], .field select[aria-invalid="true"]{ border-color:#A3231F; }
.form-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap:16px 18px; }
.form-note{ font-size:.82rem; color:var(--ink-soft); margin:16px 0 0; }
.form-status{ margin-top:14px; min-height:1.4em; font-weight:700; font-size:.9rem; }
.form-status[data-state="error"]{ color:#A3231F; }
.form-status[data-state="ok"]{ color:var(--brand); }
.consent{ display:flex; flex-wrap:wrap; gap:10px; align-items:flex-start; font-size:.85rem; color:var(--ink-soft); margin-top:18px; }
.consent > label{ flex:1 1 200px; font-size:.85rem; font-weight:600; margin:0; }
.consent .err{ flex-basis:100%; }
.consent input{ width:20px; height:20px; min-height:0; flex:none; margin-top:2px; }

/* --- доступность --- */
.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:fixed; z-index:1000; left:16px; top:-120px;
  background:var(--surface); color:var(--ink); padding:12px 18px;
  border:1px solid var(--line); border-radius:var(--radius);
  text-decoration:none; font-weight:700;
}
.skip-link:focus{ top:16px; }

:is(a, button, input, select, textarea, summary, [tabindex]):focus-visible{
  outline:3px solid var(--accent); outline-offset:3px;
}

/* --- проза (юридические и текстовые страницы) --- */
.prose{ max-width:78ch; }
.prose > :first-child{ margin-top:0; }   /* иначе у первого заголовка страницы лишние 49px сверху */
.prose h2{ font-size:clamp(1.45rem, 2.4vw, 2.1rem); margin-top:1.6em; }
.prose h3{ margin-top:1.5em; }
.prose ul, .prose ol{ padding-left:1.25em; margin:0 0 1.1em; }
.prose li{ margin-bottom:.5em; }
.prose a{ color:var(--accent); }
.prose table{ width:100%; border-collapse:collapse; }
.prose th, .prose td{ text-align:left; padding:12px; border-bottom:1px solid var(--line); vertical-align:top; }
.table-scroll{ overflow-x:auto; -webkit-overflow-scrolling:touch; }
.table-scroll table{ min-width:560px; }
.notice{
  padding:20px 22px; border-left:4px solid var(--accent);
  background:var(--tone); border-radius:0 var(--radius) var(--radius) 0;
}
.notice :last-child{ margin-bottom:0; }

/* --- анимация появления (полностью отключается reduce-motion) --- */
[data-reveal]{ opacity:0; transform:translateY(20px); transition:opacity .6s ease, transform .6s ease; }
[data-reveal].is-visible{ opacity:1; transform:none; }

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ transition:none !important; animation:none !important; scroll-behavior:auto !important; }
  [data-reveal]{ opacity:1; transform:none; }
  .btn:hover{ transform:none; }
}
