/* ===== Галерея советской живописи — оформление ===== */

:root {
  --bg: #f5f0e6;            /* тёплый кремовый фон */
  --bg-soft: #efe8d8;
  --surface: #fbf8f1;
  --ink: #2b2620;           /* основной текст */
  --muted: #7a6f5d;
  --accent: #8c2f2f;        /* глубокий бордовый */
  --accent-dark: #6f2222;
  --gold: #b8934a;          /* латунь/золото */
  --gold-soft: #c9a96a;
  --line: #ddd2bc;
  --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: Georgia, 'Times New Roman', 'PT Serif', serif;
  /* фон — бесшовный холст (static/img/canvas-bg.jpg, тайл 512x512) */
  background-color: var(--bg);
  background-image: url("../img/canvas-bg.jpg?v=3");
  background-repeat: repeat;
  background-size: 512px 512px;
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ===== Шапка ===== */
.site-header {
  background: var(--accent-dark);
  color: #f6efe2;
  border-bottom: 3px solid var(--gold);
}

.site-header .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 18px 0;
}

.site-title {
  font-size: 26px;
  font-weight: bold;
  letter-spacing: 0.5px;
  color: #fbf6ec;
}
.site-title a { color: inherit; text-decoration: none; }

.site-subtitle {
  font-size: 13px;
  color: #d8c9a8;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.main-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.main-nav a {
  color: #f1e7d2;
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 15px;
  letter-spacing: 0.4px;
}
.main-nav a:hover {
  background: rgba(255,255,255,0.10);
  text-decoration: none;
  color: #fff;
}

/* ===== Контент ===== */
.site-main { min-height: 60vh; padding: 32px 0 56px; }

.page-title {
  font-size: 30px;
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-weight: bold;
}
.page-subtitle { color: var(--muted); margin: 0 0 24px; }

