/* === GRID === */
.gk64-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 20px;
  justify-items: center;
  margin: 40px auto;
  max-width: 1200px;
}

/* === CARD BASE === */
.gk64-card {
  width: 210px;
  height: 430px;
  border-radius: 12px;
  overflow: visible; /* позволяваме pop-up да излиза извън клетката */
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s;
  position: relative;
}

.gk64-card:hover {
  transform: translateY(-4px);
}

.gk64-card.inactive {
  opacity: 0.55;
}

/* === COLOR VARIANTS === */
.gk64-card.odd .gk64-top { background: #f9eec8; }
.gk64-card.odd .gk64-bottom { background: #f3ca48; }
.gk64-card.even .gk64-top { background: #f8e9dc; }
.gk64-card.even .gk64-bottom { background: #f8c6b8; }

/* === TOP SECTION === */
.gk64-top {
  position: relative;
  height: 55%;
  text-align: center;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
}

/* === DECORATIVE DIVIDER === */
.gk64-divider {
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(
    to right,
    rgba(0, 0, 0, 0.15),
    rgba(255, 255, 255, 0.4),
    rgba(0, 0, 0, 0.15)
  );
  z-index: 2;
  border-radius: 3px;
}

/* === HEADER === */
.gk64-card__header {
  text-align: center;
  padding: 14px 10px 0;
}

.gk64-card__name {
  font-size: 18px;
  margin: 0;
  line-height: 1.25;
  color: #4a3f26;
  display: block;
  white-space: normal;
  word-break: break-word;
  text-align: center;
  font-weight: 600;
  min-height: 2.8em; /* винаги две линии за име и фамилия */
}

/* === CENTER (Ключ + кръг) === */
.gk64-card__center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 12px;
  position: relative;
  height: 100px;
}

.gk64-card__subtitle {
  font-weight: 600;
  color: #5d4f27;
  margin-bottom: 8px;
  position: relative;
  z-index: 3;
}

/* === КРЪГЧЕ === */
.gk64-badge {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #2f2c25, #1c1a17 90%);
  border: 5px solid #f3e6bb;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.25);
  position: absolute;
  bottom: -50px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
}

.gk64-badge span {
  color: #f3ca48;
  font-size: 30px;
  font-weight: 600;
  font-family: 'Georgia', serif;
}

/* === BOTTOM SECTION === */
.gk64-bottom {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  padding-top: 45px;
}

.gk64-card__body {
  font-size: 14px;
  color: #3e3520;
  padding: 10px 16px 0;
  min-height: 130px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* === ИМЕЙЛ и ТЕЛЕФОН === */
.gk64-line {
  margin: 4px 0;
  text-align: center;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 0.9em;
}

/* === LINK === */
.gk64-link {
  color: #0b4f8a;
  text-decoration: underline;
  margin-top: 6px;
  display: block;
  text-align: center;
}

/* === FOOTER === */
.gk64-card__footer {
  padding: 10px;
  text-align: center;
}

/* === ГЛАВЕН СТИЛ ЗА БУТОНИ === */
.gk64-btn,
.gk64-btn-mini {
  background: linear-gradient(#e7de83, #a7972b);
  border: none;
  border-radius: 8px;
  font-weight: 600;
  padding: 8px 0;
  cursor: pointer;
  color: #222;
  width: 100%;
  text-align: center;
  transition: all 0.2s ease-in-out;
  display: block;
  box-sizing: border-box;
}

/* Форум линк като бутон */
a.gk64-btn-mini {
  text-decoration: none;
  display: block;
  color: #222;
}
a.gk64-btn-mini:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.gk64-btn:hover:not(:disabled),
.gk64-btn-mini:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.gk64-btn:disabled,
.gk64-btn-mini:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* === POPUP === */
.gk64-popup {
  position: absolute;
  background: #fffbe7;
  border: 1px solid #cbb760;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  color: #2c260d;
  box-shadow: 0 4px 10px rgba(0,0,0,0.25);
  z-index: 9999;
  transform: translate(-50%, 10px);
  left: 50%;
  top: 100%;
  white-space: nowrap;
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.gk64-popup.visible {
  display: block;
}

.gk64-popup button.copy {
  background: none;
  border: none;
  color: #0b4f8a;
  font-size: 12px;
  cursor: pointer;
  margin-left: 8px;
  text-decoration: underline;
}

/* Малка стрелка над popup-а */
.gk64-popup::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent #fffbe7 transparent;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
}


@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, 0); }
  to { opacity: 1; transform: translate(-50%, 10px); }
}

/* === FIX: Отстояние между картите === */
.gk64-card {
  margin-bottom: 20px; /* добавя въздух между редовете */
}

/* Ако някои карти все още се „залепват“ заради overflow, това ги раздалечава визуално */
.gk64-grid {
  row-gap: 30px; /* подсилва вертикалното разстояние */
}

/* === FIX: форум бутонът да се клика нормално === */
.gk64-line.forum {
  position: relative;
  z-index: 5;
  pointer-events: auto;
}

.gk64-line.forum a.gk64-btn-mini {
  position: relative;
  z-index: 10;
  pointer-events: auto !important;
  display: block;
  width: 100%;
  text-decoration: none;
  color: #222;
  text-align: center;
}

.gk64-line.forum a.gk64-btn-mini:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* === FIX: Форум бутонът да работи и да стои най-отгоре === */
.gk64-line.forum {
  position: relative;
  z-index: 50;
  pointer-events: auto !important;
}

.gk64-line.forum a.gk64-btn-mini {
  display: block;
  width: 100%;
  text-align: center;
  color: #222;
  text-decoration: none;
  background: linear-gradient(#e7de83, #a7972b);
  border-radius: 8px;
  font-weight: 600;
  padding: 8px 0;
  transition: all 0.2s ease-in-out;
  z-index: 100;
  position: relative;
}

.gk64-line.forum a.gk64-btn-mini:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* Да се уверим, че pop-up не блокира кликове под него */
.gk64-popup {
  pointer-events: none;
}

/* === Попъпи – стабилна финална версия === */

/* базов контейнер */
.gk64-line {
  position: relative;
  overflow: visible;
}

/* общ стил за popup */
.gk64-popup {
  position: absolute;
  background: #fffbe7;
  border: 1px solid #cbb760;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  color: #2c260d;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  z-index: 99999;
  white-space: nowrap;
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

/* показан popup */
.gk64-popup.visible {
  display: block;
}

/* === ИМЕЙЛ – излиза НАДОЛУ === */
.gk64-line.email .gk64-popup {
  top: 100%;
  bottom: auto;
  transform: translate(-50%, 8px);
  left: 50%;
}

.gk64-line.email .gk64-popup::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent #fffbe7 transparent;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
}

/* === ТЕЛЕФОН – излиза НАГОРЕ === */
.gk64-line.phone .gk64-popup {
  bottom: 100%;
  top: auto;
  transform: translate(-50%, -8px);
  left: 50%;
}

.gk64-line.phone .gk64-popup::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #fffbe7 transparent transparent transparent;
  filter: drop-shadow(0 -1px 1px rgba(0,0,0,0.15));
}

/* === Z-INDEX ЙЕРАРХИЯ – финален баланс === */

/* Имейл ред – най-горе в слоя */
.gk64-line.email {
  position: relative;
  z-index: 30;
  overflow: visible;
}
.gk64-line.email .gk64-popup {
  top: 100%;
  transform: translate(-50%, 8px);
  left: 50%;
  z-index: 10000;
}

/* Телефон ред – под имейл, над форум */
.gk64-line.phone {
  position: relative;
  z-index: 20;
  overflow: visible;
}
.gk64-line.phone .gk64-popup {
  bottom: 100%;
  transform: translate(-50%, -8px);
  left: 50%;
  z-index: 10000;
}

/* Форум ред – най-долу */
.gk64-line.forum {
  position: relative;
  z-index: 10;
  overflow: visible;
}

/* Визуални стрелки */
.gk64-line.email .gk64-popup::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent #fffbe7 transparent;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
}

.gk64-line.phone .gk64-popup::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #fffbe7 transparent transparent transparent;
  filter: drop-shadow(0 -1px 1px rgba(0,0,0,0.15));
}

