/* ==========================================================================
   The desktop bar across the top of the window (owner's design, 2026-11-21;
   shared with the pages beyond chat from 2026-11-22).

   Markup: templates/components/chat_desk_bar.html. Places to go on the left,
   with a line under the current one; the support and account links on the
   right. static/chat_desk.js folds places that do not fit under "More" and
   widens the row past --desk-card-w when the links need it.

   Scope: every rule is inside @media (min-width: 601px) and scoped to
   body.desk-bar, so nothing here reaches a phone (600px and below) or a page
   without the bar; the one base rule keeps the bar itself out of the phone
   layout. The sheet is linked only while the switch is on (desk_bar_on() in
   app.py: CHAT_DESKTOP_LAYOUT_ENABLED or ?chat_desk_preview=1, with the phone
   menu's switch). What a page adds
   around the bar (its own top padding, the chat page's menu button and
   docked chat list) is in that page's sheet, e.g. chat_desktop.css.

   Colours: this file is a source of scripts/build_dark_css.py; the bar's wash
   and line are chosen by hand in static/css/dark_extra.css. Media queries
   are kept flat (never nested).
   ========================================================================== */

/* Rendered only while the switch is on; shown only above 600px. */
.chat-desk-bar {
  display: none;
}

@media (min-width: 601px) {
  body.desk-bar {
    --desk-bar-h: 60px;
    /* The chat page's docked chat list moves the bar's row with the page
       (chat_desktop.css sets it to 300px while the list is open). */
    --desk-dock: 0px;
    /* The bar's row: as wide as the chat page's card until its links need
       more room (chat_desk.js then sets --desk-row-w on <body>). */
    --desk-card-w: 920px;
    --desk-row-w: var(--desk-card-w);
  }

  body.desk-bar .chat-desk-bar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 90;
    display: block;
    box-sizing: border-box;
    height: var(--desk-bar-h);
    padding-left: var(--desk-dock);
    /* The bar's own font, the one Tailwind's `font-sans` gives the pages
       that have it on <body>: the Character Library does not (it falls
       back to the base 'Segoe UI', Tahoma… stack), and there the bar's
       links were in another typeface and up to 23px off where they are
       everywhere else. Its links and buttons inherit from here. */
    font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    /* The page's own gradient through a light wash: a lighter band of the
       background, not a third colour (the owner's objection to a flat tint). */
    background: rgba(255, 255, 255, 0.55);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(138, 60, 200, 0.16);
    transition: padding-left 0.3s ease;
  }

  body.desk-bar .chat-desk-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-sizing: border-box;
    width: min(var(--desk-row-w), calc(100% - 40px));
    height: 100%;
    margin: 0 auto;
  }

  /* The places start 74px in on every page: on the chat page that is the
     room for the chat list's menu button (40px, then one link gap), which
     sits over the row's left end; the other pages have no button there and
     leave the same room, so the links are in the same place on every page
     (owner, 2026-11-23). */
  body.desk-bar .chat-desk-places {
    display: flex;
    flex: none;
    align-items: center;
    gap: 34px;
    padding-left: 74px;
  }

  body.desk-bar .chat-desk-account {
    display: flex;
    flex: none;
    align-items: center;
    gap: 30px;
  }

  body.desk-bar .chat-desk-bar .chat-desk-link {
    position: relative;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: #8a3cc8;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
  }

  body.desk-bar .chat-desk-bar .chat-desk-link:hover {
    color: #6b21a8;
  }

  body.desk-bar .chat-desk-bar .chat-desk-link:focus-visible {
    outline: 2px solid #7e22ce;
    outline-offset: 5px;
    border-radius: 4px;
  }

  body.desk-bar .chat-desk-bar .chat-desk-link.support-link {
    color: #c42a63;
  }

  body.desk-bar .chat-desk-bar .chat-desk-link.support-link:hover {
    color: #9f1c4b;
  }

  /* The current page: a line under the word, drawn around it so the word
     sits level with the others (the owner chose the line over a pill). */
  body.desk-bar .chat-desk-bar .chat-desk-link.is-current::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: -9px;
    left: 0;
    height: 2px;
    border-radius: 2px;
    background: #8a3cc8;
  }

  /* The longest wordings and their short forms (below 901px, further down). */
  body.desk-bar .chat-desk-bar .chat-desk-narrow {
    display: none;
  }

  /* "More": places that do not fit (static/chat_desk.js moves them). */
  body.desk-bar .chat-desk-more {
    position: relative;
    display: block;
  }

  body.desk-bar .chat-desk-more[hidden] {
    display: none;
  }

  body.desk-bar .chat-desk-bar .chat-desk-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  /* Clear of the bar's bottom line (the button's text is 16px tall in a
     60px bar: 22px below it is the line, then 8px). */
  body.desk-bar .chat-desk-more-menu {
    position: absolute;
    top: calc(100% + 30px);
    left: -14px;
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 180px;
    padding: 8px;
    border: 1px solid #e5def2;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(40, 20, 80, 0.14);
  }

  body.desk-bar .chat-desk-more-menu[hidden] {
    display: none;
  }

  body.desk-bar .chat-desk-bar .chat-desk-more-menu .chat-desk-link {
    padding: 10px 12px;
    border-radius: 8px;
    line-height: 1.2;
  }

  body.desk-bar .chat-desk-bar .chat-desk-more-menu .chat-desk-link:hover {
    background: #f3ebfc;
  }
}

/* ---- 601px to 900px: tighter gaps, and the long wordings use the phone's
   short forms ("Support us" or a donor's "Thank you", and "Log in") ---- */
@media (min-width: 601px) and (max-width: 900px) {
  body.desk-bar .chat-desk-places {
    gap: 26px;
    padding-left: 66px;
  }

  body.desk-bar .chat-desk-account {
    gap: 26px;
  }

  body.desk-bar .chat-desk-bar .chat-desk-wide {
    display: none;
  }

  body.desk-bar .chat-desk-bar .chat-desk-narrow {
    display: inline;
  }
}
