/* chrome.css — THE SHIPPED HEADER. Structure only, identical in all three
 * mockups, so the only variable between them is look and feel.
 *
 * 🔴 The markup here is `layouts/ops.blade.php` verbatim, class for class —
 * app-header, app-nav, app-menu, app-menu-button, app-menu-pop,
 * app-menu-heading, app-menu-item, app-account, app-avatar, is-current. The
 * structure shipped in de1d2ff and is FROZEN. These mockups exist for one
 * decision — look and feel — and a mockup that rearranges the menu is
 * answering a question nobody asked.
 *
 * 🔴 NO JAVASCRIPT. Not a stylistic preference: dropdowns were rejected once on
 * the belief they needed a script, and the whole change rests on their not
 * needing one. `:hover` opens them for a pointer, `:focus-within` for the
 * keyboard. If you find an onclick in here, it is a bug — it is showing
 * something that will not ship.
 *
 * Every colour is var(--token) from tokens.css, which is a verbatim copy of
 * public/css/tokens.css. Those values already passed contrast and
 * colour-blindness validation; an earlier neon palette failed outright.
 */

/* ── header ─────────────────────────────────────────────────────────────── */

.app-header {
  position: relative; z-index: 50;
  display: flex; align-items: center; gap: var(--s-2);
  padding: 0 var(--s-5); min-height: 52px;
  background: var(--header-bg); color: var(--header-ink);
}

.app-brand {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: var(--t-16); font-weight: 600; letter-spacing: -0.018em;
  flex: none; margin-right: var(--s-5);
}
.app-brand-logo {
  width: 24px; height: 24px; border-radius: 7px; flex: none;
  background: var(--brand-orange); color: #fff;
  display: grid; place-items: center; font-size: var(--t-13); font-weight: 700;
}

/* The toggle. Visually hidden but FOCUSABLE — a display:none input cannot be
   reached by keyboard and the whole menu would need a pointer. */
.app-nav-checkbox {
  position: absolute; width: 1px; height: 1px; opacity: 0;
  margin: 0; pointer-events: none;
}
.app-nav-button { display: none; }

.app-nav { display: flex; align-items: center; gap: var(--s-1); }

.app-nav-link {
  display: inline-flex; align-items: center; gap: 5px;
  height: 32px; padding: 0 var(--s-3); border-radius: var(--radius-sm);
  border: 0; background: none; cursor: pointer;
  font-size: var(--t-14); font-weight: 450; line-height: 1;
  color: var(--header-ink-muted); text-decoration: none; white-space: nowrap;
}
.app-nav-link:hover { color: var(--header-ink); background: rgba(255,255,255,.07); }

/* 🔴 The PARENT is marked, not only the child. On /ops/runs `is-current` sits
   on the Admin button AND on Runs. Without it the header goes blank on every
   page except Home — which is what this rule is here to prevent. */
.app-nav-link.is-current { color: var(--header-ink); font-weight: 550; }

.app-menu { position: relative; }
.app-menu-caret { width: 8px; height: 8px; opacity: .7; }

/* ── the dropdown. Hover for a pointer, focus-within for the keyboard. ──── */

.app-menu-pop {
  position: absolute; top: 100%; left: 0; z-index: 60;
  min-width: 224px; padding: var(--s-2);
  margin-top: 6px;
  background: var(--surface-raised);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(-3px);
  transition: opacity .11s ease, transform .11s ease, visibility 0s .11s;
}

/* The 6px gap between button and popup would drop the hover on the way down,
   so the popup carries an invisible bridge over it. */
.app-menu-pop::before {
  content: ''; position: absolute; left: 0; right: 0; top: -8px; height: 8px;
}

.app-menu:hover .app-menu-pop,
.app-menu:focus-within .app-menu-pop,
.app-menu.is-open .app-menu-pop {          /* .is-open = still-image demo only */
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .11s ease, transform .11s ease;
}

.app-menu-heading {
  padding: var(--s-3) var(--s-3) var(--s-1);
  font-size: var(--t-11); font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-muted);
}
.app-menu-heading:first-child { padding-top: var(--s-1); }

.app-menu-item {
  display: block; padding: 7px var(--s-3); border-radius: var(--radius-sm);
  font-size: var(--t-14); font-weight: 450; line-height: 20px;
  color: var(--ink-secondary); text-decoration: none; white-space: nowrap;
}
.app-menu-item:hover { background: var(--surface-sunken); color: var(--ink); }
.app-menu-item.is-current { color: var(--ink); font-weight: 600;
                            background: var(--surface-sunken); }

/* ── account ────────────────────────────────────────────────────────────── */

