/* -------------------------------------------------------------------------- */
/* #topnavigation Formatting */
/* -------------------------------------------------------------------------- */

/* Keep the top navigation on the top of the page and make sure it displays
above other things that may overlap with it on the screen. */
#topnav
{
  background-color: var(--color-background);
  position: sticky;
  top: 0;
  padding-top: 0.5rem;
  z-index: 10;
}

#topnav > nav
{
  margin-bottom: -1px;
  z-index: 10;
  display: flow-root;        /* unchanged */
  position: relative;        /* anchor for absolutely-positioned portrait widget */
}

#topnav a
{
  text-decoration: none;
}

/* ── Tab list ────────────────────────────────────────────────────────────── */

/* Was: no rule for the outer ul. Now we give it list-reset and clear the
   implicit margin/padding browsers add to ul elements. */
#topnav-tabs
{
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ── Individual tabs ─────────────────────────────────────────────────────── */

/* Was: #topnav .toptab  (targeted ul.toptab — the old broken inner lists).
   Now: li.toptab — each tab is a proper list item. float/font rules unchanged. */
#topnav li.toptab
{
  float: left;
  font-family: redressed;
  font-style: italic;
  font-size: 1.2rem;
}

#topnav li.toptab:hover
{
  border-color: var(--color-border);
}

#topnav li.toptab.current,
#topnav li.toptab.section
{
  background: var(--color-border);
}

/* Was: #topnav .toptab > li  (the link inside the inner ul).
   Now: the anchor is a direct child of li.toptab, so we target that. */
#topnav li.toptab > a
{
  display: block;        /* makes the whole tab area clickable, not just the text */
  margin: .5rem;
}

/* Was: #topnav .toptab:first-of-type
   first-of-type on li won't behave correctly for mixed content, so we use
   first-child instead. */
#topnav li.toptab:first-child
{
  margin-left: .75rem;
}

/* ── Dropdown panel ──────────────────────────────────────────────────────── */

/* Unchanged visually. The selector now anchors to #topnav to be specific,
   but the rule itself is the same. */
#topnav .dropdown-content
{
  background: var(--color-primary2);
  border-style: ridge;
  border-width: medium;
  border-color: var(--color-secondary2);
  border-radius: .5rem;
  padding: .5rem;
}

/* Dropdown items need list-reset too. */
#topnav .dropdown-content
{
  list-style: none;
}

/* ── Hamburger button (hidden on desktop) ────────────────────────────────── */

#topnav-hamburger
{
  display: none;          /* hidden unless the mobile breakpoint fires */
  cursor: pointer;
  padding: .5rem .75rem;
  font-size: 1.4rem;
  background: none;
  border: none;
  color: var(--color-text-highlight);
  float: left;
}

/* ── Mobile breakpoint ───────────────────────────────────────────────────── */

@media (max-width: 680px)
{
  #topnav-hamburger
  {
    display: block;
  }

  #topnav-tabs
  {
    display: none;
    flex-direction: column;
    background-color: var(--color-background);
    padding: .5rem 0;
    clear: both;            /* clears the floated hamburger button */
  }

  #topnav-tabs.open
  {
    display: flex;
  }

  #topnav li.toptab
  {
    float: none;
    border-radius: 0;
    border-width: 0 0 1px 0;
    border-color: var(--color-border);
    margin-left: 0;
  }

  #topnav li.toptab:first-child
  {
    margin-left: 0;         /* override the desktop left indent */
  }

  /* On mobile, dropdown panels are static (no absolute positioning) and
     always visible under their parent tab. */
  #topnav .dropdown-content
  {
    position: static;
    display: block;
    padding-left: 1.5rem;
    background: none;
    border: none;
    box-shadow: none;
  }
}

/* ── Active character portrait widget ───────────────────────────────────── */

#nav-character-widget
{
  position: absolute;   /* taken out of flow so it can't affect nav bar height */
  right: .5rem;
  top: -0.125rem;
}

.nav-character-portrait
{
  position: relative;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 20%;
  overflow: visible;
  border: 1px solid var(--color-decoration-dark);
  background: var(--color-primary4);
  transition: border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-character-portrait:hover
{
  border-color: var(--color-decoration);
}

.nav-character-portrait img
{
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20%;
  display: block;
}

.nav-character-portrait > span
{
  font-size: .6rem;
  color: var(--color-text-dimmed);
  font-family: 'courgette';
}

/* ── Notification count badge ───────────────────────────────────────────── */

.notification-badge
{
  background-color: var(--color-decoration);
  color: var(--color-background) !important;
  border-radius: 9999px;
  font-size: 0.65rem;
  font-style: normal;
  font-family: sans-serif !important;
  font-weight: bold;
  line-height: 1;
  min-width: 1rem;
  padding: .1rem .25rem;
  text-align: center;
  position: absolute;
  top: -.3rem;
  right: -.3rem;
  z-index: 1;
}

/* ── Portrait button reset ──────────────────────────────────────────────── */

.nav-character-portrait-btn
{
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: block;
  line-height: 0;       /* prevent the button from adding extra height around the portrait */
  vertical-align: top;  /* suppress inline-block baseline gap */
}

/* ── Character dropdown menu ─────────────────────────────────────────────── */

.nav-character-menu
{
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 10rem;
  background: var(--color-primary2);
  border-style: ridge;
  border-width: medium;
  border-color: var(--color-secondary2);
  border-radius: .5rem;
  padding: .4rem .25rem;
  z-index: 20;          /* above sticky nav */
}

/* Direct-child links only (Dashboard, Log out) — chips are handled separately */
.nav-character-menu > a
{
  display: block;
  padding: .3rem .6rem;
  font-family: redressed;
  font-style: italic;
  font-size: 1.1rem;
  color: var(--color-text-normal);
  text-decoration: none;
  white-space: nowrap;
  border-radius: .3rem;
}

.nav-character-menu > a:hover
{
  color: var(--color-highlight);
}

.nav-character-menu hr
{
  border: none;
  border-top: 1px solid var(--color-border);
  margin: .3rem .4rem;
}

.nav-menu-section-label
{
  display: block;
  padding: .15rem .6rem;
  font-size: 0.7rem;
  font-family: sans-serif;
  font-style: normal;
  color: var(--color-text-dimmed);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Chip container inside the menu */
.nav-chips
{
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: .3rem .4rem;
}

/* Character chip links — full-width rows for consistent layout */
a.nav-character-chip
{
  width: 100%;
  box-sizing: border-box;
  text-decoration: none;
  cursor: pointer;
  white-space: normal;    /* allow name to wrap rather than overflow */
  align-items: center;    /* keep icon centred against two text lines */
}

a.nav-character-chip:hover
{
  border-color: var(--color-decoration-dark);
  color: var(--color-highlight);
}

a.nav-character-chip.active
{
  border-color: var(--color-decoration);
  color: var(--color-decoration);
}

/* Two-line text block inside the chip */
.nav-character-chip .chip-text
{
  display: flex;
  flex-direction: column;
  gap: .05rem;
}

.nav-character-chip .chip-name
{
  line-height: 1.2;
}

.nav-character-chip .chip-server
{
  font-size: .6rem;
  color: var(--color-text-dimmed);
  line-height: 1.2;
}

a.nav-character-chip.active .chip-server
{
  color: var(--color-decoration-dark);
}

/* ── Bottom decorative bar ───────────────────────────────────────────────── */

#nav-bottom
{
  height: var(--border-radius);
  background-color: var(--color-border);
  border-top-left-radius: var(--border-radius);
  border-top-right-radius: var(--border-radius);
}