/* Разширяваме полезната ширина на list страниците (Статии, Принципи и т.н.) */
body.list main.main {
  max-width: 1200px;
  padding-left: 18px;
  padding-right: 18px;
}

/* 2 колони (desktop) */
.posts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

/* Мобилно - 1 колона */
@media (max-width: 768px) {
  body.list main.main { max-width: 720px; }
  .posts { grid-template-columns: 1fr; gap: 10px; }
}

/* Стягаме вертикалните отстояния над списъка */
body.list .main {
  padding-top: 10px !important;
}

body.list .page-header {
  margin: 0 0 10px 0 !important;
}

body.list .page-header h1 {
  margin: 0 !important;
  line-height: 1.15;
}

body.list .post-content {
  margin: 0 0 10px 0 !important;
}

/* --- FIX: да няма огромна празнина преди картите в section/list страници --- */
body.list .post-content,
body.section .post-content {
  margin-bottom: 16px !important;
  padding-bottom: 0 !important;
}

/* Ако някъде main е flex и центрира - дърпай нагоре */
body.list main.main,
body.section main.main {
  justify-content: flex-start;
}

/* =========================================================
   КАРТИ - рамка за post-entry + first-entry (вкл. Home)
   ========================================================= */

/* Карта (нормално + първа статия на началната) */
body.list main.main > article.post-entry,
body.list main.main > article.first-entry,
body.home main.main > article.post-entry,
body.home main.main > article.first-entry {
  border: 1px solid rgba(255, 0, 0, 0.55) !important;
  border-radius: 12px !important;
  padding: 12px 14px !important;
  background: rgba(0, 0, 0, 0.02) !important;
  min-height: 110px;
  margin: 0 !important;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

/* Hover */
body.list main.main > article.post-entry:hover,
body.list main.main > article.first-entry:hover,
body.home main.main > article.post-entry:hover,
body.home main.main > article.first-entry:hover {
  border-color: rgba(255, 0, 0, 0.95) !important;
  background: rgba(0, 0, 0, 0.05) !important;
  box-shadow: 0 6px 14px rgba(0,0,0,0.10);
}

/* По-стегнати вътрешни отстояния в картата */
body.list main.main > article.post-entry .entry-header h2,
body.list main.main > article.first-entry .entry-header h2,
body.home main.main > article.post-entry .entry-header h2,
body.home main.main > article.first-entry .entry-header h2 {
  margin: 0 0 6px 0 !important;
  line-height: 1.15;
}

body.list main.main > article.post-entry .entry-content,
body.list main.main > article.post-entry .entry-content p,
body.list main.main > article.first-entry .entry-content,
body.list main.main > article.first-entry .entry-content p,
body.home main.main > article.post-entry .entry-content,
body.home main.main > article.post-entry .entry-content p,
body.home main.main > article.first-entry .entry-content,
body.home main.main > article.first-entry .entry-content p {
  margin: 0 !important;
}

/* =========================================================
   YouTube embed
   ========================================================= */

.yt-embed {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 18px auto;
  padding-top: 56.25%; /* 16:9 */
}

.yt-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 10px;
}
.link-card {
  max-width: 900px;
  margin: 18px auto;
}

.link-card__a {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 14px;
  align-items: center;
  text-decoration: none;
  border: 1px solid rgba(0,0,0,0.15);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer; /* важно: "ръка" */
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.link-card__a:hover {
  border-color: rgba(255, 0, 0, 0.75);
  box-shadow: 0 8px 18px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}

.link-card__img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}

.link-card__title {
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 6px;
}

.link-card__desc {
  opacity: 0.9;
  line-height: 1.35;
  margin-bottom: 10px;
}

.link-card__cta {
  font-weight: 700;
  opacity: 0.85;
}
@media (max-width: 640px) {
  .link-card__a {
    grid-template-columns: 1fr;
  }
  .link-card__img {
    width: 100%;
  }
}

/* Slideshow link - match #slideshow even if it becomes /#slideshow or full URL */
a[href="#slideshow"],
a[href$="#slideshow"]{
  display:inline-block !important;
  font-weight:700 !important;
  text-decoration:none !important;
  padding:2px 10px !important;
  border-radius:999px !important;
  border:1px solid currentColor !important;
}

a[href="#slideshow"]:hover,
a[href$="#slideshow"]:hover{
  text-decoration:none !important;
}

/* Collage gallery grid - no crop */
.bgz-gallery{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap:12px;
  margin-top:16px;
}

.bgz-gallery a{
  display:block;
  border-radius:12px;
  overflow:hidden;
  border:1px solid rgba(127,127,127,.35);
  background:#000;
}

.bgz-gallery img{
  width:100%;
  height:260px;
  object-fit:contain;
  display:block;
}

/* Lightbox */
#bgz-lightbox{
  position:fixed;
  inset:0;
  z-index:99998;
  display:none;
  background:rgba(0,0,0,.92);
}
#bgz-lightbox.open{ display:block; }
#bgz-lightbox img{
  position:absolute;
  inset:0;
  margin:auto;
  max-width:95vw;
  max-height:95vh;
  width:auto;
  height:auto;
  object-fit:contain;
}
#bgz-lightbox .bgz-x{
  position:absolute;
  top:10px;
  right:10px;
  width:40px;
  height:40px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.3);
  background:rgba(0,0,0,.35);
  color:#fff;
  font-size:22px;
  cursor:pointer;
}