:root {
  --color-bg: #243640;      /* темно-сірий: rgb(36,54,64) */
  --color-red: #f44336;     /* rgb(244,67,54) */
  --color-white: #ffffff;
  --color-bg-lighter: #2f4451;
  --max-width: 1200px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-white);
  font-family: "Inter", Arial, sans-serif;
  font-weight: 400;
  line-height: 1.5;
}

h1, h2, h3, h4 {
  color: var(--color-red);
  font-weight: 600;
  margin: 0 0 0.5em;
}

a {
  color: var(--color-red);
}

img {
  max-width: 100%;
  display: block;
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 20px;
  background: var(--color-bg);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.header-top {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.logo-link {
  flex: 0 0 auto;
}

.logo {
  width: 90px;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  transition: width 0.25s ease, height 0.25s ease;
}

/* лого зменшується на 40% після прокрутки на один екран (мобільний і десктоп) */
.site-header.is-scrolled .logo {
  width: 54px;
  height: 54px;
}

.header-right {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.site-title {
  margin: 0;
  line-height: 1.2;
  color: var(--color-red);
  font-weight: 600;
  font-size: 1.1rem;
}

@media (min-width: 768px) {
  .site-title {
    font-size: 1.5rem;
  }
}

.categories-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.categories-nav a {
  color: var(--color-white);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  border-bottom: 2px solid transparent;
  padding-bottom: 2px;
}

.categories-nav a:hover {
  border-bottom-color: var(--color-red);
}

.search-wrap {
  max-width: var(--max-width);
  margin: 16px auto 0;
}

.search-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: var(--color-bg-lighter);
  color: var(--color-white);
  font-family: inherit;
  font-size: 1rem;
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* ---------- sections ---------- */

main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px;
}

.section {
  padding: 40px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  scroll-margin-top: 220px; /* щоб липкий хедер не перекривав заголовок після переходу з навігації */
}

@media (max-width: 767px) {
  .section {
    scroll-margin-top: 320px;
  }
}

.section-intro {
  margin: -6px 0 20px;
}

.section-title {
  font-size: 1.4rem;
  margin-bottom: 20px;
}

/* ---------- map ---------- */

.map-wrap {
  position: relative;
  max-width: 600px;
}

.map-wrap iframe {
  width: 100%;
  height: 450px;
  border: 0;
  display: block;
  pointer-events: none;
}

.map-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.15);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 600;
  cursor: pointer;
  padding: 20px;
}

.map-wrap.active .map-overlay {
  display: none;
}

.map-wrap.active iframe {
  pointer-events: auto;
}

/* ---------- відео (акордеон) ---------- */

.video-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 600px;
  margin-top: 24px;
}

.video-item {
  background: var(--color-bg-lighter);
  border-radius: 8px;
  overflow: hidden;
}

.video-item summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 600;
  color: var(--color-red);
}

.video-item summary::-webkit-details-marker {
  display: none;
}

.video-item summary::before {
  content: "▸ ";
}

.video-item[open] summary::before {
  content: "▾ ";
}

/* підпис відео "Про місто": дата й тривалість білі, назва червона */
.video-date,
.video-duration {
  color: var(--color-white);
  font-weight: 400;
}

.video-name {
  color: var(--color-red);
}

.video-body {
  padding: 0 16px 16px;
}

.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
}

.video-frame.video-frame-vertical {
  width: auto;
  max-width: 280px;
  aspect-ratio: 9 / 16;
  margin: 0 auto;
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* "Про місто": на десктопі ширина дозволяє розкласти акордеони у дві колонки */
@media (min-width: 768px) {
  #about-city .video-list {
    max-width: none;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-items: start;
    gap: 10px 20px;
  }
}

/* ---------- tiles ---------- */

.tiles-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 768px) {
  /* базова ширина тайлу в 3-колонковій розкладці — ~373px;
     якщо колонці стає тісно (менше ~80% від цього, тобто < 300px),
     авто-заповнення саме перелаштовує сітку на 2, а потім на 1 колонку */
  .tiles-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

.tile {
  display: flex;
  background: var(--color-bg-lighter);
  border-radius: 8px;
  overflow: hidden;
}

.tile.is-hidden {
  display: none;
}

.tile-photo {
  flex: 0 0 40%;
  width: 40%;
  min-width: 100px;
  height: auto;
  object-fit: cover;
  cursor: pointer;
}

.tile-photo.is-fallback-icon {
  object-fit: contain;
  background: var(--color-bg);
  padding: 20px;
}

.tile-body {
  flex: 1 1 auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.tile-sabtype {
  margin: 0 0 4px;
  color: var(--color-white);
  font-weight: 700;
  font-size: 0.8rem;
}

.tile-name {
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.tile-excerpt {
  font-size: 12px;
  margin: 0 0 10px;
  flex: 1 1 auto;
}

.tile-more {
  align-self: flex-start;
  background: none;
  border: none;
  color: var(--color-red);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.section.is-empty .tiles-grid {
  display: none;
}

/* ---------- modal ---------- */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 100;
  padding: 20px;
  overflow-y: auto;
}

.modal-backdrop.is-open {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.modal-content {
  position: relative;
  background: var(--color-bg);
  max-width: 700px;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  margin: 40px 0;
}

.modal-photo {
  width: 100%;
  height: 280px;
  object-fit: cover;
}

.modal-body {
  padding: 24px;
}

.modal-description {
  font-size: 14px;
}

.modal-row {
  margin: 0 0 10px;
  color: var(--color-white);
}

.modal-row strong {
  color: var(--color-red);
  font-weight: 600;
}

.modal-row a {
  color: var(--color-white);
  text-decoration: underline;
}

/* тел. номер: клікабельний dialer-лінк лише на мобільному */
@media (min-width: 768px) {
  .modal-row a.tel-link {
    pointer-events: none;
    cursor: default;
    text-decoration: none;
  }
}

.modal-comment {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-comment-title {
  font-size: 1rem;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: var(--color-white);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}

/* ---------- footer ---------- */

.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: left;
  padding: 32px 20px 24px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

.footer-social {
  display: flex;
  justify-content: flex-start;
  gap: 20px;
  margin-bottom: 20px;
}

.footer-social img {
  width: 28px;
  height: 28px;
  opacity: 0.85;
}

.footer-social a:hover img {
  opacity: 1;
}

.footer-disclaimer {
  max-width: 700px;
  margin: 0 0 16px;
  font-size: 0.7rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.55);
  white-space: pre-line; /* зберігаємо переноси рядків із тексту в Sanity */
}

.footer-copyright {
  margin: 0;
}

/* ---------- порожній розділ-заглушка ---------- */

.section-placeholder {
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
}

