/* Публичен хедър: синя горна част + бяла лента с менюто.
   Размерите са взети от supercomputing.lu (MaterialX): 1rem = 20px там. */

:root {
  --sh-bg: #022658;
  --sh-fg: #ffffff;
  --sh-muted: #b4b7bd;
  --st-bg: transparent;
  --st-fg: rgba(0, 0, 0, 0.87);
  --st-line: rgba(0, 0, 0, 0.07);
  --st-active: rgba(0, 0, 0, 0.87);
}
html[data-theme="dark"] {
  --st-bg: #1e2029;
  --st-fg: rgba(224, 225, 232, 0.82);
  --st-line: rgba(224, 225, 232, 0.12);
  --st-active: rgba(224, 225, 232, 0.82);
}

/* ---------- синя част ---------- */
.sh { position: sticky; top: 0; z-index: 50; display: block; background: var(--sh-bg); color: var(--sh-fg);
  font-family: Roboto, -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif; }
.sh-inner { display: flex; align-items: center; max-width: 1600px; margin: 0 auto; padding: 0 8px; }

.sh-btn { display: inline-flex; align-items: center; gap: 6px; margin: 4px; padding: 8px; border: 0; background: none;
  color: inherit; font: inherit; line-height: 1; text-decoration: none; cursor: pointer; transition: opacity 0.25s; }
