/* Рамката на портала: черната горна лента (марка, навигация с икони, „Нова карта“, кой е вписан),
   съдържанието и заглавието на страницата (долната лента е в layout.css). Черното е еднакво в двете
   теми — като лентата на витрината, за да е ясно, че е едно място. */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bar);
  color: var(--bar-fg);
  border-bottom: 1px solid var(--bar-edge);
}

.topbar :focus-visible {
  outline-color: var(--bar-fg);
}

.topbar__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0 28px;
  max-width: 1200px;
  min-height: 64px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand__text {
  display: grid;
  line-height: 1.1;
  white-space: nowrap;
}

.brand__name {
  font-family: var(--font-cond);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.brand__product {
  font-size: 0.8125rem;
  color: var(--bar-muted);
}

.nav {
  container: topnav / inline-size;
  display: flex;
  align-self: stretch;
  gap: 2px;
  min-width: 0;
}

.nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--bar-muted);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}

.nav .icon {
  width: 18px;
  height: 18px;
}

.nav a:hover {
  color: var(--bar-fg);
}

.nav a[aria-current='page'] {
  color: var(--bar-fg);
  box-shadow: inset 0 -3px 0 var(--bar-fg);
}

/* Когато мястото не стига за икони и имена (най-много точки има MASTER), иконите отпадат първи. */
@container topnav (max-width: 720px) {
  .nav[data-count='6'] .icon,
  .nav[data-count='5'] .icon {
    display: none;
  }
}

@container topnav (max-width: 520px) {
  .nav .icon {
    display: none;
  }
}

.nav__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bar-fg);
  color: var(--bar);
  font-size: 0.75rem;
  font-weight: 700;
}

.topbar__end {
  display: flex;
  align-items: center;
  gap: 10px;
}

.who {
  display: grid;
  text-align: right;
  line-height: 1.15;
  color: inherit;
  text-decoration: none;
  padding: 4px 8px;
  border-radius: var(--radius);
}

.who:hover .who__name {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.who__name {
  font-weight: 600;
  max-width: 18ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.who__role {
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8125rem;
  color: var(--bar-muted);
}

.topbar__account {
  display: none;
}

/* Под 1280 px името на вписания отстъпва на иконката на акаунта; под 1100 px навигацията слиза на
   втори ред и се плъзга. */
@media (max-width: 1279px) {
  .who {
    display: none;
  }

  .topbar__account {
    display: inline-flex;
  }
}

@media (max-width: 1099px) {
  .topbar__inner {
    grid-template-columns: 1fr auto;
    min-height: 0;
    padding-top: 8px;
  }

  .nav {
    grid-column: 1 / -1;
    grid-row: 2;
    overflow-x: auto;
    margin: 6px calc(var(--gutter) * -1) 0;
    padding: 0 calc(var(--gutter) - 9px);
    border-top: 1px solid var(--bar-line);
    scrollbar-width: none;
  }

  .nav a {
    min-height: 46px;
  }
}

@media (max-width: 479px) {
  .brand__product {
    display: none;
  }

  /* На телефон бутонът е само иконата, но името му остава за екранния четец (display: none би го
     оставил безименен). */
  .topbar__new .btn__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

.main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px var(--gutter) 72px;
}

.main--narrow {
  max-width: 820px;
}

.main:focus {
  outline: none;
}

/* Заглавието на страницата: голямо, в тесния шрифт, с тънка линия под него. */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.page-head > div > a:first-child:not(.btn) {
  display: inline-block;
  margin-bottom: 8px;
  font-size: 0.9375rem;
  color: var(--muted);
}

.page-head__sub {
  max-width: 62ch;
  margin-top: 8px;
  color: var(--muted);
}
