*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── ШРИФТЫ ─────────────────────────────────── */
/* Подключите локально через @font-face вместо Google Fonts */
@import url('/fonts/fonts.css');

/* ── ПЕРЕМЕННЫЕ ──────────────────────────────── */
:root {
  --bg:           #f4ede0;
  --surface:      #fdf8f0;
  --text:         #1a1410;
  --muted:        #6b5a46;
  --faint:        #9c8570;
  --border:       rgba(90,60,20,.14);
  --border-md:    rgba(90,60,20,.26);
  --red:          #a32d2d;
  --red-bg:       #fcf0f0;
  --red-border:   rgba(163,45,45,.22);
  --amber-bg:     #faeeda;
  --amber-text:   #7a4808;
  --amber-border: rgba(186,117,23,.28);
  --blue:         #0088cc;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #17130d;
    --surface:      #201910;
    --text:         #e8dcc8;
    --muted:        #a08060;
    --faint:        #6b5040;
    --border:       rgba(200,160,80,.11);
    --border-md:    rgba(200,160,80,.22);
    --red-bg:       #28100e;
    --red-border:   rgba(163,45,45,.28);
    --amber-bg:     #221700;
    --amber-text:   #e0a040;
    --amber-border: rgba(186,117,23,.24);
  }
}

/* ── БАЗОВЫЕ ─────────────────────────────────── */
body {
  font-family: 'Spectral', serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.5rem; }

/* ── ШАПКА ───────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border-md);
  padding: 1.2rem 0 0;
}

.header-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: .75rem;
}

.brand { display: flex; align-items: flex-start; gap: 12px; }
.brand-link { display: block; flex-shrink: 0; }

.logo-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  display: block;
}

@media (prefers-color-scheme: dark) {
  .logo-img { filter: invert(1); }
}

.site-title {
  font-family: 'IM Fell English', serif;
  font-size: 20px; font-weight: 400;
  line-height: 1.3; letter-spacing: .01em;
}

.site-latin {
  font-family: 'Courier Prime', monospace;
  font-size: 10.5px; letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--faint); margin-top: 3px;
}

nav {
  display: flex; align-items: center;
  gap: 1.1rem; flex-wrap: wrap; padding-top: 4px;
}

nav a {
  font-family: 'Courier Prime', monospace;
  font-size: 11.5px; letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted); text-decoration: none;
  border-bottom: .5px solid transparent; padding-bottom: 2px;
  display: flex; align-items: center; gap: 4px;
  transition: color .15s, border-color .15s;
}
nav a:hover,
nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--border-md); }
nav a.nav-tg  { color: var(--blue); }
nav a.nav-don { color: var(--red); border-bottom-color: rgba(163,45,45,.3); }

/* ── ОСНОВНАЯ ОБЛАСТЬ ────────────────────────── */
.site-main { padding: 1.4rem 0 2rem; }

/* ── СЕТКИ ───────────────────────────────────── */
.grid-top {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 1rem; margin-bottom: 1rem;
}
.grid-bot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 860px) {
  .grid-top { grid-template-columns: 1fr; }
  .sidebar  { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
}
@media (max-width: 560px) {
  .grid-bot { grid-template-columns: 1fr; }
  .sidebar  { grid-template-columns: 1fr; }
}

/* ── КАРТОЧКИ ────────────────────────────────── */
.card {
  background: var(--surface);
  border: .5px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
}

.lbl {
  font-family: 'Courier Prime', monospace;
  font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--faint);
  margin-bottom: 10px;
}

.ctitle {
  font-family: 'IM Fell English', serif;
  font-size: 19px; font-weight: 400;
  line-height: 1.35; margin-bottom: 6px;
}
.ctitle.sm { font-size: 15px; }

.cmeta {
  font-size: 12px; font-style: italic;
  color: var(--faint); margin-bottom: 10px;
}

.cbody {
  font-size: 14px; line-height: 1.72;
  color: var(--muted); margin-bottom: 13px;
}

.clink {
  font-family: 'Courier Prime', monospace;
  font-size: 11.5px; letter-spacing: .06em;
  text-transform: uppercase; color: var(--red);
  text-decoration: none;
  border-bottom: .5px solid rgba(163,45,45,.3);
  padding-bottom: 1px;
}
.clink:hover { border-bottom-color: var(--red); }

