/* =============================================================================
   MyLappi — юридические страницы и 404 поверх main.css
   Подключается на: ru/privacy-policy, ru/privacy-policy-2025-07-01, ru/terms-of-service, 404.
   Брейкпоинты те же, что в main.css: 992 · 768 · 575 · 374 (только max-width).
   ============================================================================= */

/* =============================================================================
   Юр.страницы: шапка документа (крошки → eyebrow → h1 → карточка реквизитов)
   ============================================================================= */
.lg-hero {
  padding: 16px 0 calc(var(--wave-h) + 64px);
}

.lg-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: calc(880px + 2 * var(--gutter));
  text-align: center;
}

.lg-crumbs {
  max-width: 100%;
  margin-bottom: 26px;
}

/* ссылка крошки — тап-цель 44px, отрицательный margin держит высоту пилюли как в main.css */
.lg-crumbs .crumbs a {
  min-height: 44px;
  margin: -5px 0;
}

.lg-crumbs .crumbs .i {
  font-size: 16px;
  color: var(--primary);
}

.lg-title {
  max-width: 100%;
  margin-bottom: 34px;
  font-size: clamp(30px, 1.5rem + 2.2vw, 54px);
  text-wrap: balance;
}

/* карточка реквизитов документа */
.doc-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 760px;
  padding: 24px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--white);
  box-shadow: var(--sh-1);
  text-align: left;
}

.doc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px 24px;
}

.doc-card--archive .doc-row {
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
}

.doc-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
}

.doc-item-text,
.archive-note-text {
  min-width: 0;
  font-size: 15.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;     /* длинные URL в шапке архивной редакции не распирают страницу на 320 */
}

.doc-item-title {
  margin-bottom: 2px;
  font-size: 17px;
  line-height: 1.35;
  color: var(--ink);
}

.doc-item-title b { font-weight: 900; }

.doc-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  background: var(--cream);
  font-size: 15.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.doc-strip .i {
  font-size: 22px;
  color: var(--peach-600);
}

/* ссылки в шапке документа и в тексте */
.doc-card a,
.archive-note-text a,
.lg-read a {
  color: var(--primary-600);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: var(--lav-200);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: text-decoration-color .2s;
}

@media (hover: hover) {
  .doc-card a:hover,
  .lg-read a:hover { text-decoration-color: var(--primary); }
}

/* архивная редакция: плашка над карточкой реквизитов */
.archive-note {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px 16px;
  width: 100%;
  max-width: 760px;
  margin-bottom: 16px;
  padding: 20px 22px;
  border: 1.5px solid #FBE6B8;
  border-radius: var(--r-lg);
  background: var(--butter-50);
  text-align: left;
}

.archive-note .tile {
  background: var(--white);
  color: var(--butter-700);
}

.archive-note-text .doc-item-title { font-size: 18px; }

.archive-note-btn {
  grid-column: 2;
  justify-self: start;
}

/* =============================================================================
   Юр.страницы: колонка чтения
   ============================================================================= */
.lg-body {
  background: var(--white);
  padding: 16px 0 110px;
}

.lg-read {
  max-width: calc(760px + 2 * var(--gutter));
  font-size: 17px;
  line-height: 1.7;
}

.lg-read p,
.lg-read li,
.lg-read td {
  overflow-wrap: anywhere;
}

.lg-read p {
  margin: 0 0 18px;
}

.lg-read b { color: var(--ink); }

.lg-sec {
  padding-top: 48px;
}

.lg-sec:first-child {
  padding-top: 24px;
}

.lg-sec h2 {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 20px;
  font-size: 30px;
  line-height: 1.2;
}

/* номер раздела — цветная плитка; точка из исходного «1.» остаётся в тексте заголовка, но не видна */
.sec-n {
  flex: 0 0 48px;
  height: 48px;
  border-radius: 16px;
  font-size: 21px;
  font-weight: 900;
  line-height: 48px;
  text-align: center;
  letter-spacing: 0;
}

.sec-dot {
  display: inline-block;
  width: 0;
  overflow: hidden;
  vertical-align: top;
}