/* === ПОПРАВКА: Телефон попъп винаги видим над бутон форум === */

/* Родителят не трябва да реже popup-а */
.gk64-card__body,
.gk64-line.phone {
  overflow: visible !important;
}

/* Телефонът да стои по-високо от форума */
.gk64-line.phone {
  position: relative;
  z-index: 60;
}

/* Попъпът да се показва над бутона (нагоре) */
.gk64-line.phone .gk64-popup {
  top: auto;
  bottom: 100%;
  transform: translate(-50%, -10px);
  left: 50%;
  z-index: 10000;
}

/* Стрелка под попъпа (посочва бутона) */
.gk64-line.phone .gk64-popup::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #fffbe7 transparent transparent transparent;
  filter: drop-shadow(0 -1px 1px rgba(0,0,0,0.15));
}

/* === ПОПРАВКА: стабилно показване на попъпите === */

/* Всеки ред може да показва pop-up извън себе си */
.gk64-line {
  position: relative;
  overflow: visible !important;
  z-index: 10;
}

/* Имейл попъп — винаги под бутона */
.gk64-line.email .gk64-popup {
  top: 100%;
  bottom: auto;
  transform: translate(-50%, 10px);
  z-index: 9999;
}

/* Телефон попъп — винаги над бутона */
.gk64-line.phone .gk64-popup {
  bottom: 100%;
  top: auto;
  transform: translate(-50%, -10px);
  z-index: 10000;
}

