/* =========================================================
   main.css — goad.se (Refactor v3 Final Polished)
   Fixes: dark mode contrast, modal readability, filter visibility,
   consistent gradients, and overall polish.
   ======================================================= */

:root{
  --bg:#0b1220;
  --panel:#0f1629;
  --panel-2:#131e36;
  --text:#e6e9f2;
  --muted:#94a3b8;
  --border:#243249;
  --blue:#3b82f6;
  --blue-hero:#335dff;
  --accent:var(--blue);
  --focus:#7c3aed;
  --bad:#ef4444;
  --good:#10b981;
  --radius:14px;
  --shadow:0 6px 22px rgba(0,0,0,.45);
  --shadow-lg:0 20px 60px rgba(0,0,0,.6);
  --container:1200px;
}

*{box-sizing:border-box;margin:0;padding:0;}
html,body{height:100%;font-family:ui-sans-serif,system-ui,"Segoe UI",Roboto,Arial,sans-serif;color:var(--text);background:var(--bg);}

/* Header */
.header{display:flex;align-items:center;justify-content:space-between;max-width:var(--container);margin:0 auto;padding:12px 20px;}
.header input[type="search"]{width:100%;padding:10px 14px;border-radius:10px;border:1px solid var(--border);background:#111a2e;color:var(--text);}
.header .btn{color:#fff;background:var(--blue);border:none;padding:10px 18px;border-radius:10px;cursor:pointer;}
.header .btn:hover{filter:brightness(1.1);}

/* Hero */
.mp-hero{background:linear-gradient(135deg,var(--blue-hero),var(--blue));color:#fff;text-align:center;padding:60px 20px;}
.mp-hero h1{font-size:clamp(28px,3.2vw,42px);margin-bottom:8px;}
.mp-hero p{opacity:.9;}

/* Body layout */
.mp-body{display:grid;grid-template-columns:280px 1fr;gap:24px;max-width:var(--container);margin:-28px auto 40px;padding:0 20px;}
.mp-filters{background:var(--panel-2);border:1px solid var(--border);border-radius:var(--radius);padding:18px;box-shadow:var(--shadow);color:var(--text);}
.mp-filter{display:flex;flex-direction:column;margin-bottom:12px;}
.mp-filter label{margin-bottom:6px;color:var(--muted);}
.mp-filter select,.mp-filter input{background:#111a2e;color:var(--text);border:1px solid var(--border);border-radius:8px;padding:10px;}
.mp-filter select:focus,.mp-filter input:focus{border-color:var(--accent);outline:none;}

/* Cards */
.mp-grid{display:grid;gap:16px;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));}
.card{background:var(--panel-2);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);padding:16px;display:flex;flex-direction:column;gap:10px;}
.card__badge{display:inline-block;background:#1e293b;color:#e2e8f0;padding:6px 10px;border-radius:999px;font-size:12px;}
.card__title{font-size:18px;color:var(--text);}
.card__desc{color:var(--muted);}
.card__meta{color:var(--muted);font-size:13px;display:flex;flex-wrap:wrap;gap:10px;}
.card__actions{margin-top:auto;text-align:right;}
.btn--primary{background:var(--blue);color:#fff;border:none;padding:10px 14px;border-radius:10px;cursor:pointer;}
.btn--primary:hover{filter:brightness(1.1);}

/* Modal */
.modal-overlay{display:none;position:fixed;inset:0;background:rgba(2,6,23,.65);backdrop-filter:blur(6px);justify-content:center;align-items:center;z-index:9999;}
.modal-overlay.show{display:flex;}
.modal-box{background:var(--panel-2);border:1px solid var(--border);border-radius:20px;box-shadow:var(--shadow-lg);color:var(--text);width:min(92vw,420px);padding:22px;position:relative;}
.close-btn{position:absolute;top:10px;right:12px;background:#111a2e;color:var(--text);border:1px solid var(--border);border-radius:8px;width:32px;height:32px;font-size:20px;cursor:pointer;}
.modal-box h1,.modal-box h2,.modal-box p,.modal-box a{color:var(--text);}

/* Footer */
.site-footer{background:linear-gradient(135deg,#1530b0,#2f54ff);color:#eaf0ff;}
.site-footer__inner{max-width:var(--container);margin:0 auto;padding:40px 20px;display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:24px;}
.site-footer__inner a{color:#eaf0ff;opacity:.95;text-decoration:none;}
.site-footer__inner a:hover{opacity:1;text-decoration:underline;}

/* Responsive */
@media(max-width:960px){.mp-body{grid-template-columns:1fr;}}
@media(max-width:640px){.mp-hero{padding:36px 20px;}}

/* Bottom-centered footer bar */
.site-footer__bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.85); /* полупрозрачный тёмный фон */
  color: #eaf0ff;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px 10px 0 0;
  padding: 10px 20px;
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  z-index: 999;
  width: fit-content;
  max-width: 90%;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}

.site-footer__bar a {
  color: #eaf0ff;
  text-decoration: none;
}

.site-footer__bar a:hover {
  text-decoration: underline;
  color: #fff;
}

/* === POPUP HARD FIX: контраст + единый размер + скролл === */

/* Оверлей — темнее и над всем */
.modal-overlay{
  background: rgba(2,6,23,.75) !important;
  backdrop-filter: blur(6px);
  z-index: 9999 !important;
}

/* Коробка попапа: тёмная, читаемая, одного размера */
.modal-box{
  background: #0f1629 !important;          /* тёмная панель */
  color: #e6e9f2 !important;                /* светлый текст */
  border: 1px solid #243249 !important;
  box-shadow: 0 20px 60px rgba(0,0,0,.60) !important;

  /* ЕДИНЫЙ РАЗМЕР (desktop) */
  width: min(92vw, 600px) !important;       /* фиксированная ширина на десктопе */
  max-width: 600px !important;
  min-width: 320px;

  max-height: calc(100vh - 140px) !important; /* чтобы не вылезал за окно */
  display: flex;
  flex-direction: column;
  overflow: hidden;                            /* внутренний скролл ниже */
  padding: 22px !important;
  border-radius: 20px !important;
}

/* Внутренний контент — прокрутка при длинном тексте */
.modal-box .content,
.modal-box .modal-content,
.modal-box .body,
.modal-box .inner{
  overflow: auto;
  scrollbar-gutter: stable;
}

/* На случай неизвестной разметки — делаем скролл у коробки */
.modal-box{ overflow: auto; }

/* Контраст текста во всех элементах внутри */
.modal-box h1, .modal-box h2, .modal-box h3,
.modal-box p,  .modal-box li, .modal-box a,
.modal-box strong, .modal-box span, .modal-box small{
  color: #e6e9f2 !important;
  opacity: 1 !important;
}

/* Размеры типографики в попапе */
.modal-box h1{ font-size: 22px; line-height: 1.25; margin: 0 0 8px; }
.modal-box h2{ font-size: 18px; line-height: 1.3;  margin: 0 0 6px; }
.modal-box p, .modal-box li{ font-size: 15px; line-height: 1.6; }

/* Бейдж/иконки в попапе остаются видимыми */
.modal-box .card__badge{ background:#1e293b !important; color:#e2e8f0 !important; }

/* Кнопка закрытия — читаемая */
.close-btn{
  background: #111a2e !important;
  color: #e6e9f2 !important;
  border: 1px solid #243249 !important;
}

/* Единая ширина (и не «резиновая») на больших экранах */
@media (min-width: 1024px){
  .modal-box{ width: 600px !important; }
}

/* === (Опционально) ровные карточки и усечение строк === */
.card{ min-height: 340px; } /* один визуальный размер сетки */
.card__title{
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__desc{
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; color: var(--muted);
}


/* Кнопка под сеткой – центр и отступы */
.show-more-wrap { text-align: center; margin: 16px 0 0; }
.show-more-wrap .btn { min-width: 200px; }

#grid:not(.expanded) > *:nth-child(n+4) { display: none; }

.geo-links {
  margin-top: 10px;
  line-height: 1.6;
}

.geo-links a {
  color: #fff;
  text-decoration: none;
  margin: 0 5px;
  transition: color 0.2s ease-in-out;
}

.geo-links a:hover {
  color: #ffce54; /* лёгкий золотистый акцент при наведении */
}


/* ===== Галерея (модалка) ===== */
.gallery { margin-top:16px; display:grid; gap:12px; }

.gallery__hero {
  position:relative;
  background:rgba(15,23,42,.6);
  border:1px solid rgba(148,163,184,.25);
  border-radius:14px;
  padding:8px;
}

.gallery__stage {
  min-height:240px;
  display:grid;
  place-items:center;
  overflow:hidden;
  border-radius:10px;
}

.gallery__spinner {
  width:28px;height:28px;border:3px solid rgba(148,163,184,.35);
  border-top-color:#60a5fa;border-radius:50%;animation:spin .8s linear infinite;
}
@keyframes spin { to { transform:rotate(360deg) } }

.gallery__img {
  max-width:100%; max-height:62vh; display:block; border-radius:10px;
  box-shadow:0 10px 30px rgba(0,0,0,.35);
}
.fade-in { animation: fade .25s ease; }
@keyframes fade { from{opacity:0} to{opacity:1} }

.gallery__nav {
  position:absolute; top:50%; transform:translateY(-50%);
  height:40px;width:40px;border-radius:999px;
  border:1px solid rgba(148,163,184,.3);
  background:rgba(2,6,23,.6); color:#e5e7eb;
  display:grid; place-items:center; cursor:pointer;
  transition:all .18s ease;
}
.gallery__nav:hover { background:rgba(2,6,23,.85); transform:translateY(-50%) scale(1.06); }
.gallery__nav[disabled]{ opacity:.35;pointer-events:none; }
.gallery__nav--prev{ left:10px; } .gallery__nav--next{ right:10px; }

.gallery__thumbs {
  display:grid; grid-template-columns:repeat(auto-fill, minmax(72px,1fr));
  gap:10px;
}
.gallery__thumb {
  border:1px solid transparent; border-radius:10px; padding:2px;
  background:rgba(15,23,42,.6); transition:all .18s ease; cursor:pointer;
}
.gallery__thumb:hover { border-color:rgba(148,163,184,.35); transform:translateY(-1px); }
.gallery__thumb.is-active { border-color:#60a5fa; box-shadow:0 0 0 2px rgba(96,165,250,.25) inset; }
.gallery__thumb img { width:100%; height:64px; object-fit:cover; border-radius:8px; display:block; }

.gallery__fallback { color:#94a3b8; padding:28px 0; }

@media (min-width:1024px) { .gallery__img { max-height:68vh; } }

/* ===== Галерея в модалке ===== */
.modal-gallery{
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 900px){
  .modal-gallery{ grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px){
  .modal-gallery{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.modal-gallery a{
  display: block;
  border: 1px solid var(--border, #263248);
  background: rgba(0,0,0,.15);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.modal-gallery a:hover{
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  border-color: rgba(99,102,241,.45);
}

.modal-gallery img{
  width: 100%;
  height: 120px;           /* размер миниатюры */
  object-fit: cover;       /* можно заменить на contain, если хочешь без обрезки */
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  filter: saturate(1.05) contrast(1.02);
}

/* немного пространства над/под текстом в модалке */
.view__body{ margin-top: 10px; line-height: 1.6; }

/* мини-галерея превью в модалке */
.modal-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.modal-gallery img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #1f2a44;
  box-shadow: 0 4px 18px rgba(0,0,0,.35);
  cursor: zoom-in;          /* показать, что можно увеличить */
  transition: transform .12s ease;
}
.modal-gallery img:hover { transform: translateY(-1px); }

/* лайтбокс-оверлей */
.lb {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5,10,20,.86);
  z-index: 9999;            /* поверх модалки */
}
.lb.show { display: flex; }
.lb img {
  max-width: 95vw;
  max-height: 95vh;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
  cursor: zoom-out;         /* клик – закрыть */
}

.gallery img {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.gallery img.loaded {
  opacity: 1;
  transform: scale(1);
}


.char-counter {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 12px;
  line-height: 1;
  color: var(--muted, #9aa4b2);
  user-select: none;
  pointer-events: none;
  opacity: .95;
}
.char-counter.warn { color: #f59e0b; }
.char-counter.over { color: #ef4444; }
.ta-wrap{ position: relative; }
.has-counter{ padding-right:72px; }     /* резерв под счётчик */
.char-counter{ right:16px; bottom:10px; z-index:1; }



/* End of file */
