/* ===========================================================================
   23 · HEADER BAR (desktop, wider than 1020px) — templates/partials/header.php
   Same height (one grid square) and same width (the page frame) as before; now built on the page grid:
   every menu and action is a whole number of grid squares, its dividers fall on grid lines, and the
   bar's bottom rule is the grid line the page panel starts on.
     · Logo square (1 square) · Web Services (3) · Solutions, Analytics, Media (2 each)
     · Contact (2, the one solid cell) · Search, Theme, Client login (1 each)
   A sync bar (2px, accent) glides under the menu you point at and rests under the current section;
   an open menu's cell turns panel-white and runs straight into its drop-down, like a tab.
   Behaviour: site.js "Header bar". Phones and tablets keep the compact header (05-header.css).
   =========================================================================== */
@media (min-width: 1021px) {
  .hdr { gap: 0; align-items: stretch; }
  /* The bar is one solid strip as wide as the page panel, so the background grid never runs through the menus. */
  .hdr::before { content: ""; position: absolute; z-index: -1; left: var(--fl, 0px); right: var(--fr, 0px); top: 0; bottom: 0; background: var(--panel); box-shadow: inset 1px 0 0 var(--rule), 1px 0 0 var(--rule); pointer-events: none; }   /* right edge drawn just outside, on the grid line */
  .hdr::after { content: ""; position: absolute; left: var(--fl, 0px); right: var(--fr, 0px); top: 100%; height: 1px; background: var(--rule); pointer-events: none; }
  .hdr-left { flex: 1; display: grid; grid-template-columns: var(--u, 60px) auto minmax(0, 1fr); gap: 0; align-items: stretch; }   /* logo square · menus · staff badge (fills the space up to Contact) */
  /* The whole logo square is the home link; the logo itself keeps its size (24px), centred. */
  .hdr-left > .logo { align-self: stretch; justify-self: stretch; width: auto; height: auto; align-items: center; justify-content: center; transition: color .15s ease, background-color .2s ease; }
  .hdr-left > .logo svg { flex: none; width: 24px; height: 24px; }
  .hdr-left > .logo:hover { background: var(--hover-tint); }
  .hdr-left > .logo:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }

  .nav { position: relative; gap: 0; align-items: stretch; height: auto; }
  .nav button, .nav a {
    position: relative; justify-content: center; gap: 7px; box-sizing: border-box;
    width: calc(var(--u, 60px) * 2); height: auto; padding: 0;
    border-left: 1px solid var(--rule); font-size: 14.5px; font-weight: 500; letter-spacing: -.005em;
    color: color-mix(in srgb, var(--ink) 76%, transparent); transition: color .15s ease, background-color .2s ease;
  }
  .nav > :first-child { width: calc(var(--u, 60px) * 3); }
  .nav > :last-child { box-shadow: 1px 0 0 var(--rule); }   /* dividers sit on the left edge of each cell = on the grid line */
  .nav .nav-chev { flex: none; margin-left: 0; color: currentColor; opacity: .6; transition: transform .25s cubic-bezier(.2, .8, .2, 1), opacity .15s ease; }   /* direction: 05-header.css (down; up when open) */
  .nav button:hover, .nav a:hover, .nav [aria-current="page"] { color: var(--ink); }
  .nav button:hover { background: var(--hover-tint); }
  .nav button:hover .nav-chev { opacity: 1; }
  .nav [aria-current="page"]:not(:last-child), .nav button[aria-expanded="true"]:not(:last-child) { box-shadow: none; }
  /* An open menu: the cell becomes part of its drop-down panel. */
  .nav button[aria-expanded="true"] { z-index: 1; color: var(--ink); background: var(--panel); box-shadow: 0 1px 0 var(--panel), 1px 0 0 var(--rule); }
  .nav button[aria-expanded="true"] .nav-chev { opacity: 1; }
  .nav button:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
  /* The sync bar. Position and width come from site.js (--nb-x, --nb-w); hidden until it has somewhere to be. */
  .nav::after {
    content: ""; position: absolute; left: 0; bottom: 0; z-index: 2; width: var(--nb-w, 0px); height: 2px;
    background: var(--accent); transform: translateX(var(--nb-x, 0px)); opacity: var(--nb-o, 0);
    transition: transform .38s cubic-bezier(.2, .8, .2, 1), width .38s cubic-bezier(.2, .8, .2, 1), opacity .2s ease;
    pointer-events: none;
  }
  .nav.nb-still::after { transition: none; }

  .hdr-actions { gap: 0; align-items: stretch; }
  .hdr-actions > .btn-outline, .hdr-actions > .icon-btn, .hdr-actions > .theme > .icon-btn {
    box-sizing: border-box; height: var(--hdr-h); border: 0; border-left: 1px solid var(--rule); border-radius: 0; background: transparent;
  }
  .hdr-actions > .icon-btn, .hdr-actions > .theme > .icon-btn { width: var(--u, 60px); color: color-mix(in srgb, var(--ink) 76%, transparent); }
  .hdr-actions > .icon-btn:hover, .hdr-actions > .theme > .icon-btn:hover, .hdr-actions > .theme > .icon-btn[aria-expanded="true"] { color: var(--ink); background: var(--hover-tint); }
  .hdr-actions > .icon-btn svg, .hdr-actions > .theme > .icon-btn svg { width: 17px; height: 17px; }
  .hdr-actions > .burger { display: none; }
  .theme { display: flex; }
  .theme-menu { top: calc(var(--hdr-h) + 1px); right: -1px; }
  /* Contact: the one solid cell, two squares wide. */
  .hdr-actions > .btn-outline { gap: 10px; width: calc(var(--u, 60px) * 2); padding: 0; font-size: 14.5px; font-weight: 600; color: var(--bg); background: var(--ink); border-left-color: var(--ink); }
  .hdr-actions > .btn-outline::after { content: ""; width: 6px; height: 6px; border-top: 1.6px solid currentColor; border-right: 1.6px solid currentColor; transform: rotate(45deg); transition: transform .2s ease; }
  .hdr-actions > .btn-outline:hover { background: var(--accent); border-left-color: var(--accent); color: #fff; }
  .hdr-actions > .btn-outline:hover::after { transform: translateX(3px) rotate(45deg); }
  .hdr-actions > .btn-outline[aria-current="page"] { background: var(--accent); border-left-color: var(--accent); color: #fff; }
  .hdr-actions > .icon-btn.is-close { color: var(--bg); background: var(--ink); }
  .hdr-actions > .btn-outline:focus-visible, .hdr-actions > .icon-btn:focus-visible, .hdr-actions > .theme > .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
  /* Staff badge (team and beta testers only): fills every square between the menus and Contact (always whole
     squares, so the lines stay on the grid); the pill runs the width of its cell. */
  .hdr-left > .gt-sb { box-sizing: border-box; justify-content: center; min-width: 0; margin-left: 0; padding: 0 14px; }
  .hdr-left > .gt-sb .gt-sb-pill { justify-content: center; width: 100%; height: 32px; gap: 8px; font-size: 11.5px; letter-spacing: .08em; }
  .hdr-left > .gt-sb .gt-sb-card { top: calc(100% + 8px); }
  /* BETA, maintenance or beta-tester access: the cell is marked with fine amber stripes and the pill is solid amber,
     its dot pulsing, so nobody on the team mistakes this for the public site. */
  .hdr-left > .gt-sb.is-beta, .hdr-left > .gt-sb.is-maintenance, .hdr-left > .gt-sb.is-tester {
    background: repeating-linear-gradient(135deg, rgba(234, 88, 12, .11) 0 6px, transparent 6px 12px);
  }
  .hdr-left > .gt-sb.is-beta .gt-sb-pill, .hdr-left > .gt-sb.is-maintenance .gt-sb-pill, .hdr-left > .gt-sb.is-tester .gt-sb-pill {
    border-color: #ea580c; border-radius: 2px; background: #ea580c; color: #fff; font-weight: 700; box-shadow: 0 6px 16px -6px rgba(234, 88, 12, .7);
  }
  .hdr-left > .gt-sb.is-beta .gt-sb-pill:hover, .hdr-left > .gt-sb.is-maintenance .gt-sb-pill:hover, .hdr-left > .gt-sb.is-tester .gt-sb-pill:hover,
  .hdr-left > .gt-sb.is-beta.is-open .gt-sb-pill, .hdr-left > .gt-sb.is-maintenance.is-open .gt-sb-pill, .hdr-left > .gt-sb.is-tester.is-open .gt-sb-pill { border-color: #c2410c; background: #c2410c; }
  .hdr-left > .gt-sb.is-beta .gt-sb-pill .gt-sb-dot, .hdr-left > .gt-sb.is-maintenance .gt-sb-pill .gt-sb-dot, .hdr-left > .gt-sb.is-tester .gt-sb-pill .gt-sb-dot {
    background: #fff; box-shadow: none; animation: gt-sb-ping 1.8s ease-out infinite;
  }
  @keyframes gt-sb-ping { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .85); } 100% { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); } }
  .hdr-left > .gt-sb.is-compact { padding: 0; }
  .hdr-left > .gt-sb.is-compact .gt-sb-pill { width: 26px; padding: 0; justify-content: center; }
  .hdr-left > .gt-sb.is-compact .gt-sb-tag { display: none; }
  .mega { box-shadow: 0 30px 50px -10px rgba(10, 35, 65, .18); }
}
@media (min-width: 1021px) and (max-width: 1240px) {
  .nav > :first-child { width: calc(var(--u, 60px) * 2); }   /* Web Services: two squares on smaller desktops, so the bar always fits */
  .hdr-left > .gt-sb { margin-left: 0; }
  .nav button, .nav a, .hdr-actions > .btn-outline { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { .nav::after { transition: opacity .2s ease; } .hdr-left > .gt-sb .gt-sb-dot { animation: none !important; } }
/* Tablets and phones: the buttons on the right are 38px squares 8px apart — the same as the admin and client headers. */
@media (max-width: 1020px) {
  .hdr-actions { gap: 8px; }
  .hdr-actions .btn-outline, .hdr-actions .icon-btn { height: 38px; }
  .hdr-actions .icon-btn { width: 38px; }
}

/* The bar carries the same light tint as the footer (light theme only; dark keeps the panel colour). */
html:not([data-theme="dark"]) .hdr::before { background: #f6f9fe; }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] .hdr::before { background: var(--panel); } }
