/* ============================================================================
   meow.poofeg.ru — стили
   Порядок: переменные тем → база → декор → шапка → секции → футер → адаптив
   ========================================================================= */

/* ---------------------------------------------------------------------------
   1. Тема «День кота» (светлая, тёплая, как шерсть на солнце)
   ------------------------------------------------------------------------ */
:root {
  color-scheme: light;

  --bg: #fff6ec;
  --glow-1: #ffe4c4;
  --glow-2: #d8f0e3;
  --surface: #ffffff;
  --surface-soft: #fff2e2;
  --text: #4a3527;
  --text-muted: #8b7361;
  --accent: #e8802f;
  --accent-hover: #d26f22;
  --accent-contrast: #fffaf4;
  --accent-soft: #ffe0c0;
  --border: #f1ddc7;
  --focus: #1f6b58;
  --shadow: 0 14px 34px rgba(122, 84, 50, 0.13);
  --shadow-soft: 0 6px 18px rgba(122, 84, 50, 0.08);

  --radius: 24px;
  --radius-pill: 999px;
  --page-width: 1080px;
}

/* ---------------------------------------------------------------------------
   2. Тема «Ночь кота» (тёмная, как кот под одеялом)
   Значения продублированы в двух блоках намеренно: один отвечает за системную
   тёмную тему, второй — за ручной переключатель. Так нет «мигания» при загрузке.
   ------------------------------------------------------------------------ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="day"]) {
    color-scheme: dark;

    --bg: #191422;
    --glow-1: #3a2a3f;
    --glow-2: #213b3b;
    --surface: #241d2f;
    --surface-soft: #2d2439;
    --text: #f4e9dd;
    --text-muted: #b3a2b8;
    --accent: #ffb26b;
    --accent-hover: #ffc48d;
    --accent-contrast: #2a1a08;
    --accent-soft: #46324a;
    --border: #3a2f47;
    --focus: #8ee0c0;
    --shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
    --shadow-soft: 0 8px 20px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme="night"] {
  color-scheme: dark;

  --bg: #191422;
  --glow-1: #3a2a3f;
  --glow-2: #213b3b;
  --surface: #241d2f;
  --surface-soft: #2d2439;
  --text: #f4e9dd;
  --text-muted: #b3a2b8;
  --accent: #ffb26b;
  --accent-hover: #ffc48d;
  --accent-contrast: #2a1a08;
  --accent-soft: #46324a;
  --border: #3a2f47;
  --focus: #8ee0c0;
  --shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* ---------------------------------------------------------------------------
   3. База
   ------------------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", Verdana, sans-serif;
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.08rem);
  line-height: 1.65;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(60vw 55vw at 12% -8%, var(--glow-1), transparent 70%),
    radial-gradient(50vw 50vw at 105% 2%, var(--glow-2), transparent 65%);
  background-attachment: fixed;
  transition: background-color 0.35s ease, color 0.35s ease;
}

h1, h2, h3 {
  margin: 0 0 0.6em;
  line-height: 1.2;
  font-weight: 700;
}

p {
  margin: 0 0 1em;
}

/* Единый заметный фокус для клавиатурной навигации */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 8px;
}

/* Ссылка «перейти к содержимому» — видна только при фокусе */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 30;
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 700;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 16px;
}

/* ---------------------------------------------------------------------------
   4. Фоновые лапки и котики
   ------------------------------------------------------------------------ */
.floaties {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.floatie {
  position: absolute;
  bottom: -14vh;
  left: var(--x, 50%);
  font-size: var(--size, 2rem);
  opacity: 0;
  animation: float-up var(--dur, 22s) linear var(--delay, 0s) infinite;
  will-change: transform;
}

@keyframes float-up {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 0;
  }
  12% {
    opacity: var(--opacity, 0.35);
  }
  88% {
    opacity: var(--opacity, 0.35);
  }
  100% {
    transform: translate3d(var(--drift, 30px), -118vh, 0) rotate(var(--spin, 25deg));
    opacity: 0;
  }
}

/* ---------------------------------------------------------------------------
   5. Шапка
   ------------------------------------------------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px clamp(16px, 4vw, 36px);
  background: var(--bg); /* фолбэк для браузеров без color-mix() */
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

.topbar__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  max-width: var(--page-width);
  margin: 0 auto;
}

.logo {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
  text-decoration: none;
}

.logo__paw {
  font-size: 1.4rem;
  animation: paw-wave 3.6s ease-in-out infinite;
}

@keyframes paw-wave {
  0%, 60%, 100% { transform: rotate(0deg); }
  70% { transform: rotate(-18deg); }
  80% { transform: rotate(14deg); }
  90% { transform: rotate(-8deg); }
}

.theme-toggle {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.25s ease;
}

.theme-toggle:hover {
  transform: translateY(-2px);
  background: var(--surface-soft);
}

.theme-toggle__icon {
  font-size: 1.2rem;
}

/* ---------------------------------------------------------------------------
   6. Котики (кликабельные)
   ------------------------------------------------------------------------ */
