/* LUNEA KOSA — unified.css
 * Additive layer on top of assets/css/main.css. Injected by assets/js/core.js
 * (resolved against the SCRIPT url, so it also works from /xx/ intl pages).
 *
 * Scope: shared chrome hooks and scoped international template integration.
 * 3A shipped the provisional rules, 3B refined the nav + mobile menu, 3C added
 * the market switcher. Tokens only, no !important — every rule here wins on
 * load order alone, so the injected <link data-unified> must stay last.
 *
 * Why each rule exists:
 *  - main.css:206-207 rotates .nav__link .i only on .nav__item:hover, but the
 *    "Više" trigger becomes a <button aria-expanded>, driven by JS not hover.
 *  - main.css:258 makes EVERY <a> inside .mobile-menu__links serif 38px, so
 *    sub-lists and the market list must opt out / live outside that container.
 */

/* ---------------- Desktop: JS-driven dropdown ---------------- */

/* Chevron state for the <button> trigger (keyboard + click, not just hover). */
.nav__link[aria-expanded="true"] .i { transform: rotate(180deg); }

/* The Više / market-switcher panel. Same look as main.css:208-218 .mega,
   but opened by toggling [hidden] in JS instead of CSS :hover. */
.nav__panel {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 60;
  min-width: 220px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(20, 20, 22, .96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.nav__panel a {
  padding: 9px 12px;
  border-radius: var(--radius-xs);
  font-family: var(--sans);
  font-size: 13px;
  color: var(--text-2);
  transition: color .2s var(--ease), background-color .2s var(--ease);
}

.nav__panel a:hover,
.nav__panel a:focus-visible { color: var(--text); background: var(--bg-3); }

.nav__panel a[aria-current] { color: var(--gold); }

/* ---------------- Desktop: market switcher ---------------- */

/* The switcher sits in .header-actions (not .nav), so it needs .nav__item's
   position:relative itself to anchor the absolutely-positioned panel. */
.nav__switcher { position: relative; }

/* The trigger is .nav__link, which main.css:194 gives height:var(--header-h) and
   padding:0 14px — correct here. Only the compact code needs tightening. */
.nav__switcher .nav__link { padding: 0 10px; gap: 4px; font-size: 12px; letter-spacing: .08em; }

/* Right-anchored: the switcher is the leftmost item in .header-actions, so a
   left-anchored panel would hang over the search/cart icons. */
.nav__panel--markets { left: auto; right: 0; min-width: 260px; }

.nav__panel-title {
  padding: 4px 12px 8px;
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold);
}

/* Row: CODE — label — currency. The label takes the slack so the currency
   stays flush right and the column of codes reads straight down. */
.nav__panel .market { display: flex; align-items: center; gap: 10px; }

.nav__panel .market__code {
  min-width: 26px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--muted);
}

.nav__panel .market__label { flex: 1; }

.nav__panel .market__cur { font-size: 11px; letter-spacing: .08em; color: var(--muted); }

.nav__panel .market:hover .market__code,
.nav__panel .market[aria-current] .market__code { color: inherit; }

/* "Sva tržišta" — separated from the market rows, it is a different kind of target. */
.nav__panel-all {
  margin-top: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

/* ---------------- Mobile menu add-ons ---------------- */

/* Sub-list inside .mobile-menu__links: opt out of the serif 38px cascade.
   3B: the "Više" row above it is an hrefless <a>, so it keeps main.css:258's serif
   row styling and the --i stagger while being skipped by core.js's a[href] handler. */
.mobile-menu__sub {
  display: flex;
  flex-direction: column;
  padding-left: 18px;
  margin: 8px 0 4px;
  border-left: 1px solid var(--line);
}

/* Ties main.css:258 on specificity (0,1,1) and wins on load order. That rule also
   sets display:flex, justify-content:space-between, padding:10px 0 and a
   border-bottom, which a nested sub-list must not inherit — reset them here. */
.mobile-menu__sub a {
  font-family: var(--sans);
  font-size: 22px;
  line-height: 1.5;
  letter-spacing: 0;
  color: var(--text-2);
  justify-content: flex-start;
  padding: 7px 0;
  border-bottom: 0;
}

.mobile-menu__sub a:hover,
.mobile-menu__sub a:focus-visible { color: var(--gold); }

/* Market list. Lives OUTSIDE .mobile-menu__links (same cascade reason)
   and BEFORE .mobile-menu__foot, which keeps its margin-top:auto (main.css:265). */
.mobile-menu__markets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 24px;
  margin-top: 24px;
  border-top: 1px solid var(--line-2);
}

.mobile-menu__markets > a {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 14px;
  color: var(--muted);
  transition: color .2s var(--ease), border-color .2s var(--ease);
}

.mobile-menu__markets > a:hover,
.mobile-menu__markets > a:focus-visible { color: var(--gold-hi); border-color: var(--gold); }

.mobile-menu__markets > a[aria-current] { color: var(--gold); border-color: var(--gold); }

