/* ============================================
   Sound of Scripture — Bible Verse + Wave Player
   Clean, frameless, large adaptive typography
   ============================================ */

:root {
  --bg-deep: #0a0a14;
  --bg-mid: #12122a;
  --accent: #8b5cf6;
  --accent-2: #6366f1;
  --accent-cyan: #22d3ee;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Playfair Display', Georgia, 'Times New Roman', serif;

  --radius-full: 9999px;
  --anim-duration: 0.55s; /* slower transitions */
}

/* Reset & base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ========== Background ========== */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}

.bg-image {
  position: absolute;
  top: -4%;
  left: -4%;
  width: 108%;
  height: 108%;
  object-fit: cover;
  object-position: center;
  /* no live blur — expensive on GPU; slight scale only */
  transform-origin: center center;
  animation: bgKenBurns 60s ease-in-out infinite alternate;
}

@keyframes bgKenBurns {
  0%   { transform: scale(1); }
  100% { transform: scale(1.06); }
}

/* Soft dark overlay for readability */
.bg-overlay {
  position: absolute;
  inset: 0;
  background: rgba(6, 4, 16, 0.38);
  pointer-events: none;
}

/* Subtle film grain / noise */
.bg-noise {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.07;
  mix-blend-mode: overlay;
  pointer-events: none;
  z-index: 1;
}

/* Animated color washes / light leaks — more visible */
.bg-layer::before,
.bg-layer::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
}

.bg-layer::before {
  width: 75vw;
  height: 75vw;
  top: -28%;
  left: -22%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.65) 0%, rgba(99, 102, 241, 0.25) 45%, transparent 70%);
  animation: colorDrift1 20s ease-in-out infinite alternate;
}

.bg-layer::after {
  width: 70vw;
  height: 70vw;
  bottom: -32%;
  right: -22%;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.5) 0%, rgba(99, 102, 241, 0.18) 40%, transparent 70%);
  animation: colorDrift2 26s ease-in-out infinite alternate;
}

@keyframes colorDrift1 {
  0%   { transform: translate(0, 0) scale(1);       opacity: 0.5; }
  35%  { transform: translate(18%, 22%) scale(1.28); opacity: 0.8; }
  70%  { transform: translate(5%, -12%) scale(1.12); opacity: 0.6; }
  100% { transform: translate(12%, 8%) scale(0.95);  opacity: 0.45; }
}

@keyframes colorDrift2 {
  0%   { transform: translate(0, 0) scale(1);        opacity: 0.45; }
  40%  { transform: translate(-20%, -15%) scale(1.32); opacity: 0.72; }
  100% { transform: translate(-8%, 18%) scale(1.05);   opacity: 0.5; }
}

/* ========== App shell ========== */
.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* ========== Header ========== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Тот же отступ нужен выпадающей панели подменю, чтобы она начиналась
     ровно под шапкой — держим его переменной, а не двумя числами. */
  --header-pad-y: 1.1rem;
  padding: var(--header-pad-y) 1.75rem;
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 20, 0.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text-primary);
  text-decoration: none;
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
  display: block;
  background: transparent;
}

.logo-text {
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: 0.28em;
}

.logo-sound {
  color: #ffffff;
}

.logo-scripture {
  color: #b794f6; /* soft purple matching the reference */
}

.menu {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.menu-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-full);
  transition: color 0.2s, background 0.2s;
}

.menu-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.menu-link.active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.menu-link.current-link {
  color: #07111f;
  background: #67e8f9;
  border: 1px solid #a5f3fc;
  box-shadow: 0 4px 16px rgba(34, 211, 238, 0.28);
}

.menu-link.current-link:hover {
  color: #07111f;
  background: #a5f3fc;
}

/* Support заметен, но не кричит: полупрозрачная заливка вместо сплошного
   оранжевого и без свечения — раньше кнопка перетягивала внимание с логотипа
   и остального меню. Цвет проявляется на наведении. */
.menu-link.donate-link {
  color: #fdba74;
  background: rgba(194, 65, 12, 0.28);
  border: 1px solid rgba(251, 146, 60, 0.38);
}

.menu-link.donate-link:hover {
  color: #ffedd5;
  background: rgba(234, 88, 12, 0.5);
  border-color: rgba(251, 146, 60, 0.6);
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.menu-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: 0.25s;
}

