/* ============================================================
   MyPickleball — спортивная светлая тема
   Один файл стилизует все шаблоны, наследующие base.html
   Классы взяты из существующей разметки, без изменений в HTML
   ============================================================ */

/* ---------- Дизайн-токены ---------- */
:root {
  --green:        #16a34a;   /* основной акцент — корт */
  --green-dark:   #15803d;
  --green-darker: #0f5c2e;
  --lime:         #d7f24a;   /* мяч — яркий акцент */
  --lime-ink:     #3d4a00;
  --ink:          #10221a;   /* основной текст */
  --muted:        #5c6b63;   /* второстепенный текст */
  --line:         #e2e8e4;   /* границы */
  --bg:           #f6f9f7;   /* фон страницы */
  --surface:      #ffffff;   /* карточки */
  --surface-2:    #eef5f0;   /* мягкая заливка */
  --shadow:       0 1px 2px rgba(16,34,26,.06), 0 8px 24px rgba(16,34,26,.06);
  --shadow-hover: 0 4px 12px rgba(16,34,26,.10), 0 16px 40px rgba(16,34,26,.12);
  --radius:       16px;
  --radius-sm:    10px;
  --maxw:         1080px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 20px;
}

main.container { padding-block: 40px 64px; }

a { color: var(--green-dark); text-decoration: none; }
a:hover { color: var(--green); text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ---------- Типографика ---------- */
h1 {
  font-size: clamp(2rem, 4vw, 2.9rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-weight: 800;
  margin: 0 0 20px;
}

h2 {
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 750;
  margin: 40px 0 16px;
}

h3 { font-size: 1.2rem; font-weight: 700; margin: 28px 0 12px; }

p { margin: 0 0 16px; }

.lead {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: 60ch;
  margin-bottom: 28px;
}

.muted { color: var(--muted); }

/* ---------- Шапка ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,.82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 66px;
}

.logo {
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.logo:hover { text-decoration: none; color: var(--ink); }
.logo::before {
  content: "";
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--lime);
  border: 2.5px solid var(--green);
  /* ямочки мяча */
  background-image: radial-gradient(var(--green) 1.2px, transparent 1.3px);
  background-size: 6px 6px;
  flex: none;
}

.site-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.site-nav a {
  color: var(--ink);
  font-weight: 600;
  font-size: .98rem;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background .15s, color .15s;
}
.site-nav a:hover {
  text-decoration: none;
  background: var(--surface-2);
  color: var(--green-dark);
}

/* ---------- Хлебные крошки ---------- */
.breadcrumbs { margin: 0 0 24px; font-size: .9rem; }
.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0; margin: 0;
  color: var(--muted);
}
.breadcrumbs li { display: inline-flex; align-items: center; gap: 6px; }
.breadcrumbs li + li::before { content: "›"; color: var(--line); }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--green); text-decoration: none; }

/* ---------- Плитки разделов (.tiles / .tile) ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin: 32px 0;
}
.tile {
  display: block;
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 24px 28px;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.tile::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 5px;
  background: linear-gradient(90deg, var(--green), var(--lime));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s ease;
}
.tile:hover {
  text-decoration: none;
  color: var(--ink);
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: transparent;
}
.tile:hover::before { transform: scaleX(1); }
.tile h2 { margin: 0 0 8px; font-size: 1.3rem; }
.tile p { margin: 0; color: var(--muted); }
.tile-meta {
  margin: 0 0 8px !important;
  font-size: .85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- Свежее на главной (.latest) ---------- */