.cat {
  display: grid;
  place-items: center;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

.cat__face {
  display: block;
  line-height: 1;
  user-select: none;
  transition: transform 0.2s ease;
}

.cat--hero {
  margin: 0 auto 8px;
}

.cat--hero .cat__face {
  font-size: clamp(5rem, 20vw, 12rem);
  filter: drop-shadow(0 18px 22px rgba(90, 60, 35, 0.22));
  animation: bounce 2.8s ease-in-out infinite;
}

.cat--pet .cat__face {
  font-size: clamp(4.5rem, 22vw, 14rem);
  filter: drop-shadow(0 18px 22px rgba(90, 60, 35, 0.22));
}

.cat:hover .cat__face {
  transform: scale(1.04);
}

/* Подпрыгивание по клику — перекрывает постоянную анимацию */
.cat.is-jumping .cat__face {
  animation: jump 0.65s ease;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7%); }
}

@keyframes jump {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-38%) scale(1.06) rotate(-4deg); }
  55% { transform: translateY(0) scaleY(0.92) scaleX(1.06); }
  75% { transform: translateY(-12%) rotate(3deg); }
  100% { transform: translateY(0) scale(1); }
}

/* ---------------------------------------------------------------------------
   7. Секции
   ------------------------------------------------------------------------ */
.section,
.hero {
  position: relative;
  z-index: 1;
  max-width: var(--page-width);
  padding: clamp(40px, 7vw, 84px) clamp(16px, 4vw, 36px);
  margin: 0 auto;
}

.section--facts,
.section--pet {
  text-align: center;
}

.hero {
  text-align: center;
  padding-top: clamp(32px, 6vw, 64px);
}

.hero__title {
  font-size: clamp(2rem, 5.6vw, 3.4rem);
  letter-spacing: -0.01em;
}

.hero__subtitle {
  max-width: 46ch;
  margin-inline: auto;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.hero__actions {
  margin: 28px 0 22px;
}

.section__title {
  font-size: clamp(1.6rem, 3.6vw, 2.4rem);
}

.section__lead {
  margin-bottom: 32px;
  color: var(--text-muted);
}

/* --- Кнопки --- */
.btn {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  padding: 16px 34px;
  font: inherit;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--accent-contrast);
  background: var(--accent);
  border: 0;
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-3px);
}

.btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn.is-pulsing {
  animation: pulse 0.45s ease;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--accent-soft); }
  100% { box-shadow: 0 0 0 22px transparent; }
}

/* --- Счётчик мурчания --- */
.counter {
  display: inline-block;
  padding: 18px 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.counter__value {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.counter__value strong {
  font-size: 1.7rem;
  color: var(--accent);
}

.counter__caption {
  margin: 0;
  color: var(--text-muted);
}

/* --- Карточки «услуг» --- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.card {
  padding: 26px 24px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-5px) rotate(-0.6deg);
  box-shadow: var(--shadow);
}

.card__icon {
  display: block;
  margin-bottom: 10px;
  font-size: 2.3rem;
}

.card__title {
  font-size: 1.2rem;
}

.card__text {
  margin: 0;
  color: var(--text-muted);
}

/* --- Котофакты --- */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.fact {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 22px;
  text-align: left;
  background: var(--surface-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.fact__num {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  font-weight: 700;
  color: var(--accent-contrast);
  background: var(--accent);
  border-radius: 50%;
}

.fact__text {
  margin: 0;
}

/* --- Погладь кота --- */
.section--pet .cat {
  margin: 0 auto 16px;
}

.section--pet .cat:active .cat__face {
  transform: scale(0.94);
}

.pet-counter {
  display: inline-block;
  padding: 14px 26px;
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-soft);
}

.pet-counter strong {
  color: var(--accent);
  font-size: 1.3rem;
}

/* ---------------------------------------------------------------------------
   8. Всплывающие слова («мур», «мяу»…) и фразы кота
   ------------------------------------------------------------------------ */
.pop-word {
  position: fixed;
  z-index: 25;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 2px 10px var(--bg);
  pointer-events: none;
  animation: pop-word 1.2s ease-out forwards;
}

@keyframes pop-word {
  0% { transform: translate(-50%, 0) scale(0.6); opacity: 0; }
  20% { transform: translate(-50%, -14px) scale(1.12); opacity: 1; }
  100% { transform: translate(-50%, -76px) scale(1); opacity: 0; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 26;
  max-width: min(92vw, 420px);
  padding: 14px 24px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 24px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------------------------------------------------------------------------
   9. Футер
   ------------------------------------------------------------------------ */
.footer {
  position: relative;
  z-index: 1;
  padding: 46px clamp(16px, 4vw, 36px) 58px;
  margin-top: 20px;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--surface-soft); /* фолбэк для браузеров без color-mix() */
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.footer__disclaimer {
  font-size: 1.1rem;
  font-weight: 700;
}

.footer__note,
.footer__fine {
  margin: 0 0 6px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ---------------------------------------------------------------------------
   10. Уважение к настройкам пользователя
   ------------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .floaties {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
   11. Мелкие экраны
   ------------------------------------------------------------------------ */
@media (max-width: 520px) {
  .logo__text {
    font-size: 1rem;
  }

  .topbar {
    padding: 10px 14px;
  }

  .theme-toggle {
    padding: 9px 14px;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .counter,
  .pet-counter {
    display: block;
  }
}
