/* ===== Палитра и базовые настройки ===== */
:root {
  --bg: #f5f2ea;
  --surface: #ffffff;
  --surface-soft: #eef2e8;
  --text: #1e2a22;
  --muted: #55645a;
  --line: #d8d5c9;
  --green: #2f5f3f;
  --green-dark: #24492f;
  --green-soft: #e3ecdf;
  --cream: #f3e9cf;
  --cream-text: #5a4300;
  --blue-soft: #dce9f5;
  --blue-text: #1f4470;
  --done-bg: #e2f0d9;
  --done-text: #2c5a1f;
  --warn-bg: #fff4d6;
  --warn-line: #d9a700;
  --error: #a92a2a;
  --error-bg: #fdeaea;
  --focus: #e07b00;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Times New Roman", "Noto Serif", serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; font-family: var(--serif); font-weight: 700; }
h1 { font-size: clamp(2rem, 5vw, 3.1rem); letter-spacing: -.01em; }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.1rem); }
h3 { font-size: 1.15rem; font-family: var(--font); }
p { margin: 0 0 1em; }
a { color: var(--green-dark); }
a:hover { color: var(--green); }
code { background: #e8e4d8; padding: 0 .3em; border-radius: 4px; font-size: .95em; }
ul, ol { margin-top: 0; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
main:focus { outline: none; }
h1:focus, h2:focus { outline: none; }

.container { width: min(100% - 32px, 1100px); margin-inline: auto; }
.container--narrow { max-width: 780px; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 720px; }
.lead--big { font-size: 1.3rem; color: var(--text); font-family: var(--serif); }
.view > .container > h1:first-child { margin-top: 32px; }
.view > .container > .breadcrumbs { margin: 24px 0 8px; }
.breadcrumbs a { text-decoration: none; font-weight: 600; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.skip-link {
  position: absolute; left: 8px; top: -60px;
  background: var(--green); color: #fff; padding: 10px 14px;
  border-radius: 8px; z-index: 100; text-decoration: none;
}
.skip-link:focus { top: 8px; }

.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; }

/* ===== Шапка ===== */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px 16px; padding: 12px 0;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--text);
  font-family: var(--serif); font-weight: 700; font-size: 1.5rem;
}
.brand--small { font-size: 1.15rem; }
.brand__mark { width: 36px; height: 36px; border-radius: 50%; }
.brand--small .brand__mark { width: 28px; height: 28px; }
.brand__logo { height: 52px; width: auto; display: block; }
.brand--small .brand__logo { height: 40px; }
@media (min-width: 860px) { .brand__logo { height: 64px; } }

.nav-toggle {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); font: inherit; cursor: pointer; color: var(--text);
}
.nav-toggle__icon { width: 18px; height: 2px; background: currentColor; position: relative; }
.nav-toggle__icon::before, .nav-toggle__icon::after {
  content: ""; position: absolute; left: 0; width: 18px; height: 2px; background: currentColor;
}
.nav-toggle__icon::before { top: -6px; }
.nav-toggle__icon::after { top: 6px; }

.site-nav { display: none; width: 100%; flex-direction: column; gap: 4px; padding-bottom: 8px; }
.site-nav.is-open { display: flex; }
.site-nav a:not(.nav-cta) {
  display: flex; align-items: center; min-height: 44px; padding: 8px 12px;
  border-radius: 10px; text-decoration: none; color: var(--text); font-weight: 500;
}
.site-nav a:not(.nav-cta):hover { background: var(--green-soft); }
.site-nav a[aria-current="page"]:not(.nav-cta) { background: var(--green-soft); color: var(--green-dark); font-weight: 700; }
.site-nav .nav-cta { margin-top: 4px; }
.site-nav .nav-cta[aria-current="page"] { background: var(--green-dark); }

@media (min-width: 860px) {
  .nav-toggle { display: none; }
  .site-nav { display: flex; width: auto; flex-direction: row; align-items: center; gap: 4px; padding: 0; }
  .site-nav .nav-cta { margin: 0 0 0 12px; }
}

