/* ============= БАЗОВІ ЗМІННІ ============= */
.comm {
  --c-bg1: #004aad;
  --c-bg2: #0072ff;
  --c-bg3: #f7d23b;
  --c-bg4: #03a5ed;
  --c-bg5: #58b377;
  --c-accent1: #ffe173;
  --c-surface: #ffffff;
  --c-text: #0a2540;
  --c-muted: #5b6b7b;
  --c-shadow: 0 8px 22px rgba(0, 0, 0, 0.12);
  --radius-lg: 16px;
  --radius-md: 12px;
  --space-base: 20px;
  --space-lg: 28px;
}

.comm * {
  box-sizing: border-box;
  font-family: "Philosopher", sans-serif;
}
/* Убираємо можливість горизонтального прокрутки для всього тіла */
html,
body {
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}
/* ============= ФОН СТОРІНКИ ============= */
body.comm {
  background: var(--color-bg-gradient-community);
  background-attachment: fixed;
  color: var(--c-text);
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* ============= HERO ============= */
.comm-hero {
  width: 100vw; /* повна ширина viewport */
  margin-left: calc(50% - 50vw); /* прибирає відступи контейнера */
  margin-right: calc(50% - 50vw);
  border-radius: 0; /* на випадок якщо десь задано */
  background: linear-gradient(200deg, var(--comm-bg1) 0%, var(--comm-bg2) 100%);
  color: #fff;
  padding: 12px 20px;
  box-shadow: 0 4px 16px rgba(0, 72, 173, 0.3);
}
.comm-hero__inner {
  max-width: none;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}
.comm-hero__logo {
  width: 96px;
  height: auto;
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.25));
}
.comm-hero__text {
  text-align: center;
}
.comm-hero__title {
  margin: 0;
  font-size: clamp(1.5rem, 3.4vw, 2.2rem);
  font-weight: 800;
  color: #fff;
}
.comm-hero__subtitle {
  margin: 6px 0 0;
  font-size: clamp(0.95rem, 2.2vw, 1.1rem);
  opacity: 0.95;
  color: #fff;
}

/* =========== СЕКЦІЇ ============ */
.comm-section {
  flex: 1 0 auto;
  min-height: calc(100vh - 260px);
  padding: var(--space-lg) var(--space-base) 60px;
}
.comm-section__title {
  text-align: center;
  font-size: clamp(1.4rem, 2.6vw, 1.8rem);
  margin: 0 0 12px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
.comm-section__subtitle {
  text-align: center;
  font-size: clamp(1rem, 2vw, 1.15rem);
  font-weight: 500;
  margin: 0 0 var(--space-base);
}

/* ======= КАРТКИ СИМВОЛІКИ ======= */
.comm-symbols {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 26px;
  justify-items: center;
  align-items: stretch;
  padding: 0 10px;
}
.comm-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-lg);
  box-shadow: 0 6px 20px rgba(0, 72, 173, 0.15);
  padding: 22px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 380px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.comm-card:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.3);
  box-shadow: 0 10px 24px rgba(0, 72, 173, 0.25);
}
.comm-card__media {
  display: grid;
  place-items: center;
  margin-bottom: 12px;
}
.comm-card__img {
  width: 100%;
  max-width: 220px;
  cursor: pointer;
  height: 220px;
  object-fit: contain;
  display: block;
  margin: 0 auto 12px;
  border-radius: 8px;
  transition: transform 0.25s ease, filter 0.25s ease, box-shadow 0.25s ease;
}
.comm-card__img:hover {
  transform: scale(1.05);
  filter: brightness(1.1);
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.35),
    0 0 40px rgba(0, 122, 255, 0.25);
}
.comm-card__title {
  margin: 6px 0 8px;
  font-size: clamp(1rem, 2vw, 1.15rem);
}
.comm-card__text {
  margin: 0 0 14px;
  line-height: 1.5;
  flex-grow: 1;
}

/* ============= КНОПКИ ============= */
.comm-btn {
  align-self: center;
  border: none;
  border-radius: var(--radius-md);
  background: var(--btn-gradient);
  color: #fff;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  box-shadow: 0 2px 6px rgba(0, 72, 173, 0.3);
}
.comm-btn:hover {
  transform: translateY(-2px);
  background: var(--btn-hover-gradient);
  box-shadow: 0 4px 10px rgba(0, 72, 173, 0.4);
}

/* ============= МОДАЛКИ ============= */
.comm-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 5vh;
  z-index: 1000;
}
.comm-modal[aria-hidden="false"] {
  display: flex;
  animation: fadeIn 0.3s ease forwards;
}
.comm-modal[aria-hidden="true"] {
  animation: fadeOut 0.25s ease forwards;
}

