/* Тема «Пригоди»: квесты и поиск приключений — старая карта, пергамент,
   латунь и свет смолоскипов, анимированный маршрут по карте. */
:root {
  --qst-bg: #17100a;
  --qst-bg-2: #2b1d12;
  --qst-parchment: #f0e2c4;
  --qst-panel: rgba(34, 23, 14, 0.82);
  --qst-brass: #d69e4a;
  --qst-brass-dark: #a8722a;
  --qst-ink: #f4e9d3;
  --qst-muted: #c2a685;
  --qst-line: rgba(214, 158, 74, 0.28);
}

body {
  background: var(--qst-bg);
  color: var(--qst-ink);
  font-family: "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
}

/* Свет смолоскипов: тёплые пятна с медленным «мерцанием» */
body::before {
  content: "";
  position: fixed;
  inset: -25vh -25vw;
  z-index: -3;
  background:
    radial-gradient(32vw 32vw at 18% 12%, rgba(224, 169, 79, 0.32), transparent 62%),
    radial-gradient(28vw 28vw at 86% 22%, rgba(178, 92, 40, 0.26), transparent 62%),
    radial-gradient(38vw 38vw at 60% 95%, rgba(72, 110, 96, 0.28), transparent 62%),
    linear-gradient(180deg, var(--qst-bg-2), var(--qst-bg) 70%);
  animation: qstTorch 9s ease-in-out infinite alternate;
}
/* Сетка старой карты + румбы компаса поверх фона */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    linear-gradient(rgba(240, 226, 196, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240, 226, 196, 0.05) 1px, transparent 1px),
    repeating-conic-gradient(from 0deg at 50% 42%, rgba(214, 158, 74, 0.07) 0deg 2deg, transparent 2deg 45deg);
  background-size: 72px 72px, 72px 72px, 100% 100%;
  mask-image: radial-gradient(85% 70% at 50% 25%, #000 15%, transparent 82%);
  -webkit-mask-image: radial-gradient(85% 70% at 50% 25%, #000 15%, transparent 82%);
  animation: qstCompass 90s linear infinite;
}

.bg-layer { opacity: 0.28; filter: sepia(0.35) saturate(0.9) contrast(1.05); }
.bg-layer::after {
  background:
    linear-gradient(180deg, rgba(23, 16, 10, 0.8), rgba(23, 16, 10, 0.94)),
    radial-gradient(120% 80% at 50% 0%, transparent, rgba(23, 16, 10, 0.65));
}

/* --- Header / Footer: латунные накладки --- */
.site-header,
.site-footer {
  position: relative;
  background: var(--qst-panel);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
}
.site-header { border-bottom: 1px solid var(--qst-line); animation: qstDrop 0.75s cubic-bezier(.2,.7,.3,1) both; }
.site-footer { border-top: 1px solid var(--qst-line); }

/* --- Калькулятор в теме Пригоди --- */
.calculator-card {
  border: 1px solid var(--qst-line);
  background: linear-gradient(180deg, rgba(40, 28, 18, 0.8), rgba(24, 16, 10, 0.75));
  box-shadow: 0 24px 60px rgba(10, 6, 3, 0.6);
}
.calc-card-title { color: var(--qst-brass); }
.calc-badge { background: var(--qst-brass); color: #211206; font-weight: 700; }
.calc-result-sum { color: var(--qst-brass); }
/* «Маршрут» пунктиром — бежит по карте вдоль header и footer */
.site-header::after,
.site-footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background-image: linear-gradient(90deg, var(--qst-brass) 0 12px, transparent 12px 24px);
  background-size: 24px 2px;
  opacity: 0.75;
  animation: qstTrail 3.5s linear infinite;
}
.site-header::after { bottom: -1px; }
.site-footer::before { top: -1px; }

.site-header .logo {
  height: 46px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.6));
  transition: transform 0.4s cubic-bezier(.2,.7,.3,1);
}
.site-header .logo:hover { transform: rotate(-2deg) scale(1.04); }

/* --- Титульный блок: заголовок-вывеска и компасная роза --- */
.brand { animation: qstRise 0.95s cubic-bezier(.2,.7,.3,1) 0.1s both; }
.site-title {
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: linear-gradient(100deg, #f7ecd2 10%, var(--qst-brass) 50%, #f7ecd2 90%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  animation: qstSheen 11s linear infinite;
}
.brand::after {
  content: "✦";
  display: block;
  margin: 0.7rem auto 0;
  color: var(--qst-brass);
  font-size: 1rem;
  letter-spacing: 0.6em;
  text-indent: 0.6em;
  animation: qstSpark 4s ease-in-out infinite;
}
.site-description { color: var(--qst-muted); font-size: 1.05rem; font-style: italic; }

/* --- Контент: лист пергамента --- */
.content {
  position: relative;
  padding: 1.8rem 1.4rem;
  border: 1px solid rgba(120, 86, 44, 0.55);
  border-radius: 6px;
  color: #2b2013;
  background:
    radial-gradient(60% 40% at 15% 10%, rgba(255, 255, 255, 0.5), transparent 60%),
    linear-gradient(180deg, #f6ecd6, var(--qst-parchment) 60%, #e6d3ae);
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.55),
    inset 0 0 60px rgba(150, 110, 55, 0.25),
    inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  animation: qstUnroll 1.1s cubic-bezier(.2,.7,.3,1) 0.25s both;
}
/* Латунные «гвозди» по углам пергамента */
.content::before,
.content::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f0cd8a, var(--qst-brass-dark));
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
}
.content::before { top: 10px; left: 10px; }
.content::after { top: 10px; right: 10px; }