.app-account { position: relative; margin-left: auto; }

.app-account-button {
  display: flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 6px 0 4px; border: 0; border-radius: 999px;
  background: none; cursor: pointer; color: var(--header-ink-muted);
}
.app-account-button:hover { background: rgba(255,255,255,.07); }

/* Initials on a coloured disc unless a photo is set. Never a broken image,
   never a silhouette — an avatar that can fail to load is chrome that can look
   broken on a good day. */
.app-avatar {
  width: 26px; height: 26px; border-radius: 999px; flex: none; overflow: hidden;
  background: var(--series-2); color: #fff;
  display: grid; place-items: center;
  font-size: var(--t-11); font-weight: 600; letter-spacing: .01em;
}
.app-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.app-caret { width: 8px; height: 8px; opacity: .7; }

.app-account-menu {
  position: absolute; top: 100%; right: 0; z-index: 60;
  min-width: 208px; padding: var(--s-2); margin-top: 6px;
  background: var(--surface-raised);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(-3px);
  transition: opacity .11s ease, transform .11s ease, visibility 0s .11s;
}
.app-account-menu::before {
  content: ''; position: absolute; left: 0; right: 0; top: -8px; height: 8px;
}
.app-account:hover .app-account-menu,
.app-account:focus-within .app-account-menu,
.app-account.is-open .app-account-menu {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .11s ease, transform .11s ease;
}

.app-account-who {
  padding: var(--s-2) var(--s-3); margin: 0 0 var(--s-1);
  border-bottom: 1px solid var(--border);
  font-size: var(--t-13); font-weight: 600; color: var(--ink);
}
.app-account-item {
  display: block; width: 100%; text-align: left;
  padding: 7px var(--s-3); border: 0; border-radius: var(--radius-sm);
  background: none; cursor: pointer;
  font-size: var(--t-14); font-weight: 450;
  color: var(--ink-secondary); text-decoration: none;
}
.app-account-item:hover { background: var(--surface-sunken); color: var(--ink); }
.app-account form { margin: 0; }

/* ── phone: ≤900px. The dropdowns stop being dropdowns. ─────────────────── */

/* `:hover` on a touchscreen is whatever the browser decides a tap meant, so on
   a phone the menus unfold as labelled SECTIONS inside the ☰ drawer instead.
   The heading prints from `data-label`, so the label still has one source. */
@media (max-width: 900px) {
  .app-header { flex-wrap: wrap; padding: var(--s-2) var(--s-4); }

  .app-nav-button {
    display: inline-flex; align-items: center; gap: 6px;
    height: 32px; padding: 0 var(--s-3); border-radius: var(--radius-sm);
    margin-left: auto; cursor: pointer;
    font-size: var(--t-13); font-weight: 500; color: var(--header-ink);
    background: rgba(255,255,255,.09);
  }
  .app-nav-checkbox:focus-visible + .app-nav-button {
    outline: 2px solid var(--brand-orange); outline-offset: 2px;
  }

  .app-account { margin-left: var(--s-2); order: 2; }

  .app-nav {
    order: 3; display: none; flex-direction: column; align-items: stretch;
    width: 100%; gap: 0; padding: var(--s-2) 0 var(--s-3);
    margin-top: var(--s-2); border-top: 1px solid rgba(255,255,255,.10);
  }
  .app-nav-checkbox:checked ~ .app-nav { display: flex; }

  .app-menu { position: static; }
  .app-menu-button { display: none; }          /* the label becomes a heading */

  .app-menu::before {
    content: attr(data-label);
    display: block; padding: var(--s-4) var(--s-2) var(--s-1);
    font-size: var(--t-11); font-weight: 600;
    text-transform: uppercase; letter-spacing: .07em;
    color: var(--header-ink-muted);
  }

  .app-menu-pop {
    position: static; opacity: 1; visibility: visible; transform: none;
    min-width: 0; padding: 0; margin: 0;
    background: none; border: 0; box-shadow: none;
    transition: none;
  }
  .app-menu-pop::before { content: none; }

  .app-menu-heading { padding: var(--s-2) var(--s-2) var(--s-1);
                      color: var(--header-ink-muted); opacity: .75; }

  .app-menu-item, .app-nav > .app-nav-link {
    color: var(--header-ink-muted); padding: 9px var(--s-2); border-radius: var(--radius-sm);
  }
  .app-menu-item:hover, .app-nav > .app-nav-link:hover {
    background: rgba(255,255,255,.07); color: var(--header-ink);
  }
  .app-menu-item.is-current, .app-nav > .app-nav-link.is-current {
    background: rgba(255,255,255,.10); color: var(--header-ink);
  }
}