hr.div {
  border: none; border-top: .5px solid var(--border);
  margin: 11px 0;
}

/* ── БЕЙДЖИ ──────────────────────────────────── */
.badge {
  display: inline-block;
  font-family: 'Courier Prime', monospace;
  font-size: 10.5px; padding: 2px 9px;
  border-radius: 3px; margin-bottom: 9px;
  letter-spacing: .05em;
}
.b-red   { background: var(--red-bg);   color: var(--red);        border: .5px solid var(--red-border); }
.b-amber { background: var(--amber-bg); color: var(--amber-text); border: .5px solid var(--amber-border); }

/* ── ТЕГИ ────────────────────────────────────── */
.tags {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-bottom: 10px;
}
.tags-top    { margin-bottom: 10px; }
.tags-bottom { margin-top: 8px; margin-bottom: 0; }

.tag {
  font-family: 'Courier Prime', monospace;
  font-size: 10.5px; letter-spacing: .05em;
  padding: 2px 8px; border-radius: 3px;
  background: var(--bg);
  border: .5px solid var(--border-md);
  color: var(--muted);
  text-decoration: none;
  transition: border-color .15s, color .15s;
}
.tag:hover { color: var(--text); border-color: var(--muted); }

/* ── СБОР ────────────────────────────────────── */
.card-don {
  background: var(--red-bg);
  border-color: var(--red-border);
  margin-bottom: 1rem;
}
.card-don .lbl { color: rgba(163,45,45,.7); }

.prog-label { font-size: 13px; color: var(--muted); margin-bottom: 7px; }

.prog-track {
  height: 5px; background: rgba(163,45,45,.14);
  border-radius: 3px; overflow: hidden; margin-bottom: 14px;
}
.prog-fill {
  height: 100%; background: var(--red); border-radius: 3px;
}

.don-btn {
  display: block; width: 100%; padding: 9px 0;
  background: var(--red); color: #fdf8f0;
  font-family: 'Courier Prime', monospace;
  font-size: 11.5px; letter-spacing: .09em;
  text-transform: uppercase; text-align: center;
  border-radius: 6px; text-decoration: none;
  border: none; cursor: pointer;
  transition: opacity .15s;
}
.don-btn:hover { opacity: .85; }

/* ── ГАЛЕРЕЯ ─────────────────────────────────── */
.photo-wrap {
  width: 100%; aspect-ratio: 4/3;
  border-radius: 6px; overflow: hidden;
  background: var(--bg); margin-bottom: 8px;
}
.photo-wrap img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  filter: sepia(18%) saturate(85%);
}
.photo-wrap--empty {
  display: flex; align-items: center; justify-content: center;
  font-family: 'Courier Prime', monospace;
  font-size: 12px; color: var(--faint);
}

/* ── КАЛЕНДАРЬ МЕРОПРИЯТИЙ ───────────────────── */
.event-header {
  display: flex; align-items: flex-start;
  justify-content: space-between;
  gap: 8px; margin-bottom: 4px;
}

.cal-btn {
  font-family: 'Courier Prime', monospace;
  font-size: 10.5px; letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
  border: .5px solid var(--border-md);
  border-radius: 4px;
  padding: 3px 9px;
  cursor: pointer;
  display: flex; align-items: center; gap: 5px;
  white-space: nowrap; flex-shrink: 0;
  transition: color .15s, border-color .15s, background .15s;
}
.cal-btn:hover  { color: var(--text); border-color: var(--muted); }
.cal-btn.active { color: var(--red); border-color: var(--red-border); background: var(--red-bg); }

.event-top { margin-top: 10px; }

.event-calendar {
  margin-top: 12px;
  border-top: .5px solid var(--border);
  padding-top: 10px;
}

.ev-list { list-style: none; }

.ev-item {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0 10px; padding: 8px 0;
  border-bottom: .5px solid var(--border);
  align-items: start;
}
.ev-item:last-child { border-bottom: none; }