/* ===== Кнопки ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; border-radius: 10px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  border: 2px solid transparent; transition: background .15s, color .15s;
}
.btn--primary { background: var(--green); color: #fff; }
.btn--primary:hover { background: var(--green-dark); color: #fff; }
.btn--secondary { background: var(--surface); color: var(--green-dark); border-color: var(--green); }
.btn--secondary:hover { background: var(--green-soft); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface); }
.btn--danger { background: var(--surface); color: var(--error); border-color: #e2b4b4; }
.btn--danger:hover { background: var(--error-bg); }
.btn--small { min-height: 40px; padding: 6px 14px; font-size: .95rem; }
.btn[aria-disabled="true"], .btn:disabled {
  background: #e3e0d6; color: #5b6460; border-color: transparent; cursor: not-allowed;
}
.btn--block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }

/* ===== Главная: hero ===== */
.hero {
  display: grid; gap: 24px; margin-top: 24px;
  background: var(--surface-soft); border-radius: 24px; overflow: hidden;
}
.hero__text { padding: 28px 24px 8px; }
.hero__tagline { font-size: 1.15rem; color: var(--muted); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 20px 0; }
.hero__note {
  display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: .95rem;
  max-width: 520px;
}
.hero__leaf {
  flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--surface);
  background-image: url("../favicon.svg"); background-size: 70%; background-position: center; background-repeat: no-repeat;
}
.hero__media { min-height: 220px; }
.hero__media img, .hero__art { width: 100%; height: 100%; min-height: 220px; display: block; object-fit: cover; }
.hero__media img { object-fit: contain; padding: 12px; box-sizing: border-box; }

@media (min-width: 760px) {
  .hero { grid-template-columns: 1.1fr 1fr; gap: 0; }
  .hero__text { padding: 44px 36px 32px; }
  .hero__media { min-height: 360px; }
}

/* ===== Категории (чипы) ===== */
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin: 28px 0 8px; justify-content: center; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 8px 18px;
  border: 2px solid var(--green); border-radius: 999px; background: var(--surface);
  color: var(--green-dark); text-decoration: none; font-weight: 600;
}
.chip:hover { background: var(--green-soft); }

/* ===== Блоки ===== */
.block { margin: 36px 0; }
#how { scroll-margin-top: 84px; }
.block__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.link-more { font-weight: 600; text-decoration: none; }
.link-more:hover { text-decoration: underline; }

.banner {
  display: grid; gap: 16px; align-items: center;
  background: linear-gradient(90deg, #eef2e6, #f6f2e6);
  border: 1px solid #dfe3d4; border-radius: 24px; padding: 28px 24px; margin: 36px 0;
}
.banner__text p { color: var(--muted); margin: 0; font-size: 1.05rem; }
.banner__art svg { width: 100%; max-width: 260px; display: block; margin-inline: auto; }
@media (min-width: 760px) {
  .banner { grid-template-columns: 1.4fr 1fr; padding: 32px 40px; }
}

.steps { padding: 0; list-style: none; counter-reset: step; display: grid; gap: 16px; }
.steps li { counter-increment: step; position: relative; padding: 4px 0 4px 56px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 42px; height: 42px; border-radius: 50%; background: var(--green-soft); color: var(--green-dark);
  display: grid; place-items: center; font-weight: 700; font-family: var(--serif); font-size: 1.2rem;
}
.steps h3 { margin-bottom: .2em; }
.steps p { margin: 0; color: var(--muted); }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); gap: 24px; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat__value { font-size: 2rem; font-weight: 700; line-height: 1.1; font-family: var(--serif); color: var(--green-dark); }
.stat__label { color: var(--muted); font-size: .95rem; }
.stats__note { grid-column: 1 / -1; margin: 0; font-size: .9rem; color: var(--muted); }

