/*
 * The account menu and the app header (Trello 281).
 *
 * ONE FILE, TWO SITES. This stylesheet is byte-for-byte the same in
 * chaos_tester (static/css/account-menu.css, website-auditor.io) and
 * website-auditor-api (public/account-menu.css, api.website-auditor.io), so
 * the header and menu are the same on both hosts. Each repo's tests pin its
 * sha256 to the same value; change one, and change the other and both pins
 * with it. account-menu.js is shared the same way.
 *
 * Figma wnthOuvoHY8GnfKDN0uJKK: app header 860:7, desktop menu 860:517,
 * mobile 881:2. Colours are literal rather than either site's variables,
 * because the two sites name their tokens differently and this file must not
 * depend on either.
 *
 *   .app-header        the one header on every page of both hosts: logo,
 *                      "Website Auditor | How it works · AI Website Audit ·
 *                      Directory · API · Contact · Pro Dashboard" (the page
 *                      you are on underlined), and the account button, or
 *                      "Member Log In" signed out
 *   .acct              the account button and its menu
 *
 * Below 1100px the links fold into the site menu, behind a button beside the
 * photo. Below 768px the header is 56px, the account button is the photo
 * alone in a 44x44 target, and both menus open full width under the header
 * with the page dimmed behind them, in 48px rows. From 768px the account
 * menu is a 256px dropdown in 34px rows.
 */

/*
 * header.app-header, not .app-header: the main site styles every <header>
 * (fixed, padded, blurred, and darker with a shadow once scrolled, as
 * header.scrolled). The element-and-class selector matches header.scrolled's
 * weight and this file loads after the site's own, so the app header looks
 * the same on both hosts, scrolled or not.
 */
header.app-header {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: #040815;
  border-bottom: 1px solid #1e293b;
  box-shadow: none;
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  padding: 0;
  position: sticky;
  top: 0;
  transition: none;
  z-index: 50;
}

.app-header-inner {
  align-items: center;
  display: flex;
  justify-content: space-between;
  padding: 16px 32px;
}