/* Поправка за стрелките на двата попъпа */
.gk64-line.email .gk64-popup::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent #fffbe7 transparent;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
}

.gk64-line.phone .gk64-popup::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #fffbe7 transparent transparent transparent;
  filter: drop-shadow(0 -1px 1px rgba(0,0,0,0.15));
}

/* === FIX: Височина и позициониране на картите и разделителя === */

/* по-висока карта, за да побере всичко и да се върнат 5 в ред */
.gk64-card {
  height: 460px; /* увеличена от 430px */
}

/* линията да не минава през кръгчето */
.gk64-divider {
  bottom: -1px; /* беше -3px */
  z-index: 1; /* по-нисък слой от кръгчето */
}

/* кръгчето да стои над линията чисто */
.gk64-badge {
  z-index: 3; /* гарантира, че стои отгоре */
}

/* === FIX: отделни блокове за имейл / телефон / форум === */
.gk64-block {
  position: relative;
  overflow: visible;
  margin: 4px 0;
  z-index: 1;
}

/* отделни контексти (изолират попъпите един от друг) */
.gk64-block-email { isolation: isolate; z-index: 100; }
.gk64-block-phone { isolation: isolate; z-index: 90; }
.gk64-block-forum { isolation: isolate; z-index: 80; }

/* попъп под имейл бутона */
.gk64-line.email .gk64-popup {
  top: 100%;
  bottom: auto;
  transform: translate(-50%, 10px);
  z-index: 9999;
}

/* попъп над телефон бутона */
.gk64-line.phone .gk64-popup {
  bottom: 100%;
  top: auto;
  transform: translate(-50%, -10px);
  z-index: 9999;
}

/* === FINISH FIX: бутоните и попъпите === */

/* бутоните – еднакви размери като "Материали" */
.gk64-btn-mini {
  width: 90%;               /* по-малки от 100% */
  margin: 0 auto;           /* центрирани */
  display: block;
  box-sizing: border-box;
}

/* всички блокове да позволяват pop-up извън себе си */
.gk64-block {
  position: relative;
  overflow: visible !important;
  margin: 5px 0;
  text-align: center;
}

/* имейл и телефон да имат попъп надолу */
.gk64-line.email .gk64-popup,
.gk64-line.phone .gk64-popup {
  top: 100%;
  bottom: auto;
  transform: translate(-50%, 10px);
  left: 50%;
  z-index: 9999;
}

/* стрелка под pop-up-а */
.gk64-line.email .gk64-popup::before,
.gk64-line.phone .gk64-popup::before {
  content: '';
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: transparent transparent #fffbe7 transparent;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
}

/* === FINAL FIX: форум бутон еднакъв с останалите === */
.gk64-line.forum a.gk64-btn-mini.gk64-btn-forum {
  width: 90% !important;       /* пренебрегва старите правила */
  margin: 0 auto !important;
  display: block;
  text-align: center;
  box-sizing: border-box;
}

/* === FIX: Активен бутон Материали === */
.gk64-card__footer .gk64-btn {
  opacity: 1 !important;
  pointer-events: auto !important;
  cursor: pointer !important;
  filter: none !important;
}

.gk64-card__footer .gk64-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* === Материали бутони – визуален достъп === */
.gk64-btn-materials.locked {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(70%);
  cursor: not-allowed;
  transition: all 0.2s ease-in-out;
}

.gk64-btn-materials.locked:hover {
  filter: grayscale(70%) brightness(0.9);
}

.gk64-btn-materials.active {
  opacity: 1;
  filter: none;
  cursor: pointer;
}

/* === Финален приоритет за достъп до бутона Материали === */
.gk64-btn-materials {
  position: relative;
  transition: all 0.25s ease-in-out;
}

.gk64-btn-materials.locked {
  opacity: 0.45 !important;
  pointer-events: none !important;
  filter: grayscale(90%) brightness(1.1) !important;
  cursor: not-allowed !important;
}

.gk64-btn-materials.active {
  opacity: 1 !important;
  pointer-events: auto !important;
  filter: none !important;
  cursor: pointer !important;
}

/* === POPUP ФУНКЦИОНАЛНОСТ – Вариант A (замръзване + X бутон) === */

/* Активен попъп — долната част се замразява */
.gk64-card.is-popup-open .gk64-bottom {
  pointer-events: none; /* не може да се клика под попъпа */
  filter: brightness(0.97); /* лек визуален ефект на замръзване */
}

/* Попъпът и съдържанието му остават активни */
.gk64-card.is-popup-open .gk64-popup {
  pointer-events: auto;
}

