/* ============================================================
   Account settings — sidebar layout
   Sidebar + content two-column layout for account.html. Colors and
   spacing come from the --lr-* tokens defined in css/landing-refresh.css
   (dark mode flips those tokens via body.dark-mode / html.dark-mode
   class selectors there, so this file needs no separate dark rules).
   ============================================================ */

.account-page-layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: flex-start;
  gap: 32px;
}

/* Forced 2FA setup (js/account-security.js enforceSetup2FAMode) hides the sidebar and every card but one:
   match the page header's 860px column and drop the dividers left between the hidden cards. The header has
   no side padding and this layout has 24px a side, so the box is 860 + 48 for the card to start under the heading. */
.account-page-layout--single {
  max-width: 908px;
}

.account-page-layout--single hr.lr-divider {
  display: none;
}

/* ---------- Sidebar ---------- */

.account-nav {
  flex: 0 0 240px;
  min-width: 0;
  position: sticky;
  top: 24px;
}

.account-nav-mobile-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--lr-surface-2);
  border: 1px solid var(--lr-line);
  border-radius: var(--lr-r-md, 6px);
  color: var(--lr-ink);
  font-family: var(--lr-sans);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.account-nav-mobile-toggle:hover {
  border-color: var(--lr-accent);
}

.account-nav-group {
  margin-bottom: 4px;
}

.account-nav-group-label {
  padding: 8px 12px;
  font-family: var(--lr-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--lr-ink-muted);
}

.account-nav-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: none;
  border-radius: var(--lr-r-sm, 4px);
  color: var(--lr-ink-muted);
  font-family: var(--lr-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  cursor: pointer;
  text-align: left;
}

.account-nav-group-toggle:hover {
  background: var(--lr-accent-tint);
  color: var(--lr-ink);
}

.account-nav-group-toggle:focus-visible {
  outline: 2px solid var(--lr-accent);
  outline-offset: 2px;
}

.account-nav-chevron {
  font-size: 11px;
  transition: transform 0.15s ease;
}

.account-nav-group-toggle[aria-expanded="true"] .account-nav-chevron {
  transform: rotate(90deg);
}

.account-nav-items {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Multi-item groups start collapsed; account-nav.js expands the group
   holding the active item and toggles .expanded from then on. The single
   item group (Profile, marked .account-nav-group--single in the markup —
   it has no toggle button, nothing to collapse) is exempt so its one link
   is always visible. Written this way instead of a :has() selector for
   broader browser support. */
.account-nav-group:not(.account-nav-group--single):not(.expanded) .account-nav-items {
  display: none;
}

.account-nav-link {
  display: block;
  padding: 8px 12px 8px 20px;
  border-radius: var(--lr-r-sm, 4px);
  color: var(--lr-ink-2, var(--lr-ink));
  font-family: var(--lr-sans);
  font-size: 14px;
  text-decoration: none;
  overflow-wrap: break-word;
}

.account-nav-link:hover {
  background: var(--lr-accent-tint);
  color: var(--lr-ink);
}

.account-nav-link:focus-visible {
  outline: 2px solid var(--lr-accent);
  outline-offset: -2px;
}

.account-nav-link.active {
  background: var(--lr-accent-soft);
  color: var(--lr-accent);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--lr-accent);
}

/* ---------- Content column ---------- */

.account-content {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 860px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- Responsive: sidebar becomes a toggle above the content ---------- */

@media (max-width: 991.98px) {
  .account-page-layout {
    flex-direction: column;
    gap: 16px;
  }

  .account-nav {
    flex: 1 1 auto;
    width: 100%;
    position: static;
  }

  .account-nav-mobile-toggle {
    display: flex;
  }

  .account-nav-list {
    display: none;
    padding: 8px;
    background: var(--lr-surface-2);
    border: 1px solid var(--lr-line);
    border-radius: var(--lr-r-lg, 8px);
  }

  .account-nav.mobile-open .account-nav-list {
    display: block;
  }

  .account-content {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .account-page-layout {
    padding: 0 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .account-nav-chevron {
    transition: none;
  }
}

/* ---------- Password-manager username hint (#957) ----------
   account.html and js/account-security.js insert a hidden `username` field
   above password/2FA-code inputs purely so Chrome/other password managers
   associate the right account (a well-known autofill trick). This class was
   applied but never defined anywhere, so the field was a plain visible,
   focusable text input -- in the "Add a passkey" dialog specifically, an
   unlabeled box Chrome filled with the account email. `aria-hidden="true"`
   on a focusable element is also an accessibility failure (axe rule
   aria-hidden-focus): a screen reader is told to skip it while it can still
   receive keyboard focus. `display: none` removes it from view, from the
   tab order, and from the accessibility tree all at once, which is what the
   `aria-hidden` attribute alone does not do. */
.autocomplete-hidden {
  display: none;
}
