/*
  The shared header and menu (templates/_nav.html). Colors, fonts and the corner come only from
  static/altar-theme.css, so a brand change is made there and never here. The look is the dashboard's:
  the brand row with the rust rule, the six groups as big uppercase tabs, the active group's items
  as small uppercase chips underneath.

  ONE SIZE. There is no compact or smaller variant and no per-page height: the header is the same
  height, in the same place, sticky the same way, on every page (Matt, Thu Oct 8: moving between screens
  must never shift it). The few fixed sizes below (the slot's width, the rows' minimum heights) are what
  keep it so when a page has buttons of its own, a group has a single page, or a font arrives late.

  Loaded by every page (templates/_theme_head.html), before the page's own <style>, so a page can
  still override a rule by being more specific. Nothing in here is inline: the suspension pages'
  Content-Security-Policy allows this file ('self') but refuses style="" attributes.
*/

.altar-nav { background: var(--altar-bg); color: var(--altar-text); font-family: var(--altar-font-mono);
             font-size: 16px; line-height: 1.5; text-align: left; flex: none; margin: 0; padding: 0;
             position: sticky; top: 0; z-index: 100; }
.altar-nav *, .altar-askai { box-sizing: border-box; }
.altar-nav [hidden] { display: none !important; }
/* The menu's text at rest and under the pointer is --altar-menu / --altar-menu-hover: altar.bike's Cream turning to the text
   rust in dark (Altar Rust itself is 4.0-4.3:1 behind these letters), Max's dim gray turning to the body text in light. The
   theme makes that pick, so this file holds no theme selector for it. The header's own links (Needs CSV, Sign out) hover
   the same way. */
/* A header that follows the page when it scrolls also has to leave room for itself when the page jumps to an
   anchor (the suspension pages' scroll-margin-top was written for a 64 px bar). */
@media (min-width: 701px) { html:has(.altar-nav) { scroll-padding-top: 8rem; } }
/* A page that scrolls and one that doesn't would differ by a scrollbar's width (15 px on a PC), which would slide the
   right-hand end of the header (Light / Dark, "Signed in") sideways between screens. Keep the gutter on every page. */
html:has(.altar-nav) { scrollbar-gutter: stable; }

/* ---- brand row ---- */
.altar-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.75rem;
             padding: 0.9rem 2rem; background: var(--altar-bg); border-bottom: 3px solid var(--altar-accent); }
.altar-brand { display: flex; align-items: center; gap: 1.1rem; text-decoration: none; color: inherit; flex: none; }
.altar-brand img { height: 64px; width: auto; display: block; }
.altar-brand-sub { font-family: var(--altar-font-display); font-weight: 900; font-size: 1.15rem; letter-spacing: .18em;
                   text-transform: uppercase; color: var(--altar-text-dim); border-left: 1px solid var(--altar-border); padding-left: 1.1rem;
                   white-space: nowrap; }
/* The logo for the other theme is a second file; only one shows. */
.altar-logo-light { display: none !important; }
:root[data-theme="light"] .altar-logo-dark { display: none !important; }
:root[data-theme="light"] .altar-logo-light { display: block !important; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) .altar-logo-dark { display: none !important; }
  :root:not([data-theme="dark"]):not([data-theme="light"]) .altar-logo-light { display: block !important; }
}

/* ---- the right of the brand row: always the page-button slot, the theme button, who is signed in, in that order ---- */
.altar-meta { display: flex; align-items: center; justify-content: flex-end; flex-wrap: nowrap; gap: 0.5rem 1rem; margin-left: auto; font-size: 0.75rem;
              color: var(--altar-text-dim); min-width: 0; }
.altar-meta a { color: var(--altar-text-dim); text-decoration: none; text-transform: uppercase; letter-spacing: .08em; font-size: 0.72rem; white-space: nowrap; }
.altar-meta a:hover { color: var(--altar-menu-hover); }
/* The page's own buttons (Refresh Now on the dashboard, the shop-use CSV link) live in this box. It has the same
   width and height on every page, empty or not, and its contents sit against the right edge, so the theme button and the
   "Signed in" line never move. 28rem holds the dashboard's four things (last updated, Refresh Now, Needs CSV, Test Chat). */
.altar-page-slot { flex: 0 0 28rem; width: 28rem; height: 2.5rem; display: flex; align-items: center; justify-content: flex-end;
                   gap: 0.5rem 1.25rem; white-space: nowrap; overflow: hidden; }
/* The dashboard's "Last updated: 2026-10-08 13:12 UTC" is not a button: two small lines, so the four things fit the slot. */
.altar-page-slot #updated-at { white-space: normal; max-width: 8.5rem; font-size: 0.66rem; line-height: 1.2; text-align: right; }
.altar-btn, .altar-meta button.altar-btn {
  background: var(--altar-accent); color: var(--altar-on-accent); border: none; padding: 0.4rem 1rem; border-radius: var(--altar-radius);
  cursor: pointer; font: inherit; font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  transition: background-color .2s, opacity .2s; }
/* Hover darkens the face to Rust Dark, as the website's buttons do, with the same Cream on it (4.5:1 or better there).
   The face is --altar-accent-solid, not --altar-accent-press: the two are both Rust Dark in dark, but in light accent-solid
   is the light rust itself, so light keeps exactly the hover it always had (the rust faded to .85, no darker face).
   A disabled button (Refreshing…) doesn't answer the pointer. */