.lg-sec:nth-of-type(3n+1) .sec-n { background: var(--lav-100); color: var(--primary-600); }
.lg-sec:nth-of-type(3n+2) .sec-n { background: var(--peach-50); color: var(--peach-700); }
.lg-sec:nth-of-type(3n) .sec-n { background: var(--butter-50); color: var(--butter-700); }

.lg-sec h3 {
  margin: 30px 0 10px;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.3;
}

.lg-sec h3 .n {
  color: var(--primary);
}

/* списки — лапки в лавандовых кружках */
.lg-read ul {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0 0 22px;
  list-style: none;
}

.lg-read li {
  position: relative;
  padding-left: 36px;
}

.lg-read li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--lav-100) center / 14px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237352C9'%3E%3Cellipse cx='5' cy='10' rx='2.3' ry='2.9'/%3E%3Cellipse cx='9.2' cy='5.2' rx='2.3' ry='3'/%3E%3Cellipse cx='14.8' cy='5.2' rx='2.3' ry='3'/%3E%3Cellipse cx='19' cy='10' rx='2.3' ry='2.9'/%3E%3Cpath d='M12 11.2c-3.3 0-6.4 4.6-6.4 7.4 0 2.2 1.9 2.8 3.4 2.4 1.2-.3 2-.9 3-.9s1.8.6 3 .9c1.5.4 3.4-.2 3.4-2.4 0-2.8-3.1-7.4-6.4-7.4z'/%3E%3C/svg%3E");
}

/* история редакций — таймлайн */
.lg-read ul.timeline {
  gap: 0;
  margin-left: 4px;
}

.timeline li {
  padding: 0 0 18px 34px;
}

.timeline li:last-child { padding-bottom: 0; }

.timeline li::before {
  top: 7px;
  width: 14px;
  height: 14px;
  background: var(--primary);
  box-shadow: 0 0 0 5px var(--lav-100);
}

.timeline li + li::before {
  background: var(--white);
  box-shadow: inset 0 0 0 2.5px var(--lav-200);
}

.timeline li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 24px;
  bottom: 2px;
  width: 2px;
  border-radius: 2px;
  background: var(--lav-100);
}

/* таблицы: десктоп — скруглённая рамка с кремовой шапкой; прокрутка (если вдруг не влезет) — внутри обёртки */
.lg-table-wrap {
  margin: 6px 0 22px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--white);
  overflow-x: auto;
}

.lg-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 16px;
  line-height: 1.55;
}

.lg-table th {
  padding: 13px 20px;
  background: var(--cream);
  text-align: left;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--primary-600);
  vertical-align: bottom;
}

.lg-table td {
  padding: 14px 20px;
  border-top: 1.5px solid var(--line);
  vertical-align: top;
}

.lg-table td:first-child {
  width: 34%;
  font-weight: 800;
  color: var(--ink);
}

.lg-table--3 td:first-child { width: 28%; }
.lg-table--3 td:last-child { width: 28%; }

.lg-table--6 th,
.lg-table--6 td { padding-left: 14px; padding-right: 14px; }
.lg-table--6 { font-size: 15px; }
.lg-table--6 td:first-child { width: auto; }
.lg-read .lg-table--6 td { overflow-wrap: break-word; }   /* шесть узких столбцов: не рвать слова посреди, лишнее — прокрутка внутри обёртки */

.lg-table tbody tr:nth-child(even) { background: #FFFCF7; }

/* важный абзац */
.lg-read .callout {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin: 4px 0 22px;
  padding: 18px 20px;
  border: 1.5px solid var(--lav-200);
  border-radius: var(--r-md);
  background: var(--lav-50);
}

.callout-ic {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--white);
  color: var(--primary-600);
  font-size: 22px;
}

.lg-read .callout p {
  margin: 0;
  padding-top: 4px;
  line-height: 1.65;
}

/* ссылка на шаблон договора: иконка документа — маской (i-file-doc-bold из спрайта), чтобы ссылка осталась текстовой */
.lg-read a.dl-link::before {
  content: "";
  display: inline-block;
  width: 1.05em;
  height: 1.05em;
  margin-right: 4px;
  vertical-align: -.15em;
  background: currentColor;
  -webkit-mask: var(--ic-doc) center / contain no-repeat;
  mask: var(--ic-doc) center / contain no-repeat;
}