/* ========== Main ========== */
.main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem 3.5rem;
}

.quote-stage {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
  max-width: 980px;
  position: relative;
}

/* Navigation arrows */
.nav-arrow {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s, transform 0.25s;
  backdrop-filter: blur(8px);
}

.nav-arrow svg {
  width: 22px;
  height: 22px;
}

.nav-arrow:hover {
  background: rgba(139, 92, 246, 0.2);
  border-color: var(--accent);
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.35);
  transform: scale(1.06);
}

.nav-arrow:active {
  transform: scale(0.96);
}

/* Animation classes for arrows */
.nav-arrow.fade-left {
  animation: fadeLeft var(--anim-duration) ease both;
}
.nav-arrow.fade-right {
  animation: fadeRight var(--anim-duration) ease both;
}

@keyframes fadeLeft {
  0%   { opacity: 1; transform: translateX(0); }
  40%  { opacity: 0; transform: translateX(-22px); }
  60%  { opacity: 0; transform: translateX(22px); }
  100% { opacity: 1; transform: translateX(0); }
}

@keyframes fadeRight {
  0%   { opacity: 1; transform: translateX(0); }
  40%  { opacity: 0; transform: translateX(22px); }
  60%  { opacity: 0; transform: translateX(-22px); }
  100% { opacity: 1; transform: translateX(0); }
}

/* ========== Quote content (NO card / frame) ========== */
.quote-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

/* Lesson number (left) + Return to · cover · title (from center to right) */
.works-link {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 1.25rem;
  text-decoration: none;
  margin-bottom: 1.75rem;
  width: min(92vw, 640px);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.9s ease, transform 0.9s ease;
}

.works-link.works-visible {
  opacity: 1;
  transform: translateY(0);
}

.works-link.works-hidden {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

/* Huge semi-transparent lesson number — left side */
.works-num {
  font-family: var(--font-sans);
  font-size: clamp(5rem, 18vw, 8.5rem);
  font-weight: 700;
  line-height: 0.85;
  letter-spacing: -0.05em;
  color: rgba(255, 255, 255, 0.14);
  flex: 0 0 auto;
  min-width: 0.7em;
  text-align: left;
  user-select: none;
  transition: color 0.3s ease;
}

.works-link:hover .works-num {
  color: rgba(255, 255, 255, 0.26);
}

/* Right block: Return to + cover + book title */
.works-meta {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto; /* push toward right / from center */
  min-width: 0;
}

.works-return {
  font-size: clamp(0.75rem, 1.8vw, 0.88rem);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  color: rgba(255, 255, 255, 0.45);
  white-space: nowrap;
  transition: color 0.3s ease;
}

.works-link:hover .works-return {
  color: rgba(255, 255, 255, 0.75);
}

.works-cover {
  position: relative;
  width: 48px;
  height: 64px; /* 3:4 */
  border-radius: 5px;
  overflow: hidden;
  flex-shrink: 0;
  opacity: 0.55;
  box-shadow:
    0 0 0 1px rgba(139, 92, 246, 0.3),
    0 4px 14px rgba(0, 0, 0, 0.35);
  transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.works-link:hover .works-cover {
  opacity: 0.85;
  transform: translateY(-2px);
  box-shadow:
    0 0 0 1px rgba(183, 148, 246, 0.5),
    0 6px 18px rgba(0, 0, 0, 0.4);
}

.works-icon {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  filter: grayscale(1) contrast(1.1) brightness(0.9);
}

.works-duotone {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(183, 148, 246, 0.75) 0%,
    rgba(139, 92, 246, 0.65) 45%,
    rgba(76, 29, 149, 0.8) 100%
  );
  mix-blend-mode: color;
  pointer-events: none;
}

.works-label {
  font-size: clamp(0.9rem, 2.2vw, 1.1rem);
  font-weight: 600;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.78);
  text-align: left;
  max-width: 12em;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  transition: color 0.3s ease;
}

.works-link:hover .works-label {
  color: rgba(255, 255, 255, 0.98);
}