/* Pills are compact (code + currency, label in aria-label) so all 7 markets wrap
   into a tidy block at 390px instead of forcing a horizontal scroll. */
.mobile-menu__markets > a { display: inline-flex; align-items: center; gap: 7px; }

.mobile-menu__markets .market__code { font-weight: 600; letter-spacing: .1em; }

.mobile-menu__markets .market__cur { font-size: 11px; letter-spacing: .06em; opacity: .7; }

/* ---------------- Intl chrome (core.js chromeIntl) ---------------- */

/* chromeIntl() emits no announce bar, but main.css:173 pins .site-header to
   top:var(--announce-h) (36px, 32px below 760px) and main.css:715/749 pad the page
   heroes by the same token — all of which would reserve space for a bar that does
   not exist. Zeroing the TOKEN instead of overriding each consumer keeps every one
   of those calc()s correct with no further rules. .is-intl is set on <html> by
   chromeIntl() before the header markup is inserted. */
.is-intl { --announce-h: 0px; }

/* main.css:697 is a 4-column grid built for the BA brand block + Shop/Usluge/Pomoć.
   The intl footer has exactly 2 children, so columns 3 and 4 would be empty and the
   brand column would be squeezed to 1.4fr of the full width. */
.footer__grid--intl { grid-template-columns: 1.4fr 1fr; }

/* ---------------- Breakpoint ---------------- */

/* Below 1180px main.css:858 hides .nav entirely; the switcher moves into the
   mobile menu, so its desktop host must not linger in the header. */
@media (max-width: 1180px) {
  .nav__switcher { display: none; }
}

/* The tight band. MEASURED: at exactly 1181px the pre-3C header already fitted with
   0px to spare (scrollWidth === clientWidth === 1181), because main.css:185 is a
   grid `auto 1fr auto` whose middle column cannot shrink below the nav's min-content
   width, and main.css:861 only drops the 196px .header-cta below 1180px. Adding the
   55px switcher therefore overflowed by 47px.
   Fix by reclaiming padding rather than removing anything: between 1181px and 1340px
   the nav gets tighter link padding and the header a smaller column gap. Nothing is
   hidden — at these widths .burger is still display:none, so a hidden switcher would
   be unreachable entirely. Below 1181px the media query above takes over. */
@media (min-width: 1181px) and (max-width: 1340px) {
  .site-header__inner { gap: 16px; }
  .nav__link { padding: 0 9px; }
  .nav__switcher .nav__link { padding: 0 7px; }
}

/* ---------------- Real international templates (Phase 7) ---------------- */
/* Nested pages place breadcrumbs before their hero. Reserve the fixed header
   once, above the crumbs, rather than hiding them under the generated chrome. */
.is-intl body[data-page="intl"] .intl-crumbs {
  padding-top: calc(var(--header-h) + 26px);
}
.is-intl body[data-page="intl"] .intl-crumbs + .page-hero {
  padding-top: 40px;
}
body[data-page="intl"] #intl-main { overflow-wrap: anywhere; }
body[data-page="intl"] .intl-home-hero {
  background: radial-gradient(ellipse at 85% 15%, rgba(201, 166, 107, .12), transparent 60%);
  border-bottom: 1px solid var(--line);
}
body[data-page="intl"] .intl-home-hero h1 { max-width: 16ch; }
body[data-page="intl"] .intl-home-pillars .intl-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
body[data-page="intl"] .intl-home-pillars .intl-card a {
  padding: clamp(24px, 3vw, 48px);
  border-color: var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  gap: 20px;
}
body[data-page="intl"] .intl-home-pillars .intl-card a:hover,
body[data-page="intl"] .intl-home-pillars .intl-card a:focus-visible {
  border-color: var(--gold);
}
body[data-page="intl"] .intl-home-pillars h3 {
  font-size: clamp(30px, 3vw, 48px);
  color: var(--text);
}
body[data-page="intl"] .intl-home-pillars .intl-card p { color: var(--text-2); }
/* Existing templates use btn--primary, which main.css does not define.
   Give that legacy modifier the existing gold treatment only in intl content. */
body[data-page="intl"] .btn--primary {
  background: var(--gold-grad);
  color: #17130d;
  box-shadow: 0 14px 40px -14px rgba(201, 166, 107, .55);
}
body[data-page="intl"] .intl-market-directory {
  padding: 40px 0;
  border-top: 1px solid var(--line);
}
body[data-page="intl"] .intl-market-directory .intl-brand__mark { color: var(--text); }
/* Academy hub (Phase 12): topic cards grouped into route-map clusters. */
body[data-page="intl"] .intl-academy-cluster + .intl-academy-cluster {
  margin-top: clamp(48px, 6vw, 80px);
}
@media (max-width: 760px) {
  body[data-page="intl"] .intl-home-pillars .intl-cards { grid-template-columns: minmax(0, 1fr); }
  body[data-page="intl"] .footer__grid--intl { grid-template-columns: minmax(0, 1fr); }
}