.dl-link {
  --ic-doc: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath d='M48,140H32a12,12,0,0,0-12,12v56a12,12,0,0,0,12,12H48a40,40,0,0,0,0-80Zm0,56H44V164h4a16,16,0,0,1,0,32Zm180.3-3.8a12,12,0,0,1,.37,17A34,34,0,0,1,204,220c-19.85,0-36-17.94-36-40s16.15-40,36-40a34,34,0,0,1,24.67,10.83,12,12,0,0,1-17.34,16.6A10.27,10.27,0,0,0,204,164c-6.5,0-12,7.33-12,16s5.5,16,12,16a10.27,10.27,0,0,0,7.33-3.43A12,12,0,0,1,228.3,192.2ZM128,140c-19.85,0-36,17.94-36,40s16.15,40,36,40,36-17.94,36-40S147.85,140,128,140Zm0,56c-6.5,0-12-7.33-12-16s5.5-16,12-16,12,7.33,12,16S134.5,196,128,196ZM48,120a12,12,0,0,0,12-12V44h76V92a12,12,0,0,0,12,12h48v4a12,12,0,0,0,24,0V88a12,12,0,0,0-3.51-8.48l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40v68A12,12,0,0,0,48,120ZM160,57l23,23H160Z'/%3E%3C/svg%3E");
}

/* контакты — карточка с иконками */
.contact-card {
  padding: 8px 22px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--cream);
}

.c-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
}

.c-row + .c-row {
  border-top: 1.5px solid var(--line);
}

.c-row .tile {
  width: 42px;
  height: 42px;
  font-size: 22px;
}

.lg-read .contact-card p {
  margin: 0;
  min-width: 0;
}

/* =============================================================================
   404
   ============================================================================= */
.nf-zone {
  padding: 0 0 110px;
  overflow-x: clip;          /* края декоративной сцены не дают горизонтального скролла */
}

.nf-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 40px;
  padding: 40px 0 30px;
}

.nf-hero h1 {
  margin-bottom: 24px;
}

.nf-hero h1 .marker { white-space: nowrap; }

.nf-text {
  max-width: 500px;
  margin-bottom: 32px;
  font-size: 19px;
}

.nf-hl {
  color: var(--primary-700);
  font-weight: 800;
  background: linear-gradient(transparent 64%, var(--butter) 64%, var(--butter) 94%, transparent 94%);
  padding: 0 2px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.nf-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

/* сцена рисуется в 560×480 и масштабируется целиком через --nf-s */
.nf-visual {
  --nf-s: 1;
  position: relative;
  height: calc(480px * var(--nf-s));
}

.nf-stage {
  position: absolute;
  left: 50%;
  top: 0;
  width: 560px;
  height: 480px;
  margin-left: -280px;
  transform: scale(var(--nf-s));
  transform-origin: top center;
}

.nf-blob-lav { width: 200px; height: 200px; left: 10px; top: 10px; }
.nf-blob-peach { width: 270px; height: 270px; right: 0; bottom: 10px; }

.nf-digits {
  position: absolute;
  left: 0;
  right: 0;
  top: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.nf-d {
  font-size: 210px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--primary-700);
  text-shadow: 0 10px 0 rgba(166, 139, 215, .25);
}

.nf-zero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 184px;
  height: 184px;
  border: 9px solid #fff;
  border-radius: 50%;
  background: var(--butter);
  box-shadow: var(--sh-2);
  font-size: 108px;
  color: var(--peach-600);
}

.nf-mag {
  position: absolute;
  right: -26px;
  top: -18px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--sh-2);
  font-size: 34px;
  color: var(--primary);
  transform: rotate(-8deg);
}

.nf-chip {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  font-size: 30px;
  box-shadow: var(--sh-1);
}

.nf-chip--1 { left: 62px; top: 34px; transform: rotate(-12deg); }
.nf-chip--2 { right: 34px; top: 28px; transform: rotate(10deg); }
.nf-chip--3 { right: 10px; top: 250px; width: 46px; height: 46px; border-radius: 50%; font-size: 24px; transform: rotate(-6deg); }