/* ✨ Ефекти появи/зникнення */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
@keyframes fadeOut {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.97);
  }
}

/* === Основне вікно === */
.comm-modal__dialog {
  display: flex;
  flex-direction: column;
  width: min(880px, 95vw);
  max-height: 90vh;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
  background: var(--comm-modal-gradient);
  backdrop-filter: blur(18px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 8px 32px rgba(0, 72, 173, 0.25);
}

/* === Текст та кнопки === */
.comm-modal__title {
  margin: 18px 22px 8px;
  font-size: 1.25rem;
  font-weight: 700;
}
.comm-modal__scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 22px 22px;
  line-height: 1.6;
}
.comm-modal__scroll::-webkit-scrollbar {
  width: 8px;
}
.comm-modal__scroll::-webkit-scrollbar-thumb {
  background: var(--btn-gradient);
  border-radius: 4px;
}
.comm-modal__scroll::-webkit-scrollbar-thumb:hover {
  background: var(--btn-gradient);
}

.comm-modal__close {
  position: absolute;
  top: 8px;
  right: 10px;
  border: none;
  background: transparent;
  font-size: 26px;
  cursor: pointer;
  color: #333;
  transition: color 0.3s ease;
}
.comm-modal__close:hover {
  color: var(--c-surface);
}

.comm-modal__footer {
  text-align: center;
  padding: 14px 0 16px;
  background: rgba(255, 255, 255, 0.25);
  border-top: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 -2px 8px rgba(0, 72, 173, 0.12);
  backdrop-filter: blur(10px);
}
.comm-modal__footer .comm-btn {
  padding: 10px 26px;
  font-size: 1rem;
  border-radius: 8px;
  background: var(--btn-gradient);
  animation: glowPulse 2.5s infinite ease-in-out;
}
@keyframes glowPulse {
  0% {
    box-shadow: 0 0 10px rgba(0, 114, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 22px rgba(0, 144, 255, 0.65);
  }
  100% {
    box-shadow: 0 0 10px rgba(0, 114, 255, 0.3);
  }
}

/* ====== АДАПТАЦІЯ ====== */
@media (max-width: 600px) {
  .comm-modal {
    padding-top: 40px;
  } /* стабільний відступ */
  .comm-modal__dialog {
    width: 95vw;
    max-height: 86vh;
    border-radius: 12px;
  }
  .comm-modal__footer .comm-btn {
    width: 90%;
    font-size: 0.9rem;
  }
  .comm-modal__close {
    font-size: 22px;
  }
}

/* ================================
   🔙 Кнопка повернення (оновлена)
   ================================ */
.comm-back {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 2.5rem 0 2rem;
  opacity: 0;
  animation: fadeInUp 0.9s ease forwards;
  animation-delay: 1.2s;
  width: 100%;
}

.comm-back__btn {
  position: relative;
  overflow: hidden;
  max-width: 300px;
  width: 90%;
  min-height: 48px;
  padding: 12px 0;
  font-size: 1.2rem;
  font-weight: 600;
  border-radius: 28px;
  border: none;
  cursor: pointer;
  color: #fff;
  background: var(--btn-gradient);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  transition: all 0.3s ease;
  font-family: "Philosopher", sans-serif;
  text-decoration: none; /* щоб не було підкреслення */
}

/* 🌟 Ефект блиску при наведенні */
.comm-back__btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(255, 255, 255, 0.6) 50%,
    rgba(255, 255, 255, 0.3) 100%
  );
  transform: skewX(-25deg);
  transition: all 0.5s ease;
}

.comm-back__btn:hover::before {
  left: 125%;
}

.comm-back__btn:hover {
  background: var(--btn-hover-gradient);
  box-shadow: var(--shadow-hover);
  transform: scale(1.04);
}

.comm-back__btn:focus {
  outline: none;
  box-shadow: var(--shadow-focus);
  transform: scale(1.05);
}

/* ✨ Анімація появи (як у services) */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===============================
   💡 Акцентні стилі для модалок: вступ і фінал
   =============================== */

/* Вступний акцент — легкий блиск і глибина */
.intro-highlight {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.25),
    rgba(255, 255, 255, 0.05)
  );
  border-left: 5px solid #007bff; /* основний синій акцент */
  padding: 10px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  box-shadow: inset 0 0 14px rgba(0, 123, 255, 0.12),
    0 4px 8px rgba(0, 0, 0, 0.08);
  font-weight: 500;
  font-size: 1.02em;
  line-height: 1.6;
}

