/* ==========================================================================
   НА ФОКУС — featured сървъри (панелът следва картата, връзки, модал)
   Слоеве: .featured-links (2) < .viewport (3) < .featured-dock (11) — над тъмния
   градиент на .top (10), който иначе притъмнява короната; няма застъпване с .search/.tl/.bl.
   ========================================================================== */

/* ---------- Връзки BG HUB → featured карти ---------- */
.featured-links {
  position: fixed;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.fl { transition: opacity 280ms var(--ease); }
.fl.is-off { opacity: 0.12; }
.fl.active { opacity: 1; }
.fl-path {
  fill: none;
  stroke: url(#fl-grad);
  stroke-width: 1.4;
  stroke-linecap: round;
}
.fl-node {
  fill: #fbbf24;
  stroke: rgba(8, 12, 24, 0.9);
  stroke-width: 1.5;
}
.fl.active .fl-path {
  stroke: color-mix(in srgb, var(--accent, #fbbf24) 62%, #fcd34d);
  stroke-width: 2;
  stroke-dasharray: 8 6;
  animation: flow 1.6s linear infinite;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent, #fbbf24) 70%, transparent));
}
.fl.active .fl-node { fill: #fef3c7; filter: drop-shadow(0 0 5px #f59e0b); }

/* ---------- Док ---------- */
.featured-dock {
  --fd-w: clamp(276px, 23vw, 336px);
  --fd-overlap: calc(var(--fd-w) * 0.165); /* колко от банера влиза в рамката */
  position: fixed;
  left: 52px;  /* spawn: FEATURED_DOCK_SPAWN в public/js/featured.js */
  top: 118px;
  z-index: 11;
  width: var(--fd-w);
  max-height: calc(100vh - 168px);
  display: flex;
  flex-direction: column;
  transform-origin: 0 0;
}
.featured-dock.is-dragging { user-select: none; cursor: grabbing; }
.fd-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Банер „НА ФОКУС“ — пресича горния ръб като герб */
.fd-title {
  position: relative;
  z-index: 2;
  flex: none;
  margin: 0 12px calc(var(--fd-overlap) * -1);
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.65));
}
.featured-dock.is-dragging .fd-title { cursor: grabbing; }
.fd-title-art {
  position: relative;
  display: block;
  overflow: hidden;
  -webkit-mask: url(/images/featured_title.webp) center / 100% 100% no-repeat;
  mask: url(/images/featured_title.webp) center / 100% 100% no-repeat;
}
.fd-title img { width: 100%; height: auto; }
/* рядък метален отблясък само върху златото на банера */
.fd-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 36%, rgba(255, 251, 235, 0.8) 50%, transparent 64%);
  mix-blend-mode: overlay;
  transform: translateX(-110%);
  animation: fd-shine 8s ease-in-out 1.8s infinite;
}
@keyframes fd-shine {
  0% { transform: translateX(-110%); }
  20%, 100% { transform: translateX(110%); }
}

/* Стъклен панел с двойна метална рамка */
.fd-panel {
  position: relative;
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--fd-overlap) + 6px) 10px 10px;
  border-radius: 14px;
  background:
    radial-gradient(120% 50% at 50% 0%, rgba(245, 158, 11, 0.11), transparent 62%),
    linear-gradient(180deg, rgba(14, 19, 36, 0.94), rgba(8, 12, 24, 0.97));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.65),
    0 0 32px rgba(245, 158, 11, 0.14),
    inset 0 1px 0 rgba(254, 240, 138, 0.1);
}
.fd-panel::before { /* външен 1.5px метален градиент */
  content: '';
  position: absolute;
  inset: 0;
  padding: 1.5px;
  border-radius: inherit;
  background: linear-gradient(160deg, #fef08a, #f59e0b 26%, #b45309 50%, #fde68a 72%, #d97706);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}
.fd-panel::after { /* вътрешен фин кант */
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: 10px;
  pointer-events: none;
}

.fd-corner {
  position: absolute;
  z-index: 1;
  width: 30px;
  height: 30px;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.35));
}
.fd-corner.c-tl { left: -3px; top: -3px; }
.fd-corner.c-tr { right: -3px; top: -3px; transform: scaleX(-1); }
.fd-corner.c-bl { left: -3px; bottom: -3px; transform: scaleY(-1); }
.fd-corner.c-br { right: -3px; bottom: -3px; transform: scale(-1); }

