/* ONE definition of the Log in / Sign up dialog (the auth-mode account dialog), shared by every page.
   styles.css @imports this file (Home, libraries, legal, Roadmap, Settings, Crystal Ball); the Explore pages, which do not load
   styles.css, link it directly; global-account-auth.js links it on any other page that has no site stylesheet. Before: the rules lived
   in styles.css, so the four Explore pages showed bare text over the page, and a second D07 copy gave the other pages a different look
   (owner staging review 2026-10-25, finding 2; E FAIL on 529f4408). ADR "Deck-as-parameter": shared component, no per-page copies.
   Tokens: the dialog resolves its colours from the BrandManifest variables with the same Day/Dark values as styles.css, so it looks
   the same where styles.css is absent. */
.global-account-auth-dialog {
  --brand-radius-control: 12px; --brand-radius-panel: 24px;
  --brand-shadow-elevated: 0 26px 70px rgba(45, 37, 62, .12);
  --brand-color-surface-translucent: rgba(255, 255, 255, .88); --brand-color-surface-default: #ffffff; --brand-color-surface-subtle: #faf4ea;
  --brand-color-text-primary: #1c1b21; --brand-color-text-muted: #68646f;
  --brand-color-border-default: rgba(43, 37, 55, .14); --brand-color-border-strong: rgba(43, 37, 55, .24);
  --brand-color-accent-default: #4b1f3f; --brand-color-accent-strong: #4b1f3f; --brand-color-accent-soft: #efe2cc;
  --brand-color-button-primary-text: #ffffff; --brand-color-control-secondary-background: #efe2cc; --brand-color-control-secondary-text: #1d1819;
  --brand-color-focus: #b4873f;
}
:root[data-theme="dark"] .global-account-auth-dialog {
  --brand-shadow-elevated: 0 26px 70px rgba(0, 0, 0, .34);
  --brand-color-surface-translucent: rgba(21, 21, 29, .88); --brand-color-surface-default: #16171d; --brand-color-surface-subtle: #111219;
  --brand-color-text-primary: #f4f1f8; --brand-color-text-muted: #b2acbb;
  --brand-color-border-default: rgba(255, 255, 255, .11); --brand-color-border-strong: rgba(255, 255, 255, .2);
  --brand-color-accent-default: #e2b15c; --brand-color-accent-strong: #f3dfb6; --brand-color-accent-soft: #161c34;
  --brand-color-button-primary-text: #17121f; --brand-color-control-secondary-background: #25262a; --brand-color-control-secondary-text: #f1f1f3;
  --brand-color-focus: #e0ae55;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .global-account-auth-dialog {
    --brand-shadow-elevated: 0 26px 70px rgba(0, 0, 0, .34);
    --brand-color-surface-translucent: rgba(21, 21, 29, .88); --brand-color-surface-default: #16171d; --brand-color-surface-subtle: #111219;
    --brand-color-text-primary: #f4f1f8; --brand-color-text-muted: #b2acbb;
    --brand-color-border-default: rgba(255, 255, 255, .11); --brand-color-border-strong: rgba(255, 255, 255, .2);
    --brand-color-accent-default: #e2b15c; --brand-color-accent-strong: #f3dfb6; --brand-color-accent-soft: #161c34;
    --brand-color-button-primary-text: #17121f; --brand-color-control-secondary-background: #25262a; --brand-color-control-secondary-text: #f1f1f3;
    --brand-color-focus: #e0ae55;
  }
}
.global-account-auth-dialog {
  --surface: var(--brand-color-surface-translucent); --surface-solid: var(--brand-color-surface-default); --surface-soft: var(--brand-color-surface-subtle);
  --text: var(--brand-color-text-primary); --muted: var(--brand-color-text-muted);
  --border: var(--brand-color-border-default); --border-strong: var(--brand-color-border-strong);
  --accent: var(--brand-color-accent-default); --accent-strong: var(--brand-color-accent-strong); --accent-soft: var(--brand-color-accent-soft);
  --button-text: var(--brand-color-button-primary-text); --secondary-bg: var(--brand-color-control-secondary-background);
  --secondary-text: var(--brand-color-control-secondary-text); --shadow: var(--brand-shadow-elevated); --focus: var(--brand-color-focus);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
}
/* styles.css sets border-box on every element; pages without it (Explore) must not change the dialog's size. */
.account-dialog, .account-dialog *, .account-dialog *::before, .account-dialog *::after { box-sizing: border-box; }
/* Headings: the display font where the page loads it (Home and the dialog itself), Georgia otherwise; never the sans fallback. */
.account-dialog :is(h2, h3) { font-family: var(--arcana-font-display, Georgia, "Times New Roman", serif); font-weight: 500; }
.account-dialog .section-kicker { margin: 0; letter-spacing: .15em; font-size: .72rem; color: var(--accent-strong); font-weight: 800; }