/* Large adaptive Bible verse */
.quote-text {
  font-family: var(--font-serif);
  font-size: clamp(1.55rem, 4.5vw, 2.55rem);
  font-weight: 500;
  font-style: italic;
  line-height: 1.38;
  color: var(--text-primary);
  text-align: center;
  max-width: 820px;
  margin: 0 auto 1.35rem;
  padding: 0 0.5rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  transition: opacity var(--anim-duration) ease, transform var(--anim-duration) ease;
}

/* Scripture reference — right of center */
.scripture-ref {
  display: block;
  font-style: normal;
  font-family: var(--font-sans);
  font-size: clamp(0.95rem, 2.2vw, 1.12rem);
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
  margin: 0 0 2.2rem;
  align-self: flex-end;
  padding-right: clamp(1rem, 8vw, 4.5rem);
  max-width: 100%;
  transition: opacity var(--anim-duration) ease, transform var(--anim-duration) ease;
}

.scripture-ref::before {
  content: "— ";
  opacity: 0.6;
}

.youtube-watch-link {
  display: block;
  align-self: center;
  margin: 0.8rem auto 0;
  color: rgba(255, 255, 255, 0.42);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: color 0.25s ease, opacity 0.25s ease;
}

.youtube-watch-link[hidden] {
  display: none;
}

.support-content {
  max-width: 560px;
  margin: 0 auto 2rem;
  text-align: center;
}

.support-content h1 {
  margin-bottom: 0.75rem;
}

.support-content p {
  margin-bottom: 1.25rem;
}

.support-content ul {
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.support-content li {
  margin: 0;
  padding: 0;
}

.support-content li p {
  margin: 0;
  line-height: 1.35;
}

.youtube-watch-link:hover {
  color: rgba(255, 255, 255, 0.78);
}

/* ========== Player (frameless) ========== */
.player {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 0.4rem 0;
  transition: opacity var(--anim-duration) ease, transform var(--anim-duration) ease;
}

.play-btn {
  flex-shrink: 0;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.25s;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.45);
}

.play-btn:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 28px rgba(139, 92, 246, 0.6);
}

.play-btn:active {
  transform: scale(0.96);
}

.play-btn svg {
  width: 20px;
  height: 20px;
}

.play-btn .icon-pause {
  display: none;
}

.play-btn.playing .icon-play {
  display: none;
}

.play-btn.playing .icon-pause {
  display: block;
}

.wave-wrap {
  flex: 1;
  position: relative;
  height: 56px;
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
}

#waveform {
  width: 100%;
  height: 100%;
  display: block;
}

.wave-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.12));
  pointer-events: none;
  border-right: 2px solid var(--accent-cyan);
  transition: width 0.1s linear;
}

.time-display {
  flex-shrink: 0;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  min-width: 78px;
  text-align: right;
}

.time-display .sep {
  margin: 0 2px;
  opacity: 0.5;
}

/* Performers / musicians line under the wave */
.performers {
  margin-top: 1.1rem;
  font-size: clamp(0.8rem, 1.8vw, 0.92rem);
  font-weight: 400;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 0.01em;
  max-width: 620px;
  line-height: 1.45;
  opacity: 0.9;
  transition: opacity var(--anim-duration) ease, transform var(--anim-duration) ease;
}

.performers:empty {
  display: none;
}

/* play all / repeat text buttons */
.playback-modes {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.75rem;
  margin-top: 1.35rem;
}

/* Звёздочка стоит между «play all» и «repeat»; вокруг неё зазор шире,
   чтобы она читалась как отдельное действие, а не как третий режим. */
.playback-modes .player-fav-star {
  margin: 0 0.6rem;
}

.mode-btn {
  appearance: none;
  background: none;
  border: none;
  padding: 0.25rem 0.15rem;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.28);
  cursor: pointer;
  transition: color 0.25s ease, text-shadow 0.25s ease;
}

.mode-btn:hover {
  color: rgba(255, 255, 255, 0.55);
}

.mode-btn.active {
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 0 18px rgba(183, 148, 246, 0.45);
}


/* ========== Fade animations ========== */
/* Quote + reference → fade up */
.fade-up-out {
  opacity: 0 !important;
  transform: translateY(-14px) !important;
}
.fade-up-in {
  opacity: 0;
  transform: translateY(14px);
}

/* Player + performers → fade down */
.fade-down-out {
  opacity: 0 !important;
  transform: translateY(14px) !important;
}
.fade-down-in {
  opacity: 0;
  transform: translateY(-14px);
}

