/* ==========================================================================
   NKB DESIGN SYSTEM · v1.0
   Monumental without being loud. Premium without being luxury.
   --------------------------------------------------------------------------
   01 Tokens   02 Base   03 Type   04 Layout   05 Motifs (ECG / heart)
   06 Buttons  07 Forms & Search   08 Header / MegaMenu / SearchOverlay
   09 Components   10 Footer   11 Motion   12 Review tools (wireframe)
   ========================================================================== */

/* 01 · TOKENS ------------------------------------------------------------ */
:root {
  /* Brand */
  --red: #E30613;            /* НКБ - само сигнал: пулс, спешност, фокус */
  --red-ink: #C2050F;        /* червено за текст (AA върху бяло) */
  --red-tint: #FDECEC;

  /* Neutrals - топла хартия + дълбок navy */
  --paper: #F6F5F1;
  --paper-2: #EFEEE8;
  --white: #FFFFFF;
  --ink: #0B1626;
  --ink-2: #263244;
  --muted: #5B6676;
  --faint: #8A929E;
  --line: #DADAD3;
  --line-2: #E7E6E0;

  /* Night - тъмната медицинска секция */
  --night: #050A13;
  --night-2: #0B1422;
  --hero-night: #0F1E33;   /* hero на началната - една идея по-светло */
  --night-line: rgba(207, 216, 230, .14);
  --night-ink: #E8EDF4;
  --night-muted: #8C98AB;

  /* Clinical data accent */
  --clinical: #2F6BDB;
  --clinical-2: #8EB0E8;
  --clinical-tint: #E9F0FB;

  /* Pediatric sub-identity */
  --peds-bg: #F7F0E7;
  --peds-blue: #DCE7F2;
  --peds-ink: #23415F;
  --peds-warm: #E39B6B;

  /* Semantic */
  --ok: #138A5A;
  --warn: #B86E00;

  /* Type */
  --f-sans: 'Inter Tight', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-serif: 'Source Serif 4', Georgia, serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --t-mega: clamp(2.8rem, 6.6vw, 6.8rem);
  --t-d1: clamp(2.3rem, 4.6vw, 4.6rem);
  --t-d2: clamp(1.9rem, 3.2vw, 3.2rem);
  --t-d3: clamp(1.45rem, 2.1vw, 2rem);
  --t-h4: clamp(1.25rem, 1.6vw, 1.5rem);
  --t-lead: clamp(1.1rem, 1.35vw, 1.3rem);
  --t-body: 1.0625rem;
  --t-sm: .9375rem;
  --t-xs: .8125rem;
  --t-label: .72rem;

  /* Space - 4pt base */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px; --s11: 192px;
  --section: clamp(64px, 7.5vw, 120px);

  /* Grid */
  --max: none;            /* full-bleed: съдържанието е от край до край на всеки екран */
  --pad: clamp(16px, 3.2vw, 72px);
  --gap: clamp(16px, 2vw, 32px);

  /* Shape & depth */
  --r-xs: 6px; --r-sm: 10px; --r-md: 16px; --r-lg: 24px; --r-pill: 999px;
  --sh-1: 0 1px 0 rgba(11, 22, 38, .04), 0 1px 3px rgba(11, 22, 38, .06);
  --sh-2: 0 2px 4px rgba(11, 22, 38, .04), 0 12px 32px -8px rgba(11, 22, 38, .12);
  --sh-3: 0 4px 8px rgba(11, 22, 38, .04), 0 32px 64px -16px rgba(11, 22, 38, .22);

  /* Motion */
  --ease: cubic-bezier(.2, .7, .1, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --d-fast: 160ms; --d: 320ms; --d-slow: 720ms;

  --header-h: 72px;
}

/* 02 · BASE -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 24px); }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--t-body)/1.6 var(--f-sans);
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, h3, h4, h5, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
::selection { background: var(--ink); color: var(--paper); }
:focus-visible { outline: 2px solid var(--clinical); outline-offset: 3px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 16px; top: -60px; z-index: 999; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-pill); }
.skip:focus { top: 12px; }

/* 03 · TYPOGRAPHY -------------------------------------------------------- */
.t-mega, .t-d1, .t-d2, .t-d3 { font-weight: 500; letter-spacing: -.045em; line-height: .94; text-wrap: balance; }
.t-mega { font-size: var(--t-mega); letter-spacing: -.055em; line-height: .88; }
.t-d1 { font-size: var(--t-d1); }
.t-d2 { font-size: var(--t-d2); letter-spacing: -.04em; line-height: 1; }
.t-d3 { font-size: var(--t-d3); letter-spacing: -.03em; line-height: 1.08; }
.t-h4 { font-size: var(--t-h4); font-weight: 500; letter-spacing: -.02em; line-height: 1.25; }
.t-lead { font-size: var(--t-lead); line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.t-sm { font-size: var(--t-sm); }
.t-xs { font-size: var(--t-xs); }
.t-muted { color: var(--muted); }
.t-serif { font-family: var(--f-serif); font-style: italic; font-weight: 400; letter-spacing: -.02em; }
.t-mono, .label { font-family: var(--f-mono); }
.label {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: var(--t-label); font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.label--tick::before { content: ''; width: 18px; height: 1px; background: var(--red); }
.label--dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.num { font-feature-settings: 'tnum', 'lnum'; }
.prose { max-width: 68ch; }
.prose p + p { margin-top: 1em; }
.fade-ink { color: color-mix(in srgb, currentColor 34%, transparent); }

/* 04 · LAYOUT ------------------------------------------------------------ */
.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--pad); container-type: inline-size; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); }
.section { padding-block: var(--section); position: relative; }
.section--tight { padding-block: calc(var(--section) * .6); }
.section--white { background: var(--white); }
.section--night { background: var(--night); color: var(--night-ink); }
.rule { height: 1px; background: var(--line); border: 0; margin: 0; }
.sec-head { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); row-gap: var(--s5); align-items: end; margin-bottom: clamp(32px, 3.6vw, 56px); }
.sec-head__label { grid-column: 1 / -1; }
.sec-head__title { grid-column: 1 / span 8; }
.sec-head__aside { grid-column: 9 / -1; color: var(--muted); }
@container (max-width: 860px) {
  .sec-head__title, .sec-head__aside { grid-column: 1 / -1; }
}