/* ===== Хлебные крошки ===== */
.breadcrumbs {
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.breadcrumbs a { color: var(--muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs .sep { margin: 0 6px; color: var(--line); }

/* ===== Главная: hero ===== */
.hero {
  background: linear-gradient(135deg, #6f2222 0%, #8c2f2f 55%, #a03c3c 100%);
  color: #f7efe0;
  border-radius: var(--radius);
  padding: 46px 40px;
  margin-bottom: 34px;
  border: 1px solid var(--gold);
  box-shadow: 0 8px 24px rgba(70, 30, 20, 0.16);
}
.hero h1 { margin: 0 0 14px; font-size: 34px; line-height: 1.2; }
.hero p { margin: 0; font-size: 17px; color: #ecdcc0; max-width: 720px; }

/* ===== Сетки карточек ===== */
.grid {
  display: grid;
  gap: 22px;
}
.grid-artists { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.grid-paintings { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 36px 0 18px;
}
.section-head h2 {
  margin: 0;
  font-size: 22px;
  color: var(--accent-dark);
  border-left: 4px solid var(--gold);
  padding-left: 12px;
}

/* ===== Карточка художника ===== */
.card-artist {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
  display: flex;
  flex-direction: column;
}
.card-artist:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(70, 30, 20, 0.14);
  text-decoration: none;
}
.card-artist .photo {
  aspect-ratio: 4 / 5;
  background: var(--bg-soft) center/cover no-repeat;
  background-image: radial-gradient(circle at 30% 25%, #e7dcc4, #d9ccae);
}
.card-artist .photo img { width: 100%; height: 100%; object-fit: cover; }
.card-artist .body { padding: 14px 16px 16px; }
.card-artist .name { font-size: 17px; font-weight: bold; color: var(--ink); line-height: 1.25; }
.card-artist .years { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.card-artist .count { font-size: 13px; color: var(--gold); margin-top: 6px; }

/* ===== Карточка картины ===== */
.card-painting {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card-painting:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(70, 30, 20, 0.14);
  text-decoration: none;
}
.card-painting .frame {
  aspect-ratio: 4 / 3;
  background: var(--bg-soft) center/cover no-repeat;
  background-image: radial-gradient(circle at 30% 25%, #e7dcc4, #d9ccae);
}
.card-painting .frame img { width: 100%; height: 100%; object-fit: cover; }
.card-painting .body { padding: 12px 14px 14px; }
.card-painting .title { font-size: 15px; font-weight: bold; color: var(--ink); }
.card-painting .meta { font-size: 13px; color: var(--muted); margin-top: 3px; }

/* ===== Страница художника ===== */
.artist-header {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 30px;
  align-items: start;
  margin-bottom: 34px;
}
.artist-photo {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 10px;
  border-radius: var(--radius);
}
.artist-photo .img {
  aspect-ratio: 4 / 5;
  background: var(--bg-soft) center/cover no-repeat;
  background-image: radial-gradient(circle at 30% 25%, #e7dcc4, #d9ccae);
}
.artist-photo img { width: 100%; height: 100%; object-fit: cover; }
.artist-bio h1 { margin: 0 0 6px; font-size: 30px; color: var(--accent-dark); }
.artist-bio .years { color: var(--gold); font-size: 16px; margin-bottom: 16px; }
.artist-bio .text { color: var(--ink); font-size: 16px; }
.artist-bio .text p { margin: 0 0 12px; }

/* ===== Страница картины ===== */
.painting-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 34px;
  align-items: start;
}
.painting-visual {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(70,30,20,0.12);
}
.painting-visual img { width: 100%; }

/* ===== «Умный просмотр»: лупа по наведению ===== */
.painting-zoom {
  position: relative;
  margin: 0;
  overflow: hidden;
  cursor: zoom-in;
  background: #fff;
  line-height: 0;
  touch-action: manipulation;
}
.painting-zoom img {
  display: block;
  width: 100%;
  transform-origin: 50% 50%;
  transition: transform 0.18s ease-out;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}
.painting-zoom.zoom-active { cursor: crosshair; }
.painting-zoom.zoom-active img,
.painting-zoom img.zoomed {
  transform: scale(var(--zoom, 2.4));
  transition: transform 0.06s linear;
}
.painting-zoom .zoom-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: rgba(30, 20, 15, 0.62);
  color: #fff;
  font-size: 11.5px;
  letter-spacing: 0.3px;
  padding: 4px 9px;
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  line-height: 1.4;
}
.painting-zoom:hover .zoom-badge { opacity: 1; }
.painting-zoom.zoom-active .zoom-badge { opacity: 0; }
.zoom-help {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
.muted-sm { color: var(--muted); font-size: 13px; }
.painting-info h1 { margin: 0 0 12px; font-size: 28px; color: var(--accent-dark); }
.painting-meta { margin: 0 0 20px; }
.painting-meta .row { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.painting-meta .row .k { color: var(--muted); min-width: 120px; }
.painting-desc { font-size: 16px; }
.painting-desc p { margin: 0 0 12px; }

/* Навигация по картинам */
.painting-nav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 26px;
  flex-wrap: wrap;
}
.painting-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent);
  font-size: 14.5px;
  transition: background .15s ease;
}
.painting-nav a:hover { background: var(--accent); color: #fff; text-decoration: none; }
.painting-nav a.disabled { opacity: 0.4; pointer-events: none; }
.painting-counter { color: var(--muted); font-size: 14px; text-align: center; margin-top: 8px; }

/* ===== Контакты ===== */
.contacts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 34px;
}
.contact-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
}
.contact-card .k { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.contact-card .v { font-size: 17px; margin-top: 3px; }

/* ===== Формы ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf7;
  color: var(--ink);
}
.form-control:focus { outline: 2px solid var(--gold-soft); border-color: var(--gold); }
textarea.form-control { min-height: 120px; resize: vertical; }

.btn {
  display: inline-block;
  padding: 11px 22px;
  font-family: inherit;
  font-size: 15px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: background .15s ease;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn-outline { background: transparent; color: var(--accent); }
.btn-outline:hover { background: var(--accent); color: #fff; }
.btn-danger { border-color: #a33; background: #a33; }
.btn-sm { padding: 6px 12px; font-size: 13.5px; }

/* ===== Подвал ===== */
.site-footer {
  background: #2b2118;
  color: #cbbfa6;
  border-top: 3px solid var(--gold);
  padding: 26px 0;
  font-size: 14px;
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.site-footer a { color: var(--gold-soft); }

/* ===== Флэш-сообщения ===== */
.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; font-size: 15px; }
.flash.success { background: #e6efe2; color: #3d6b3d; border: 1px solid #bcd7b4; }
.flash.error { background: #f6e2e0; color: #8c2f2f; border: 1px solid #e0b9b4; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

/* ===== Админка ===== */
.admin-wrap { display: grid; grid-template-columns: 220px 1fr; gap: 26px; align-items: start; }
.admin-side {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.admin-side h3 { margin: 0 0 10px; font-size: 15px; color: var(--accent-dark); }
.admin-side ul { list-style: none; margin: 0; padding: 0; }
.admin-side li { margin: 2px 0; }
.admin-side a { display: block; padding: 7px 10px; border-radius: 4px; color: var(--ink); font-size: 14.5px; }
.admin-side a:hover { background: var(--bg-soft); text-decoration: none; color: var(--accent); }

.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14.5px; vertical-align: top; }
.admin-table th { background: var(--bg-soft); color: var(--accent-dark); }
.admin-table tr:hover td { background: #faf5ea; }
.thumb-sm { width: 64px; height: 52px; object-fit: cover; border: 1px solid var(--line); border-radius: 3px; }
.thumb-artist { width: 46px; height: 58px; object-fit: cover; border: 1px solid var(--line); border-radius: 3px; }

/* ===== Админка: увеличение миниатюр при наведении ===== */
.thumb-sm.hover-zoom {
  transition: transform 0.16s ease-out, box-shadow 0.16s ease-out;
  transform-origin: left center;
  position: relative;
  z-index: 1;
  cursor: zoom-in;
  background: var(--surface);
}
.thumb-sm.hover-zoom:hover {
  transform: scale(4.2);
  z-index: 60;
  box-shadow: 0 10px 28px rgba(60, 25, 15, 0.35);
  border-color: var(--accent);
}
.admin-table td:first-child { position: relative; }

/* превью в форме массовой загрузки */
.upload-preview-item {
  width: 110px;
  text-align: center;
  font-size: 11px;
  position: relative;
  z-index: 1;
}
.upload-preview-item img {
  width: 110px;
  height: 88px;
  object-fit: cover;
  border-radius: 4px;
  display: block;
  border: 1px solid var(--line);
  transition: transform 0.16s ease-out, box-shadow 0.16s ease-out;
  transform-origin: left center;
  cursor: zoom-in;
}
.upload-preview-item img:hover {
  transform: scale(2.6);
  z-index: 60;
  box-shadow: 0 12px 30px rgba(60, 25, 15, 0.35);
  border-color: var(--accent);
}

.login-box {
  max-width: 380px;
  margin: 60px auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  box-shadow: 0 8px 24px rgba(70,30,20,0.12);
}
.login-box h1 { margin: 0 0 20px; font-size: 22px; color: var(--accent-dark); text-align: center; }

.badge { display: inline-block; background: var(--gold); color: #fff; font-size: 12px; border-radius: 10px; padding: 1px 8px; margin-left: 6px; }

/* ===== Главная: призыв к покупке и SEO-блок ===== */
.hero-actions {
  margin: 22px 0 0;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.hero-actions .btn { border-color: var(--gold); }
.btn-gold {
  background: var(--gold);
  border-color: var(--gold);
  color: #2b2118;
}
.btn-gold:hover { background: var(--gold-soft); color: #2b2118; }
.btn-ghost {
  background: transparent;
  color: #f7efe0;
  border-color: rgba(246, 241, 231, 0.55);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }

.seo-block {
  margin: 0 0 32px;
  background: rgba(251, 248, 241, 0.75);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.seo-block h2 { margin: 0 0 10px; font-size: 21px; color: var(--accent-dark); }
.seo-block p { margin: 0 0 10px; font-size: 15.5px; }
.seo-block p:last-child { margin-bottom: 0; }

.painting-cta {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.painting-cta .btn { width: 100%; text-align: center; }
.painting-cta .muted-sm { margin-top: 8px; text-align: center; }

/* ===== Адаптивность ===== */
@media (max-width: 860px) {
  body { background-attachment: scroll; }   /* на телефонах fixed тормозит */
  .artist-header, .painting-layout, .contacts-grid, .admin-wrap { grid-template-columns: 1fr; }
  .site-header .top { flex-direction: column; align-items: flex-start; }
  .hero { padding: 30px 22px; }
  .hero h1 { font-size: 26px; }
  .hero-actions { flex-direction: column; }
  .hero-actions .btn { width: 100%; text-align: center; }
  .page-title { font-size: 25px; }
}
