/* ============================================================
   666pay — общий каркас сайта: токены, база, шапка, меню, кнопки, подвал.
   Новый язык страниц шлюза. Главная подключает его первой, остальные
   страницы переезжают на него по одной; до тех пор они живут на styles.css.

   Палитра — та же, что у обменника (brand.css): светлая тема — пепельный
   пергамент и тёмная кровь, тёмная — уголь с кровавым подтоном и пламя.
   ============================================================ */

:root {
  --hx-ground: #F4EEE9;
  --hx-raise: #FFFBF8;
  --hx-sunk: #EAE0D9;
  --hx-line: #D9C9C0;
  --hx-line-soft: #E6DAD2;
  --hx-text: #1A0B0A;
  --hx-dim: #6B524D;
  --hx-faint: #9A817B;
  --hx-accent: #A8120C;
  --hx-accent-soft: #F6DED9;
  --hx-on-accent: #FFF6F2;
  --hx-live: #A44A0A;
  --hx-ok: #2F7D4F;
  --hx-bad: #B0103F;
  --hx-ember: #F5973A;

  --hx-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --hx-body: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif;
  --hx-data: "Martian Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --ease: cubic-bezier(.2, .7, .2, 1);
  --shell: 1240px;
  --gutter: clamp(16px, 4vw, 40px);
  --sh-h: 72px;
}

:root[data-theme="dark"],
.cond-dark {
  --hx-ground: #0B0506;
  --hx-raise: #150A0B;
  --hx-sunk: #070304;
  --hx-line: #2E1517;
  --hx-line-soft: #1F0E10;
  --hx-text: #F2E8E4;
  --hx-dim: #A98E89;
  --hx-faint: #6E5552;
  --hx-accent: #EE2A1B;
  --hx-accent-soft: #2B0B0A;
  --hx-on-accent: #FFF6F2;
  --hx-live: #F5973A;
  --hx-ok: #5FBF85;
  --hx-bad: #FF4D7A;
}

/* ── База ─────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--sh-h) + 16px);
  -webkit-text-size-adjust: 100%;
  background: var(--hx-ground);
}

body {
  margin: 0;
  background: var(--hx-ground);
  color: var(--hx-text);
  font: 400 16px/1.6 var(--hx-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--hx-display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 em, h2 em, h3 em { font-style: italic; color: var(--hx-accent); }

p { margin: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; }
code, kbd, samp, .mn { font-family: var(--hx-data); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

::selection { background: var(--hx-accent); color: var(--hx-on-accent); }

:focus-visible { outline: 2px solid var(--hx-accent); outline-offset: 3px; }

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Подпись над заголовком: номер круга и тема, моноширинным с разрядкой. */
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 500 11px/1.55 var(--hx-data);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--hx-dim);
}
.kicker b { color: var(--hx-accent); font-weight: 500; }
.kicker::before {
  content: "";
  width: 22px;
  height: 1px;
  background: currentColor;
  opacity: .6;
}

/* Перевод: пока выбран EN, русский исходник не мелькает. */
.tongue-hold body { visibility: hidden; }

/* ── Кнопки ───────────────────────────────────────────────────────────── */

.press {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 2px;
  font: 600 14.5px/1 var(--hx-body);
  letter-spacing: .01em;
  white-space: nowrap;
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), box-shadow .25s var(--ease), transform .2s var(--ease);
}
.press svg { flex: none; transition: transform .25s var(--ease); }
.press:hover svg { transform: translateX(3px); }
.press--lg { height: 54px; padding: 0 28px; font-size: 15.5px; }
.press--sm { height: 38px; padding: 0 16px; font-size: 13.5px; }

/* Огненная: акцент с тлеющей кромкой снизу. */
.press--fire {
  background: var(--hx-accent);
  color: var(--hx-on-accent);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .22);
}
.press--fire:hover {
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .22), 0 0 0 4px color-mix(in srgb, var(--hx-accent) 22%, transparent), 0 10px 30px -10px var(--hx-accent);
  transform: translateY(-1px);
}

.press--ghost {
  border-color: var(--hx-line);
  color: var(--hx-text);
  background: transparent;
}
.press--ghost:hover { border-color: var(--hx-accent); color: var(--hx-accent); }

/* ── Шапка ────────────────────────────────────────────────────────────── */

.sh {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--sh-h);
  background: color-mix(in srgb, var(--hx-ground) 84%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--hx-line-soft);
  transition: height .25s var(--ease), background .25s var(--ease);
}

