/* Base reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: #121212;
  background: #ffffff;
  line-height: 1.5;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

.container {
  width: min(1200px, 92%);
  margin: 0 auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #ffffffcc;
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid #e6e6e6;
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: linear-gradient(135deg, #0078f0, #00c6ff);
}

.logo-text {
  font-weight: 800;
  letter-spacing: 0.3px;
}

.nav {
  display: flex;
  gap: 16px;
}

.nav a {
  padding: 8px 10px;
  border-radius: 8px;
  color: #222;
  transition: background .2s ease, color .2s ease;
}

/* Align authenticated user label like nav links */
.nav #auth-user {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  color: #222;
}

.nav a:hover,
.nav a:focus {
  background: #f2f6ff;
  color: #0b63e6;
}

/* Hero */
.hero {
  padding: 28px 0 8px;
}

.hero-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.hero-main {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  min-height: 320px;
}

.hero-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform .4s ease;
}

.hero-main:hover img { transform: scale(1.06); }

.hero-main .hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.0), rgba(0,0,0,0.6));
}

.hero-main .hero-title {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  color: #fff;
  font-size: 28px;
  font-weight: 700;
}

.hero-side {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 20px;
}

.card {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 14px;
  border: 1px solid #eee;
  border-radius: 12px;
  overflow: hidden;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s ease;
}

.card:hover img { transform: scale(1.04); }

.card-body {
  padding: 12px;
}

.card-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.card-meta {
  color: #666;
  font-size: 13px;
}

/* Absolute image collage (requirement) */
.collage {
  position: relative;
  margin: 30px 0;
  height: 260px;
  border-radius: 14px;
  background: #f7f9fc;
  border: 1px dashed #c7d6ff;
  overflow: hidden;
}

.collage img {
  position: absolute;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

/* Positioned items */
.collage .img1 { left: 14px; top: 18px; width: 220px; height: 140px; }
.collage .img2 { left: 250px; top: 40px; width: 180px; height: 120px; }
.collage .img3 { left: 450px; top: 16px; width: 210px; height: 150px; }
.collage .img4 { left: 680px; top: 60px; width: 190px; height: 120px; }
.collage .img5 { left: 900px; top: 24px; width: 220px; height: 150px; }
.collage .img6 { left: 320px; top: 168px; width: 520px; height: 90px; border-radius: 10px; }

/* News list */
.section {
  padding: 12px 0 32px;
}

.section-title {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 14px;
}

.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

/* Overlay card for news/articles */
.news-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  height: 220px;
}

.news-item .thumb {
  position: absolute;
  inset: 0;
}

.news-item .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform .3s ease;
}

.news-item:hover .thumb img { transform: scale(1.06); }

.news-item .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.75), rgba(0,0,0,0));
  pointer-events: none;
}

.news-item .title {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  color: #fff;
  font-weight: 800;
  font-size: 18px;
  line-height: 1.25;
  margin: 0;
}

/* Article */
.article {
  display: grid;
  grid-template-columns: 3fr 1.2fr;
  gap: 24px;
  padding: 20px 0 40px;
}

.article .cover { border-radius: 12px; overflow: hidden; }
.article h1 { font-size: 34px; line-height: 1.2; margin: 10px 0 12px; }
.article .meta { color: #666; font-size: 14px; margin-bottom: 14px; }
.article .content p { margin: 12px 0; }

.aside {
  position: sticky;
  top: 88px;
  height: fit-content;
}

/* Contacts */
.contacts {
  display: grid;
  grid-template-columns: 1.2fr 2fr;
  gap: 24px;
  padding: 20px 0 40px;
}

.info-box {
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 16px;
}

/* Remove bullets and extra indent in "По теме" list */
.info-box ul { list-style: none; padding-left: 0; margin-left: 0; }
.info-box li { margin: 6px 0; }

.map {
  border: 0;
  width: 100%;
  height: 320px;
  border-radius: 12px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 2000;
}

.modal-backdrop.active { display: flex; }

.modal {
  background: #fff;
  width: min(420px, 100%);
  border-radius: 12px;
  border: 1px solid #e9e9e9;
  box-shadow: 0 20px 60px rgba(0,0,0,0.16);
  animation: pop .16s ease-out;
}

@keyframes pop { from { transform: translateY(8px); opacity: .7; } }

.modal header {
  padding: 14px 16px;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}

.modal .content { padding: 16px; }
.modal .actions { padding: 14px 16px; border-top: 1px solid #eee; display: flex; gap: 10px; justify-content: flex-end; }

.input { width: 100%; padding: 10px 12px; border: 1px solid #ddd; border-radius: 10px; }
.label { display: block; font-size: 14px; color: #444; margin-bottom: 6px; }
.field { margin-bottom: 12px; }
.btn { padding: 10px 14px; border-radius: 10px; border: 1px solid #0b63e6; background: #0b63e6; color: #fff; cursor: pointer; }
.btn.secondary { background: #fff; color: #0b63e6; }

/* Toast notification (уведомление) */
.toast {
  position: fixed;
  left: 50%;
  bottom: 45px;
  min-width: 260px;
  max-width: 95vw;
  padding: 14px 32px;
  border-radius: 12px;
  background: #1661ec;
  color: #fff;
  font-weight: 700;
  font-size: 17px;
  box-shadow: 0 2px 40px rgba(5,25,70,0.19);
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transform: translateX(-50%) translateY(40px);
  transition: opacity 0.25s, transform 0.4s;
}
.toast.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.toast.toast-error {
  background: #ef373a;
}

/* Footer */
.site-footer {
  border-top: 1px solid #e6e6e6;
  padding: 18px 0;
  color: #666;
}

/* Responsive */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-side { grid-template-rows: 1fr 1fr; }
  .article { grid-template-columns: 1fr; }
  .contacts { grid-template-columns: 1fr; }
  .collage { height: 340px; }
  .collage .img1 { left: 10px; top: 14px; }
  .collage .img2 { left: 200px; top: 36px; }
  .collage .img3 { left: 390px; top: 12px; }
  .collage .img4 { left: 590px; top: 56px; }
  .collage .img5 { left: 790px; top: 20px; }
  .collage .img6 { left: 220px; top: 190px; width: 540px; }
}

@media (max-width: 768px) {
  .site-header-inner { flex-direction: column; gap: 10px; align-items: flex-start; }
  .nav { flex-wrap: wrap; }
  .card { grid-template-columns: 1fr; }
  .news-grid { grid-template-columns: 1fr 1fr; }
  .news-item { height: 200px; }
  .collage { height: 420px; }
  .collage .img1 { left: 10px; top: 14px; width: 46%; height: 120px; }
  .collage .img2 { left: 54%; top: 36px; width: 42%; height: 110px; }
  .collage .img3 { left: 6%; top: 160px; width: 44%; height: 120px; }
  .collage .img4 { left: 52%; top: 150px; width: 44%; height: 110px; }
  .collage .img5 { left: 10%; top: 270px; width: 46%; height: 120px; }
  .collage .img6 { left: 6%; top: 310px; width: 88%; height: 90px; }
}

@media (max-width: 480px) {
  .news-grid { grid-template-columns: 1fr; }
  .hero-main .hero-title { font-size: 22px; }
  .news-item { height: 180px; }
}