/* ===== Фильтры и поля форм ===== */
.filters {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin: 16px 0; display: grid; gap: 14px;
}
.filters__row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 160px; flex: 1 1 160px; }
.field--grow { flex: 2 1 220px; }
.field label, .field__label { font-weight: 600; font-size: .95rem; }
.field select, .field input, .field textarea {
  min-height: 46px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; background: var(--surface); color: var(--text); width: 100%;
}
.field textarea { min-height: 120px; resize: vertical; }
.field__hint { font-size: .88rem; color: var(--muted); margin: 0; }
.field__error { font-size: .9rem; color: var(--error); margin: 0; font-weight: 600; }
.field--invalid input, .field--invalid select, .field--invalid textarea { border-color: var(--error); }
.field--check { flex-direction: row; align-items: flex-start; gap: 10px; }
.field--check input { width: 22px; height: 22px; min-height: 0; margin-top: 2px; flex: none; }
.field--check label { font-weight: 500; }
.results-count { color: var(--muted); font-size: .95rem; min-height: 1.5em; }
.form { display: grid; gap: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.form__row { display: grid; gap: 18px; }
@media (min-width: 640px) { .form__row--2 { grid-template-columns: 1fr 1fr; } }
.form__error { background: var(--error-bg); color: var(--error); border-radius: 10px; padding: 12px 14px; font-weight: 600; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Загрузка фото */
.photos { display: grid; gap: 10px; }
.photos__drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 110px; border: 2px dashed var(--green); border-radius: var(--radius);
  background: var(--surface-soft); color: var(--green-dark); cursor: pointer; text-align: center; padding: 14px;
}
.photos__drop:hover, .photos__drop.is-over { background: var(--green-soft); }
.photos__drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.photos__drop strong { font-size: 1.05rem; }
.photos__drop span { font-size: .9rem; color: var(--muted); }
.photos__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.photo-thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--surface-soft); border: 1px solid var(--line); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb__remove {
  position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 1.1rem; cursor: pointer; display: grid; place-items: center;
}
.photo-thumb__main { position: absolute; left: 6px; bottom: 6px; background: var(--green); color: #fff; font-size: .75rem; padding: 2px 8px; border-radius: 6px; }
.photo-thumb--busy::after { content: "…"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.7); font-size: 2rem; }
.progress { height: 8px; background: var(--green-soft); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--green); width: 0; transition: width .2s; }