/* Фінальний акцент — “золотисте світло” з диханням */
.final-glow {
  background: var(-comm-finalglow);
  border-top: 2px solid rgba(255, 255, 150, 0.75);
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 1.05em;
  text-align: center;
  color: #002b5c;
  font-weight: 600;
  box-shadow: 0 0 16px rgba(255, 230, 140, 0.55);
  margin-top: 20px;
  animation: glowPulseSoft 4s ease-in-out infinite;
}

/* Плавне пульсуюче світіння */
@keyframes glowPulseSoft {
  0% {
    box-shadow: 0 0 10px rgba(255, 255, 200, 0.3);
  }
  50% {
    box-shadow: 0 0 22px rgba(255, 255, 180, 0.7);
  }
  100% {
    box-shadow: 0 0 10px rgba(255, 255, 200, 0.3);
  }
}

/* 💙 Варіації відтінків для різних модалок */
.comm-modal[data-type="herb"] .intro-highlight {
  border-left-color: #0056b3; /* глибший синій */
  box-shadow: inset 0 0 14px rgba(0, 86, 179, 0.15);
}

.comm-modal[data-type="herb"] .final-glow {
  background: linear-gradient(
    180deg,
    rgba(255, 240, 180, 0.6),
    rgba(255, 255, 220, 0.25)
  );
  color: #1a1a40;
}

.comm-modal[data-type="flag"] .intro-highlight {
  border-left-color: #007bff;
}

.comm-modal[data-type="flag"] .final-glow {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 210, 0.55),
    rgba(255, 255, 180, 0.3)
  );
}

.comm-modal[data-type="community"] .intro-highlight {
  border-left-color: #009245; /* зелено-бірюзовий для “Про громаду” */
}

.comm-modal[data-type="community"] .final-glow {
  background: linear-gradient(
    180deg,
    rgba(220, 255, 210, 0.55),
    rgba(240, 255, 230, 0.25)
  );
  color: #004422;
}

/* ================================
   🕊 Початковий стан сторінки community
   ================================ */
body.comm {
  opacity: 0;
  transform: translateX(-80px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
/* ============================================================
   ♿ Контрастний режим — художній стиль "ескіз олівцем"
   ============================================================ */

body.contrast-mode .comm-card__img {
  filter: grayscale(100%) brightness(1.1) contrast(1.3);
  mix-blend-mode: multiply; /* легке затемнення контурів */
  opacity: 0.95; /* робить вигляд м’яким */
  transition: filter 0.35s ease, transform 0.25s ease, opacity 0.25s ease;
}

/* Hover — легке підсилення контуру */
body.contrast-mode .comm-card__img:hover {
  filter: grayscale(100%) brightness(1.05) contrast(1.4);
  opacity: 1;
  transform: scale(1.02);
}

/* ============================================================
   ♿ Контрастний режим — повне обнулення кольору intro/final у всіх data-type
   ============================================================ */
body.contrast-mode .comm-modal[data-type="flag"] .intro-highlight,
body.contrast-mode .comm-modal[data-type="herb"] .intro-highlight,
body.contrast-mode .comm-modal[data-type="community"] .intro-highlight {
  background: linear-gradient(90deg, #f5f5f5, #e8e8e8) !important;
  border-left: 5px solid #000 !important;
  color: #000 !important;
  box-shadow: none !important;
}

body.contrast-mode .comm-modal[data-type="flag"] .final-glow,
body.contrast-mode .comm-modal[data-type="herb"] .final-glow,
body.contrast-mode .comm-modal[data-type="community"] .final-glow {
  background: linear-gradient(180deg, #fafafa 0%, #dcdcdc 100%) !important;
  border-top: 2px solid #000 !important;
  color: #000 !important;
  box-shadow: none !important;
  animation: none !important;
}

/* Легка відокремлююча рамка для узгодженості */
body.contrast-mode .comm-modal[data-type="flag"] .intro-highlight,
body.contrast-mode .comm-modal[data-type="flag"] .final-glow,
body.contrast-mode .comm-modal[data-type="herb"] .intro-highlight,
body.contrast-mode .comm-modal[data-type="herb"] .final-glow,
body.contrast-mode .comm-modal[data-type="community"] .intro-highlight,
body.contrast-mode .comm-modal[data-type="community"] .final-glow {
  border-radius: 8px !important;
  outline: 1px solid #333 !important;
}
/* ============================================================
   ♿ Контрастний режим — очищення тіней кнопок
   ============================================================ */
body.contrast-mode button,
body.contrast-mode .main-btn {
  box-shadow: none !important;
}

body.contrast-mode button:hover,
body.contrast-mode .main-btn:hover,
body.contrast-mode button:focus,
body.contrast-mode .main-btn:focus {
  box-shadow: none !important;
}