/* златна разделителна линия с диамант под банера */
.fd-rule {
  position: relative;
  flex: none;
  height: 9px;
  margin: 0 18px 10px;
}
.fd-rule::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 4px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.55) 28%, #fde68a 50%, rgba(251, 191, 36, 0.55) 72%, transparent);
}
.fd-rule span {
  position: absolute;
  left: 50%;
  top: 1px;
  width: 7px;
  height: 7px;
  transform: translateX(-50%) rotate(45deg);
  background: linear-gradient(135deg, #fef9c3, #f59e0b 55%, #b45309);
  box-shadow: 0 0 0 2px rgba(10, 14, 28, 0.95), 0 0 10px rgba(245, 158, 11, 0.7);
}

/* ---------- Списък ---------- */
.featured-list {
  position: relative; /* offsetParent на картите (кеширани anchor-и за линиите) */
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 -2px;
  padding: 4px 4px 6px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(245, 158, 11, 0.35) transparent;
}
.featured-list::-webkit-scrollbar { width: 5px; }
.featured-list::-webkit-scrollbar-track { background: transparent; }
.featured-list::-webkit-scrollbar-thumb { background: rgba(245, 158, 11, 0.35); border-radius: 999px; }
.featured-list::-webkit-scrollbar-thumb:hover { background: rgba(245, 158, 11, 0.6); }
.featured-list.fade-top { -webkit-mask-image: linear-gradient(transparent, #000 22px); mask-image: linear-gradient(transparent, #000 22px); }
.featured-list.fade-bottom { -webkit-mask-image: linear-gradient(#000 calc(100% - 26px), transparent); mask-image: linear-gradient(#000 calc(100% - 26px), transparent); }
.featured-list.fade-top.fade-bottom {
  -webkit-mask-image: linear-gradient(transparent, #000 22px, #000 calc(100% - 26px), transparent);
  mask-image: linear-gradient(transparent, #000 22px, #000 calc(100% - 26px), transparent);
}

/* ---------- Featured карта ---------- */
.featured-card {
  --accent: var(--gold);
  --badge-color: color-mix(in srgb, var(--accent) 78%, #000);
  --bar-fill: var(--accent);
  --bar-empty: rgba(148, 163, 184, 0.14);
  --card-tick-size: 21px;
  --card-medal-size: 24px;
  position: relative;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(24, 32, 56, 0.9), rgba(12, 17, 32, 0.95));
  border: 1px solid color-mix(in srgb, var(--accent) 28%, rgba(148, 163, 184, 0.16));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: border-color var(--t), box-shadow var(--t), transform var(--t) var(--ease);
}
.featured-card::before { /* фин акцентен кант горе */
  content: '';
  position: absolute;
  left: 16px;
  right: 16px;
  top: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 80%, #fff), transparent);
  pointer-events: none;
}
.featured-card:hover,
.featured-card:focus-within {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 80%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent), 0 14px 32px color-mix(in srgb, var(--accent) 24%, transparent);
}
.featured-card.glow {
  border-color: color-mix(in srgb, var(--accent) 80%, transparent);
  animation: card-glow 2.8s ease-in-out infinite;
}
.featured-card:has(.card-open:focus-visible) { outline: 2px solid var(--blue-2); outline-offset: 1px; }
.featured-card.is-spot { animation: fc-spot 1.6s var(--ease); }
@keyframes fc-spot {
  0% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0); }
  18% { box-shadow: 0 0 0 2px #fbbf24, 0 0 30px rgba(251, 191, 36, 0.55); }
  100% { box-shadow: 0 0 0 1px rgba(251, 191, 36, 0), 0 0 0 rgba(251, 191, 36, 0); }
}

.fc-banner {
  height: 62px;
  overflow: hidden;
  border-radius: 11px 11px 0 0;
  background: color-mix(in srgb, var(--accent) 22%, var(--panel-2));
}
.fc-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-mask-image: linear-gradient(#000 45%, transparent);
  mask-image: linear-gradient(#000 45%, transparent);
}

.fc-body { padding: 12px; }
.has-banner .fc-body { padding-top: 0; }

.fc-head { display: flex; align-items: center; gap: 11px; }
.has-banner .fc-head {
  position: relative;
  z-index: 1;
  align-items: center;
  margin-top: -22px;
}
.featured-card .s-icon { width: 42px; height: 42px; border-radius: 10px; font-size: 19px; }
.has-banner .s-icon { border: 2px solid #111a30; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5); }
.fc-titles { min-width: 0; flex: 1; }
.has-banner .fc-titles {
  position: relative;
  z-index: 1;
  padding: 7px 9px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 9px;
  background: linear-gradient(105deg, rgba(5, 9, 20, 0.98), rgba(7, 12, 25, 0.92));
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.fc-name {
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 15.5px;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.7);
}
.has-banner .fc-name {
  font-size: 16px;
  text-shadow: 0 2px 7px rgba(0, 0, 0, 0.95);
}
.fc-name .card-open { font-weight: 400; }
.has-banner .fc-name .card-open {
  white-space: normal;
  overflow-wrap: anywhere;
  text-overflow: clip;
  line-height: 1.2;
}
.has-banner .fc-head .status { margin-top: 5px; }

.fc-descr,
.owner-quote p,
.m-featured-lead { white-space: pre-line; overflow-wrap: anywhere; }
.fc-descr {
  margin-top: 10px;
  font-family: var(--font-body);
  font-size: 12.5px;
  line-height: 1.45;
  color: #cbd5e1;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}

.fc-bars { display: flex; flex-direction: column; gap: 5px; margin-top: 10px; }

/* ---------- Цитат от собственика (карта + модал) ---------- */
.owner-quote {
  position: relative;
  margin-top: 10px;
  padding: 9px 12px 9px 13px;
  border-left: 2.5px solid #fbbf24;
  border-radius: 0 9px 9px 0;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.09), rgba(245, 158, 11, 0.03));
}
.owner-quote::before {
  content: '\201C';
  position: absolute;
  right: 8px;
  top: -4px;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 40px;
  line-height: 1;
  color: rgba(251, 191, 36, 0.26);
  pointer-events: none;
}
.owner-quote p {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 12.5px;
  line-height: 1.5;
  color: #e2e8f0;
}
.featured-card .owner-quote p {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
  overflow: hidden;
}
.owner-quote figcaption { display: flex; align-items: center; gap: 7px; margin-top: 7px; min-width: 0; }
.oq-avatar {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 1px solid rgba(251, 191, 36, 0.32);
  background: rgba(7, 11, 22, 0.6);
  image-rendering: pixelated;
  object-fit: cover;
}
.oq-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  color: #fcd34d;
}
.oq-role {
  flex: none;
  margin-left: auto;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(251, 191, 36, 0.55);
}

/* действия — Vote с топъл златен тон */
.featured-card .btn-vote {
  border-color: rgba(251, 191, 36, 0.38);
  background: linear-gradient(180deg, rgba(251, 191, 36, 0.14), rgba(245, 158, 11, 0.05));
  color: #fef3c7;
}
.featured-card .btn-vote svg { color: #fbbf24; }
.featured-card .btn-vote:hover { border-color: #fbbf24; background: rgba(251, 191, 36, 0.2); }

/* ---------- Езичета под картата (нормален поток — без застъпване) ---------- */
.featured-labels {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 5px;
}
.featured-labels .card-label { padding: 3px 8px; font-size: 10.5px; }
.featured-labels .card-label svg { width: 12px; height: 12px; }
.featured-labels.is-dense { gap: 3px; }
.featured-labels.is-dense .card-label { padding: 2px 6px; font-size: 9.5px; }
.featured-labels.is-dense .card-label svg { width: 11px; height: 11px; }

/* ---------- Вход (само при първо показване; transform/opacity → 60fps) ---------- */
.featured-dock.is-entering .fd-panel { animation: fd-panel-in 560ms var(--ease) var(--e-dock-delay, 0ms) both; }
.featured-dock.is-entering .fd-title { animation: fd-title-in 720ms var(--ease) calc(var(--e-dock-delay, 0ms) + 80ms) both; }
.featured-dock.is-entering .featured-item { animation: fd-item-in 520ms var(--ease) both; animation-delay: calc(var(--e-dock-delay, 0ms) + 200ms + var(--i, 0) * 70ms); }
@keyframes fd-panel-in { from { opacity: 0; transform: translateX(-14px); } }
@keyframes fd-title-in { from { opacity: 0; transform: translateY(-8px) scale(0.96); } }
@keyframes fd-item-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Модал ---------- */
.m-featured-badge {
  display: block;
  width: auto;
  height: 72px;
  margin: 0 auto;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 14px rgba(245, 158, 11, 0.22));
}
.modal.is-featured[open] .m-featured-badge { animation: m-badge-in 620ms var(--ease) 120ms both; }
@keyframes m-badge-in { from { opacity: 0; transform: translateY(6px) scale(0.9) rotate(-2deg); } }

.modal.is-featured:not(.glow) .m-shell {
  border-color: rgba(251, 191, 36, 0.4);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.14), 0 0 40px rgba(245, 158, 11, 0.12), var(--shadow);
}

.m-featured-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fbbf24;
}
.m-featured-eyebrow::before {
  content: '';
  width: 7px;
  height: 7px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, #fef9c3, #f59e0b 55%, #b45309);
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.6);
}
.m-featured-lead {
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.6;
  color: #e8edf5;
}

.owner-quote.is-lg { margin-top: 0; padding: 14px 18px 13px; border-left-width: 3px; }
.owner-quote.is-lg::before { right: 12px; top: -6px; font-size: 58px; }
.owner-quote.is-lg p { font-size: 15px; line-height: 1.6; }
.owner-quote.is-lg figcaption { gap: 9px; margin-top: 10px; }
.owner-quote.is-lg .oq-avatar { width: 30px; height: 30px; border-radius: 7px; }
.owner-quote.is-lg .oq-name { font-size: 13.5px; }
.owner-quote.is-lg .oq-role { font-size: 10.5px; }
