/* ---------- Токены ---------- */
:root {
  --ink: #1a2433;
  --text: #333e4c;
  --muted: #6b7684;
  --steel: #24466b;
  --steel-dark: #1a3552;
  --heat: #a8322d;
  --bg: #ffffff;
  --header-bg: #eef2f7;
  --line: #e1e5ea;
  --field: #c3cbd4;
  --focus: #3b78c3;
  --radius: 2px;
  --font: "Golos Text", "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: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--steel); text-underline-offset: 3px; }
a:hover { color: var(--steel-dark); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
img { max-width: 100%; display: block; }

.container { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 24px; }

/* ---------- Шапка ---------- */
.site-header { background: var(--header-bg); color: var(--ink); }
.header-inner { padding-top: 18px; padding-bottom: 18px; }

.brand { display: inline-flex; align-items: center; gap: 16px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }

/* Логотип наложен прямо на светлый фон шапки — подложка не нужна, PNG прозрачный */
.brand-mark {
  flex: none;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-logo { width: 100%; height: 100%; object-fit: contain; display: block; }

.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-name { font-size: 19px; font-weight: 700; color: var(--ink); }
.brand-sub { font-size: 13px; color: var(--muted); max-width: 280px; }

.main-nav { background: var(--bg); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 28px; }
.main-nav a {
  display: block;
  padding: 13px 0 11px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 15px;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover { color: var(--ink); }
.main-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--steel); }
.main-nav .nav-auth { margin-left: auto; }
.main-nav .nav-auth form { margin: 0; }
.nav-btn {
  display: block; padding: 13px 0 11px; background: none; border: 0;
  border-bottom: 2px solid transparent; cursor: pointer;
  font: inherit; font-weight: 500; font-size: 15px; color: var(--muted);
}
.nav-btn:hover { color: var(--ink); }

/* ---------- Основная часть ---------- */
.site-main { flex: 1; padding-top: 24px; padding-bottom: 56px; }

.page-head { margin: 32px 0 8px; }
.page-head h1 { margin: 0; font-size: 22px; line-height: 1.3; font-weight: 600; color: var(--ink); }
.page-count { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* ---------- Панель фильтров ---------- */
.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.filters { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.filters .field { min-width: 220px; }
.filters-actions { display: flex; gap: 6px; align-items: center; }

/* ---------- Поля ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; font-weight: 500; color: var(--muted); }
.req { color: var(--heat); }

input[type="text"], input[type="password"], input[type="date"], select, textarea {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--field);
  border-radius: var(--radius);
  padding: 8px 11px;
  min-height: 38px;
}
textarea { resize: vertical; line-height: 1.55; min-height: 200px; }
select {
  appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
input:hover, select:hover, textarea:hover { border-color: #9aa6b3; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px rgba(59,120,195,.15); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--heat); }
.error { margin: 0; color: var(--heat); font-size: 13px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px; padding: 0 18px;
  font: inherit; font-weight: 500; font-size: 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--steel); color: #fff; }
.btn-primary:hover { background: var(--steel-dark); color: #fff; }
.btn-secondary { background: var(--bg); color: var(--ink); border-color: var(--field); }
.btn-secondary:hover { border-color: var(--ink); color: var(--ink); }
.btn-link { background: none; color: var(--muted); padding: 0 8px; }
.btn-link:hover { color: var(--ink); }

/* ---------- Список событий ---------- */
.event-list { list-style: none; margin: 0; padding: 0; }

.event-row {
  display: grid;
  grid-template-columns: 144px 1fr;
  gap: 22px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.event-thumb { display: block; aspect-ratio: 4 / 3; background: #f3f5f7; overflow: hidden; text-decoration: none; }
.event-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-empty { display: flex; height: 100%; align-items: center; justify-content: center; font-size: 12px; color: var(--muted); }

.event-date { display: block; font-size: 13px; color: var(--muted); }
.event-title { margin: 3px 0 4px; font-size: 16px; line-height: 1.35; font-weight: 600; }
.event-title a { color: var(--ink); text-decoration: none; }
.event-title a:hover { color: var(--steel); text-decoration: underline; }
.event-full { margin: 0 0 8px; font-size: 14px; color: var(--text); max-width: 70ch; }

.event-meta { margin: 0; display: flex; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.event-meta span + span { margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--field); }

.pagination { display: flex; gap: 18px; align-items: center; justify-content: center; margin-top: 24px; font-size: 14px; color: var(--muted); }

.empty { padding: 48px 0; text-align: center; color: var(--muted); }
.empty p { margin: 0 0 16px; }

/* ---------- Форма входа ---------- */
.login-form { max-width: 360px; margin-top: 20px; }
.grid-single { display: grid; gap: 16px; margin-bottom: 20px; }

/* ---------- Форма ---------- */
.event-form { max-width: 760px; margin-top: 20px; }

.form-block { margin: 0 0 28px; padding: 0; border: 0; }
.form-block legend {
  float: left; width: 100%;
  margin: 0 0 16px; padding: 0 0 8px;
  font-size: 15px; font-weight: 600; color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.form-block legend + * { clear: both; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.grid .wide { grid-column: 1 / -1; }

.upload { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.upload input[type="file"] { font: inherit; font-size: 14px; }
.upload input[type="file"]::file-selector-button {
  font: inherit; font-weight: 500; margin-right: 12px;
  padding: 7px 14px; border: 1px solid var(--field); border-radius: var(--radius);
  background: var(--bg); color: var(--ink); cursor: pointer;
}
.upload-preview { width: 96px; height: 72px; object-fit: cover; }
.upload-hint { font-size: 13px; color: var(--muted); }

.form-actions { display: flex; gap: 10px; align-items: center; padding-top: 4px; }

/* ---------- Страница события ---------- */
.breadcrumbs { font-size: 13px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--ink); }

.event-detail { max-width: 720px; margin-top: 28px; }
.event-detail h1 { margin: 4px 0 8px; font-size: 22px; line-height: 1.35; font-weight: 600; color: var(--ink); }
.event-detail .event-meta { margin-bottom: 24px; }

.event-photo { margin: 0 0 24px; max-width: 440px; }
.event-photo img { width: 100%; max-height: 300px; object-fit: cover; }

.event-text { max-width: 68ch; font-size: 15px; line-height: 1.7; margin-bottom: 28px; }
.event-text p { margin: 0 0 1em; }

.back-link { font-size: 14px; }

/* ---------- Уведомления ---------- */
.notice { padding: 10px 14px; margin-bottom: 16px; font-size: 14px; border-left: 3px solid; }
.notice-success { background: #f1f7f2; border-color: #4f8a5a; color: #1e4d27; }
.notice-error { background: #fbf1f0; border-color: var(--heat); color: #6e1f1a; }

/* ---------- Подвал ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 18px 0; font-size: 13px; color: var(--muted); }

/* ---------- Адаптивность ---------- */
@media (max-width: 820px) {
  .toolbar { flex-direction: column; align-items: stretch; }
  .filters .field { min-width: 0; flex: 1 1 200px; }
  .toolbar > .btn-primary { width: 100%; }
}

@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .main-nav ul { gap: 20px; }
  .brand-mark { width: 52px; height: 52px; }
  .brand-name { font-size: 15px; }
  .brand-sub { font-size: 11px; max-width: 200px; }
  .event-row { grid-template-columns: 96px 1fr; gap: 14px; padding: 16px 0; }
  .event-full { display: none; }
  .grid { grid-template-columns: 1fr; }
  .event-photo { max-width: 100%; }
  .page-head h1, .event-detail h1 { font-size: 20px; }
}