/* Тлеющая нить по нижней кромке: огонь гаснет к краям. */
.sh::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--hx-accent) 30%, var(--hx-ember) 50%, var(--hx-accent) 70%, transparent 100%);
  opacity: .55;
  pointer-events: none;
}

.sh[data-compact="true"] { height: 60px; }

.sh__in {
  height: 100%;
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 40px);
}

.sh__brand { display: inline-flex; align-items: center; flex: none; }
.sh__brand img { height: 46px; width: auto; transition: height .25s var(--ease); }
.sh[data-compact="true"] .sh__brand img { height: 38px; }
.sh__brand .lk-dark { display: none; }
:root[data-theme="dark"] .sh__brand .lk-light { display: none; }
:root[data-theme="dark"] .sh__brand .lk-dark { display: block; }

/* Разделы главной пронумерованы как круги: римская цифра — курсивом. */
.sh__nav {
  display: flex;
  align-items: center;
  gap: clamp(4px, 1.2vw, 18px);
  margin-inline-start: auto;
}
.sh__nav a {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  padding: 8px 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--hx-dim);
  transition: color .2s var(--ease);
}
.sh__nav a i {
  font: italic 600 13px/1 var(--hx-display);
  color: var(--hx-accent);
  opacity: .85;
}
.sh__nav a::after {
  content: "";
  position: absolute;
  inset: auto 6px 2px;
  height: 1px;
  background: var(--hx-accent);
  transform: scaleX(0);
  transition: transform .3s var(--ease);
}
.sh__nav a:hover, .sh__nav a.cond-on { color: var(--hx-text); }
.sh__nav a:hover::after, .sh__nav a.cond-on::after { transform: scaleX(1); }

.sh__act {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-inline-start: clamp(8px, 1.6vw, 20px);
  border-inline-start: 1px solid var(--hx-line-soft);
}

.sh__eco {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  font: 500 11px/1 var(--hx-data);
  letter-spacing: .06em;
  color: var(--hx-dim);
  transition: color .2s var(--ease);
}
.sh__eco:hover { color: var(--hx-accent); }

.ib {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: none;
  color: var(--hx-dim);
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.ib:hover { color: var(--hx-text); border-color: var(--hx-line); }

/* Тема: в светлой показан месяц (уйти во тьму), в тёмной — пламя свечи. */
.ib .i-dark { display: none; }
:root[data-theme="dark"] .ib .i-light { display: none; }
:root[data-theme="dark"] .ib .i-dark { display: block; }

/* Язык: два положения, без выпадашки. */
.lang2 {
  display: inline-flex;
  border: 1px solid var(--hx-line);
  border-radius: 2px;
  overflow: hidden;
}
.lang2 button {
  height: 30px;
  padding: 0 9px;
  border: 0;
  background: none;
  font: 500 11px/1 var(--hx-data);
  letter-spacing: .08em;
  color: var(--hx-faint);
  transition: color .2s var(--ease), background .2s var(--ease);
}
.lang2 button.cond-on { background: var(--hx-text); color: var(--hx-ground); }
.lang2 button:not(.cond-on):hover { color: var(--hx-text); }

.menubtn {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--hx-line);
  border-radius: 2px;
  background: none;
  position: relative;
}
.menubtn span {
  position: absolute;
  left: 11px;
  right: 11px;
  height: 1.5px;
  background: currentColor;
  transition: transform .3s var(--ease), opacity .2s;
}
.menubtn span:nth-child(1) { top: 14px; }
.menubtn span:nth-child(2) { top: 19px; }
.menubtn span:nth-child(3) { top: 24px; }
.menubtn.cond-x span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
.menubtn.cond-x span:nth-child(2) { opacity: 0; }
.menubtn.cond-x span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }

/* ── Мобильное меню: тёмный занавес с крупными номерами кругов ─────────── */

.shopnav {
  position: fixed;
  inset: 0;
  z-index: 49;
  display: flex;
  flex-direction: column;
  padding: calc(var(--sh-h) + 24px) var(--gutter) 32px;
  background: var(--hx-ground);
  color: var(--hx-text);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .25s var(--ease), transform .3s var(--ease), visibility 0s .3s;
  overflow-y: auto;
}
.shopnav-on .shopnav { opacity: 1; visibility: visible; transform: none; transition: opacity .25s var(--ease), transform .3s var(--ease); }
.shopnav a.shopnav__i {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--hx-line);
  font: 600 28px/1.1 var(--hx-display);
}
.shopnav a.shopnav__i i { font-size: 18px; color: var(--hx-accent); width: 28px; }
.shopnav__foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; padding-top: 28px; }
.shopnav__foot .press { width: 100%; }
.shopnav__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