/* 05 · SIGNATURE MOTIFS -------------------------------------------------- */
/* Глобалната ECG линия - пулсът на сайта */
.pulse-layer { position: absolute; inset: 0 0 auto 0; pointer-events: none; z-index: 31; } /* над подменюто (.subnav, 30), под хедъра (50) - линията не се прекъсва от лентата */
.pulse-layer path.track { stroke: rgba(120, 130, 145, .22); stroke-width: 1; fill: none; }
.pulse-layer path.live { stroke: var(--red); stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.pulse-layer circle { fill: var(--red); filter: drop-shadow(0 0 6px rgba(227, 6, 19, .6)); }
.pulse-gap { height: clamp(56px, 6vw, 96px); }
/* Секциите около ЕКГ удара не добавят свой отстъп - ритъмът идва от самия удар */
.pulse-gap + section:not([data-night]):not(.sig):not(.section--night), .pulse-gap + .section--tight { padding-top: clamp(16px, 2vw, 28px); }
section:has(+ .pulse-gap):not([data-night]):not(.sig):not(.section--night):not(.ph--night) { padding-bottom: clamp(16px, 2vw, 28px); }
.pg-ecg { display: none; }
@media (max-width: 900px) {
  .pulse-layer { display: none; }
  .pulse-gap { height: 44px; display: flex; align-items: center; padding-inline: var(--pad); }
  .pg-ecg { display: block; width: 100%; height: 32px; overflow: visible; }
  .pg-ecg path { fill: none; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
  .pg-track { stroke: rgba(120, 130, 145, .22); stroke-width: 1; }
  .pg-beat { stroke: var(--red); stroke-width: 1.5; stroke-dasharray: 600; stroke-dashoffset: 600; transition: stroke-dashoffset 1.6s var(--ease-io); }
  .pulse-gap.in .pg-beat { stroke-dashoffset: 0; }
}
body.wf .pg-ecg { visibility: hidden; }

/* Монитор - ECG лента */
.ecg-strip { position: relative; overflow: hidden; }
.ecg-strip svg { width: 100%; height: 100%; }
.ecg-strip .grid-minor { stroke: currentColor; opacity: .06; }
.ecg-strip .trace { fill: none; stroke: var(--red); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.ecg-strip .sweep { fill: url(#sweepFade); }

/* Анатомично сърце - визуални слоеве */
.heart { width: 100%; height: auto; overflow: visible; --hs: var(--ink); --heart-fill-hi: #FFFFFF; --heart-fill-lo: #E8ECF1; }
.heart * { vector-effect: non-scaling-stroke; }
.heart .h-tube, .heart .h-aorta, .heart .h-trunk, .heart .h-silhouette, .heart .h-atrium { stroke: var(--hs); stroke-width: 1.1; transition: fill var(--d-slow) var(--ease), stroke var(--d-slow) var(--ease), opacity var(--d-slow); }
.heart .h-cap { fill: var(--heart-fill-lo); stroke: var(--hs); stroke-width: 1; }
.heart .h-line { stroke: var(--hs); stroke-width: .8; }
.heart .h-contours path { stroke: var(--hs); stroke-width: .6; opacity: .16; }
.heart .h-coronary path { stroke: var(--red); stroke-width: 1.8; stroke-linecap: round; fill: none; }
.heart .h-coronary .thin { stroke-width: 1; }
.heart .h-conduction path { stroke: var(--clinical); stroke-width: 1.5; stroke-dasharray: 3 3; fill: none; }
.heart .h-conduction .node { fill: var(--clinical); }
.heart .h-valves ellipse, .heart .h-valves path { stroke: var(--hs); fill: none; stroke-width: 1.2; }
.heart .h-conduction, .heart .h-valves, .heart .h-scan { opacity: 0; transition: opacity var(--d-slow) var(--ease); }
.heart .scan-frame { fill: none; stroke: var(--clinical-2); stroke-dasharray: 2 6; opacity: .5; }
.heart .scan-line { stroke: var(--clinical-2); stroke-width: 1.5; }

/* 06 · BUTTONS ----------------------------------------------------------- */
.btn {
  --bg: var(--ink); --fg: var(--paper); --bd: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 52px; padding: 0 26px; border-radius: var(--r-pill);
  background: var(--bg); color: var(--fg); border: 1px solid var(--bd);
  font-size: var(--t-sm); font-weight: 500; letter-spacing: -.005em; white-space: nowrap;
  transition: background var(--d-fast), color var(--d-fast), border-color var(--d-fast), transform var(--d-fast) var(--ease), box-shadow var(--d);
}
.btn .i { width: 18px; height: 18px; transition: transform var(--d) var(--ease); }
.btn:hover .i--arrow { transform: translateX(3px); }
.btn:active { transform: scale(.98); }
.btn--primary:hover, .btn:not([class*='--']):hover { --bg: #1D2B40; }
.btn--secondary { --bg: transparent; --fg: var(--ink); --bd: var(--line); }
.btn--secondary:hover { --bd: var(--ink); }
.btn--light { --bg: var(--white); --fg: var(--ink); --bd: var(--white); }
.btn--light:hover { --bg: var(--paper); }
.btn--ghost-night { --bg: transparent; --fg: var(--night-ink); --bd: var(--night-line); }
.btn--ghost-night:hover { --bd: var(--night-ink); }
.btn--emergency { --bg: var(--red); --fg: #fff; --bd: var(--red); }
.btn--emergency:hover { --bg: #C70511; }
.btn--sm { height: 40px; padding: 0 18px; font-size: var(--t-xs); }
.btn--lg { height: 60px; padding: 0 32px; font-size: 1rem; }
.btn[disabled], .btn.is-disabled { opacity: .38; pointer-events: none; }
.link-arrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: var(--t-sm); border-bottom: 1px solid var(--line); padding-bottom: 4px; transition: border-color var(--d-fast), gap var(--d) var(--ease); }
.link-arrow:hover { border-color: var(--ink); gap: 12px; }
.link-arrow .i { width: 16px; height: 16px; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center; border: 1px solid var(--line); transition: border-color var(--d-fast), background var(--d-fast); }
.icon-btn:hover { border-color: var(--ink); }
.icon-btn .i { width: 20px; height: 20px; }

/* Icons */
.i { width: 24px; height: 24px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; --icon-accent: var(--red); }

/* 07 · FORMS & SEARCH ---------------------------------------------------- */
.field { display: grid; gap: 8px; }
.field__label { font-size: var(--t-xs); font-weight: 500; color: var(--ink-2); }
.field__hint { font-size: var(--t-xs); color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 52px; padding: 0 18px; border-radius: var(--r-sm);
  background: var(--white); border: 1px solid var(--line); color: var(--ink); font: inherit; font-size: 1rem;
  transition: border-color var(--d-fast), box-shadow var(--d-fast);
}
.textarea { height: auto; min-height: 140px; padding: 14px 18px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: #BDBDB4; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 4px rgba(11, 22, 38, .08); }
.field.is-error .input { border-color: var(--red-ink); box-shadow: 0 0 0 4px var(--red-tint); }
.field.is-error .field__hint { color: var(--red-ink); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%230B1626' stroke-width='1.5'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 18px center; padding-right: 44px; }
.check { display: inline-flex; gap: 12px; align-items: flex-start; font-size: var(--t-sm); cursor: pointer; }
.check input { appearance: none; width: 20px; height: 20px; border: 1px solid #BDBDB4; border-radius: 5px; margin: 2px 0 0; background: var(--white); display: grid; place-items: center; transition: background var(--d-fast), border-color var(--d-fast); }
.check input:checked { background: var(--ink); border-color: var(--ink); }
.check input:checked::after { content: ''; width: 10px; height: 6px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }

/* Chip / Filter */
.chip {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: transparent; font-size: var(--t-sm); color: var(--ink-2); white-space: nowrap;
  transition: background var(--d-fast), color var(--d-fast), border-color var(--d-fast);
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip[aria-pressed='true'], .chip.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip__count { font-family: var(--f-mono); font-size: 11px; opacity: .6; }
.filterbar { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.filterbar::-webkit-scrollbar { display: none; }

/* Search - един компонент, три размера */
.search { position: relative; }
.search__box {
  display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 12px 0 22px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md);
  transition: border-color var(--d-fast), box-shadow var(--d);
}
.search__box:hover { border-color: #BDBDB4; }
.search__box:focus-within { border-color: var(--ink); box-shadow: 0 0 0 6px rgba(11, 22, 38, .06), var(--sh-2); }
.search__box .i { color: var(--muted); }
.search__input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 1.125rem; color: var(--ink); height: 100%; }
.search__input:focus { outline: none; }
.search__input::placeholder { color: var(--faint); }
.search--xl .search__box { height: 84px; padding-left: 28px; border-radius: var(--r-lg); }
.search--xl .search__input { font-size: clamp(1.15rem, 1.8vw, 1.6rem); letter-spacing: -.02em; }
.search--sm .search__box { height: 48px; border-radius: var(--r-pill); }
.search--sm .search__input { font-size: 1rem; }
.kbd { font-family: var(--f-mono); font-size: 11px; padding: 3px 7px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; color: var(--muted); background: var(--paper); }
.search__results {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 20;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-3);
  padding: 8px; max-height: min(520px, 60vh); overflow: auto; display: none;
}
.search.is-open .search__results { display: block; animation: pop var(--d) var(--ease); }
.result { display: grid; grid-template-columns: 40px 1fr auto; gap: 16px; align-items: center; padding: 12px 14px; border-radius: var(--r-sm); }
.result:hover, .result.is-active { background: var(--paper); }
.result__ico { width: 40px; height: 40px; border-radius: 10px; background: var(--paper-2); display: grid; place-items: center; font-family: var(--f-mono); font-size: 12px; color: var(--ink-2); }
.result__ico .i { width: 20px; height: 20px; }
.result__title { font-weight: 500; line-height: 1.3; }
.result__title mark { background: none; color: var(--ink); box-shadow: inset 0 -.35em 0 var(--red-tint); }
.result__ctx { font-size: var(--t-xs); color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.result__type { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.results__group { padding: 12px 14px 4px; }
.results__empty { padding: 24px 14px; color: var(--muted); font-size: var(--t-sm); }

/* 08 · HEADER / MEGAMENU / SEARCH OVERLAY -------------------------------- */
/* Utility bar - вторични връзки над главното меню */
.ubar { position: relative; z-index: 51; background: var(--night); color: var(--night-muted); font-size: 12.5px; border-bottom: 1px solid var(--night-line); }
.ubar__in { height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.ubar a { color: var(--night-muted); transition: color var(--d-fast); white-space: nowrap; }
.ubar a:hover, .ubar a[aria-current] { color: #fff; }
.ubar__info { display: inline-flex; align-items: center; gap: 8px; }
.ubar__info i { width: 6px; height: 6px; border-radius: 50%; background: var(--red); animation: ping 2s infinite; }
.ubar__nav { display: flex; align-items: center; gap: 22px; }
.ubar__n { display: inline-grid; place-items: center; min-width: 18px; height: 16px; padding: 0 5px; margin-left: 6px; border-radius: 8px; background: var(--red); color: #fff; font-family: var(--f-mono); font-size: 10px; vertical-align: 1px; }
.ubar__tel { color: var(--night-ink) !important; font-weight: 500; padding-left: 22px; border-left: 1px solid var(--night-line); }
@media (max-width: 760px) { .ubar__info, .ubar__opt { display: none; } .ubar__in { justify-content: flex-start; } .ubar__nav { gap: 16px; overflow-x: auto; scrollbar-width: none; max-width: 100%; } .ubar__nav::-webkit-scrollbar { display: none; } .ubar__tel { padding-left: 16px; } }
@media (max-width: 440px) { .ubar__tel { display: none; } .ubar__nav { gap: 14px; } }
@media print { .ubar { display: none; } }
/* No background transition — animating paper→night reads as a white flash on load. */
.hdr { position: sticky; top: 0; z-index: 50; height: var(--header-h); background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: saturate(1.4) blur(18px); -webkit-backdrop-filter: saturate(1.4) blur(18px); border-bottom: 1px solid transparent; transition: border-color var(--d); }
.hdr.is-scrolled { border-bottom-color: var(--line-2); }
/* Night hero pages: paint hdr dark immediately (no white frame before .is-night).
   body[data-night-top] is seeded by DesignPage; :has() covers SSR / hard reload. */
body[data-night-top='1'] .hdr:not(.is-night):not(.is-scrolled),
body:has(#hero[data-night], #hero.hero--night, #main > [data-night], #main > .ph--night) .hdr:not(.is-night):not(.is-scrolled) {
  background: color-mix(in srgb, var(--hero-night) 86%, transparent);
  border-bottom-color: var(--night-line);
  color: var(--night-ink);
}
body[data-night-top='1'] .hdr:not(.is-night):not(.is-scrolled) .nav__link,
body[data-night-top='1'] .hdr:not(.is-night):not(.is-scrolled) .brand__name span,
body[data-night-top='1'] .hdr:not(.is-night):not(.is-scrolled) .hdr__search,
body:has(#hero[data-night], #hero.hero--night, #main > [data-night], #main > .ph--night) .hdr:not(.is-night):not(.is-scrolled) .nav__link,
body:has(#hero[data-night], #hero.hero--night, #main > [data-night], #main > .ph--night) .hdr:not(.is-night):not(.is-scrolled) .brand__name span,
body:has(#hero[data-night], #hero.hero--night, #main > [data-night], #main > .ph--night) .hdr:not(.is-night):not(.is-scrolled) .hdr__search { color: var(--night-muted); }
body[data-night-top='1'] .hdr:not(.is-night):not(.is-scrolled) .hdr__search,
body:has(#hero[data-night], #hero.hero--night, #main > [data-night], #main > .ph--night) .hdr:not(.is-night):not(.is-scrolled) .hdr__search { border-color: var(--night-line); }
body[data-night-top='1'] .hdr:not(.is-night):not(.is-scrolled) .kbd,
body:has(#hero[data-night], #hero.hero--night, #main > [data-night], #main > .ph--night) .hdr:not(.is-night):not(.is-scrolled) .kbd { background: transparent; border-color: var(--night-line); }
body[data-night-top='1'] .hdr:not(.is-night):not(.is-scrolled) .btn,
body:has(#hero[data-night], #hero.hero--night, #main > [data-night], #main > .ph--night) .hdr:not(.is-night):not(.is-scrolled) .btn { --bg: var(--paper); --fg: var(--ink); --bd: var(--paper); }
body[data-night-top='1'] .hdr:not(.is-night):not(.is-scrolled) .hdr__sos,
body:has(#hero[data-night], #hero.hero--night, #main > [data-night], #main > .ph--night) .hdr:not(.is-night):not(.is-scrolled) .hdr__sos { color: #FF5A62; background: rgba(227, 6, 19, .14); }
body[data-night-top='1'] .hdr:not(.is-night):not(.is-scrolled) .icon-btn,
body:has(#hero[data-night], #hero.hero--night, #main > [data-night], #main > .ph--night) .hdr:not(.is-night):not(.is-scrolled) .icon-btn { border-color: var(--night-line); color: var(--night-ink); }
.hdr.is-night { background: color-mix(in srgb, var(--night) 82%, transparent); border-bottom-color: var(--night-line); color: var(--night-ink); }
.hdr.is-night .nav__link, .hdr.is-night .brand__name span, .hdr.is-night .hdr__search { color: var(--night-muted); }
.hdr.is-night .nav__link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.hdr.is-night .nav__item.is-open .nav__link { background: rgba(255, 255, 255, .1); color: #fff; }
/* подменюто е бяло и при тъмна горна лента - текстът не наследява светлия цвят */
.hdr.is-night .mega { color: var(--ink); }
.hdr.is-night .hdr__search { border-color: var(--night-line); }
.hdr.is-night .kbd { background: transparent; border-color: var(--night-line); }
.hdr.is-night .btn { --bg: var(--paper); --fg: var(--ink); --bd: var(--paper); }
.hdr.is-night .hdr__sos { color: #FF5A62; }
.hdr.is-night.is-hero { background: color-mix(in srgb, var(--hero-night) 86%, transparent); }
body[data-page='index'] .ubar { background: var(--hero-night); }
.hdr__in { height: 100%; display: flex; align-items: center; gap: 20px; container-type: normal; }
.brand { display: flex; align-items: center; gap: 12px; flex: none; }
.brand__mark { width: 34px; height: 34px; }
.brand__name { font-size: 13px; line-height: 1.15; font-weight: 600; letter-spacing: -.01em; max-width: 150px; }
.brand__name span { display: block; font-weight: 400; color: var(--muted); }
.nav { display: flex; gap: 0; margin-left: 4px; }
.nav__item { position: static; }
.nav__link { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border-radius: var(--r-pill); font-size: var(--t-sm); color: var(--ink-2); transition: background var(--d-fast), color var(--d-fast); }
.nav__link:hover, .nav__item.is-open .nav__link { background: rgba(11, 22, 38, .05); color: var(--ink); }
.nav__link[aria-current='page'] { color: var(--ink); font-weight: 500; }
.nav__link--pill { margin-left: 6px; border: 1px solid var(--line); background: color-mix(in srgb, var(--white) 50%, transparent); }
.nav__link--pill::before { content: ''; width: 21px; height: 14px; margin-right: 4px; border-radius: 2px; background: url(eu-flag.svg) center/cover no-repeat; box-shadow: 0 0 0 1px rgba(0, 0, 0, .06); flex: none; }
.hdr.is-night .nav__link--pill { border-color: var(--night-line); background: rgba(255,255,255,.04); }
.nav__link .chev { width: 10px; height: 10px; transition: transform var(--d) var(--ease); }
.nav__item.is-open .chev { transform: rotate(180deg); }
.hdr__tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.hdr__search { display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 8px 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line); color: var(--muted); font-size: var(--t-sm); min-width: 220px; transition: border-color var(--d-fast); }
.hdr__search:hover { border-color: var(--ink); }
.hdr__search .i { width: 18px; height: 18px; }
.hdr__search .kbd { margin-left: auto; }
.hdr__sos { white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; font-size: var(--t-sm); font-weight: 500; color: var(--red-ink); border-radius: var(--r-pill); }
.hdr__sos:hover { background: var(--red-tint); }
.hdr__sos .short { display: none; }
.hdr__sos::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 rgba(227, 6, 19, .5); animation: ping 2s infinite; }
.hdr__burger { display: none; }

.mega { position: absolute; left: 0; right: 0; top: var(--header-h); background: var(--white); border-bottom: 1px solid var(--line-2); box-shadow: 0 40px 60px -40px rgba(11, 22, 38, .25); opacity: 0; visibility: hidden; transform: translateY(-6px); transition: opacity var(--d) var(--ease), transform var(--d) var(--ease), visibility 0s linear var(--d); }
.nav__item.is-open .mega { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.mega__in { display: grid; grid-template-columns: 3fr 3fr 3fr 3fr; gap: var(--gap); padding-block: 40px 48px; }
.mega__intro p { color: var(--muted); font-size: var(--t-sm); margin-top: 12px; max-width: 32ch; }
.mega__col h4 { font-family: var(--f-mono); font-size: var(--t-label); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin-bottom: 14px; }
.mega__col a { display: block; padding: 7px 0; font-size: var(--t-sm); color: var(--ink-2); transition: color var(--d-fast), transform var(--d) var(--ease); }
.mega__col a:hover { color: var(--ink); transform: translateX(4px); }
.mega__feature { background: var(--paper); border-radius: var(--r-md); padding: 24px; display: flex; flex-direction: column; justify-content: space-between; min-height: 220px; }

.so { position: fixed; inset: 0; z-index: 100; background: color-mix(in srgb, var(--paper) 96%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); display: none; overflow: auto; }
.so.is-open { display: block; animation: fade var(--d) var(--ease); }
.so__in { max-width: 920px; margin: 0 auto; padding: 14vh var(--pad) 80px; }
.so__close { position: fixed; top: 20px; right: 20px; }
.so .search__results { position: static; display: block; box-shadow: none; border: 0; background: transparent; padding: 0; margin-top: 24px; max-height: none; }
.so__suggest { margin-top: 40px; display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.so__suggest a { display: block; padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: var(--t-sm); }
.so__suggest a:hover { color: var(--red-ink); }

.mnav { position: fixed; inset: var(--header-h) 0 0; z-index: 49; background: var(--paper); overflow: auto; padding: 24px var(--pad) 40px; display: none; }
.mnav.is-open { display: block; animation: fade var(--d) var(--ease); }
.mnav details { border-bottom: 1px solid var(--line); }
.mnav summary { list-style: none; display: flex; justify-content: space-between; align-items: center; padding: 18px 0; font-size: 1.5rem; letter-spacing: -.03em; font-weight: 500; cursor: pointer; }
.mnav summary::-webkit-details-marker { display: none; }
.mnav details[open] summary .i { transform: rotate(45deg); }
.mnav summary .i { transition: transform var(--d) var(--ease); }
.mnav details a { display: block; padding: 8px 0; color: var(--ink-2); }
.mnav details div { padding-bottom: 16px; }
.mnav__cta { display: grid; gap: 10px; margin-top: 32px; }

@media (max-width: 1560px) { .hdr__search { min-width: 0; } .hdr__search span, .hdr__search .kbd { display: none; } }
@media (max-width: 1320px) { .brand__name { display: none; } }
@media (max-width: 1180px) { .nav__link { padding: 0 10px; } .hdr__sos .long { display: none; } .hdr__sos .short { display: inline; } }
@media (max-width: 1160px) {
  .nav, .hdr__tools .btn, .hdr__sos .long { display: none; }
  .hdr__sos .short { display: inline; }
  .hdr__sos { background: var(--red-tint); height: 44px; }
  .hdr__burger { display: inline-grid; }
  .hdr__search { width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 50%; }
  .brand__name { display: block; }
}

/* Breadcrumbs */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: var(--t-xs); color: var(--muted); }
.crumbs a:hover { color: var(--ink); }
.crumbs li + li::before { content: '/'; margin-right: 8px; color: var(--line); }
.crumbs [aria-current] { color: var(--ink); }

/* 09 · COMPONENTS -------------------------------------------------------- */

/* QuickAction - хоризонтален hairline grid, не карти */
.qa-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.qa { position: relative; display: grid; grid-template-rows: auto 1fr auto; gap: 18px; min-height: 176px; padding: 24px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--white); transition: background var(--d) var(--ease); overflow: hidden; }
.qa .i { width: 30px; height: 30px; stroke-width: 1.25; }
.qa__title { font-size: 1.125rem; font-weight: 500; letter-spacing: -.02em; line-height: 1.2; }
.qa__text { font-size: var(--t-xs); color: var(--muted); line-height: 1.45; margin-top: 4px; }
.qa__go { justify-self: end; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); transition: background var(--d-fast), border-color var(--d-fast), color var(--d-fast), transform var(--d) var(--ease); }
.qa__go .i { width: 14px; height: 14px; stroke-width: 1.75; }
.qa:hover { background: var(--paper); }
.qa:hover .qa__go { background: var(--ink); border-color: var(--ink); color: #fff; transform: rotate(-45deg); }
.qa--sos .i { color: var(--red); }
.qa--sos:hover { background: var(--red-tint); }
.qa--sos:hover .qa__go { background: var(--red); border-color: var(--red); }
@container (max-width: 980px) { .qa-grid { grid-template-columns: repeat(2, 1fr); } }
@container (max-width: 520px) {
  .qa { min-height: 0; grid-template-columns: 30px 1fr 32px; grid-template-rows: auto; align-items: center; padding: 18px 16px; gap: 14px; }
  .qa__text { display: none; }
  .qa__title { font-size: 1rem; }
  .qa-grid { grid-template-columns: 1fr; }
}

/* DoctorCard */
.doc { display: grid; gap: 16px; }
.doc__portrait { position: relative; aspect-ratio: 4 / 5; border-radius: var(--r-md); overflow: hidden; background: linear-gradient(160deg, #E9ECEF, #D7DCE2); }
.doc__portrait img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(.15); transition: transform var(--d-slow) var(--ease), filter var(--d-slow); }
.doc__mono { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(2.5rem, 5cqi, 4rem); font-weight: 500; letter-spacing: -.05em; color: rgba(11, 22, 38, .2); }
.doc__portrait .demo { position: absolute; left: 10px; bottom: 10px; font-family: var(--f-mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: #fff; background: rgba(11, 22, 38, .45); backdrop-filter: blur(6px); padding: 3px 7px; border-radius: 4px; }
.doc__mono::after { content: 'портрет'; position: absolute; bottom: 14px; left: 14px; font-family: var(--f-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: rgba(11, 22, 38, .35); }
.doc__ecg { position: absolute; left: 0; right: 0; bottom: 30%; height: 40px; opacity: 0; transition: opacity var(--d); }
.doc__ecg path { stroke: var(--red); stroke-width: 1.5; fill: none; stroke-dasharray: 600; stroke-dashoffset: 600; }
.doc:hover .doc__ecg { opacity: 1; }
.doc:hover .doc__ecg path { animation: draw 1.4s var(--ease) forwards; }
.doc.is-live .doc__ecg { opacity: 1; }
.doc.is-live .doc__ecg path { animation: draw 1.4s var(--ease) forwards; }
.doc:hover .doc__portrait img { transform: scale(1.03); filter: none; }
.doc__title { font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.doc__name { font-size: 1.25rem; font-weight: 500; letter-spacing: -.025em; line-height: 1.15; margin-top: 2px; }
.doc__meta { font-size: var(--t-xs); color: var(--muted); margin-top: 6px; line-height: 1.45; }
.doc__spec { color: var(--ink-2); }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 500; background: var(--paper-2); color: var(--ink-2); }
.badge--kids { background: var(--peds-blue); color: var(--peds-ink); }
.badge--live { background: #E5F3EC; color: var(--ok); }
.badge--live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge--closed { background: var(--paper-2); color: var(--muted); }
.badge--red { background: var(--red-tint); color: var(--red-ink); }

/* Department - editorial index row */
.dept-list { border-top: 1px solid var(--line); counter-reset: dept; }
.dept { position: relative; display: grid; grid-template-columns: 72px minmax(0, 5fr) minmax(0, 4fr) 56px; gap: var(--gap); align-items: center; padding: 22px 0; border-bottom: 1px solid var(--line); transition: padding var(--d) var(--ease); }
.dept__n { font-family: var(--f-mono); font-size: 12px; color: var(--faint); }
.dept__name { font-size: clamp(1.3rem, 1.9vw, 1.85rem); font-weight: 500; letter-spacing: -.035em; line-height: 1.05; transition: transform var(--d) var(--ease), color var(--d); }
.dept__text { font-size: var(--t-sm); color: var(--muted); line-height: 1.5; }
.dept__tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.dept__go { justify-self: end; }
.dept::before { content: ''; position: absolute; left: 0; bottom: -1px; height: 1px; width: 0; background: var(--ink); transition: width var(--d-slow) var(--ease); }
.dept:hover::before { width: 100%; }
.dept:hover .dept__name { transform: translateX(10px); }
.dept:hover .icon-btn { background: var(--ink); color: #fff; border-color: var(--ink); }
@container (max-width: 860px) {
  .dept { grid-template-columns: 36px 1fr 44px; padding: 22px 0; }
  .dept__text { grid-column: 2 / 3; grid-row: 2; }
  .dept__go { grid-row: 1; grid-column: 3; }
}

/* ProcedureCard */
.proc { display: grid; gap: 20px; padding: 24px; border-radius: var(--r-md); background: var(--white); border: 1px solid var(--line-2); transition: border-color var(--d-fast), box-shadow var(--d); }
.proc:hover { border-color: var(--line); box-shadow: var(--sh-2); }
.proc__top { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.proc__top > .icon-btn { flex: none; }
.proc__top > div { min-width: 0; }
.proc__title { font-size: 1.25rem; font-weight: 500; letter-spacing: -.025em; line-height: 1.2; }
.proc__facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.proc__facts dt { font-family: var(--f-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.proc__facts dd { font-size: var(--t-xs); margin-top: 4px; color: var(--ink-2); }

/* NewsCard */
.news-item { display: grid; gap: 14px; }
.news-item__media { aspect-ratio: 3 / 2; border-radius: var(--r-sm); overflow: hidden; background: var(--paper-2); }
.news-item__media img { width: 100%; height: 100%; object-fit: cover; transition: transform var(--d-slow) var(--ease); }
.news-item:hover .news-item__media img { transform: scale(1.04); }
.news-item__meta { display: flex; gap: 12px; align-items: center; font-family: var(--f-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.news-item__title { font-size: 1.25rem; font-weight: 500; letter-spacing: -.025em; line-height: 1.22; text-wrap: balance; }
.news-item:hover .news-item__title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.news-row { display: grid; grid-template-columns: 140px 1fr 40px; gap: var(--gap); padding: 22px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.news-row:hover .news-item__title { color: var(--red-ink); }

/* Statistics */
.stat { display: grid; gap: 10px; align-content: start; }
.stat__n { font-size: clamp(2.4rem, 4.2vw, 4.2rem); font-weight: 500; letter-spacing: -.06em; line-height: .9; font-feature-settings: 'tnum', 'lnum'; }
.stat__n sup { font-size: .38em; letter-spacing: -.02em; vertical-align: top; position: relative; top: .25em; margin-left: .06em; color: var(--red); }
.stat__l { font-size: var(--t-sm); color: var(--muted); max-width: 30ch; line-height: 1.45; }
.stat__src { font-family: var(--f-mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }

/* ContactCard / EmergencyCard */
.contact { display: grid; gap: 6px; padding: 22px 0; border-top: 1px solid var(--line); }
.contact__label { font-size: var(--t-xs); color: var(--muted); }
.contact__value { font-size: 1.5rem; font-weight: 500; letter-spacing: -.03em; font-feature-settings: 'tnum'; }
.contact__value:hover { color: var(--red-ink); }
.contact__note { font-size: var(--t-xs); color: var(--muted); }
.sos-card { display: grid; gap: 18px; padding: 28px; border-radius: var(--r-md); background: var(--white); border: 2px solid var(--red); }
.sos-card__n { font-size: clamp(3rem, 6vw, 4.5rem); font-weight: 600; letter-spacing: -.05em; line-height: 1; color: var(--red-ink); }

/* PatientJourney */
.journey { display: grid; grid-template-columns: repeat(var(--steps, 5), 1fr); position: relative; }
.journey::before { content: ''; position: absolute; left: 0; right: 0; top: 19px; height: 1px; background: var(--line); }
.journey__step { position: relative; padding-right: 24px; }
.journey__dot { position: relative; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); border: 1px solid var(--line); font-family: var(--f-mono); font-size: 12px; margin-bottom: 20px; transition: background var(--d), border-color var(--d), color var(--d); }
.journey__step.is-active .journey__dot, .journey__step:hover .journey__dot { background: var(--ink); color: #fff; border-color: var(--ink); }
.journey__title { font-weight: 500; font-size: 1.0625rem; letter-spacing: -.015em; }
.journey__text { font-size: var(--t-xs); color: var(--muted); margin-top: 6px; line-height: 1.5; }
@container (max-width: 860px) {
  .journey { grid-template-columns: 1fr; gap: 0; }
  .journey::before { left: 19px; right: auto; top: 0; bottom: 0; width: 1px; height: auto; }
  .journey__step { display: grid; grid-template-columns: 40px 1fr; gap: 0 18px; padding: 0 0 26px; }
  .journey__dot { margin: 0; grid-row: span 2; }
}

/* Accordion / FAQ */
.acc { border-top: 1px solid var(--line); }
.acc__item { border-bottom: 1px solid var(--line); }
.acc__btn { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 26px 0; text-align: left; font-size: clamp(1.05rem, 1.4vw, 1.25rem); font-weight: 500; letter-spacing: -.02em; }
.acc__btn:hover { color: var(--ink-2); }
.acc__icon { position: relative; width: 36px; height: 36px; flex: none; border-radius: 50%; border: 1px solid var(--line); transition: background var(--d-fast), border-color var(--d-fast), transform var(--d) var(--ease); }
.acc__icon::before, .acc__icon::after { content: ''; position: absolute; left: 50%; top: 50%; width: 12px; height: 1.5px; background: currentColor; transform: translate(-50%, -50%); transition: transform var(--d) var(--ease); }
.acc__icon::after { transform: translate(-50%, -50%) rotate(90deg); }
.acc__item.is-open .acc__icon { background: var(--ink); color: #fff; border-color: var(--ink); }
.acc__item.is-open .acc__icon::after { transform: translate(-50%, -50%) rotate(0); }
.acc__panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows var(--d) var(--ease); }
.acc__item.is-open .acc__panel { grid-template-rows: 1fr; }
.acc__panel > div { overflow: hidden; }
.acc__panel p { padding: 0 64px 28px 0; color: var(--ink-2); max-width: 70ch; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { position: relative; height: 52px; padding: 0 16px; font-size: var(--t-sm); color: var(--muted); white-space: nowrap; transition: color var(--d-fast); }
.tab:hover { color: var(--ink); }
.tab[aria-selected='true'] { color: var(--ink); font-weight: 500; }
.tab[aria-selected='true']::after { content: ''; position: absolute; left: 16px; right: 16px; bottom: -1px; height: 2px; background: var(--ink); }
.tab .chip__count { margin-left: 6px; }
.segmented { display: inline-flex; padding: 4px; background: var(--paper-2); border-radius: var(--r-pill); }
.segmented button { height: 36px; padding: 0 16px; border-radius: var(--r-pill); font-size: var(--t-xs); color: var(--muted); transition: background var(--d-fast), color var(--d-fast), box-shadow var(--d-fast); }
.segmented button[aria-pressed='true'] { background: var(--white); color: var(--ink); box-shadow: var(--sh-1); font-weight: 500; }

/* Pagination */
.pager { display: flex; align-items: center; gap: 6px; }
.pager a, .pager span { min-width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; font-size: var(--t-sm); font-feature-settings: 'tnum'; }
.pager a:hover { background: var(--paper-2); }
.pager [aria-current] { background: var(--ink); color: #fff; }
.pager .pager__arrow { border: 1px solid var(--line); }

/* PageHero / EditorialHero */
.page-hero { padding-block: clamp(40px, 6vw, 88px) clamp(48px, 7vw, 112px); }
.page-hero .crumbs { margin-bottom: clamp(32px, 5vw, 72px); }
.page-hero__grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); align-items: end; }
.page-hero__title { grid-column: 1 / span 8; }
.page-hero__aside { grid-column: 9 / -1; color: var(--ink-2); }
@container (max-width: 860px) { .page-hero__title, .page-hero__aside { grid-column: 1 / -1; } }
.ed-hero { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); padding-block: clamp(48px, 7vw, 120px); }
.ed-hero__label { grid-column: 1 / span 3; }
.ed-hero__title { grid-column: 4 / -1; }
.ed-hero__media { grid-column: 4 / span 6; margin-top: 48px; }
.ed-hero__caption { grid-column: 10 / -1; align-self: end; font-size: var(--t-xs); color: var(--muted); }
@container (max-width: 860px) { .ed-hero > * { grid-column: 1 / -1 !important; } }

/* Media */
.media { position: relative; overflow: hidden; border-radius: var(--r-md); background: var(--paper-2); }
.media img { width: 100%; height: 100%; object-fit: cover; }
.media figcaption, .caption { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 12px; display: flex; gap: 12px; }

/* Map */
.map { position: relative; border-radius: var(--r-md); overflow: hidden; background: #ECEBE5; aspect-ratio: 4 / 3; }
.map svg { width: 100%; height: 100%; }
.map__pin { position: absolute; transform: translate(-50%, -100%); display: grid; justify-items: center; gap: 6px; }
.map__pin span { background: var(--ink); color: #fff; font-size: 12px; padding: 6px 10px; border-radius: var(--r-pill); white-space: nowrap; box-shadow: var(--sh-2); }
.map__pin i { width: 12px; height: 12px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 6px rgba(227, 6, 19, .18); animation: ping 2.4s infinite; }

/* CTA band */
.cta { display: grid; grid-template-columns: 1fr auto; gap: var(--gap); align-items: center; padding: clamp(32px, 4vw, 56px); border-radius: var(--r-lg); background: var(--ink); color: var(--paper); }
.cta p { color: rgba(246, 245, 241, .62); margin-top: 10px; }
@container (max-width: 760px) { .cta { grid-template-columns: 1fr; } }

/* 10 · FOOTER ------------------------------------------------------------ */
.ftr { background: var(--night); color: var(--night-ink); padding-top: clamp(72px, 9vw, 140px); position: relative; overflow: hidden; }
.ftr a { color: var(--night-ink); }
.ftr__top { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); align-items: end; padding-bottom: clamp(56px, 7vw, 104px); border-bottom: 1px solid var(--night-line); }
.ftr__statement { grid-column: 1 / span 7; }
.ftr__mark { grid-column: 10 / -1; justify-self: end; width: min(220px, 100%); }
.ftr__mark path { fill: transparent; stroke: var(--red); stroke-width: 1.2; stroke-dasharray: var(--len, 2400); stroke-dashoffset: var(--len, 2400); transition: stroke-dashoffset 2.6s var(--ease-io), fill 1s ease 2.2s; vector-effect: non-scaling-stroke; }
.ftr__mark.in path { stroke-dashoffset: 0; fill: var(--red); }
.ftr__cols { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); padding-block: 56px; }
.ftr__col { grid-column: span 2; }
.ftr__col--wide { grid-column: span 4; }
.ftr__col h4 { font-family: var(--f-mono); font-size: var(--t-label); letter-spacing: .12em; text-transform: uppercase; color: var(--night-muted); font-weight: 500; margin-bottom: 18px; }
.ftr__col a { display: block; padding: 5px 0; font-size: var(--t-sm); color: rgba(232, 237, 244, .8); }
.ftr__col a:hover { color: #fff; }
.ftr__col a.ftr__big, .ftr__big { font-size: 1.75rem; letter-spacing: -.03em; font-weight: 500; }
.ftr__bottom { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; padding-block: 28px 40px; border-top: 1px solid var(--night-line); font-size: var(--t-xs); color: var(--night-muted); }
.ftr__bottom nav { display: flex; gap: 24px; flex-wrap: wrap; }
.ftr__bottom .ftr__social { gap: 10px; } /* профилите на НКБ (Настройки на сайта → Социални мрежи) */
.ftr__social a { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; border: 1px solid var(--night-line); color: #fff; transition: border-color var(--d-fast), color var(--d-fast); }
.ftr__social a:hover { border-color: #fff; }
.ftr__social .i { width: 18px; height: 18px; }
@container (max-width: 980px) {
  .ftr__statement { grid-column: 1 / -1; }
  .ftr__mark { grid-column: 1 / -1; justify-self: start; width: 96px; }
  .ftr__col { grid-column: span 6; }
  .ftr__col--wide { grid-column: 1 / -1; }
}

/* 11 · MOTION ------------------------------------------------------------ */
/*
  Default = VISIBLE. Before nkb.js boots (1–3s of script/CDN fetches) the old
  opacity:0 / translateY(105%) left the hero looking empty ("5% loaded").
  Entrance animation only applies to below-fold nodes marked .nkb-pending.
*/
[data-reveal] { opacity: 1; transform: none; }
[data-reveal].nkb-pending { opacity: 0; transform: translateY(24px); transition: opacity var(--d-slow) var(--ease), transform var(--d-slow) var(--ease); transition-delay: calc(var(--i, 0) * 70ms); }
[data-reveal].nkb-pending.in,
[data-reveal].in { opacity: 1; transform: none; }
/* Курсивните букви (з, р, ц, у) слизат дълбоко под реда - маската им дава място, без да мести реда */
.line-mask { display: block; overflow: hidden; padding: 0 .2em .32em; margin: 0 -.2em -.32em; }
.line-mask + .line-mask { margin-top: 0; }
.line-mask > span { display: block; transform: none; }
.line-mask.nkb-pending > span { transform: translateY(105%); transition: transform 1s var(--ease); transition-delay: calc(var(--i, 0) * 90ms); }
.in .line-mask > span,
.line-mask.in > span,
.line-mask.nkb-pending.in > span { transform: none; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(227, 6, 19, .45); } 70%, 100% { box-shadow: 0 0 0 10px rgba(227, 6, 19, 0); } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.99); } }
@keyframes fade { from { opacity: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  [data-reveal],
  [data-reveal].nkb-pending,
  .line-mask > span,
  .line-mask.nkb-pending > span { opacity: 1; transform: none; }
}

/* Header - тесни телефони */
@media (max-width: 480px) {
  .hdr__in { gap: 10px; }
  .hdr__tools { gap: 6px; }
  .brand__name { font-size: 11.5px; max-width: 118px; }
  .hdr__sos { padding: 0 12px; }
}
.hdr.is-night .icon-btn { border-color: var(--night-line); color: var(--night-ink); }
.hdr.is-night .hdr__sos { background: rgba(227, 6, 19, .14); }

/* „НОВ САЙТ*“ - светещ бутон в менюто (страница за попълване от клиниките) */
.nav__link--glow { border: 1.5px solid var(--red); border-radius: var(--r-pill); padding: 0 16px; height: 40px; display: inline-flex; align-items: center; font-weight: 600; letter-spacing: .04em; color: var(--red-ink, #B5121B); animation: navglow 2.4s ease-in-out infinite; }
.hdr.is-night .nav__link--glow, .hdr.is-hero .nav__link--glow { color: #FF6A72; }
.nav__link--glow:hover { background: var(--red); color: #fff !important; }
@keyframes navglow { 0%, 100% { box-shadow: 0 0 0 0 rgba(227, 6, 19, .0), 0 0 10px rgba(227, 6, 19, .25); } 50% { box-shadow: 0 0 0 4px rgba(227, 6, 19, .12), 0 0 22px rgba(227, 6, 19, .55); } }
@media (prefers-reduced-motion: reduce) { .nav__link--glow { animation: none; box-shadow: 0 0 14px rgba(227, 6, 19, .4); } }

/* компактно меню на средни екрани (лаптопи) */
.nav__link .l-short { display: none; }
@media (max-width: 1480px) { .nav__link { padding: 0 11px; } .nav__link .l-long { display: none; } .nav__link .l-short { display: inline; } .nav__link--glow { padding: 0 14px; } }

/* Меню „Клиники“: отделенията - под клиниката си, отместени (nkb.js → NKB.depts) */
.mega__col a.mega__sub { position: relative; padding: 4px 0 4px 16px; font-size: var(--t-xs, .8125rem); color: var(--muted); }
.mega__col a.mega__sub::before { content: ''; position: absolute; left: 3px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--red); }
/* „Клиники“: по-нисък, правоъгълен - болничното лечение в две колони, клиниката заедно с отделенията си */
.mega__in--wide { grid-template-columns: minmax(0, 2.3fr) minmax(0, 5.4fr) minmax(0, 2.6fr); padding-block: 32px 36px; }
.mega__in--wide .mega__col a:not(.mega__sub) { padding: 6px 0; }
.mega__col--2 .mega__list { columns: 2; column-gap: var(--gap); }
.mega__grp { break-inside: avoid; padding-bottom: 4px; }
.mega__mini { display: grid; gap: 6px; margin-top: 24px; padding: 18px 20px; border-radius: var(--r-md); background: var(--paper); max-width: 34ch; }
.mega__mini b { font-weight: 500; font-size: 1.0625rem; color: var(--ink); }
.mega__mini > span:not(.label) { font-size: var(--t-xs, .8125rem); color: var(--muted); }
.mega__mini .link-arrow { font-size: var(--t-sm); color: var(--ink); margin-top: 4px; }
.mega__col a.mega__sub:hover { color: var(--ink); }
details a.mega__sub { position: relative; padding-left: 18px !important; font-size: .875rem; opacity: .85; }
details a.mega__sub::before { content: ''; position: absolute; left: 4px; top: 50%; width: 5px; height: 5px; margin-top: -2.5px; border-radius: 50%; background: var(--red); }

/* Интерактивна карта - покана и връзки към мястото на звеното */
.mapcard { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 28px 32px; border-radius: var(--r-lg); background: var(--white); border: 1px solid var(--line-2); color: var(--ink); transition: border-color var(--d-fast), box-shadow var(--d-fast); }
.mapcard:hover { border-color: var(--line); box-shadow: 0 10px 30px -18px rgba(11, 22, 38, .35); }
.mapcard__ico { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: rgba(227, 6, 19, .07); color: var(--red); }
.mapcard__ico .i { width: 28px; height: 28px; }
.mapcard__t { display: grid; gap: 8px; }
.mapcard__t b { font-weight: 500; }
@media (max-width: 760px) { .mapcard { grid-template-columns: 1fr; padding: 24px; gap: 16px; } .mapcard__ico { width: 52px; height: 52px; } .mapcard .btn { justify-self: start; } }
.kv__map { display: inline-flex; align-items: center; gap: 6px; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.kv__map:hover { text-decoration-color: currentColor; }
.kv__map .i { width: 14px; height: 14px; color: var(--red); }
.dcard__map .i { width: 15px; height: 15px; color: var(--red); }

/* Контакти - адрес над интерактивната карта */
.kmap__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 24px 48px; }
.kmap__head .visit__btns { margin: 24px 0 0; }
.kmap__head .contact { max-width: 420px; }
.kmap { margin-top: 48px; }
.kmap__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; margin-bottom: 16px; }
.kmap__note { flex: 1; min-width: 260px; font-size: var(--t-sm); color: var(--muted); }
.kmap .m3 { margin: 0; height: min(720px, calc(100vh - var(--header-h) - 60px)); }

/* Новина без снимка (част от архива): заместител с логото на НКБ */
.news-ph { display: grid; place-items: center; width: 100%; height: 100%; background: radial-gradient(120% 90% at 30% 20%, #F3E6E2 0%, var(--paper) 60%); color: rgba(227, 6, 19, .35); }
.news-ph .i { width: 34%; height: 34%; max-width: 96px; max-height: 96px; stroke-width: 1; }
.art-latest__img .news-ph .i, .newsx__thumb .news-ph .i { width: 28px; height: 28px; }

/* Тесни телефони (≤ 380 px, напр. iPhone SE / 320 px): заглавката се побира - името на болницата се скрива, логото, търсенето, „Спешно“ и менюто остават */
@media (max-width: 380px) {
  .brand__name { display: none !important; }
  .hdr__in { gap: 8px; }
  .hdr__tools { gap: 6px; }
  .hdr__sos { padding: 0 12px; }
}
/* общото търсене на телефон: подсказката се вижда цялата, без излишния клавиш „/“ */
@media (max-width: 760px) {
  .search__box .kbd { display: none; }
  .search--xl .search__box { padding-left: 20px; padding-right: 16px; gap: 12px; }
  .search--xl .search__input { font-size: 1.05rem; }
}
/* Тесни телефони: дълъг надпис на бутон се пренася на нов ред, вместо да излиза от екрана */
@media (max-width: 380px) { .btn:not(.btn--sm) { max-width: 100%; white-space: normal; text-align: center; height: auto; min-height: 52px; padding-top: 10px; padding-bottom: 10px; } }

/* „Powered by Medboard“ - в края на долния ред на футъра, след правните линкове (както на nursing-bg.com) */
.ftr__powered { display: flex; align-items: center; gap: 10px; margin: 0; padding-left: 24px; border-left: 1px solid var(--night-line); color: var(--night-muted); white-space: nowrap; }
.ftr__powered a { display: inline-flex; opacity: .9; transition: opacity var(--d-fast); }
.ftr__powered a:hover { opacity: 1; }
.ftr__powered img { height: 22px; width: auto; display: block; }
@media (max-width: 1100px) { .ftr__powered { flex-basis: 100%; padding-left: 0; border-left: 0; } }
.ftr__end { display: flex; align-items: center; flex-wrap: wrap; gap: 16px 24px; }