.sh-btn:hover { opacity: 0.7; }
.sh-btn svg { display: block; width: 24px; height: 24px; fill: currentColor; }
.sh-btn:focus-visible, .sh-logo:focus-visible { outline: 2px solid #ffffff; outline-offset: 2px; }
.sh-lang span { font-size: 14px; font-weight: 700; letter-spacing: 0.02em; }
.sh-burger { display: none; }

/* логото: ромб + ICT | Center of Excellence */
.sh-logo { display: flex; align-items: center; box-sizing: content-box; height: 50px; margin: 4px; padding: 8px;
  color: inherit; text-decoration: none; }
.sh-mark { display: block; width: auto; height: 46px; }
.sh-ict { margin-left: 8px; font-size: 38px; font-weight: 700; line-height: 1; letter-spacing: 0.02em; }
.sh-bar { width: 2px; height: 46px; margin: 0 12px 0 14px; background: var(--sh-muted); }
.sh-coe { display: flex; flex-direction: column; color: var(--sh-muted); text-transform: uppercase;
  font-family: "Barlow Condensed", "Arial Narrow", Roboto, sans-serif; font-size: 17px; font-weight: 500;
  line-height: 15px; letter-spacing: 0.03em; }

/* българският надпис: Barlow Condensed няма кирилица, затова Roboto Condensed */
html[lang="bg"] .sh-coe { font-family: "Roboto Condensed", "Arial Narrow", Roboto, sans-serif; font-size: 16px;
  font-weight: 400; letter-spacing: 0.05em; }

/* надписът */
.sh-title { flex: 1 1 auto; min-width: 0; height: 48px; margin: 0 8px; font-size: 18px; line-height: 48px; letter-spacing: -0.025em; }
.sh-ellipsis { position: relative; width: 100%; height: 100%; overflow: hidden; text-overflow: ellipsis; }
.sh-topic { position: absolute; display: flex; max-width: 100%; white-space: nowrap;
  transition: transform 0.4s cubic-bezier(0.1, 0.7, 0.1, 1), opacity 0.15s; }
.sh-topic:first-child { font-weight: 700; }
.sh-topic + .sh-topic { opacity: 0; pointer-events: none; transform: translateX(25px); z-index: -1;
  transition: transform 0.4s cubic-bezier(1, 0.7, 0.1, 0.1), opacity 0.15s; }
.sh-title--active .sh-topic { opacity: 0; pointer-events: none; transform: translateX(-25px); z-index: -1;
  transition: transform 0.4s cubic-bezier(1, 0.7, 0.1, 0.1), opacity 0.15s; }
.sh-title--active .sh-topic + .sh-topic { opacity: 1; pointer-events: auto; transform: translateX(0); z-index: 0;
  transition: transform 0.4s cubic-bezier(0.1, 0.7, 0.1, 1), opacity 0.15s; }

/* икона на темата: луна в светъл режим, слънце в тъмен */
.sh-btn .ico-sun { display: none; }
html[data-theme="dark"] .sh-btn .ico-sun { display: block; }
html[data-theme="dark"] .sh-btn .ico-moon { display: none; }

/* ---------- бяла лента с менюто ---------- */
/* overflow е „visible“, за да могат падащите менюта да излизат под лентата */
.st { position: relative; z-index: 40; display: block; width: 100%; background: var(--st-bg); color: var(--st-fg);
  line-height: 1.3; box-shadow: 0 -1px 0 inset var(--st-line);
  font-family: Roboto, -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif; }
.st-grid { max-width: 1600px; margin: 0 auto; }
.st-list { display: flex; margin: 0 0 0 8px; padding: 0; list-style: none; white-space: nowrap; }
.st-item { position: relative; box-sizing: border-box; height: 48px; padding: 0 12px; }
.st-item--active { border-bottom: 1px solid var(--st-active); font-weight: 700; }
.st-link { display: flex; align-items: center; gap: 4px; margin-top: 16px; color: inherit; font-size: 14px;
  text-decoration: none; opacity: 0.7; transition: opacity 0.25s; }
.st-item--active > .st-link, .st-link:hover, .st-link:focus, .st-item:hover > .st-link,
.st-item:focus-within > .st-link { opacity: 1; }
.st-link:focus-visible, .st-sub-link:focus-visible { outline: 2px solid #0099ff; outline-offset: 3px; }
/* стрелка при елементи с подменю */
.st-item.has-sub > .st-link::after { content: ""; width: 5px; height: 5px; margin: -2px 0 0 2px; border: solid currentColor;
  border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); opacity: 0.8; }

/* ---------- падащи менюта ---------- */
:root {
  --sub-bg: #ffffff;
  --sub-fg: rgba(0, 0, 0, 0.82);
  --sub-line: rgba(2, 38, 88, 0.12);
  --sub-hover: rgba(0, 153, 255, 0.09);
  --sub-shadow: 0 14px 32px rgba(2, 38, 88, 0.2);
}
html[data-theme="dark"] {
  --sub-bg: #262a36;
  --sub-fg: rgba(224, 225, 232, 0.88);
  --sub-line: rgba(224, 225, 232, 0.14);
  --sub-hover: rgba(0, 153, 255, 0.16);
  --sub-shadow: 0 14px 32px rgba(0, 0, 0, 0.55);
}
.st-sub { position: absolute; top: 100%; left: 0; z-index: 5; width: max-content; min-width: 15rem; max-width: 23rem;
  margin: 0; padding: 6px 0; list-style: none; white-space: normal; font-weight: 400; color: var(--sub-fg);
  background: var(--sub-bg); border: 1px solid var(--sub-line); border-top: 2px solid #0099ff;
  box-shadow: var(--sub-shadow); opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s; }
.st-item:hover > .st-sub, .st-item:focus-within > .st-sub, .st-item.open > .st-sub,
.st-sub-item:hover > .st-sub, .st-sub-item:focus-within > .st-sub, .st-sub-item.open > .st-sub {
  opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.st-sub-item { position: relative; }
.st-sub-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 16px;
  color: inherit; font-size: 14px; line-height: 1.35; text-decoration: none; transition: background 0.15s, color 0.15s; }
.st-sub-link:hover, .st-sub-link:focus, .st-sub-item:hover > .st-sub-link, .st-sub-item:focus-within > .st-sub-link {
  background: var(--sub-hover); }
.st-sub-item.is-active > .st-sub-link { font-weight: 700; box-shadow: inset 3px 0 0 #0099ff; }
.st-sub-item.has-sub > .st-sub-link::after { content: ""; flex: none; width: 5px; height: 5px; border: solid currentColor;
  border-width: 1.5px 1.5px 0 0; transform: rotate(45deg); opacity: 0.6; }
/* вложеното меню излиза встрани, подравнено с реда си */
.st-sub .st-sub { top: -8px; left: 100%; margin-left: -1px; transform: translateX(-6px); }
.st-sub-item:hover > .st-sub, .st-sub-item:focus-within > .st-sub, .st-sub-item.open > .st-sub { transform: none; }
/* на по-тесни екрани вложеното меню на последните елементи излиза наляво, за да не излиза извън екрана */
@media (max-width: 1499px) {
  .st-item:nth-last-child(-n+3) .st-sub .st-sub { left: auto; right: 100%; margin: 0 -1px 0 0; transform: translateX(6px); }
  .st-item:nth-last-child(-n+3) .st-sub .st-sub-item.has-sub > .st-sub-link::after { transform: rotate(-135deg); }
  .st-item:nth-last-child(-n+3) .st-sub .st-sub-item:hover > .st-sub,
  .st-item:nth-last-child(-n+3) .st-sub .st-sub-item:focus-within > .st-sub,
  .st-item:nth-last-child(-n+3) .st-sub .st-sub-item.open > .st-sub { transform: none; }
}

/* ---------- мобилно меню ---------- */
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer[hidden] { display: none; }
.drawer-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.54); }
.drawer-panel { position: absolute; top: 0; bottom: 0; left: 0; width: min(18rem, 85vw); overflow-y: auto; background: #ffffff;
  color: #1a1a1a; box-shadow: 0 0 24px rgba(0, 0, 0, 0.35);
  font-family: Roboto, -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif; }