.account-dialog {
  width: min(1120px, calc(100vw - 48px));
  height: min(90svh, 840px);
  max-height: min(90svh, 840px);
  margin: auto;
  padding: 0;
  overflow: hidden;
}
.account-dialog::backdrop { backdrop-filter: blur(8px); }
.account-dialog-shell {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}
.account-dialog-header {
  position: relative;
  display: grid;
  justify-items: start;
  gap: 5px;
  padding-block: 18px 16px; padding-inline: 28px 64px;
  text-align: start;
  border-bottom: 1px solid var(--border);
}
.account-dialog-header > div { display: grid; justify-items: start; gap: 5px; }
.account-dialog-header h2 { margin: 0; font-size: clamp(1.45rem, 2.4vw, 2rem); }
.account-dialog-lead { margin: 0; max-width: 44ch; color: var(--muted); line-height: 1.5; }
.account-dialog-close {
  position: absolute;
  top: 14px;
  inset-inline-end: 14px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.account-dialog-close:hover { background: var(--surface-soft); color: var(--text); }
.account-dialog-close:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.account-settings-shell {
  min-height: 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  overflow: hidden;
}
.account-settings-nav {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 12px;
  overflow-y: auto;
  border-inline-end: 1px solid var(--border);
  background: var(--surface-soft);
}
.account-settings-nav[hidden] { display: none; }
.account-settings-nav[hidden] + .account-settings-content { grid-column: 1 / -1; }
.account-settings-nav-item {
  min-height: 40px;
  padding: 9px 11px;
  border: 0;
  border-radius: var(--brand-radius-control);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  text-align: start;
  cursor: pointer;
}
.account-settings-nav-item:hover,
.account-settings-nav-item[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--text);
}
.account-settings-content {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 28px 36px 36px;
}
.account-settings-panel { display: grid; gap: 18px; align-content: start; }
.account-settings-panel[data-account-panel-content="account"],
.account-settings-panel[data-account-panel-content="access"] {
  justify-items: start;
}
.account-settings-panel[hidden] { display: none; }
.account-section-heading { display: grid; gap: 4px; padding-top: 4px; }
.account-section-heading .section-kicker, .account-section-heading h3 { margin: 0; }
/* HF-1 H-3 (owner, reopened): a guest in the sign-in dialog is not in "Account settings": the settings sub-heading ("PROFILE & SIGN-IN / Account settings") is for the signed-in
   settings mode only. The dialog's own title and lead already say what the buttons do (both copies of the dialog: the Home page's and the shared one carry the same classes). */
.account-dialog[data-account-mode="auth"] .account-section-heading { display: none; }
.account-provider-stack {
  width: min(100%, 520px);
  margin-inline: 0;
  display: grid;
  gap: 12px;
}
/* Branded provider buttons (data-provider-brand) are laid out by auth-provider-branding.css ONLY. Library pages pull that file in through `@import ... layer(shell)`, and an unlayered rule here
   would beat it on those pages (the label then sat 98 px off the button centre): this generic grid is for a button without a brand. */
.account-provider-stack .auth-provider-action:not([data-provider-brand]) {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 10px 14px;
  text-align: center;
  text-decoration: none;
}
.account-provider-stack .auth-provider-action[hidden] {
  display: none !important;
}
.account-dialog-kicker-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.account-dialog-kicker-row .section-kicker { margin: 0; }
@media (min-width: 721px) {
  .account-dialog[data-account-mode="auth"] {
    width: min(560px, calc(100vw - 32px));
    height: auto;
    max-height: min(86svh, 760px);
  }
  .account-dialog[data-account-mode="auth"] .account-dialog-shell {
    min-height: 520px;
    height: auto;
    grid-template-rows: auto 1fr;
    overflow: visible;
  }
  .account-dialog[data-account-mode="auth"] .account-dialog-header {
    justify-items: center;
    gap: 8px;
    padding: 28px 64px 22px;
    text-align: center;
  }
  .account-dialog[data-account-mode="auth"] .account-dialog-header > div {
    justify-items: center;
    gap: 8px;
  }
  .account-dialog[data-account-mode="auth"] .account-dialog-header h2 {
    font-size: clamp(1.7rem, 4vw, 2.35rem);
  }
  .account-dialog[data-account-mode="auth"] .account-settings-shell {
    grid-template-columns: 170px minmax(0, 1fr);
    overflow: visible;
  }
  .account-dialog[data-account-mode="auth"] .account-settings-content {
    overflow: auto;
    scrollbar-gutter: auto;
    padding: 28px 30px 32px;
  }
}

@media (max-width: 720px) {
  .account-dialog {
    width: calc(100vw - 18px);
    height: calc(100svh - 18px);
    max-height: calc(100svh - 18px);
  }
  .account-dialog-shell { min-height: min(720px, calc(100svh - 20px)); }
  /* HF-1 H-3 (owner, phone): the sign-in (auth) dialog is a short card, like on wider screens: as tall as its content (the header and the provider buttons), never taller than the
     screen, and it scrolls inside when it does not fit. Only the settings dialog (data-account-mode other than auth) keeps the full-height sheet; before this, the ≥721 px
     rules were the only ones that sized the auth dialog, so on a phone it was a full-height sheet with a large empty area under the provider buttons. */
  .account-dialog[data-account-mode="auth"] {
    height: fit-content; /* not auto: an open modal dialog is inset:0, and height:auto would stretch it to the full screen */
    max-height: calc(100svh - 18px);
  }
  .account-dialog[data-account-mode="auth"] .account-dialog-shell {
    min-height: 0;
    height: auto;
    max-height: calc(100svh - 18px);
  }
  .account-dialog[data-account-mode="auth"] .account-settings-shell { grid-template-rows: minmax(0, 1fr); }
  .account-dialog-header { padding: 18px 16px 14px; }
  .account-settings-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    align-content: start;
  }
  .account-settings-nav {
    align-self: start;
    align-items: center;
    flex-direction: row;
    overflow-x: auto;
    border-inline-end: 0;
    border-bottom: 1px solid var(--border);
    padding: 10px 12px;
  }
  .account-settings-nav-item {
    flex: 0 0 auto;
    align-self: center;
  }
  .account-settings-content { min-height: 0; padding: 18px 16px 24px; }
}
