/* Внутренние страницы (вход, политика, блог) поверх дизайн-системы лендинга (styles.css).
   Подключается только там, где нужен, — через слот head в x-layouts.site. */

.auth-page {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.auth-page main {
  flex: 1;
}

.auth-glow {
  position: absolute;
  z-index: -1;
  top: 44%;
  left: 62%;
  width: 820px;
  height: 820px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(108, 92, 231, 0.16), rgba(79, 124, 255, 0.03) 40%, transparent 68%);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.auth-card {
  width: min(100%, 470px);
  padding: clamp(28px, 4vw, 40px);
  border: 1px solid rgba(126, 103, 255, 0.34);
  border-radius: var(--radius-xl);
  background: linear-gradient(155deg, rgba(24, 32, 57, 0.96), rgba(11, 16, 33, 0.96));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ---------------------------------------------------------------- Вход */

/* Селекторы с .section: pages.css подключается раньше styles.css, и одиночный класс проигрывал бы базовому
   правилу .section { padding: 124px 0 } — из-за этого первые экраны внутренних страниц начинались слишком низко. */
.section.login-section {
  position: relative;
  overflow: hidden;
  padding-top: 28px;
}

.login-layout {
  display: grid;
  max-width: 1080px;
  margin-inline: auto;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
  align-items: start;
  gap: clamp(36px, 4vw, 64px);
}

.login-copy h1 {
  margin: 26px 0 22px;
  font-size: clamp(38px, 4.4vw, 62px);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.login-copy h1 i {
  color: var(--violet-light);
  font-style: normal;
}

.login-copy .hero-lead {
  max-width: 520px;
}

.login-copy .check-list {
  margin-top: 30px;
}

.login-help {
  margin-top: 32px;
  color: var(--muted);
  font-size: 15px;
}

.login-help a {
  color: var(--white);
  font-weight: 600;
}

.login-step {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.login-step label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.login-step input {
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(8, 12, 26, 0.72);
  color: var(--white);
  font-weight: 600;
}

.login-step input::placeholder {
  color: var(--muted-2);
  font-weight: 500;
}

.login-step input:focus-visible {
  border-color: rgba(154, 133, 255, 0.68);
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

/* Поле телефона — это код страны плюс ввод: обводим фокусом весь блок, а не правую половину. */
@supports selector(:has(a)) {
  .phone-field:has(> input:focus-visible) {
    border-radius: 13px;
    outline: 2px solid var(--violet);
    outline-offset: 2px;
  }

  .phone-field:has(> input:focus-visible) .phone-country summary {
    border-color: rgba(154, 133, 255, 0.68);
  }

  .phone-field > input:focus-visible {
    outline: none;
  }
}

.login-step .button {
  width: 100%;
  margin-top: 22px;
}

/* Поле телефона: код страны с флагом слева, маска +7 (000) 000-00-00 справа. */
.phone-field {
  display: flex;
  align-items: stretch;
}

.phone-field input {
  border-radius: 0 13px 13px 0;
  border-left: 0;
}

.phone-country {
  position: relative;
  flex: none;
}

.phone-country summary {
  display: flex;
  height: 100%;
  align-items: center;
  gap: 9px;
  padding: 0 13px 0 15px;
  border: 1px solid var(--line);
  border-radius: 13px 0 0 13px;
  background: rgba(21, 29, 52, 0.9);
  cursor: pointer;
  font-weight: 700;
  list-style: none;
  white-space: nowrap;
}

.phone-country summary::-webkit-details-marker {
  display: none;
}

.phone-country summary:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--violet);
  outline-offset: 2px;
}

.phone-country .flag {
  width: 22px;
  height: 16px;
  flex: none;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.phone-country .chev {
  width: 12px;
  height: 12px;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.phone-country[open] .chev {
  transform: rotate(180deg);
}

.phone-country ul {
  position: absolute;
  z-index: 5;
  top: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  margin: 0;
  padding: 7px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--panel-2);
  box-shadow: var(--shadow);
  list-style: none;
}

.phone-country li[role="option"] {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
}

.phone-country li[aria-selected="true"] {
  background: var(--violet-soft);
  font-weight: 600;
}

.phone-country li[role="option"] span {
  margin-left: auto;
  color: var(--muted);
  font-weight: 400;
}

.phone-country-note {
  padding: 8px 12px 4px;
  color: var(--muted-2);
  font-size: 12px;
}

.login-consent,
.login-resend {
  margin: 16px 0 0;
  color: var(--muted-2);
  font-size: 13px;
}

.login-consent a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.login-sent {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.login-sent b {
  color: var(--white);
  white-space: nowrap;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--violet-light);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link-button[disabled] {
  color: var(--muted-2);
  cursor: default;
  text-decoration: none;
}

#code {
  max-width: 230px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 6px;
}

.login-status {
  margin: 20px 0 0;
  padding: 13px 15px;
  border: 1px solid rgba(255, 138, 0, 0.35);
  border-radius: 13px;
  background: rgba(255, 138, 0, 0.08);
  color: #ffc48a;
  font-size: 14px;
}

.login-status[hidden] {
  display: none;
}

.login-note {
  margin: 26px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 13px;
  line-height: 1.55;
}

.login-note a {
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ------------------------------------------------- Юридические страницы */

.section.legal-section {
  padding-top: 28px;
}

.legal {
  max-width: 860px;
}

.legal h1 {
  margin: 22px 0 14px;
  font-size: clamp(34px, 4vw, 54px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.legal-date {
  color: var(--muted-2);
  font-size: 14px;
}

.legal h2 {
  margin: 48px 0 16px;
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.legal h3 {
  margin: 30px 0 12px;
  font-size: 18px;
  font-weight: 700;
}

.legal p,
.legal li {
  color: #c8cfdf;
  font-size: 16px;
}

.legal ul,
.legal ol {
  margin: 16px 0;
  padding-left: 22px;
}

.legal li {
  margin-bottom: 10px;
}

.legal a {
  color: var(--violet-light);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-box {
  margin: 26px 0;
  padding: 24px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(155deg, rgba(21, 29, 52, 0.9), rgba(10, 15, 32, 0.94));
}

.legal-box p:first-child {
  margin-top: 0;
}

.legal-box p:last-child {
  margin-bottom: 0;
}

/* ---------------------------------------------------------------- Блог */

.section.blog-section {
  padding-top: 28px;
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px;
  margin-top: 52px;
}

.post-card {
  display: flex;
  flex-direction: column;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: linear-gradient(155deg, rgba(21, 29, 52, 0.92), rgba(10, 15, 32, 0.96));
  text-decoration: none;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.post-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.36);
  transform: translateY(-4px);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.post-meta .post-tag {
  padding: 5px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 99px;
  color: #cfc6ff;
}

.post-card h2 {
  margin: 20px 0 0;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.post-card p {
  margin: 14px 0 26px;
  color: var(--muted);
  font-size: 15px;
}

.post-card .post-more {
  margin-top: auto;
  color: var(--violet-light);
  font-size: 14px;
  font-weight: 700;
}

.post {
  max-width: 1080px;
}

.post h1 {
  margin: 22px 0 18px;
  font-size: clamp(34px, 4.2vw, 56px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.post-lead {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 19px;
}

/* Статья и оглавление: текст слева, липкая навигация по разделам справа. */
.post-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 56px;
  align-items: start;
  margin-top: 44px;
}

.post-body {
  max-width: 780px;
}

.post-toc {
  position: sticky;
  top: calc(var(--header-height) + 24px);
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(155deg, rgba(21, 29, 52, 0.9), rgba(10, 15, 32, 0.94));
}

.post-toc summary {
  color: var(--muted-2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  list-style: none;
  text-transform: uppercase;
}

.post-toc summary::-webkit-details-marker {
  display: none;
}

.post-toc nav {
  display: grid;
  gap: 2px;
  margin-top: 16px;
}

.post-toc a {
  padding: 8px 0 8px 14px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.post-toc a:hover {
  color: var(--white);
}

.post-toc a.is-current {
  border-left-color: var(--violet);
  color: var(--white);
  font-weight: 600;
}

.post-body > h2:first-child {
  margin-top: 0;
}

.post-body h2 {
  margin: 46px 0 16px;
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.post-body h3 {
  margin: 32px 0 12px;
  font-size: 19px;
  font-weight: 700;
}

.post-body p,
.post-body li {
  color: #c8cfdf;
  font-size: 17px;
}

.post-body ul,
.post-body ol {
  margin: 18px 0;
  padding-left: 22px;
}

.post-body li {
  margin-bottom: 10px;
}

.post-body a {
  color: var(--violet-light);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-body blockquote {
  margin: 28px 0;
  padding: 18px 24px;
  border-left: 3px solid var(--violet);
  background: var(--violet-soft);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.post-body blockquote p {
  margin: 0;
}

/* Иллюстрации в статье: картинка на всю ширину колонки, подпись под ней (с 29.09.2026). */
.post-body figure,
.post-figure {
  margin: 32px 0;
}

.post-body figure img,
.post-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}

.post-body figcaption {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.post-body table {
  width: 100%;
  margin: 26px 0;
  border-collapse: collapse;
  font-size: 15px;
}

.post-body th,
.post-body td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.post-body th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.post-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  margin: 56px 0 0;
  padding: 32px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 92% 8%, rgba(108, 92, 231, 0.18), transparent 32%),
    linear-gradient(145deg, rgba(17, 24, 45, 0.98), rgba(8, 12, 26, 0.98));
}

.post-cta p {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
}

.post-cta small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
}

.post-more-list {
  margin-top: 64px;
}

.post-more-list h2 {
  margin: 0 0 26px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.post-more-list .blog-grid {
  grid-template-columns: repeat(2, 1fr);
  margin-top: 0;
}

@media (max-width: 1020px) {
  .post-columns { grid-template-columns: 1fr; gap: 0; }
  .post-toc { position: static; order: -1; margin-bottom: 32px; }
  .post-toc summary::after { content: " ▾"; }
  .post-toc[open] summary::after { content: " ▴"; }
  .login-layout { grid-template-columns: 1fr; }
  .auth-card { width: min(100%, 520px); }
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .section.login-section,
  .section.legal-section,
  .section.blog-section { padding-top: 18px; }
  .blog-grid,
  .post-more-list .blog-grid { grid-template-columns: 1fr; gap: 18px; }
  .post-card { padding: 24px; }
  .post-cta { flex-direction: column; align-items: flex-start; padding: 26px; }
  .post-cta .button { width: 100%; }
  .legal-box { padding: 20px; }
}

/* --------------------------------------------- Внутренние страницы в светлой теме */

:root[data-theme="light"] .auth-card,
:root[data-theme="light"] .post-card,
:root[data-theme="light"] .post-toc,
:root[data-theme="light"] .legal-box {
  background: #ffffff;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.07);
}

:root[data-theme="light"] .login-step input,
:root[data-theme="light"] .phone-country summary,
:root[data-theme="light"] .phone-country ul {
  background: #ffffff;
}

:root[data-theme="light"] .login-step input::placeholder {
  color: #9aa3b8;
}

:root[data-theme="light"] .legal p,
:root[data-theme="light"] .legal li,
:root[data-theme="light"] .post-body p,
:root[data-theme="light"] .post-body li {
  color: #3d4760;
}

:root[data-theme="light"] .post-body blockquote {
  background: rgba(108, 92, 231, 0.07);
}

:root[data-theme="light"] .auth-glow {
  opacity: 0.6;
}

:root[data-theme="light"] .link-button,
:root[data-theme="light"] .post-card .post-more,
:root[data-theme="light"] .post-toc a.is-current {
  color: #4d36c7;
}