html[data-theme="dark"] .drawer-panel { background: #1e2029; color: rgba(224, 225, 232, 0.9); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--sh-bg);
  color: #ffffff; font-size: 16px; font-weight: 700; }
.drawer-close { border: 0; background: none; color: inherit; font-size: 22px; line-height: 1; cursor: pointer; }
.drawer-panel a { display: block; padding: 14px 16px; border-bottom: 1px solid rgba(128, 128, 128, 0.2); color: inherit;
  font-size: 15px; text-decoration: none; }
.drawer-panel a.active { font-weight: 700; box-shadow: inset 3px 0 0 #0099ff; }
/* подменюта в мобилното меню: разгъват се с бутона отдясно */
.dr-row { display: flex; align-items: stretch; border-bottom: 1px solid rgba(128, 128, 128, 0.2); }
.drawer-panel .dr-row > a { flex: 1 1 auto; border-bottom: 0; }
.dr-toggle { position: relative; flex: none; width: 52px; border: 0; border-left: 1px solid rgba(128, 128, 128, 0.2);
  background: none; color: inherit; cursor: pointer; }
.dr-toggle::after { content: ""; position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; border: solid currentColor;
  border-width: 0 2px 2px 0; transform: translate(-50%, -70%) rotate(45deg); transition: transform 0.2s; }
.dr-toggle[aria-expanded="true"]::after { transform: translate(-50%, -30%) rotate(-135deg); }
.dr-toggle:focus-visible { outline: 2px solid #0099ff; outline-offset: -2px; }
.dr-sub { background: rgba(128, 128, 128, 0.08); }
.dr-sub[hidden] { display: none; }
.drawer-panel .dr-d2 > a, .drawer-panel .dr-d2 > .dr-row > a { padding-left: 28px; font-size: 14px; }
.drawer-panel .dr-d3 > a, .drawer-panel .dr-d3 > .dr-row > a { padding-left: 40px; font-size: 13.5px; }

/* ---------- тесни екрани (под 1220px менюто става „хамбургер“) ---------- */
@media (max-width: 1219px) {
  .st { display: none; }
  .sh-burger { display: inline-flex; }
}
@media (max-width: 760px) {
  .sh-title { display: none; }
  .sh-spacer { flex: 1 1 auto; }
}
@media (max-width: 560px) {
  .sh-bar, .sh-coe { display: none; }
  .sh-logo { padding: 8px 4px; }
}
@media (min-width: 761px) { .sh-spacer { display: none; } }