/* ===== Карточки ===== */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.card__media { position: relative; aspect-ratio: 4 / 3; background: var(--surface-soft); display: block; }
.card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--green); }
.card__placeholder .icon { width: 64px; height: 64px; opacity: .6; }
.tag {
  position: absolute; left: 12px; top: 12px; padding: 5px 12px; border-radius: 8px;
  font-size: .85rem; font-weight: 700;
}
.tag--free { background: var(--green); color: #fff; }
.status {
  position: absolute; right: 12px; top: 12px; padding: 5px 12px; border-radius: 8px;
  font-size: .85rem; font-weight: 700; background: #fff; color: var(--text);
}
.status--given { background: var(--done-bg); color: var(--done-text); }
.status--stale { background: var(--warn-bg); color: #6b5300; }
.status--hidden { background: #e8e4d8; color: #4a4a4a; }
.card__count { position: absolute; right: 12px; bottom: 12px; background: rgba(0,0,0,.55); color: #fff; font-size: .8rem; padding: 2px 8px; border-radius: 6px; }
.card__body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card h3 { margin: 0; }
.card h3 a { color: inherit; text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.card p { margin: 0; }
.card__text { color: var(--muted); font-size: .97rem; }
.card__meta { font-size: .9rem; color: var(--muted); }
.card__example {
  background: var(--warn-bg); border: 1px dashed var(--warn-line); color: #5a4600;
  padding: 6px 10px; border-radius: 8px; font-size: .9rem; font-weight: 600;
}
.card--example .card__media { filter: saturate(.7); }
.card__mine { font-size: .9rem; font-weight: 600; }
.card__footer { margin-top: auto; padding-top: 8px; display: grid; gap: 6px; }
.card__hint { font-size: .88rem; color: var(--muted); }

/* ===== Страница объявления ===== */
.item { display: grid; gap: 20px; }
.gallery { display: grid; gap: 10px; }
.gallery__main { aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; background: var(--surface-soft); position: relative; }
.gallery__main img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.gallery__thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.gallery__thumb { width: 72px; height: 72px; border-radius: 8px; overflow: hidden; border: 2px solid transparent; padding: 0; background: var(--surface-soft); cursor: pointer; }
.gallery__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery__thumb[aria-current="true"] { border-color: var(--green); }
.item__title { margin-bottom: .2em; }
.item__meta { color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .95rem; }
.item__desc { white-space: pre-line; font-size: 1.05rem; }
.item__contact { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 10px; }
.item__contact .phone { font-size: 1.5rem; font-weight: 700; font-family: var(--serif); text-decoration: none; }
.item__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.report-form { display: grid; gap: 10px; }
.item__given { background: var(--done-bg); color: var(--done-text); border-radius: var(--radius); padding: 14px 16px; font-weight: 600; }

/* ===== Пустые состояния и уведомления ===== */
.empty {
  grid-column: 1 / -1; text-align: center; padding: 40px 20px;
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
  color: var(--muted);
}
.empty p { margin: 0; }
.empty .btn { margin-top: 14px; }
.loading { grid-column: 1 / -1; text-align: center; padding: 30px; color: var(--muted); }
.notice { border-radius: var(--radius); padding: 14px 16px; border: 1px solid var(--line); background: var(--surface); }
.notice--warn { background: var(--warn-bg); border-color: var(--warn-line); color: #4a3a00; }
.notice--ok { background: var(--done-bg); border-color: #bfd9b0; color: var(--done-text); }
.notice--error { background: var(--error-bg); border-color: #e2b4b4; color: var(--error); }
.notice--closed { text-align: center; padding: 36px 20px; background: var(--surface-soft); border-color: #cfd8c8; }
.notice--closed h2 { margin-bottom: .4em; }
.notice--closed p { margin: 0; color: var(--muted); }
.link-box { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; background: var(--surface-soft); border-radius: 10px; padding: 10px 12px; }
.link-box code { flex: 1 1 200px; word-break: break-all; background: none; padding: 0; font-size: .9rem; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 50;
  max-width: min(90vw, 480px); box-shadow: 0 6px 24px rgba(0,0,0,.2);
}

/* ===== «О проекте» ===== */
.about-text p { font-size: 1.08rem; }
.why { display: grid; gap: 14px; margin-bottom: 1.5em; }
@media (min-width: 640px) { .why { grid-template-columns: repeat(3, 1fr); } }
.why__card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.why__icon { width: 46px; height: 46px; border-radius: 50%; background: var(--green-soft); color: var(--green-dark); display: grid; place-items: center; margin-bottom: 10px; }
.why__icon .icon { width: 26px; height: 26px; }
.why__card h3 { margin-bottom: .3em; }
.why__card p { margin: 0; color: var(--muted); font-size: .97rem; }
.view[data-view="about"] h2, .view[data-view="add"] h2, .view[data-view="manage"] h2, .view[data-view="admin"] h2 { margin-top: 1.6em; }
.check-list { padding-left: 1.2em; margin-bottom: 1.5em; }
.check-list li { margin-bottom: .45em; }
.contacts { display: grid; gap: 10px; }
.contact { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
.contact__icon { width: 40px; height: 40px; border-radius: 50%; background: var(--green-soft); color: var(--green-dark); display: grid; place-items: center; flex: none; }
.contact__label { font-size: .85rem; color: var(--muted); }
.contact__value { font-weight: 600; word-break: break-word; }
.contact__value a { text-decoration: none; }

/* ===== Панель организатора ===== */
.admin-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 12px 0 18px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--surface); font: inherit; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.admin-list { display: grid; gap: 12px; }
.admin-row { display: grid; grid-template-columns: 96px 1fr; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.admin-row__img { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; background: var(--surface-soft); }
.admin-row__title { font-weight: 700; }
.admin-row__meta { font-size: .9rem; color: var(--muted); }
.admin-row__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.admin-row--flag { border-color: var(--warn-line); background: #fffbef; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--green-soft); color: var(--green-dark); }
.pill--given { background: var(--done-bg); color: var(--done-text); }
.pill--hidden { background: #e8e4d8; color: #4a4a4a; }
.pill--removed { background: var(--error-bg); color: var(--error); }
.pill--warn { background: var(--warn-bg); color: #6b5300; }

/* ===== Подвал ===== */
.site-footer { margin-top: 56px; padding: 24px 0 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: .95rem; }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.footer-nav a { text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; }
.footer-nav a:hover { text-decoration: underline; }
.footer-admin { opacity: .7; }
.footer-text { margin: 0; }
.heart { color: #c0392b; }