/* Вътрешен контейнер за по-добро подравняване */
.gk64-popup-inner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* X бутон за затваряне */
.gk64-popup button.close {
  background: none;
  border: none;
  font-size: 14px;
  color: #8b6b1f;
  font-weight: bold;
  cursor: pointer;
  margin-left: 6px;
  padding: 2px 4px;
  line-height: 1;
  transition: color 0.2s ease-in-out;
}

.gk64-popup button.close:hover {
  color: #000;
}

/* При показване pop-up-ът да стои най-отгоре */
.gk64-popup.visible {
  display: block;
  z-index: 100000;
}

/* Поправка: pop-up да може да се клика */
.gk64-popup {
  pointer-events: auto !important;
}

/* === НАВИГАЦИЯ ПО 64-ТЕ ГЕН КЛЮЧА (изравнена с ширината на картите) === */
.gk64-nav {
  position: sticky;
  top: 10px;
  z-index: 200;
  background: rgba(255, 250, 230, 0.96);
  backdrop-filter: blur(4px);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); /* повече бутони в реда */
  gap: 8px;
  max-width: 1200px; /* точно колкото решетката */
  margin: 20px auto 30px;
  padding: 10px 12px;
  border-radius: 12px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

/* бутоните */
.gk64-nav-btn {
  background: linear-gradient(#e7de83, #a7972b);
  border: none;
  border-radius: 8px;
  color: #2b230f;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  padding: 6px 0;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.gk64-nav-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.gk64-nav-btn:active {
  transform: translateY(0);
  filter: brightness(0.95);
}

/* активен бутон */
.gk64-nav-btn.active {
  background: linear-gradient(#f3ca48, #b99722);
  box-shadow: 0 0 0 2px #fff6cc, 0 0 10px rgba(243, 202, 72, 0.6);
}

/* === РЕСПОНСИВ === */
@media (max-width: 1280px) {
  .gk64-nav {
    max-width: 1000px;
    grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  }
}

@media (max-width: 1024px) {
  .gk64-nav {
    max-width: 760px;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  }
}

@media (max-width: 768px) {
  .gk64-nav {
    max-width: 90%;
    grid-template-columns: repeat(8, 1fr); /* 8 бутона на ред */
    gap: 6px;
    padding: 8px;
  }
  .gk64-nav-btn {
    font-size: 13px;
    padding: 5px 0;
  }
}

/* === ГЛАВНО ЗАГЛАВИЕ НА СТРАНИЦАТА === */
.gk64-title {
  text-align: center;
  font-size: clamp(36px, 4vw, 58px);
  font-family: 'Playfair Display', 'Georgia', serif;
  font-weight: 700;
  letter-spacing: 2px;
  color: #7a6520;
  text-transform: uppercase;
  margin-top: 40px;
  margin-bottom: 25px;
  background: linear-gradient(90deg, #bda03a 0%, #e7d486 50%, #bda03a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.15);
  animation: glowTitle 5s ease-in-out infinite alternate;
}

/* Лек златист блясък (анимация) */
@keyframes glowTitle {
  from { filter: drop-shadow(0 0 3px rgba(255,255,200,0.6)); }
  to { filter: drop-shadow(0 0 10px rgba(255,255,180,0.9)); }
}

/* === FIX: Dropdown менютата да са над 1–64, без да сваляме бутоните === */

/* не пипаме .gk64-topnav изобщо */
.gk64-topnav { /* остави празно или изтрий селектора ако е добавен */
}

/* бутоните 1–64 да стоят над съдържанието */
.gk64-nav {
  position: sticky;
  top: 10px;           /* колкото ти трябва под хедъра */
  z-index: 3000;       /* по-високо от картите */
}

/* картите да не „притискат“ навигацията */
.gk64-grid { 
  position: relative; 
  z-index: 1; 
}

/* dropdown/submenu все пак най-отгоре */
header,
.site-header,
.main-navigation,
.elementor-nav-menu--dropdown,
ul.sub-menu {
  position: relative;
  z-index: 9999 !important;
}

/* === FINAL FIX: всички 64 бутона напълно видими при скрол === */
.gk64-nav {
  position: sticky;
  top: 140px; /* увеличено за да се покаже и първият ред */
  z-index: 3000;
  background: rgba(255, 250, 230, 0.98);
  overflow: visible !important;
  padding-top: 12px;
  padding-bottom: 12px;
}

/* Родителите не трябва да режат sticky блока */
.gk64-grid,
.gk64-section,
.elementor-section,
.site-content,
body,
html {
  overflow: visible !important;
}


/* === RESPONSIVE === */
@media (max-width: 1280px) { .gk64-grid { max-width: 1000px; } }
@media (max-width: 1024px) { .gk64-grid { max-width: 760px; } }
@media (max-width: 800px)  { .gk64-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); } }