.altar-btn:hover:not(:disabled) { opacity: .85; background: var(--altar-accent-solid); }
.altar-btn:disabled { opacity: .5; cursor: wait; }
.altar-theme { margin: 0; display: inline-flex; flex: none; }
.altar-theme input[type="submit"] { background: transparent; color: var(--altar-text-dim); border: 1px solid var(--altar-border-strong);
  border-radius: var(--altar-radius); padding: 0.3rem 0.75rem; cursor: pointer; font: inherit; font-size: 0.72rem;
  text-transform: uppercase; letter-spacing: .08em; }
.altar-theme input[type="submit"]:hover { color: var(--altar-text); border-color: var(--altar-accent); }
.altar-who { color: var(--altar-text-dim); white-space: nowrap; }

/* ---- row one: the groups. The website's menu: Cream at rest (--altar-menu), rust under the pointer (--altar-menu-hover),
   and the one you are on is Cream with the rust rule ---- */
.altar-groups { display: flex; gap: 0; background: var(--altar-bg); padding: 0 2rem; border-bottom: 1px solid var(--altar-border);
                overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.altar-groups::-webkit-scrollbar { display: none; }
.altar-group { font-family: var(--altar-font-display); font-weight: 900; font-size: 1.15rem; letter-spacing: .1em; text-transform: uppercase;
               padding: 0.8rem 1.4rem; color: var(--altar-menu); text-decoration: none; border-bottom: 3px solid transparent;
               white-space: nowrap; transition: color .15s; }
.altar-group:hover { color: var(--altar-menu-hover); }
.altar-group.is-active { color: var(--altar-text-strong); border-bottom-color: var(--altar-accent); }

/* ---- row two: the active group's items. Always drawn, at one height, even for a group with a single page. The same
   menu colors as the groups ---- */
.altar-items { display: flex; flex-wrap: nowrap; gap: 0.25rem; align-items: center; padding: 0.25rem 2rem; height: 3.25rem;
               background: var(--altar-surface); border-bottom: 1px solid var(--altar-border); overflow-x: auto; overflow-y: hidden;
               scrollbar-width: thin; }
.altar-item { font-family: var(--altar-font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; flex: none;
              color: var(--altar-menu); text-decoration: none; padding: 0.35rem 0.6rem; border: 1px solid transparent; border-radius: var(--altar-radius); }
.altar-item:hover { color: var(--altar-menu-hover); }
.altar-item.is-active { color: var(--altar-text-strong); border-color: var(--altar-accent); }

.altar-nav a:focus-visible, .altar-nav button:focus-visible, .altar-nav input:focus-visible, .altar-askai:focus-visible { outline: 2px solid var(--altar-accent); outline-offset: 2px; }

/* ---- the floating Ask AI link (managers only; hidden on the Ask AI tab itself by altar-nav.js) ---- */
.altar-askai { position: fixed; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 90;
               background: var(--altar-accent); color: var(--altar-on-accent); text-decoration: none; border-radius: var(--altar-radius);
               font-family: var(--altar-font-display); font-weight: 900; font-size: 1rem; letter-spacing: .12em; text-transform: uppercase;
               padding: 0.6rem 1.1rem; box-shadow: 0 2px 10px rgba(0, 0, 0, .35); }
/* Rust Dark with the same Cream, as every rust button's hover; in light the face stays the light rust, faded to .9, as it
   always was (--altar-accent-solid: Rust Dark in dark, the light rust in light). The color is restated so a page's own
   a:hover (Max's layout: blue, which is more specific than .altar-askai) can't reach the label: it turned it navy on the
   rust, 1.8:1, on the manager's suspension pages. */
.altar-askai:hover { opacity: .9; background: var(--altar-accent-solid); color: var(--altar-on-accent); }
.altar-askai[hidden] { display: none; }

/* ---- a laptop: the brand row, the slot, the theme button and "Signed in as Matt Ball · Sign out" have to fit one line at 1280 ---- */
@media (max-width: 1400px) {
  .altar-top, .altar-groups, .altar-items { padding-left: 1.25rem; padding-right: 1.25rem; }
}

/* ---- narrower than the full brand row: the right-hand cluster drops under the brand (still the same on every page) ---- */
@media (max-width: 1180px) {
  .altar-meta { width: 100%; }
}

/* ---- phones: the header scrolls away with the page (four rows of it would be a third of the screen), the
   page-button slot becomes a full-width line of its own at the same height on every page, and both menu rows
   scroll sideways, never wrap. Every page does the same, so nothing shifts between screens. ---- */
@media (max-width: 700px) {
  .altar-nav { position: static; }
  .altar-top { padding: 0.75rem 1rem; }
  .altar-brand img { height: 48px; }
  .altar-brand-sub { display: none; }
  .altar-meta { flex-wrap: wrap; justify-content: flex-start; gap: 0.5rem 1rem; }
  .altar-page-slot { order: 3; flex: 1 1 100%; width: 100%; justify-content: flex-start; overflow-x: auto; }
  .altar-groups { padding: 0 0.5rem; }
  .altar-group { padding: 0.7rem 0.9rem; font-size: 1rem; }
  .altar-items { padding: 0.4rem 1rem; }
}

@media print { .altar-nav, .altar-askai { display: none !important; } }