.app-header-left {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.app-header-brand {
  align-items: center;
  color: #f8fafc;
  display: flex;
  font-size: 18px;
  font-weight: 700;
  gap: 12px;
  line-height: normal;
  text-decoration: none;
  white-space: nowrap;
}

.app-header-brand:hover,
.app-header-brand:focus-visible {
  color: #ffffff;
}

.app-header-logo {
  border-radius: 4px;
  display: block;
  height: 30px;
  width: 30px;
}

.app-header-divider {
  background: #1e293b;
  height: 20px;
  width: 1px;
}

/*
 * The site's links, in the portal's section style (owner, 2026-10-10:
 * "apply the CX treatment from the API portal" to website-auditor.io): How
 * it works, AI Website Audit, Directory, API, Contact and, signed in, Pro
 * Dashboard, the page you are on underlined. The same row on both hosts.
 *
 * A <nav id="mainNav">, and the main site styles every header <nav> and its
 * links (base.css: nav, nav a, header nav at three widths). Every rule here
 * is header.app-header-scoped so that it outweighs those, and this file loads
 * after base.css.
 */
header.app-header nav.app-header-sections {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 20px;
  margin: 0;
  padding: 0;
}

header.app-header .app-header-section {
  border-bottom: 2px solid transparent;
  color: #94a3b8;
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  min-height: 0;
  min-width: 0;
  padding: 2px 0;
  position: relative;
  text-decoration: none;
  white-space: nowrap;
}

header.app-header .app-header-section:hover,
header.app-header .app-header-section:focus-visible {
  color: #f8fafc;
}

header.app-header .app-header-section:focus-visible {
  border-radius: 2px;
  outline: 2px solid #00bfff;
  outline-offset: 4px;
}

header.app-header .app-header-section[aria-current] {
  border-bottom-color: #00bfff;
  color: #f8fafc;
}

.app-header-right {
  align-items: center;
  display: flex;
  gap: 4px;
}

/* The portal: My Account is the section you are on. */
.acct[data-current] .acct-label {
  border-bottom: 2px solid #00bfff;
  color: #f8fafc;
  padding: 2px 0;
}

/* The site menu's button: three bars, a cross while open. Hidden while the
   links fit in the row. */
.app-header-toggle {
  align-items: center;
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  display: none;
  flex-direction: column;
  gap: 4px;
  height: 44px;
  justify-content: center;
  margin: 0;
  padding: 0;
  width: 44px;
}

.app-header-toggle span {
  background: #e2e8f0;
  border-radius: 2px;
  display: block;
  height: 2px;
  transition: transform 0.2s, opacity 0.2s;
  width: 22px;
}

.app-header-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.app-header-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.app-header-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.app-header-toggle:focus-visible {
  outline: 2px solid #00bfff;
  outline-offset: 2px;
}

.app-header-scrim {
  display: none;
}

.acct {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  position: relative;
}

.acct-button {
  align-items: center;
  background: none;
  border: 0;
  border-radius: 8px;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  font: inherit;
  gap: 10px;
  margin: 0;
  padding: 4px;
}

.acct-button:focus-visible {
  outline: 2px solid #00bfff;
  outline-offset: 2px;
}

.acct-label {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
}

.acct-button:hover .acct-label {
  color: #f8fafc;
}

.acct-avatar {
  align-items: center;
  background: #162032;
  border-radius: 50%;
  color: #f8fafc;
  display: inline-flex;
  flex: none;
  font-size: 12px;
  font-weight: 600;
  height: 32px;
  justify-content: center;
  line-height: 1;
  overflow: hidden;
  width: 32px;
}

.acct-avatar img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.acct-avatar[data-fallback] img {
  display: none;
}

.acct-avatar[data-fallback]::after {
  content: attr(data-initials);
}

.acct-button[aria-expanded="true"] .acct-avatar {
  box-shadow: 0 0 0 2px #00bfff;
}

.acct-caret {
  display: block;
  flex: none;
  height: 14px;
  width: 14px;
}

.acct-button[aria-expanded="true"] .acct-caret {
  transform: rotate(180deg);
}

.acct-scrim {
  display: none;
}

.acct-menu {
  background: #0f1a2e;
  border: 1px solid #1e293b;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  position: absolute;
  right: 0;
  text-align: left;
  top: calc(100% + 8px);
  width: 256px;
  z-index: 60;
}

.acct-menu[hidden] {
  display: none;
}

.acct-who {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
  padding: 8px 10px 10px;
}

.acct-who .acct-avatar {
  font-size: 11px;
  height: 28px;
  width: 28px;
}

.acct-who-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.acct-name {
  color: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  line-height: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acct-email {
  color: #94a3b8;
  font-size: 12px;
  line-height: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acct-divider {
  background: #1e293b;
  border: 0;
  flex: none;
  height: 1px;
  margin: 0;
  width: 100%;
}

.acct-form {
  display: block;
  margin: 0;
}

.acct-item {
  align-items: center;
  background: none;
  border: 0;
  border-radius: 6px;
  box-sizing: border-box;
  color: #b0b8c8;
  cursor: pointer;
  display: flex;
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  gap: 8px;
  justify-content: space-between;
  line-height: normal;
  margin: 0;
  padding: 9px 10px;
  position: relative;
  text-align: left;
  text-decoration: none;
  width: 100%;
}

.acct-item:hover,
.acct-item:focus-visible {
  color: #f8fafc;
  outline: 2px solid #00bfff;
  outline-offset: -2px;
}

.acct-item[aria-current] {
  background: #162032;
  color: #f8fafc;
  font-weight: 600;
}

.acct-item[aria-current]::before {
  background: #00bfff;
  border-radius: 2px;
  content: "";
  height: 16px;
  left: 0;
  position: absolute;
  top: calc(50% - 8px);
  width: 3px;
}

.acct-icon {
  display: block;
  flex: none;
}

.acct-icon-chevron,
.acct-icon-external-16 {
  display: none;
}

.acct-icon-external-14 {
  height: 14px;
  width: 14px;
}

.acct-login {
  align-items: center;
  color: #94a3b8;
  display: inline-flex;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  min-height: 44px;
  padding: 0 8px;
  text-decoration: none;
  white-space: nowrap;
}

.acct-login:hover,
.acct-login:focus-visible {
  color: #f8fafc;
}

.acct-sr {
  border: 0;
  clip: rect(0 0 0 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

/*
 * Below 1100px the links no longer fit beside the account button: they fold
 * into the site menu, opened by the button beside the photo, full width
 * under the header with the page dimmed, in 48px rows (Figma 881:2, M5).
 */
@media (max-width: 1099.98px) {
  .app-header-divider {
    display: none;
  }

  .app-header-toggle {
    display: inline-flex;
  }

  header.app-header nav.app-header-sections {
    display: none;
  }

  header.app-header nav.app-header-sections[data-open] {
    align-items: stretch;
    background: #0f1a2e;
    border: 1px solid #1e293b;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 2px;
    left: 8px;
    max-height: calc(100vh - var(--acct-top, 56px) - 16px);
    overflow-y: auto;
    padding: 8px;
    position: fixed;
    right: 8px;
    top: calc(var(--acct-top, 56px) + 4px);
    z-index: 60;
  }

  header.app-header nav.app-header-sections[data-open] .app-header-section {
    align-items: center;
    border: 0;
    border-radius: 8px;
    color: #b0b8c8;
    display: flex;
    font-size: 15px;
    font-weight: 400;
    height: 48px;
    justify-content: flex-start;
    padding: 0 12px;
    text-align: left;
  }

  header.app-header nav.app-header-sections[data-open] .app-header-section[aria-current] {
    background: #162032;
    color: #f8fafc;
    font-weight: 600;
  }

  header.app-header nav.app-header-sections[data-open] .app-header-section[aria-current]::before {
    background: #00bfff;
    border-radius: 2px;
    content: "";
    height: 24px;
    left: 0;
    position: absolute;
    top: 12px;
    width: 3px;
  }

  .app-header-scrim {
    background: rgba(0, 0, 0, 0.55);
    bottom: 0;
    display: block;
    left: 0;
    position: fixed;
    right: 0;
    top: var(--acct-top, 56px);
    z-index: 55;
  }

  .app-header-scrim[hidden] {
    display: none;
  }
}

@media (max-width: 767.98px) {
  /*
   * A blurred backdrop makes a header the containing block of its fixed
   * descendants, which would size the dimmed page to the header instead of
   * the viewport. The main site's marketing header is blurred, so the blur
   * is dropped while the menu is open.
   */
  header:has(.acct-button[aria-expanded="true"]) {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }

  .app-header-inner {
    box-sizing: border-box;
    height: 56px;
    padding: 0 8px 0 16px;
  }

  .app-header-left {
    gap: 10px;
  }

  .app-header-brand {
    gap: 10px;
  }

  .app-header-logo {
    height: 26px;
    width: 26px;
  }

  .app-header-brand {
    font-size: 17px;
  }

  .acct-button {
    height: 44px;
    justify-content: center;
    padding: 0;
    width: 44px;
  }

  .acct-label,
  .acct-caret {
    display: none;
  }

  .acct-scrim {
    background: rgba(0, 0, 0, 0.55);
    bottom: 0;
    display: block;
    left: 0;
    position: fixed;
    right: 0;
    top: var(--acct-top, 56px);
    z-index: 55;
  }

  .acct-scrim[hidden] {
    display: none;
  }

  .acct-menu {
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    left: 8px;
    max-height: calc(100vh - var(--acct-top, 56px) - 16px);
    overflow-y: auto;
    position: fixed;
    right: 8px;
    top: calc(var(--acct-top, 56px) + 4px);
    width: auto;
  }

  .acct-who {
    gap: 12px;
    height: 64px;
    padding: 0 0 0 12px;
  }

  .acct-who .acct-avatar {
    font-size: 15px;
    height: 40px;
    width: 40px;
  }

  .acct-name {
    font-size: 15px;
  }

  .acct-email {
    font-size: 13px;
  }

  .acct-item {
    border-radius: 8px;
    font-size: 15px;
    height: 48px;
    padding: 0 12px;
  }

  .acct-item[aria-current]::before {
    height: 24px;
    top: 12px;
  }

  .acct-icon-external-14 {
    display: none;
  }

  .acct-icon-chevron,
  .acct-icon-external-16 {
    display: block;
    height: 16px;
    width: 16px;
  }
}