.nf-q {
  position: absolute;
  left: 400px;
  top: 356px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--sh-2);
  font-size: 30px;
  color: var(--peach-600);
  animation: floaty 5.5s ease-in-out infinite;
}

/* след лапок, который обрывается у вопросика */
.nf-paws .i {
  position: absolute;
  font-size: 30px;
  color: var(--primary);
}

.nf-paws .i:nth-child(1) { left: 18px; top: 420px; transform: rotate(62deg); opacity: .95; }
.nf-paws .i:nth-child(2) { left: 62px; top: 388px; transform: rotate(70deg); opacity: .9; }
.nf-paws .i:nth-child(3) { left: 106px; top: 414px; transform: rotate(78deg); opacity: .8; }
.nf-paws .i:nth-child(4) { left: 152px; top: 382px; transform: rotate(84deg); opacity: .7; }
.nf-paws .i:nth-child(5) { left: 198px; top: 406px; transform: rotate(90deg); opacity: .58; }
.nf-paws .i:nth-child(6) { left: 244px; top: 376px; transform: rotate(96deg); opacity: .45; }
.nf-paws .i:nth-child(7) { left: 290px; top: 398px; transform: rotate(102deg); opacity: .32; }
.nf-paws .i:nth-child(8) { left: 334px; top: 372px; transform: rotate(108deg); opacity: .2; }

/* «Или загляните сюда» */
.nf-links {
  margin-top: 30px;
  padding: 30px 32px 32px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--white);
  box-shadow: var(--sh-1);
}

.nf-links-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 20px;
  font-weight: 900;
  color: var(--ink);
}

.nf-links-head .i {
  font-size: 26px;
  color: var(--peach-600);
}

.nf-links ul {
  display: grid;
  /* 205px: при меньшей колонке «специалиста» / «Академия» не влезали рядом с иконкой и стрелкой и рвались посреди
     слова (li — overflow-wrap: break-word); теперь карточка переходит на следующую строку, а не сжимается */
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: 12px;
  list-style: none;
}

.nf-link {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
  min-height: 72px;
  padding: 12px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--cream);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink);
  transition: background-color .2s, border-color .2s;
}

.nf-link .tile {
  width: 40px;
  height: 40px;
  font-size: 22px;
}

.nf-link-text { min-width: 0; }

.nf-arr {
  margin-left: auto;
  font-size: 16px;
  color: var(--primary);
  transition: transform .2s;
}

@media (hover: hover) {
  .nf-link:hover { background: var(--lav-50); border-color: var(--lav-200); }
  .nf-link:hover .nf-arr { transform: translateX(3px); }
}

/* =============================================================================
   Адаптив
   ============================================================================= */
@media (max-width: 1200px) {
  .nf-visual { --nf-s: .85; }
}

@media (max-width: 992px) {
  .lg-hero { padding-bottom: calc(var(--wave-h) + 48px); }

  .nf-hero { gap: 24px; }
  .nf-visual { --nf-s: .7; }
}

@media (max-width: 768px) {
  .lg-body { padding-bottom: 80px; }
  .lg-sec h2 { font-size: 26px; }

  .nf-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 8px 0 10px;
  }
  .nf-visual { order: -1; --nf-s: .75; }
  .nf-zone { padding-bottom: 80px; }
}