@media (max-width: 1080px) {
  .sh__eco { display: none; }
}

@media (max-width: 980px) {
  .sh__nav, .sh__act .lang2, .sh__act .sh__login { display: none; }
  .menubtn { display: inline-block; }
  .sh__act { margin-inline-start: auto; border: 0; }
}

/* ── Подвал: всегда тёмный, огромное «666» уходит в тень ─────────────── */

.sf {
  position: relative;
  z-index: 2;
  background:
    radial-gradient(60% 120% at 50% 0%, color-mix(in srgb, var(--hx-accent) 10%, transparent), transparent 60%),
    var(--hx-sunk);
  color: var(--hx-text);
  padding-block: 88px 28px;
}

/* Кованая ограда — та же, что у обменника: перила внизу, прут и наконечник-пика
   на шаге 28px. Стоит над кромкой подвала и свешивается на секцию выше. */
.sf__fence {
  position: absolute;
  left: 0;
  right: 0;
  top: -38px;
  height: 40px;
  background: linear-gradient(to top, color-mix(in srgb, var(--hx-accent) 75%, var(--hx-line)), color-mix(in srgb, var(--hx-accent) 40%, var(--hx-line)));
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='40' viewBox='0 0 28 40'%3E%3Cpath d='M0 35h28v3H0zM12.6 36V13h2.8v23zM14 1l-6 13 6-3.2 6 3.2z' fill='%23000'/%3E%3C/svg%3E") repeat-x left bottom / 28px 40px;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='40' viewBox='0 0 28 40'%3E%3Cpath d='M0 35h28v3H0zM12.6 36V13h2.8v23zM14 1l-6 13 6-3.2 6 3.2z' fill='%23000'/%3E%3C/svg%3E") repeat-x left bottom / 28px 40px;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--hx-accent) 55%, transparent));
  pointer-events: none;
}

/* Огромное «666» обрезается своей рамкой: у самого подвала обрезки нет, иначе срезало бы ограду. */
.sf__ghostbox { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }

.sf__ghost {
  position: absolute;
  inset-inline-end: -2vw;
  bottom: -9vw;
  font: italic 700 clamp(220px, 34vw, 520px)/1 var(--hx-display);
  color: transparent;
  -webkit-text-stroke: 1px color-mix(in srgb, var(--hx-accent) 32%, transparent);
  letter-spacing: -0.04em;
  pointer-events: none;
  user-select: none;
}

.sf__grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 40px;
}

.sf__about img { height: 54px; width: auto; }
.sf__about p { margin-top: 18px; max-width: 34ch; color: var(--hx-dim); font-size: 14.5px; }
.sf__motto {
  margin-top: 22px;
  font: italic 500 17px/1.3 var(--hx-display);
  color: var(--hx-text);
}
.sf__motto span { display: block; margin-top: 4px; font: 400 11px/1.4 var(--hx-data); letter-spacing: .08em; color: var(--hx-faint); font-style: normal; }

.sf h4 {
  font: 500 11px/1 var(--hx-data);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--hx-faint);
  margin-bottom: 18px;
}
.sf ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.sf li a { color: var(--hx-dim); font-size: 14.5px; transition: color .2s var(--ease); }
.sf li a:hover { color: var(--hx-accent); }

.sf__bottom {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 72px;
  padding-top: 22px;
  border-top: 1px solid var(--hx-line);
  font: 400 11.5px/1 var(--hx-data);
  letter-spacing: .06em;
  color: var(--hx-faint);
}
.sf__live { display: inline-flex; align-items: center; gap: 8px; }
.sf__live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hx-ember);
  box-shadow: 0 0 0 0 var(--hx-ember);
  animation: sf-ember 2.4s ease-out infinite;
}
@keyframes sf-ember {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--hx-ember) 60%, transparent); }
  100% { box-shadow: 0 0 0 9px transparent; }
}

@media (max-width: 860px) {
  .sf__grid { grid-template-columns: 1fr 1fr; }
  .sf__about { grid-column: 1 / -1; }
}

/* ── Появление при прокрутке ──────────────────────────────────────────── */

.rvw { opacity: 0; transform: translateY(18px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
.rvw.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rvw { opacity: 1; transform: none; transition: none; }
  .sf__live i { animation: none; }
}