.ev-date-box {
  text-align: center;
  background: var(--bg);
  border: .5px solid var(--border-md);
  border-radius: 4px;
  padding: 4px 2px; line-height: 1.2;
}
.ev-day {
  font-family: 'IM Fell English', serif;
  font-size: 18px; font-weight: 400;
  display: block; color: var(--text);
}
.ev-mon {
  font-family: 'Courier Prime', monospace;
  font-size: 9px; letter-spacing: .08em;
  text-transform: uppercase; color: var(--faint);
  display: block;
}
.ev-title {
  font-size: 13px; font-weight: 500;
  color: var(--text); line-height: 1.35;
  margin-bottom: 3px;
}
.ev-meta {
  font-family: 'Courier Prime', monospace;
  font-size: 10.5px; color: var(--faint);
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}

.ann-cat {
  font-family: 'Courier Prime', monospace;
  font-size: 10px; letter-spacing: .06em;
  text-transform: uppercase;
  padding: 1px 6px; border-radius: 3px;
  vertical-align: middle;
}
.ann-cat.lektsiya { background: var(--amber-bg); color: var(--amber-text); }
.ann-cat.vystavka { background: #e8f4e8; color: #3a6a3a; }
.ann-cat.rekon    { background: #e8eef8; color: #2a4a7a; }

/* ── БИБЛИОТЕКА ──────────────────────────────── */
.book-wrap {
  display: flex; gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.book-cover-placeholder {
  width: 72px; flex-shrink: 0;
  aspect-ratio: 2/3;
  border-radius: 3px 5px 5px 3px;
  background: linear-gradient(135deg, #5a3a1a 0%, #7a5030 60%, #4a2a0a 100%);
  box-shadow: -3px 3px 8px rgba(0,0,0,.25), inset -2px 0 4px rgba(0,0,0,.2);
  display: flex; align-items: center; justify-content: center;
}

.book-cover {
  width: 72px; flex-shrink: 0;
  aspect-ratio: 2/3;
  border-radius: 3px 5px 5px 3px;
  object-fit: cover; display: block;
  box-shadow: -3px 3px 8px rgba(0,0,0,.18), inset -2px 0 4px rgba(0,0,0,.12);
}

.book-spine-text {
  font-family: 'Courier Prime', monospace;
  font-size: 9px; letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255,230,180,.6);
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  padding: 6px 0;
}

.book-info { flex: 1; min-width: 0; }

.book-title {
  font-family: 'IM Fell English', serif;
  font-size: 15px; font-weight: 400;
  line-height: 1.35; margin-bottom: 5px;
  color: var(--text);
}
.book-author {
  font-size: 12px; font-style: italic;
  color: var(--muted); margin-bottom: 6px;
}
.book-year {
  font-family: 'Courier Prime', monospace;
  font-size: 10.5px; color: var(--faint);
  margin-bottom: 8px;
}
.book-desc {
  font-size: 13px; line-height: 1.6;
  color: var(--muted); margin-bottom: 8px;
}

/* ── КУКИ-БАННЕР ─────────────────────────────── */
.cookie-banner {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  border: .5px solid var(--border-md);
  border-radius: 8px;
  padding: .9rem 1.2rem;
  display: flex; align-items: center; gap: 1rem;
  box-shadow: 0 4px 24px rgba(0,0,0,.12);
  max-width: 560px; width: calc(100% - 2rem);
  z-index: 100;
}
.cookie-banner[hidden] { display: none; }
.cookie-text {
  font-size: 13px; color: var(--muted); flex: 1;
}
.cookie-btn {
  font-family: 'Courier Prime', monospace;
  font-size: 11px; letter-spacing: .07em;
  text-transform: uppercase;
  background: var(--red); color: #fdf8f0;
  border: none; border-radius: 4px;
  padding: 5px 14px; cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s;
}
.cookie-btn:hover { opacity: .85; }

/* ── ПОДВАЛ ──────────────────────────────────── */
.site-footer {
  border-top: .5px solid var(--border);
  padding: 1.2rem 0; margin-top: 1rem;
}
.footer-text {
  font-family: 'Courier Prime', monospace;
  font-size: 11px; letter-spacing: .07em;
  color: var(--faint); text-align: center;
}
.footer-text a { color: var(--blue); text-decoration: none; }

.blocks-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-start;
}

.blocks-grid .w1 { flex: 1 1 280px; }
.blocks-grid .w2 { flex: 2 1 380px; }
.blocks-grid .w3 { flex: 3 1 480px; }

@media (max-width: 560px) {
    .blocks-grid > div { flex: 1 1 100%; }
}
