/* ============================================================
   «В Городе» — каталог сайтов Оренбурга
   Дизайн-система: палитра, шрифты, адаптив, анимации
   ============================================================ */

:root {
  --bg: #F2F5F3;
  --text: #182B25;
  --accent: #1E6B5C;
  --accent-dark: #14503F;
  --highlight: #D9A441;
  --muted: #5C6F68;
  --faint: #B9C7BF;
  --card: #FFFFFF;
  --line: #E1E8E4;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(24, 43, 37, 0.06);
  --shadow-hover: 0 10px 28px rgba(24, 43, 37, 0.12);
  --font-head: 'Unbounded', sans-serif;
  --font-body: 'Golos Text', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 0.5em;
}

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

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

.container {
  width: min(1160px, 92%);
  margin: 0 auto;
}

/* ---------- Шапка ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(242, 245, 243, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 20px;
  color: var(--text);
}

.brand:hover { text-decoration: none; }

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.brand small {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.site-nav {
  display: flex;
  gap: 6px;
  margin-left: auto;
  flex-wrap: wrap;
}

.site-nav a {
  padding: 8px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
}

.site-nav a:hover {
  background: #E7EDEA;
  color: var(--text);
  text-decoration: none;
}

.btn {
  display: inline-block;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  transition: background 0.2s, transform 0.15s;
}

.btn:hover {
  background: var(--accent-dark);
  text-decoration: none;
  transform: translateY(-1px);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: 64px 0 56px;
  text-align: center;
}

.hero h1 {
  font-size: clamp(30px, 4.6vw, 52px);
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

.hero .tagline {
  color: var(--muted);
  font-size: clamp(15px, 2vw, 19px);
  max-width: 640px;
  margin: 0 auto 30px;
}

.hero-ornament {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.5;
}

/* ---------- Поиск ---------- */

.search-box {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px;
  box-shadow: var(--shadow);
}

.search-box input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--text);
  padding: 8px 12px;
}

.search-box input::placeholder { color: var(--faint); }

.search-btn {
  border: none;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  padding: 10px 22px;
  border-radius: 10px;
  transition: background 0.2s;
}

.search-btn:hover { background: var(--accent-dark); }

#search-results,
.cat-search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-hover);
  overflow: hidden;
  text-align: left;
}

#search-results[hidden], .cat-search-results[hidden] { display: none; }

.result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.result-item:last-child { border-bottom: none; }

.result-item:hover { background: #F4F8F6; text-decoration: none; }

.result-name { font-weight: 600; font-size: 15px; }

.result-desc {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-empty {
  padding: 14px 16px;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Секции ---------- */

.section { padding: 48px 0; }

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.section-head h2 { font-size: clamp(22px, 3vw, 30px); }

.count-badge {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  background: #E3EEE9;
  border-radius: 999px;
  padding: 4px 12px;
}

/* ---------- Сетка категорий ---------- */

.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.cat-card {
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.cat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
  text-decoration: none;
}

.cat-card h3 { font-size: 17px; margin-bottom: 6px; }

.cat-card p {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 12px;
  min-height: 42px;
}

.cat-count {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}

/* ---------- Популярные сайты ---------- */

.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.site-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.site-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  text-decoration: none;
}

.site-logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  margin-bottom: 12px;
  background: #EDF2EF;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 22px;
  color: #fff;
  margin-bottom: 12px;
}

.site-card .card-body { flex: 1; }

.site-card h3 { font-size: 15px; font-family: var(--font-body); font-weight: 600; margin-bottom: 4px; }

.site-card p {
  color: var(--muted);
  font-size: 13.5px;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chip {
  align-self: flex-start;
  margin-top: 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  background: #E3EEE9;
  border-radius: 999px;
  padding: 4px 10px;
}

/* ---------- Топы (подборки) ---------- */

.tops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  align-items: start;
}

.top-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.top-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #F7FAF8, #EFF5F1);
}

.top-head h3 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16.5px;
  margin: 0;
  line-height: 1.35;
}

.top-more {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.top-list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  counter-reset: top-rank;
}

.top-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.top-item:last-child { border-bottom: none; }

.rank-num {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 15px;
  color: var(--muted);
  background: #EDF2EF;
}

.top-item.rank-1 .rank-num { background: var(--highlight); color: #fff; }
.top-item.rank-2 .rank-num { background: #E8C98A; color: #fff; }
.top-item.rank-3 .rank-num { background: #DDBB74; color: #fff; }

.top-item-body { min-width: 0; flex: 1; }

.top-item-name {
  display: block;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
}

.top-item-name:hover { color: var(--accent); text-decoration: none; }

.top-item-desc {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.top-foot {
  padding: 10px 20px 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--faint);
}

/* ---------- Страница категории ---------- */

.page-hero {
  padding: 48px 0 8px;
}

.page-hero h1 { font-size: clamp(26px, 3.6vw, 40px); }

#cat-sub {
  color: var(--muted);
  max-width: 640px;
  margin: 0;
  font-size: 17px;
}

.cat-section { padding: 28px 0 56px; }

.cat-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

#cat-search {
  width: min(340px, 100%);
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text);
  outline: none;
}

#cat-search:focus { border-color: var(--accent); }

.cat-count-line {
  color: var(--muted);
  font-size: 14px;
}

.site-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 10px;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}

.site-row:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-hover);
  text-decoration: none;
}

.site-row .avatar,
.site-row .site-logo { width: 46px; height: 46px; margin-bottom: 0; border-radius: 10px; }

.row-body { flex: 1; min-width: 0; }

.row-name { font-weight: 600; font-size: 15.5px; color: var(--text); }
.site-row:hover .row-name { color: var(--accent); }

.row-desc {
  color: var(--muted);
  font-size: 13.5px;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-url {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--faint);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-note {
  color: var(--muted);
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
}

/* ---------- Подвал ---------- */

.site-footer {
  margin-top: 40px;
  background: #16302A;
  color: #C9D6CF;
  padding: 44px 0 30px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
}

.site-footer h4 {
  font-family: var(--font-head);
  font-size: 15px;
  color: #fff;
  margin: 0 0 14px;
}

.footer-about p {
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
  max-width: 380px;
}

.site-footer a { color: #C9D6CF; }
.site-footer a:hover { color: #fff; }

.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin-bottom: 8px; font-size: 14px; }

.copyright {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px;
  color: #8FA79D;
}

/* ---------- Scroll-reveal ---------- */

[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-reveal].revealed {
  opacity: 1;
  transform: none;
}

/* ---------- Адаптив ---------- */

@media (max-width: 1024px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero { padding: 48px 0 44px; }
}

@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; gap: 12px; }
  .site-nav { order: 3; width: 100%; margin-left: 0; justify-content: center; }
  .section { padding: 36px 0; }
  .hero { padding: 40px 0 36px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .row-url { display: none; }
  .top-head { flex-direction: column; align-items: flex-start; gap: 6px; }
}

@media (max-width: 480px) {
  .search-box { flex-direction: column; }
  .search-btn { width: 100%; }
  .cat-grid, .popular-grid { grid-template-columns: 1fr; }
}

/* ---------- Уважение prefers-reduced-motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .cat-card:hover,
  .site-card:hover,
  .site-row:hover,
  .btn:hover {
    transform: none;
  }
}
