/* header.css – Top bar: logo, search field, tabs, sync status and account menu */

header {
  background: var(--hdr);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 16;
  border-bottom: 1px solid var(--line);
}
.top {
  display: flex;
  gap: 20px;
  align-items: center;
  height: var(--hh);
  padding: 0 24px;
  max-width: 1700px;
  margin: auto;
}
.top h1 {
  font: 700 20px/1 var(--serif);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.wm {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.lg {
  height: 26px;
  width: 26px;
  flex: none;
  display: block;
}
.sw {
  position: relative;
  flex: 1;
  max-width: 480px;
}
.sw input {
  width: 100%;
  padding: 6px 14px;
  border-radius: 99px;
  border: 1px solid var(--edge);
  background: var(--panel);
  font-size: 13px;
}
.syn {
  font-size: 12px;
  color: var(--faint);
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
#acctbar {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
#tabs .tbtn {
  border: 1px solid var(--edge);
  background: var(--panel);
  color: var(--ink);
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 8px;
}
#tabs .tbtn:hover {
  background: var(--sub);
}
#tabs .tbtn.on {
  background: var(--acc);
  color: var(--accInk);
  border-color: var(--acc);
}
#tabs .bdg {
  background: var(--accInk);
  color: var(--acc2);
}
#tabs .tbtn.on .bdg {
  background: var(--accInk);
  color: var(--ink);
}
.tbtn {
  background: none;
  border: 1px solid transparent;
  color: var(--mute);
  border-radius: 6px;
  padding: 3px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tbtn:hover {
  color: var(--ink);
  background: var(--sub);
}
.tbtn.on {
  color: var(--ink);
  background: var(--sub);
}
.wm {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
}
.acct {
  position: relative;
}
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--pan2);
  border: 1px solid var(--edge);
  border-radius: 8px;
  box-shadow: 0 10px 26px var(--cs2);
  padding: 4px;
  min-width: 180px;
  z-index: 10;
  display: flex;
  flex-direction: column;
}
.menu[hidden] {
  display: none;
}
.menu button {
  background: none;
  border: 0;
  text-align: left;
  padding: 6px 10px;
  border-radius: 5px;
  color: var(--ink);
}
.menu button:hover {
  background: var(--sub);
}
.menu hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 0;
  width: 100%;
}
@media (max-width: 760px) {
  .top {
    flex-wrap: wrap;
    gap: 8px;
    height: auto;
    padding: 8px 12px;
  }
}
.bdg {
  display: inline-block;
  min-width: 16px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--acc);
  color: var(--accInk);
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.rfb {
  padding: 4px 7px;
  display: inline-flex;
  align-items: center;
}
.rfb.spin svg {
  animation: rot 0.8s linear infinite;
}
@keyframes rot {
  to {
    transform: rotate(360deg);
  }
}
/* top bar as sections */
.top {
  gap: 0;
  padding: 0 0 0 24px;
  align-items: stretch;
}
.top > * {
  display: flex;
  align-items: center;
}
.top .wm {
  padding: 0 22px 0 0;
  border-right: 1px solid var(--edge);
}
.top .sw {
  flex: 1;
  max-width: 520px;
  padding: 0 20px;
  border-right: 1px solid var(--edge);
}
.sw input {
  background: var(--bg);
}
#tabs {
  gap: 0;
  align-items: stretch;
}
#tabs .tbtn {
  height: 100%;
  border: 0;
  border-right: 1px solid var(--edge);
  border-radius: 0;
  background: none;
  color: var(--mute);
  font-weight: 600;
  padding: 0 22px;
  box-shadow: inset 0 -2px 0 transparent;
}
#tabs .tbtn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
}
#tabs .tbtn.on {
  background: rgba(255, 255, 255, 0.07);
  color: var(--ink);
  border-color: var(--edge);
  box-shadow: inset 0 -2px 0 var(--acc);
}
#tabs .bdg,
#tabs .tbtn.on .bdg {
  background: var(--acc);
  color: var(--accInk);
}
#acctbar {
  padding: 0 24px 0 16px;
  border-left: 1px solid var(--edge);
}
@media (max-width: 760px) {
  .top {
    padding: 0 0 0 12px;
  }
  .top .sw {
    flex: 1 1 100%;
    order: 5;
    padding: 6px 12px;
    max-width: none;
    border-right: 0;
  }
  #tabs .tbtn {
    padding: 10px 14px;
  }
}
#tabs .tbtn {
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: inline-block;
  line-height: 46px;
}
.bigback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px 0 0;
  margin-right: 16px;
  border: 0;
  border-right: 1px solid var(--edge);
  background: none;
  color: var(--acc2);
  cursor: pointer;
}
.bigback[hidden],
.lg[hidden] {
  display: none;
}
.bigback:hover {
  color: #fff;
}
.bigback svg {
  width: 30px;
  height: 30px;
  flex: none;
}
#acctbar #soc {
  font-weight: 600;
  color: var(--mute);
  padding: 6px 12px;
  border-radius: 6px;
}
#acctbar #soc:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
}
#acctbar #soc.on {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.09);
}
.who {
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  border-left: 1px solid var(--edge);
  border-right: 1px solid var(--edge);
  font: 700 17px var(--serif);
  color: var(--ink);
  white-space: nowrap;
}
.menu .danger {
  color: #ff8a80;
}
.menu .danger:hover {
  background: rgba(255, 90, 70, 0.14);
  color: #ffb4ab;
}

