/* ==========================================================================
   The desktop bar on the pages beyond chat (owner, 2026-11-22): what those
   pages add around the bar. The bar itself is static/css/desk_bar.css; the
   chat page's own additions are static/css/chat_desktop.css.

   A page with the bar has `desk-bar desk-page` on its <body>, and
   `desk-light` as well where its background was not already the chat
   page's: the saturated purple (Updates, a single update, Settings, Usage,
   the Character Library, the donation pages) or the flat pale one (contact,
   install, the legal pages). The owner chose the chat page's light
   background for those ("B"), so the bar looks the same on
   every page.

   Scope: every rule is inside @media (min-width: 601px) and scoped to
   body.desk-bar.desk-page, so nothing here reaches a phone (600px and
   below), where these pages keep their own phone layouts and links, or a
   page without the bar. Linked only while the switch is on (desk_bar_on()).

   The links the bar replaces (a page's corner links, its "Back to Chat"
   button, a "Roleplay Chat" pill) stay in the page, marked `desk-bar-hidden`,
   and are hidden here: phones still use them.

   Colours: this file is a source of scripts/build_dark_css.py. Media queries
   are kept flat (never nested).
   ========================================================================== */

@media (min-width: 601px) {
  /* Room for the fixed bar, and a little air under it. The class is doubled
     on purpose: this sheet is linked before a page's own <style>, where a
     body rule of the same weight would win (Settings sets `padding: 20px`
     on body.settings-page.text-size-large, which put its card under the
     bar for a reader with a larger text size). */
  body.desk-bar.desk-page.desk-page {
    padding-top: calc(var(--desk-bar-h) + 18px);
  }

  /* What a page scrolls to the top of the window stops under the bar, not
     behind it: the Story Generator's form when a sequel is started
     (stories.html), and a story's text when its page is turned
     (story_view.html), both with scrollIntoView. */
  body.desk-bar.desk-page #story-form,
  body.desk-bar.desk-page #story-content {
    scroll-margin-top: calc(var(--desk-bar-h) + 18px);
  }

  /* The same for anything a link's #name jumps to, and anything the
     keyboard moves to: the browser brings it to the top of the window, which
     is behind the bar (an old post's link to /settings/#install-app put that
     heading under it; Shift+Tab up a long legal page left the focused link
     there). Their own scroll margin stops them under the bar. */
  body.desk-bar.desk-page [id],
  body.desk-bar.desk-page a,
  body.desk-bar.desk-page button,
  body.desk-bar.desk-page input,
  body.desk-bar.desk-page select,
  body.desk-bar.desk-page textarea,
  body.desk-bar.desk-page [tabindex] {
    scroll-margin-top: calc(var(--desk-bar-h) + 18px);
  }

  /* What sticks to the top of the window sticks under the bar: a story's
     editing toolbar (Save and Cancel, sticky at 0.5rem) slid behind the bar
     on a long story, where clicks landed on the bar. */
  body.desk-bar.desk-page .edit-toolbar {
    top: calc(var(--desk-bar-h) + 0.5rem);
  }

  /* And what appears at the top of the window appears under the bar: the
     "rewritten" message on a story (fixed at 1.5rem). */
  body.desk-bar.desk-page .rewrite-toast {
    top: calc(var(--desk-bar-h) + 12px);
  }

  /* In the bar now. */
  body.desk-bar.desk-page .desk-bar-hidden {
    display: none;
  }

  /* ---- The pages with one card on the page: contact, install, the legal
     pages, the donation pages and the Character Library (owner, 2026-11-23:
     the bar on these too) ---- */

  /* The card starts 18px under the bar, as Settings' does: the wrapper's own
     48px of top padding was the room above the "Back to Discipline Chat"
     button, which is in the bar now. */
  body.desk-bar.desk-page > .page-wrap.py-12 {
    padding-top: 0;
  }

  /* Privacy's card has a margin above it for its (hidden) text link. */
  body.desk-bar.desk-page > .page-wrap.py-12 > .desk-bar-hidden + .page-sheet {
    margin-top: 0;
  }

  /* The Character Library. Its wrapper fills the window's height and
     centres the card in it; under the bar that made every window scroll by
     the bar's height. The <body> already fills the window, so the wrapper
     is only as tall as its card, which starts at its top like the other
     pages' cards. */
  body.desk-bar.desk-page > .page-shell {
    align-items: flex-start;
    min-height: 0;
    padding-top: 0;
  }

  /* A card reached with the arrow keys or Shift+Tab is scrolled to just
     under the bar, not behind it (static/characters.js scrolls the focused
     card to the nearest edge of the window). */
  body.desk-bar.desk-page .character-card {
    scroll-margin-top: calc(var(--desk-bar-h) + 18px);
  }

  /* Its title rose 32px into the row of links above it; that row is hidden
     (both links are in the bar), so the title keeps to its own line, 20px
     from the card's top (the card's own 12px of top padding, made for that
     row, and 8px here). It was 40px, like the other cards' titles; the
     owner asked for less (2026-11-24). */
  body.desk-bar.desk-page .library-title {
    margin-top: 0.5rem;
  }

  /* The contact page's "no email address given" pop-up covers the bar (the
     bar is above the page's other layers). */
  body.desk-bar.desk-page #contact-no-email-modal {
    z-index: 100;
  }

  /* The story pages' one heading (owner, 2026-11-24): "Discipline Stories"
     on every one of them. Your Library and the sign-in prompts render it
     for this layout only (`hidden desk-title`: not displayed on a phone or
     without this sheet), in place of their own heading row, which carries
     desk-bar-hidden. */
  body.desk-bar.desk-page .desk-title {
    display: block;
  }

  /* The story pages' title starts 18px under the bar, as the chat page's
     does (owner, 2026-11-23: less space above "Discipline Stories"): their
     wrapper's own 24px of top padding is not added to the room for the bar. */
  body.desk-bar.desk-page.story-phone > .pt-6 {
    padding-top: 0;
  }

  /* The Story Generator's example prompt: its first two lines until "Show
     more", as on a phone (story_phone.css; owner, 2026-11-23). The button is
     stories.html's #example-toggle, which its script hides when the example
     fits in two lines. */
  body.desk-bar.desk-page.story-gen #example-prompt:not(.example-open) {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  body.desk-bar.desk-page.story-gen .story-example-toggle {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #6b21a8;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
  }

  body.desk-bar.desk-page.story-gen .story-example-toggle[hidden] {
    display: none;
  }

  /* A single update's "Back to Updates": a quiet pill. Its amber button was
     made for the saturated purple page; on the light one it was the loudest
     thing on the page (owner, 2026-11-23). */
  body.desk-bar.desk-page .desk-back-quiet,
  body.desk-bar.desk-page .desk-back-quiet:hover {
    padding: 8px 18px;
    border-radius: 999px;
    background-image: none;
    background-color: rgba(138, 60, 200, 0.08);
    color: #7e22ce;
    box-shadow: none;
  }

  /* Darker text on the darker tint, as the bar's links darken on hover. */
  body.desk-bar.desk-page .desk-back-quiet:hover {
    background-color: rgba(138, 60, 200, 0.16);
    color: #6b21a8;
  }

  body.desk-bar.desk-page .desk-back-quiet:focus-visible {
    outline: 2px solid #7e22ce;
    outline-offset: 2px;
  }

  /* The story pages' paired control under the title ("Write a story",
     "Your Library"; components/story_tabs.html): one pale track holding both
     halves, the current view's a white tile. Not filled purple: that is how
     the site shows something to press (Send, New Chat), and it read as an
     instruction to someone already on that view (owner, 2026-11-23). The
     halves are .story-nav-link pills restyled here, so they keep its font
     and weight family. */
  body.desk-bar.desk-page .story-tabs {
    display: flex;
    justify-content: center;
  }

  body.desk-bar.desk-page .story-tabs-pair {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background-color: rgba(138, 60, 200, 0.1);
  }

  /* The line height is set here: .story-nav-link's own differs either side
     of 640px (its phone rule), and the control would be 4px taller above. */
  body.desk-bar.desk-page .story-tabs .story-nav-link {
    margin: 0;
    padding: 6px 18px;
    background-color: transparent;
    color: #74549f;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5rem;
  }

  body.desk-bar.desk-page .story-tabs .story-nav-link:focus-visible {
    outline: 2px solid #7e22ce;
    outline-offset: 2px;
  }

  body.desk-bar.desk-page .story-tabs .story-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.55);
    color: #6b21a8;
  }

  body.desk-bar.desk-page .story-tabs .story-nav-link.is-current,
  body.desk-bar.desk-page .story-tabs .story-nav-link.is-current:hover {
    background-color: #ffffff;
    color: #6b21a8;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(90, 40, 140, 0.18);
  }

  /* The chat page's background (its Tailwind classes: from-purple-100
     via-pink-50 to-purple-50) in place of the saturated purple. */
  body.desk-bar.desk-page.desk-light {
    background-image: linear-gradient(to bottom right, #f3e8ff, #fdf2f8, #faf5ff);
  }

  /* Settings and Usage centred their card in the window's height (a flex
     <body> with Tailwind's items-center); under the bar it starts at the
     top like the other pages. */
  body.desk-bar.desk-page.items-center {
    align-items: flex-start;
  }
}