@media (max-width: 575px) {
  /* шапка документа — по левому краю */
  .lg-hero { padding: 8px 0 calc(var(--wave-h) + 32px); }
  .lg-head { align-items: flex-start; text-align: left; }
  .lg-crumbs { margin-bottom: 22px; }
  .lg-crumbs .crumbs { font-size: 14px; padding: 6px 12px; border-radius: 20px; }   /* переносится в 2–3 строки — не «капсула» */
  .lg-title { margin-bottom: 22px; font-size: var(--fs-h1-sm); line-height: 1.15; }

  .doc-card { gap: 14px; padding: 18px; border-radius: 24px; }
  .doc-row,
  .doc-card--archive .doc-row { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .doc-item { gap: 12px; }
  .doc-item-text { font-size: 15px; }
  .doc-strip { align-items: flex-start; padding: 12px 14px; font-size: 15px; }
  .doc-strip .i { margin-top: 2px; }

  .archive-note { grid-template-columns: 42px minmax(0, 1fr); align-items: start; gap: 12px; padding: 16px; }
  .archive-note .tile { width: 42px; height: 42px; font-size: 22px; }
  .archive-note-text { font-size: 15px; }
  .archive-note-btn {
    grid-column: 1 / -1;
    justify-self: stretch;
    justify-content: space-between;
    text-align: left;
    line-height: 1.3;
    padding: 12px 20px;
    font-size: 15px;
  }

  .lg-body { padding: 4px 0 64px; }
  .lg-read { font-size: 16.5px; line-height: 1.65; }
  .lg-sec { padding-top: 38px; }
  .lg-sec h2 { align-items: flex-start; gap: 12px; margin-bottom: 16px; font-size: 23px; }
  .sec-n { flex-basis: 40px; height: 40px; margin-top: -5px; border-radius: 13px; font-size: 18px; line-height: 40px; }
  .lg-sec h3 { margin: 24px 0 8px; font-size: 18px; }
  .lg-read li { padding-left: 34px; }
  .lg-read li::before { top: 3px; width: 22px; height: 22px; background-size: 13px; }
  .timeline li { padding-left: 30px; }
  .timeline li::before { top: 6px; width: 14px; height: 14px; }

  /* таблицы → карточка на строку; подписи столбцов из шапки (data-label), у двухколоночных — заголовок карточки */
  .lg-table-wrap { border: 0; border-radius: 0; background: none; overflow: visible; }
  .lg-table,
  .lg-table tbody,
  .lg-table tr,
  .lg-table td { display: block; width: auto !important; }
  .lg-table thead { display: none; }
  .lg-table tbody { display: flex; flex-direction: column; gap: 8px; }
  .lg-table tr,
  .lg-table tbody tr:nth-child(even) {
    padding: 12px 16px;
    border: 1.5px solid var(--line);
    border-radius: 16px;
    background: var(--white);
  }
  .lg-table td,
  .lg-table--6 td { padding: 0; border: 0; font-size: 15px; }
  .lg-table td:first-child { margin-bottom: 3px; font-size: 16px; }
  .lg-table td[data-label] { margin-top: 6px; }
  .lg-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 1px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--primary-600);
  }
  .lg-table--2 td[data-label] { margin-top: 0; }
  .lg-table--2 td[data-label]::before { content: none; }

  .lg-read .callout { gap: 12px; padding: 14px 16px; }
  .callout-ic { flex-basis: 36px; height: 36px; font-size: 20px; }

  .contact-card { padding: 4px 16px; border-radius: 22px; }
  .c-row { gap: 12px; font-size: 15.5px; }
  .c-row .tile { width: 38px; height: 38px; font-size: 20px; }

  /* 404 */
  .nf-visual { --nf-s: .58; }
  .nf-zone { padding-bottom: 60px; }
  .nf-hero h1 { margin-bottom: 16px; }
  .nf-text { margin-bottom: 24px; font-size: 17px; }
  .nf-buttons { flex-direction: column; gap: 10px; }
  .nf-buttons .btn { width: 100%; }
  .nf-links { margin-top: 26px; padding: 22px 16px 18px; border-radius: 26px; }
  .nf-links-head { margin-bottom: 14px; font-size: 18px; }
  .nf-links ul { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .nf-link { min-height: 60px; padding: 10px 12px 10px 10px; }
  .nf-link .tile { width: 40px; height: 40px; font-size: 22px; }
}

@media (max-width: 374px) {
  .lg-sec h2 { font-size: 21px; }
  .doc-card { padding: 16px; }
  .lg-read .callout { flex-direction: column; gap: 10px; }
  .lg-read .callout p { padding-top: 0; }

  .nf-visual { --nf-s: .5; }
}

@media (prefers-reduced-motion: reduce) {
  .nf-q { animation: none; }
  .nf-link,
  .nf-arr,
  .doc-card a,
  .lg-read a { transition: none; }
}