/* ---- Narrow windows and phones ----------------------------------------
   Row 1: menu button, logo, refresh and account. Row 2: the search field.
   The tabs and "Socialt" move into the menu (#navm, built in nav.js). */
.navm {
  display: none;
  position: relative;
}
.navbtn {
  position: relative;
  padding: 8px 10px;
  color: var(--ink);
}
.navbtn .bdg {
  position: absolute;
  top: 2px;
  right: 0;
}
.navlist {
  left: 4px;
  right: auto;
  top: calc(100% - 4px);
  min-width: 210px;
}
.navlist button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  font-weight: 600;
  color: var(--mute);
}
.navlist button.on {
  color: var(--ink);
  background: var(--sub);
  box-shadow: inset 2px 0 0 var(--acc);
}
.navsync {
  margin: 2px 12px 6px;
  font-size: 12px;
  color: var(--faint);
}
@media (max-width: 900px) {
  :root {
    --hh: 92px; /* two rows */
  }
  body.ro {
    --hh: 46px; /* no search row while viewing a friend's library */
  }
  .top {
    flex-wrap: wrap;
    height: auto;
    padding: 0 0 0 4px;
  }
  .navm {
    display: flex;
    align-items: center;
    height: 46px;
  }
  .bigback {
    height: 46px;
    padding: 0 8px;
    margin: 0;
    border-right: 0;
  }
  .bigback svg {
    width: 24px;
    height: 24px;
  }
  /* Smaller logo and title, so that on iPhones they end before the camera
     cut-out (notch / Dynamic Island) in the middle of the top edge. */
  .top .wm {
    height: 46px;
    gap: 6px;
    padding: 0 8px 0 0;
    border-right: 0;
  }
  .top .lg {
    width: 20px;
    height: 20px;
  }
  .top h1 {
    font-size: 15px;
    letter-spacing: -0.015em;
  }
  .navbtn {
    padding: 8px 7px;
  }
  #tabs,
  #acctbar #soc,
  #acctbar #sync {
    display: none;
  }
  #acctbar {
    height: 46px;
    margin-left: auto;
    padding: 0 10px 0 4px;
    gap: 2px;
    border-left: 0;
  }
  #swu .un {
    max-width: 28vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .top .sw {
    flex: 1 1 100%;
    order: 5;
    height: 46px;
    max-width: none;
    padding: 0 12px 8px;
    border-right: 0;
  }
  #dd {
    left: 12px;
    right: 12px;
    top: calc(100% - 6px);
  }
}

/* ---- iPhone safe areas: keep clear of the status bar, camera cut-out and home bar ---- */
/* The header's background reaches the top edge; its contents start below the
   status bar, and in landscape beside the camera cut-out. */
header {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0
    env(safe-area-inset-left);
}