.content h1, .content h2, .content h3 {
  color: #4a3113;
  letter-spacing: 0.01em;
  margin-top: 1.6em;
}
.content h2 { border-bottom: 2px dashed rgba(120, 86, 44, 0.45); padding-bottom: 0.25rem; }
.content blockquote {
  margin: 1.4em 0;
  padding: 0.8rem 1.2rem;
  border-left: 3px solid var(--qst-brass-dark);
  background: rgba(168, 114, 42, 0.1);
  color: #5a3d18;
  font-style: italic;
}
.content ul li::marker { color: var(--qst-brass-dark); }
.content a {
  color: #8a4f14;
  font-weight: 600;
  text-decoration: none;
  background-image: linear-gradient(90deg, var(--qst-brass-dark) 0 6px, transparent 6px 12px);
  background-size: 12px 2px;
  background-position: 0 100%;
  background-repeat: repeat-x;
  transition: color 0.3s ease, background-position 0.6s linear;
}
.content a:hover { color: #b4762b; background-position: 24px 100%; }
.content img { border-radius: 4px; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.35); filter: sepia(0.12); transition: transform 0.5s cubic-bezier(.2,.7,.3,1), filter 0.4s ease; }
.content img:hover { transform: scale(1.015) rotate(-0.4deg); filter: sepia(0); }

/* --- Кнопки: латунные печати с блеском --- */
.contact-btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(135deg, var(--qst-brass-dark), var(--qst-brass));
  color: #24170a;
  border-radius: 4px;
  border-color: rgba(255, 236, 196, 0.35);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 240, 205, 0.5);
  transition: transform 0.28s cubic-bezier(.2,.7,.3,1), box-shadow 0.3s ease, filter 0.3s ease;
}
.contact-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 25%, rgba(255, 249, 226, 0.55) 50%, transparent 75%);
  transform: translateX(-120%);
  transition: transform 0.65s ease;
}
.contact-btn:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.5), 0 0 18px rgba(224, 169, 79, 0.35);
}
.contact-btn:hover::before { transform: translateX(120%); }
.contact-btn:active { transform: translateY(0); }

.header-contacts .contact-btn {
  padding: 0.65rem 1.3rem;
  font-size: 0.88rem;
  background: rgba(240, 226, 196, 0.08);
  border-color: rgba(214, 158, 74, 0.5);
  color: #ecd7a8;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.header-contacts .contact-btn:hover {
  background: rgba(214, 158, 74, 0.22);
  border-color: var(--qst-brass);
  color: #fff6e2;
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.5), 0 0 14px rgba(224, 169, 79, 0.3);
}

.footer-contacts .contact-btn {
  padding: 0.75rem 1.6rem;
  font-size: 0.95rem;
}
.footer-contacts .contact-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.6), 0 0 20px rgba(224, 169, 79, 0.4);
}

.bot-link .contact-btn {
  padding: 0.75rem 1.7rem;
  font-size: 0.95rem;
  animation: qstBeacon 3.8s ease-in-out infinite;
}

/* Вкладки quest */
.content-tab-btn {
  background: rgba(30, 20, 12, 0.75);
  color: #ecd7a8;
  border: 1px solid var(--qst-brass-dark);
  border-radius: 8px;
}
.content-tab-btn:hover {
  background: rgba(214, 158, 74, 0.2);
  color: #fff6e2;
  border-color: var(--qst-brass);
  box-shadow: 0 4px 14px rgba(224, 169, 79, 0.25);
}
.content-tab-btn.active {
  background: linear-gradient(135deg, var(--qst-brass), #a06e2e);
  color: #24170a;
  border-color: var(--qst-brass-light);
  box-shadow: 0 6px 18px rgba(224, 169, 79, 0.4);
}

/* --- Переключатель языка --- */
.lang-switch a {
  color: var(--qst-muted);
  transition: color 0.25s ease, background 0.25s ease;
}
.lang-switch a:hover { color: #fff6e2; background: rgba(214, 158, 74, 0.15); }
.lang-switch a.active {
  color: #24170a;
  background: var(--qst-brass);
  text-decoration: none;
}


@keyframes qstTorch {
  0%   { opacity: 0.86; transform: scale(1); }
  35%  { opacity: 1; transform: scale(1.04); }
  60%  { opacity: 0.9; transform: scale(1.02); }
  100% { opacity: 1; transform: scale(1.07); }
}
@keyframes qstCompass {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes qstTrail {
  from { background-position: 0 0; }
  to   { background-position: 24px 0; }
}
@keyframes qstSheen {
  from { background-position: 0% 50%; }
  to   { background-position: 220% 50%; }
}
@keyframes qstRise {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: none; }
}
@keyframes qstDrop {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes qstUnroll {
  from { opacity: 0; transform: perspective(900px) rotateX(-8deg) translateY(28px); }
  to   { opacity: 1; transform: none; }
}
@keyframes qstSpark {
  0%, 100% { opacity: 0.5; letter-spacing: 0.6em; }
  50%      { opacity: 1; letter-spacing: 0.85em; }
}
@keyframes qstBeacon {
  0%, 100% { box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), 0 0 0 0 rgba(224, 169, 79, 0.45); }
  50%      { box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), 0 0 0 14px rgba(224, 169, 79, 0); }
}

@media (max-width: 560px) {
  .header-contacts .contact-btn {
    padding: 0.5rem 0.9rem;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
  }
  .footer-contacts .contact-btn {
    padding: 0.6rem 1.1rem;
    font-size: 0.88rem;
    letter-spacing: 0.04em;
  }
  .content-tab-btn {
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
  }
  .content {
    padding: 1.3rem 0.95rem;
  }
}

@media (min-width: 720px) {
  .content { padding: 2.6rem 2.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  body::before, body::after, .site-header, .site-header::after, .site-footer::before,
  .site-title, .brand, .brand::after, .content, .bot-link .contact-btn {
    animation: none !important;
  }
}
