:root {
  --bg: #F6F8FE;
  --surface: #FFFFFF;
  --text: #151B2F;
  --text-muted: #535E76;
  --border: #DFE4F0;
  --accent: #3E46E8;
  --accent-2: #703FE9;
  --radius: 16px;
  --radius-search: 20px;
  --shadow: 0 10px 30px rgba(21, 27, 47, 0.06);
  --max: 1200px;
  --focus: 0 0 0 3px rgba(62, 70, 232, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Golos Text", "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
:focus-visible { outline: none; box-shadow: var(--focus); }

.container { width: min(100% - 32px, var(--max)); margin-inline: auto; }

.site-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: blur(12px);
  background: rgba(246, 248, 254, 0.9);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 0;
}
.logo {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--text); font-weight: 700; font-size: 1.15rem; text-decoration: none;
}
.logo-mark {
  width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; display: grid; place-items: center; font-weight: 800;
}
.nav { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.nav a { color: var(--text-muted); font-weight: 500; text-decoration: none; }
.nav a:hover, .nav a.active { color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 0;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-primary {
  background: var(--accent); color: #fff;
}
.btn-primary:hover { background: #333bd4; text-decoration: none; color: #fff; }
.btn-secondary {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--accent); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--accent); }

.hero {
  padding: 36px 0 28px;
  background:
    radial-gradient(1200px 400px at 10% -10%, rgba(62,70,232,.16), transparent 60%),
    radial-gradient(900px 360px at 90% 0%, rgba(112,63,233,.14), transparent 55%),
    var(--bg);
}
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.75rem, 4vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.hero p { margin: 0 0 22px; color: var(--text-muted); max-width: 42rem; }
.search-box {
  display: flex; gap: 10px; align-items: stretch;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-search); padding: 8px; box-shadow: var(--shadow);
  position: relative;
}
.search-box input {
  flex: 1; border: 0; background: transparent; font: inherit;
  padding: 12px 14px; min-width: 0; color: var(--text);
}
.search-box input:focus { outline: none; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); display: none; overflow: hidden; z-index: 30;
}
.suggest.open { display: block; }
.suggest a {
  display: block; padding: 12px 16px; color: var(--text); text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.suggest a:hover, .suggest a.active { background: #EEF1FF; }
.suggest .meta { color: var(--text-muted); font-size: 13px; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; }
.tab {
  min-height: 40px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-muted); text-decoration: none; font-weight: 500;
}
.tab.active, .tab:hover { color: var(--accent); border-color: #c9cef8; background: #eef0ff; text-decoration: none; }

.section { padding: 28px 0; }
.section-head {
  display: flex; justify-content: space-between; align-items: end; gap: 12px;
  margin-bottom: 16px;
}
.section-head h2 { margin: 0; font-size: 1.35rem; }
.muted { color: var(--text-muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 14px;
}
.chip:hover { border-color: #c9cef8; text-decoration: none; }
.chip button { border: 0; background: transparent; cursor: pointer; color: var(--text-muted); }

.layout-with-filters {
  display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: start;
}
.filters {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; position: sticky; top: 84px;
}
.filters h3 { margin: 0 0 12px; font-size: 1rem; }
.filters label { display: block; font-size: 14px; color: var(--text-muted); margin: 10px 0 6px; }
.filters select, .filters input, .form-control {
  width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid var(--border);
  padding: 10px 12px; font: inherit; background: #fff; color: var(--text);
}
.filters-actions { display: flex; gap: 8px; margin-top: 14px; }
.mobile-filters-btn { display: none; }

.grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px;
}
.grid.list { grid-template-columns: 1fr; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; display: flex; gap: 12px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.card:hover { border-color: #c9cef8; box-shadow: var(--shadow); }
.avatar {
  width: 52px; height: 52px; border-radius: 14px; flex: 0 0 auto;
  display: grid; place-items: center; color: #fff; font-weight: 700;
  overflow: hidden; background: var(--accent);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.card-body { min-width: 0; flex: 1; }
.card-title {
  margin: 0; font-size: 1rem; font-weight: 650;
  overflow-wrap: anywhere;
}
.card-title a { color: var(--text); text-decoration: none; }
.card-title a:hover { color: var(--accent); }
.card-meta { margin-top: 4px; font-size: 13px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 6px 10px; }
.card-desc {
  margin: 8px 0 0; color: var(--text-muted); font-size: 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }

.resource-hero {
  display: grid; grid-template-columns: 96px 1fr; gap: 18px; align-items: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 22px;
}
.resource-hero .avatar { width: 96px; height: 96px; border-radius: 24px; font-size: 1.6rem; }
.badge {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px;
  background: #eef0ff; color: var(--accent); font-size: 13px; font-weight: 600;
}
.empty {
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 28px; text-align: center; color: var(--text-muted);
}
.flash {
  margin: 16px 0; padding: 12px 14px; border-radius: 12px;
  background: #e8f8ef; color: #146c43; border: 1px solid #b7ebd0;
}
.flash.error { background: #fdeceb; color: #8a1f11; border-color: #f5c2c0; }
.pagination { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.pagination a, .pagination span {
  min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0 10px;
}
.pagination .active { background: var(--accent); color: #fff; border-color: var(--accent); }

.site-footer {
  margin-top: 48px; border-top: 1px solid var(--border); padding: 28px 0 40px;
  color: var(--text-muted); font-size: 14px;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 20px; }
.footer-grid a { color: var(--text-muted); }
.form-stack { display: grid; gap: 12px; max-width: 560px; }
.form-stack .error { color: #b42318; font-size: 14px; }

.sheet {
  display: none; position: fixed; inset: 0; z-index: 50;
  background: rgba(21,27,47,.45);
}
.sheet.open { display: block; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--surface); border-radius: 20px 20px 0 0;
  padding: 16px 16px 24px; max-height: 85vh; overflow: auto;
}
.sheet-actions { display: flex; gap: 8px; position: sticky; bottom: 0; background: var(--surface); padding-top: 12px; }

@media (max-width: 960px) {
  .layout-with-filters { grid-template-columns: 1fr; }
  .filters.desktop { display: none; }
  .mobile-filters-btn { display: inline-flex; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .nav .hide-sm { display: none; }
  .grid { grid-template-columns: 1fr; }
  .resource-hero { grid-template-columns: 1fr; }
  .search-box { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