.latest { margin: 44px 0 8px; }
.latest > h2 { font-size: 1.5rem; margin: 0 0 18px; }
.latest-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px;
  display: grid;
  gap: 4px;
}
.latest-list li {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.latest-list li:last-child { border-bottom: 1px solid var(--line); }
.latest-list a {
  font-weight: 600;
  font-size: 1.08rem;
  color: var(--ink);
}
.latest-list a:hover { color: var(--green); }
.latest-list time {
  display: inline-block;
  margin-left: 10px;
  font-size: .85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.latest-list p { margin: 6px 0 0; color: var(--muted); }

/* ---------- Список городов (.city-list) ---------- */
.city-list {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.city-list li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.city-list li:hover {
  transform: translateY(-2px);
  border-color: var(--green);
  box-shadow: var(--shadow-hover);
}
.city-list a { font-weight: 700; font-size: 1.05rem; color: var(--ink); }
.city-list a:hover { color: var(--green-dark); text-decoration: none; }
.city-list .muted { font-size: .85rem; white-space: nowrap; }

/* ---------- Список площадок (.venue-list / .venue-card) ---------- */
.venue-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.venue-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  padding: 22px 22px 20px;
  box-shadow: var(--shadow);
  transition: transform .18s, box-shadow .18s, border-left-color .18s;
}
.venue-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-left-color: var(--lime);
}
.venue-card h2 { margin: 0 0 8px; font-size: 1.25rem; }
.venue-card h2 a { color: var(--ink); }
.venue-card h2 a:hover { color: var(--green-dark); text-decoration: none; }
.venue-card p { margin: 0 0 6px; color: var(--muted); font-size: .95rem; }
.venue-card p:last-child { margin-bottom: 0; }

/* ---------- Карточка площадки (.venue-page) ---------- */
.venue-page {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  max-width: 760px;
}
.venue-address { color: var(--muted); font-size: 1.05rem; margin-bottom: 24px; }
.venue-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0;
  margin: 0;
  border-top: 1px solid var(--line);
}
.venue-facts dt {
  font-weight: 700;
  color: var(--muted);
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 14px 24px 14px 0;
  border-bottom: 1px solid var(--line);
}
.venue-facts dd {
  margin: 0;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.venue-verified {
  margin-top: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  color: var(--green-darker);
  font-size: .88rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
}
.venue-verified::before { content: "✓"; font-weight: 800; color: var(--green); }

/* ---------- Статья (.article-*) ---------- */
.article-header { margin-bottom: 28px; }
.article-meta { color: var(--muted); font-size: .9rem; margin: 0; }
.article-body { max-width: none; }
.article-body h2 { margin-top: 40px; }
.article-body img { border-radius: var(--radius-sm); }
.article-body ul, .article-body ol { padding-left: 1.3em; }
.article-body li { margin-bottom: 8px; }
.article-body blockquote {
  margin: 24px 0;
  padding: 8px 20px;
  border-left: 4px solid var(--lime);
  background: var(--surface-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--ink);
}

/* Таблицы из Markdown: своей разметки у них нет, стилизуем по тегам */
.article-body table {
  width: 100%;
  margin: 28px 0;
  border-collapse: collapse;
  font-size: .96rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.article-body thead th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.article-body th,
.article-body td {
  padding: 11px 16px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.article-body tbody tr:last-child th,
.article-body tbody tr:last-child td { border-bottom: 0; }
.article-body tbody tr:hover { background: var(--surface-2); }
/* Первая колонка часто подпись строки — приглушаем и не даём ей рваться */
.article-body tbody td:first-child { color: var(--muted); white-space: nowrap; }

/* На узком экране таблица прокручивается внутри себя, а не растягивает страницу */
@media (max-width: 640px) {
  .article-body table { display: block; overflow-x: auto; }
  .article-body th, .article-body td { white-space: nowrap; }
}

/* ---------- FAQ (.faq / details) ---------- */
.faq { margin-top: 48px; }
.faq details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.faq summary {
  cursor: pointer;
  font-weight: 700;
  padding: 14px 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-size: 1.4rem;
  font-weight: 400;
  color: var(--green);
  transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 16px; color: var(--muted); }

/* ---------- Списки в контенте (404 и пр.) ---------- */
main.container > ul {
  padding-left: 1.2em;
  line-height: 1.9;
}

/* ---------- Подвал ---------- */
.site-footer {
  margin-top: 64px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: .92rem;
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 28px;
}
.site-footer p { margin: 0; }
.site-footer nav { display: flex; gap: 18px; }
.site-footer a { color: var(--muted); font-weight: 600; }
.site-footer a:hover { color: var(--green-dark); text-decoration: none; }

/* ---------- Адаптив ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  main.container { padding-block: 28px 44px; }
  /* Пунктов меню больше, чем влезает в строку рядом с логотипом:
     логотип отдельной строкой, меню — прокручиваемой лентой под ним. */
  .site-header .container {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    min-height: 0;
    padding-block: 9px;
  }
  .site-nav {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin-inline: -4px;
    padding-inline: 4px;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { padding: 7px 11px; font-size: .92rem; white-space: nowrap; }
  .venue-page { padding: 22px; }
  .venue-facts { grid-template-columns: 1fr; }
  .venue-facts dt { padding-bottom: 2px; border-bottom: none; }
  .venue-facts dd { padding-top: 2px; }
}

/* ---------- Доступность ---------- */
:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
  border-radius: 4px;
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Медиа: фото с атрибуцией ---------- */
.media {
  margin: 0 0 20px;
}
/* aspect-ratio из width/height в разметке предотвращает layout shift,
   пока картинка грузится — это метрика CLS в Core Web Vitals. */
.media img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #eef1ee;
}
.media figcaption {
  margin-top: 7px;
  font-size: .82rem;
  line-height: 1.45;
  color: #6b7280;
}
.media-caption {
  display: block;
  color: #374151;
}
.media-credit a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.article-cover img,
.venue-cover img {
  border-radius: 10px;
}
/* Обложка и видео — на всю ширину статьи (как текст) */
.article-cover,
.video-embed {
  max-width: none;
}

/* ---------- Медиа: встраивание видео (16:9, без прыжка вёрстки) ---------- */
.video-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}
.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
