/* Mewmori — Persona Noir.
   Цвета, шрифт и форма панелей взяты из приложения:
   Mewmori/Sources/Common/Views/PersonaNoirDesign.swift */

@font-face {
  font-family: "Handjet";
  src: url("fonts/Handjet.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #f5f5ed;
  --surface: #ffffff;
  --surface-strong: #e6e6de;
  --ink: #1c1f29;
  --muted-border: #9ea1ab;
  --text: #1c1f29;
  --text-2: #474a54;
  --text-3: #737580;
  --inverted: #fafaf2;
  --accent: #8c6beb;
  --success: #59d6c7;
  --warning: #ff9633;
  --danger: #ff575e;

  /* PersonaControlShape: прямоугольник со ступенчатыми углами */
  --cut: 7px;
  --bw: 3px;
  --shape: polygon(
    var(--cut) 0, calc(100% - var(--cut)) 0,
    calc(100% - var(--cut)) var(--cut), 100% var(--cut),
    100% calc(100% - var(--cut)), calc(100% - var(--cut)) calc(100% - var(--cut)),
    calc(100% - var(--cut)) 100%, var(--cut) 100%,
    var(--cut) calc(100% - var(--cut)), 0 calc(100% - var(--cut)),
    0 var(--cut), var(--cut) var(--cut)
  );
  --drop: drop-shadow(4px 4px 0 var(--ink));

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161d;
    --surface: #1c1f29;
    --surface-strong: #262a36;
    --ink: #fafaf2;
    --muted-border: #4a4d58;
    --text: #fafaf2;
    --text-2: #c8cad2;
    --text-3: #9ea1ab;
    --inverted: #14161d;
    --drop: drop-shadow(4px 4px 0 #000);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Handjet", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 21px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; }

a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

/* ---------- панель в стиле приложения ----------
   Рамка и заливка рисуются двумя слоями с одинаковым clip-path:
   нижний — цвет рамки, верхний — заливка, вписанная внутрь на --bw. */

.panel, .card, .skin, .reaction, .box, .art, .faq details, .table-scroll, .button, .pay-methods span {
  position: relative;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  filter: var(--drop);
}

.panel::before, .card::before, .skin::before, .reaction::before, .box::before,
.art::before, .faq details::before, .table-scroll::before, .button::before,
.pay-methods span::before,
.panel::after, .card::after, .skin::after, .reaction::after, .box::after,
.art::after, .faq details::after, .table-scroll::after, .button::after,
.pay-methods span::after {
  content: "";
  position: absolute;
  z-index: -1;
  clip-path: var(--shape);
  pointer-events: none;
}

.panel::before, .card::before, .skin::before, .reaction::before, .box::before,
.art::before, .faq details::before, .table-scroll::before, .button::before,
.pay-methods span::before {
  inset: 0;
  background: var(--ink);
}

.panel::after, .card::after, .skin::after, .reaction::after, .box::after,
.art::after, .faq details::after, .table-scroll::after, .button::after,
.pay-methods span::after {
  inset: var(--bw);
  background: var(--fill, var(--surface));
}

/* ---------- шапка ---------- */

header.site {
  border-bottom: 3px solid var(--ink);
  background: var(--surface);
}
header.site .wrap {
  display: flex; align-items: center; gap: 16px;
  padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 26px; letter-spacing: 0.02em; text-decoration: none;
}
.brand img { width: 32px; height: 32px; }
nav.site { margin-left: auto; display: flex; gap: 18px; flex-wrap: wrap; font-size: 19px; }
nav.site a { text-decoration: none; color: var(--text-2); }
nav.site a:hover { color: var(--accent); }

.lang { display: flex; gap: 6px; align-items: center; font-size: 17px; }
.lang a { text-decoration: none; color: var(--text-3); }
.lang a[aria-current="true"] { color: var(--text); font-weight: 700; }
.lang span { color: var(--muted-border); }

/* ---------- герой ---------- */

.hero { padding-block: 64px 48px; text-align: center; }
.hero h1 {
  font-size: clamp(44px, 8vw, 76px); line-height: 1; letter-spacing: 0.01em;
  margin: 0 0 18px; font-weight: 700;
}
.hero p.lead { font-size: clamp(20px, 2.6vw, 24px); color: var(--text-2); max-width: 640px; margin: 0 auto 28px; }

.cat-hero { width: 180px; height: 180px; image-rendering: pixelated; margin: 0 auto 12px; display: block; }

/* ---------- кнопки ---------- */

.button {
  --fill: var(--accent);
  display: inline-block; padding: 14px 28px;
  color: #fff; font-weight: 700; font-size: 21px; text-decoration: none;
  transition: transform .08s ease, filter .08s ease;
}
.button:hover { color: #fff; transform: translate(2px, 2px); filter: drop-shadow(2px 2px 0 var(--ink)); }
.button.secondary { --fill: var(--surface); color: var(--text); }
.button.secondary:hover { color: var(--text); }
.buttons { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.note { font-size: 18px; color: var(--text-3); margin-top: 14px; }

/* ---------- секции и карточки ---------- */

section { padding-block: 44px; }
section h2 {
  font-size: clamp(30px, 4.6vw, 42px); line-height: 1.1; letter-spacing: 0.01em;
  margin: 0 0 8px; font-weight: 700;
}
section .sub { color: var(--text-2); margin: 0 0 28px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.card { padding: 20px; }
.card h3 { margin: 0 0 8px; font-size: 23px; font-weight: 700; }
.card p { margin: 0; color: var(--text-2); font-size: 19px; }

/* ---------- витрина ---------- */

.grid-skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.skin { padding: 14px; text-align: center; }
.skin img { width: 100%; max-width: 120px; image-rendering: pixelated; display: block; margin: 0 auto 8px; }
.skin .name { font-weight: 700; font-size: 19px; }
.skin .price { font-size: 19px; color: var(--text-2); margin-top: 2px; }
.skin .free { color: var(--accent); font-weight: 700; }

.table-scroll { overflow-x: auto; margin: 0 0 24px; padding: var(--bw); }
table.price { width: 100%; border-collapse: collapse; background: transparent; }
table.price th, table.price td {
  padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--muted-border); font-size: 19px;
}
table.price th { background: var(--surface-strong); font-weight: 700; }
table.price td:last-child, table.price th:last-child { text-align: right; white-space: nowrap; }
table.price tr:last-child td { border-bottom: 0; }

/* ---------- правовые страницы ---------- */

.legal { padding-block: 40px 64px; }
.legal h1 { font-size: clamp(34px, 5vw, 46px); line-height: 1.1; margin: 0 0 6px; font-weight: 700; }
.legal .updated { color: var(--text-3); font-size: 18px; margin: 0 0 32px; }
.legal h2 { font-size: 26px; margin: 34px 0 10px; font-weight: 700; }
.legal h3 { font-size: 22px; margin: 24px 0 8px; font-weight: 700; }
.legal p, .legal li { color: var(--text-2); }
.legal ul, .legal ol { padding-left: 22px; }
.legal li { margin-bottom: 6px; }

.box { padding: 20px 22px; margin: 24px 0; }
.box p:first-child { margin-top: 0; }
.box p:last-child { margin-bottom: 0; }
.box dl { margin: 0; display: grid; grid-template-columns: minmax(140px, auto) 1fr; gap: 8px 18px; }
.box dt { color: var(--text-3); font-size: 19px; }
.box dd { margin: 0; font-weight: 700; font-size: 19px; }

/* ---------- лендинг ---------- */

.band { background: var(--surface); border-top: 3px solid var(--ink); border-bottom: 3px solid var(--ink); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.split .art { --fill: var(--bg); padding: 28px; text-align: center; }
.split .art img { width: 150px; image-rendering: pixelated; }
.split h2 { margin-bottom: 14px; }
.split p { color: var(--text-2); margin: 0 0 14px; }

.reactions { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 14px; }
.reaction { padding: 16px 18px; }
.reaction .when { font-weight: 700; font-size: 20px; margin-bottom: 4px; }
.reaction .then { color: var(--text-2); font-size: 19px; }

.cat-strip { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 0 0 22px; }
.cat-strip img { width: 76px; image-rendering: pixelated; }

.faq { max-width: 720px; margin: 0 auto; }
.faq details { padding: 14px 18px; margin-bottom: 14px; }
.faq summary { font-weight: 700; cursor: pointer; list-style: none; font-size: 21px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; float: right; color: var(--text-3); font-weight: 700; }
.faq details[open] summary::after { content: "–"; }
.faq p { color: var(--text-2); margin: 12px 0 0; font-size: 19px; }

.cta { text-align: center; padding-block: 60px; }
.cta h2 { margin-bottom: 10px; }
.cta p { color: var(--text-2); max-width: 560px; margin: 0 auto 24px; }

/* ---------- подвал ---------- */

footer.site {
  border-top: 3px solid var(--ink); background: var(--surface);
  padding: 30px 0 40px; font-size: 18px; color: var(--text-3);
}
footer.site nav { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
footer.site nav a { color: var(--text-2); text-decoration: none; }
footer.site nav a:hover { color: var(--accent); }
footer.site p { margin: 6px 0; }
.pay-methods { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 16px 0; }
.pay-methods span { --fill: var(--surface); padding: 5px 12px; font-size: 17px; color: var(--text-2); }

/* ---------- маленькие радости ----------
   Всё, что двигается, отключается при prefers-reduced-motion. */

/* Коты не стоят на месте. Движение плавное, на transform — его считает
   композитор, поэтому анимация не дёргается даже на слабых машинах. */
@keyframes idle-bob {
  0%   { transform: translateY(0); }
  50%  { transform: translateY(-12px); }
  100% { transform: translateY(0); }
}

/* Мягкая синусоида: наверху и внизу кот чуть задерживается, как при дыхании */
.cat-hero, .split .art img, .cat-strip img {
  animation-name: idle-bob;
  animation-duration: 2.4s;
  animation-timing-function: cubic-bezier(.45, 0, .55, 1);
  animation-iteration-count: infinite;
  will-change: transform;
}
.split .art img { animation-duration: 2.8s; }
.band .split .art img { animation-delay: .9s; }

/* Ряд котов идёт волной, каждый со своей задержкой */
.cat-strip img { cursor: pointer; }
.cat-strip img:nth-child(1)  { animation-delay: 0s; }
.cat-strip img:nth-child(2)  { animation-delay: .16s; }
.cat-strip img:nth-child(3)  { animation-delay: .32s; }
.cat-strip img:nth-child(4)  { animation-delay: .48s; }
.cat-strip img:nth-child(5)  { animation-delay: .64s; }
.cat-strip img:nth-child(6)  { animation-delay: .8s; }
.cat-strip img:nth-child(7)  { animation-delay: .96s; }
.cat-strip img:nth-child(8)  { animation-delay: 1.12s; }
.cat-strip img:nth-child(9)  { animation-delay: 1.28s; }
.cat-strip img:nth-child(10) { animation-delay: 1.44s; }
.cat-strip img:nth-child(11) { animation-delay: 1.6s; }

/* Наводишь — кот подпрыгивает выше обычного и мягко приземляется */
.cat-strip img:hover { animation: hop .6s cubic-bezier(.34, 1.4, .64, 1) 1; }
@keyframes hop {
  0%   { transform: translateY(0); }
  35%  { transform: translateY(-24px); }
  100% { transform: translateY(0); }
}

/* Кот гуляет по нижнему краю первого экрана и разворачивается у стенок */
.hero { position: relative; overflow: hidden; }
.walker {
  position: absolute; bottom: 0; left: -70px;
  width: 58px; image-rendering: pixelated; pointer-events: none;
  animation: walk 26s linear infinite;
  will-change: left;
}
@keyframes walk {
  0%   { left: -70px; transform: scaleX(1); }
  49%  { left: 100%;  transform: scaleX(1); }
  50%  { left: 100%;  transform: scaleX(-1); }
  99%  { left: -70px; transform: scaleX(-1); }
  100% { left: -70px; transform: scaleX(1); }
}

/* Кот в герое кликабельный — по клику говорит */
.cat-hero { cursor: pointer; }
.cat-say {
  position: relative;
  margin: 0 auto 10px;
  max-width: 340px;
  padding: 10px 16px;
  font-size: 19px;
  text-align: center;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease;
}
.cat-say.visible { opacity: 1; transform: translateY(0); }

/* Появление блоков при прокрутке */
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.shown { opacity: 1; transform: translateY(0); transition: opacity .45s ease, transform .45s ease; }

/* Ачивка в стиле приложения */
.achievement {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; max-width: min(340px, calc(100vw - 40px));
  opacity: 0; transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease;
}
.achievement.shown { opacity: 1; transform: translateY(0); }
.achievement .emoji { font-size: 26px; line-height: 1; }
.achievement .title { font-weight: 700; font-size: 19px; }
.achievement .desc { color: var(--text-2); font-size: 17px; }

@media (prefers-reduced-motion: reduce) {
  .cat-hero, .split .art img, .cat-strip img, .cat-strip img:hover, .walker { animation: none; }
  .walker { display: none; }
  .reveal, .reveal.shown, .cat-say, .achievement { opacity: 1; transform: none; transition: none; }
}

@media (max-width: 760px) {
  .split { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 640px) {
  .hero { padding-block: 44px 32px; }
  nav.site { width: 100%; margin-left: 0; gap: 14px; }
  /* Пальцем в 14×26 не попасть — растим области нажатия */
  nav.site a, footer.site nav a { display: inline-block; padding: 6px 2px; }
  .lang { font-size: 19px; }
  .lang a { display: inline-block; padding: 6px 8px; }
}