/* ========== Footer ========== */
.footer {
  padding: 1.25rem 1.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.25);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  /* Пять ссылок в строку не помещаются на узких экранах — разрешаем перенос,
     иначе ряд вылезает за вьюпорт и вся страница едет вбок. */
  flex-wrap: wrap;
  gap: 0.6rem 1.25rem;
}

.footer-links a {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: var(--accent-cyan);
}

/* ========== Responsive ========== */
/* Шапка сворачивается в гамбургер раньше остальной мобильной вёрстки.
   Замерено: логотип 207px + меню 598px + отступы = 885px. Берём 920px —
   небольшой запас на другой рендеринг шрифта. Порог уже трижды менялся
   вслед за составом меню, поэтому при добавлении пункта его надо мерить
   в браузере, а не подбирать на глаз. */
@media (max-width: 920px) {
  .menu {
    /* Абсолютно от .header (он sticky, значит задаёт систему координат):
       раньше здесь было fixed + top: 64px, и панель наезжала на шапку,
       потому что реальная высота шапки ~70px и зависит от шрифта. */
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(12, 12, 28, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column;
    padding: 1rem;
    gap: 0.25rem;
    transform: translateY(-120%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 99;
  }

  .menu.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .menu-link {
    width: 100%;
    padding: 0.85rem 1rem;
    text-align: center;
  }

  .menu-toggle {
    display: flex;
  }

  .menu-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }
  .menu-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
}

@media (max-width: 768px) {
  .header {
    --header-pad-y: 0.9rem;
    padding: var(--header-pad-y) 1.15rem;
  }

  .main {
    padding: 2rem 1rem 2.5rem;
  }

  .quote-stage {
    gap: 0.6rem;
  }

  .nav-arrow {
    width: 42px;
    height: 42px;
  }

  .nav-arrow svg {
    width: 18px;
    height: 18px;
  }

  .works-link {
    margin-bottom: 1.8rem;
  }

  .works-num {
    font-size: clamp(3.5rem, 22vw, 5.5rem);
  }

  .works-cover {
    width: 40px;
    height: 53px;
    border-radius: 4px;
  }

  .works-label {
    font-size: 0.85rem;
    max-width: 8.5em;
  }

  .works-return {
    font-size: 0.72rem;
  }

  .works-link {
    gap: 0.65rem;
    margin-bottom: 1.25rem;
  }

  .works-meta {
    gap: 0.45rem;
  }

  .quote-text {
    font-size: clamp(1.35rem, 5.2vw, 1.85rem);
    margin-bottom: 1.1rem;
  }

  .scripture-ref {
    padding-right: 1.5rem;
    margin-bottom: 1.8rem;
  }

  .player {
    padding: 0.3rem 0;
    gap: 0.75rem;
  }

  .play-btn {
    width: 46px;
    height: 46px;
  }

  .wave-wrap {
    height: 48px;
  }

  .time-display {
    min-width: 70px;
    font-size: 0.75rem;
  }

  .performers {
    margin-top: 0.9rem;
  }
}

@media (max-width: 480px) {
  .logo-text {
    font-size: 1rem;
  }

  .quote-stage {
    flex-direction: column;
    gap: 1.25rem;
  }

  .nav-arrow {
    position: absolute;
    top: 48%;
    transform: translateY(-50%);
    z-index: 5;
    width: 38px;
    height: 38px;
    background: rgba(0, 0, 0, 0.4);
  }

  .nav-arrow.prev {
    left: 0.4rem;
  }

  .nav-arrow.next {
    right: 0.4rem;
  }

  .quote-content {
    width: 100%;
    padding: 0 0.5rem;
  }

  .quote-text {
    font-size: clamp(1.3rem, 6vw, 1.7rem);
    line-height: 1.4;
  }

  .scripture-ref {
    align-self: flex-end;
    padding-right: 0.75rem;
    font-size: 0.95rem;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 0.6rem;
  }
}

/* Long verse / short viewport protection */
@media (max-height: 700px) {
  .quote-text {
    font-size: clamp(1.3rem, 3.6vw, 2rem);
    margin-bottom: 1rem;
  }
  .scripture-ref {
    margin-bottom: 1.5rem;
  }
  .works-link {
    margin-bottom: 1rem;
  }
  .main {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
  }
}

/* Footer login button */
.footer-login {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid rgba(139, 92, 246, 0.4);
  background: rgba(139, 92, 246, 0.12);
  color: var(--text-primary) !important;
  font-weight: 500;
  transition: background 0.2s, border-color 0.2s;
}
.footer-login:hover {
  background: rgba(139, 92, 246, 0.28);
  border-color: rgba(183, 148, 246, 0.6);
  color: #fff !important;
}


/* Reduce motion / GPU load when user prefers or on low-end */
@media (prefers-reduced-motion: reduce) {
  .bg-image,
  .bg-layer::before,
  .bg-layer::after {
    animation: none !important;
  }
}


/* Mobile swipe hint — barely visible */
.swipe-hint {
  display: none;
  margin-top: 1.1rem;
  text-align: center;
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  color: rgba(255, 255, 255, 0.18);
  user-select: none;
  pointer-events: none;
}

@media (max-width: 768px) {
  /* Arrows overlap text on phones — use swipe instead */
  .nav-arrow {
    display: none !important;
  }

  .swipe-hint {
    display: block;
  }

  .quote-content {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
}

/* ==========================================================================
   Подменю в шапке (Blog и Contact живут под About)
   ========================================================================== */

.menu-group {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.1rem;
  /* Растягиваем на высоту меню: тогда top:100% у панели — это низ шапки,
     а не низ короткой ссылки, и панель не заезжает в её полосу.
     Подбирать смещение числом нельзя: высота шапки зависит от шрифта. */
  align-self: stretch;
}

.menu-sub-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
}

.menu-sub-toggle svg {
  width: 13px;
  height: 13px;
}

.menu-group:hover .menu-sub-toggle,
.menu-group.is-open .menu-sub-toggle {
  color: var(--text-primary);
}

.menu-group.is-open .menu-sub-toggle {
  transform: rotate(180deg);
}

.menu-submenu {
  position: absolute;
  top: calc(100% + var(--header-pad-y, 1.1rem));
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  z-index: 120;
  display: flex;
  flex-direction: column;
  min-width: 148px;
  padding: 0.35rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(14, 14, 32, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

/* Мышью — по наведению, с клавиатуры — по фокусу, пальцем — по кнопке. */
.menu-group:hover .menu-submenu,
.menu-group:focus-within .menu-submenu,
.menu-group.is-open .menu-submenu {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Мостик до панели: без него меню закрывается в зазоре между кнопкой и панелью. */
.menu-group::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  height: var(--header-pad-y, 1.1rem);
}

.menu-sub-link {
  padding: 0.5rem 0.85rem;
  border-radius: 9px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s, background 0.2s;
}

.menu-sub-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.07);
}

.menu-sub-link.active {
  color: var(--text-primary);
  background: rgba(139, 92, 246, 0.25);
}

/* Активен вложенный пункт — подсвечиваем и саму группу. */
.menu-group.is-current > .menu-link {
  color: var(--text-primary);
}

/* Подпись «Favourites» нужна только в мобильной раскладке меню. */
.fav-label {
  display: none;
}

/* --- Подменю и звёздочка в свёрнутом меню --- */
@media (max-width: 920px) {
  .menu-group {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
  }

  /* В выпадающей панели вложенный список раскрывается на месте,
     а не всплывает поверх — места по вертикали достаточно. */
  .menu-submenu {
    position: static;
    transform: none;
    min-width: 0;
    padding: 0 0 0.35rem;
    border: none;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    box-shadow: none;
    opacity: 1;
    pointer-events: auto;
    display: none;
  }

  .menu-group.is-open .menu-submenu {
    display: flex;
    transform: none;
  }

  .menu-group::after {
    content: none;
  }

  /* Кнопку-шеврон кладём в правый край строки About. */
  .menu-group {
    position: relative;
  }

  .menu-sub-toggle {
    position: absolute;
    top: 0.5rem;
    right: 0.75rem;
    width: 34px;
    height: 34px;
  }

  .menu-sub-toggle svg {
    width: 16px;
    height: 16px;
  }

  .menu-sub-link {
    padding: 0.7rem 1rem;
    text-align: center;
    font-size: 0.92rem;
  }

}
