/* robotparts.dev accounts (static/account.js, docs/peps/0001-accounts-and-sync.md): the header Account button's label
   and the account at the head of its menu, the hearts, the Saved page. Only site.css's tokens, so light and dark follow it.
   Rules marked WHY exist for usability, not looks. */

/* ---- the account, in the header's Account menu (#am, build/site_pages.py account_menu) ---------------------------- */
/* WHY no rule on the header button itself: it is main's (site.css .quick .acct), so the header keeps its geometry
   signed in, signed out and without accounts; account.js changes only its label and, signed in, its icon. */
.acct-letter { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--accent-bg); color: var(--accent); font-size: 10px; font-weight: 700; line-height: 1; }
.am-acct { margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--rule2); }
.acct-signin { display: flex; align-items: center; justify-content: center; height: 34px; margin: 2px 0 8px; padding: 0 12px; border: 1px solid var(--accent); border-radius: 4px; background: var(--accent); color: var(--bg); font-weight: 650; white-space: nowrap; }
.acct-signin:hover { text-decoration: none; filter: brightness(1.08); }
.acct-signin:focus-visible, .acct-item:focus-visible, .heart:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.acct-who { padding: 0 4px 8px; border-bottom: 1px solid var(--rule2); margin-bottom: 4px; }
.acct-who strong, .acct-who span { display: block; overflow-wrap: anywhere; }
.acct-who span { color: var(--ink2); font-size: 12.5px; }
/* WHY full-width rows: the menu reads as one list a finger or the Tab key walks top to bottom */
.acct-item { display: block; width: 100%; height: auto; min-height: 32px; padding: 6px 4px; border: 0; border-radius: 5px; background: none; color: var(--ink); text-align: left; font: inherit; font-weight: 600; cursor: pointer; }
.acct-item:hover { background: var(--hover); text-decoration: none; border-color: transparent; }
.acct-item[aria-expanded="true"] { font-weight: 650; }
.acct-panel { padding: 2px 4px 10px; }
.acct-panel p { margin: 4px 0 8px; }
.acct-panel label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 4px; }
.acct-cmd { display: flex; gap: 6px; align-items: center; margin: 4px 0; min-width: 0; }
.acct-cmd code { flex: 1; min-width: 0; padding: 4px 6px; background: var(--bg2); border: 1px solid var(--rule2); border-radius: 3px; font-size: 11.5px; overflow-wrap: anywhere; }
.acct-cmd input { flex: 1; min-width: 0; height: 30px; border: 1px solid var(--rule); border-radius: 3px; background: var(--bg); padding: 0 8px; }
.acct-cmd input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.acct-copy { flex: none; height: 26px; padding: 0 8px; font-size: 12px; }
.acct-hint { margin: 0 4px 4px; color: var(--ink2); font-size: 12.5px; }
.acct-sync { margin: 4px 0; padding: 6px 4px; border-top: 1px solid var(--rule2); color: var(--ink2); font-size: 12.5px; }
.acct-out { color: var(--ink2); }

/* ---- hearts ------------------------------------------------------------------------------------------------- */
.heart { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 28px; min-width: 28px; padding: 0 6px; border: 1px solid transparent; border-radius: 999px; background: none; color: var(--ink3); vertical-align: middle; }
.heart svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; flex: none; }
.heart:hover:not(:disabled) { color: var(--accent); border-color: var(--rule); }
.heart.on { color: var(--accent); }
.heart.on svg { fill: currentColor; }
.heart.busy { opacity: .55; }
.heart-msg { font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.heart-msg:empty { display: none; }
/* WHY a word and not only colour: "Not saved" must be read, not inferred from an outline */
.heart.failed { color: var(--warn); border-color: currentColor; background: var(--bg); }
.heart-page { height: 30px; padding: 0 12px; margin: 0 0 8px; border-color: var(--rule); background: var(--bg2); color: var(--ink2); font-weight: 600; font-size: 13px; }
.heart-page.on { border-color: var(--accent); background: var(--accent-bg); }
.heart-row { height: 24px; min-width: 24px; margin-left: 4px; padding: 0 3px; }
/* WHY on top of the card's corner: a card is a link to its page, and the heart must not move what a reader scans */
.card, .dv-cards-card { position: relative; }
.heart-card { position: absolute; top: 6px; right: 6px; z-index: 2; background: var(--bg); border-color: var(--rule2); }
@media (hover: hover) { .heart-card:not(.on):not(.failed) { opacity: .8; } }

/* ---- the Saved page ------------------------------------------------------------------------------------------- */
#saved-parts td:first-child { min-width: 12rem; }
.saved-views { padding-left: 18px; }
.saved-views li { margin: 6px 0 10px; }
.saved-views details { margin-top: 4px; }
.saved-views summary { cursor: pointer; color: var(--ink2); font-size: 12.5px; }
.saved-views pre { max-width: 100%; overflow-x: auto; padding: 8px 10px; background: var(--bg2); border: 1px solid var(--rule2); border-radius: 3px; font-size: 12px; white-space: pre; }
.acct-host { color: var(--ink2); font-size: 12.5px; }
.saved-warn { color: var(--warn); }
/* a folder over its quota (folder-sync PEP 0003 §3.7): why, and the ways back under */
.saved-full { margin: 0 0 18px; padding: 10px 14px; border: 1px solid var(--warn); border-radius: 4px; background: var(--bg2); }
.saved-full p { margin: 4px 0; }
.saved-purge, .saved-delete { min-height: 28px; padding: 3px 10px; border: 1px solid var(--rule2); border-radius: 3px; background: var(--bg); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.saved-delete { margin-left: 8px; }
.saved-storage { padding-left: 18px; }
.saved-storage li { margin: 6px 0; overflow-wrap: anywhere; }
.saved-purge:disabled, .saved-delete:disabled { opacity: .6; cursor: default; }

/* ---- local-first (docs/peps/0007-local-first.md): where the folder is, and "Sign in to sync" as a secondary line ---- */
.acct-where code { overflow-wrap: anywhere; }
/* WHY a plain link, not the filled button: signing in only adds sync (PEP 0007), so it never looks like the way in */
.acct-sync-in .acct-signin { display: inline; height: auto; margin: 0; padding: 0; border: 0; background: none; color: var(--accent); font-weight: 650; white-space: normal; }
.acct-sync-in .acct-signin:hover { text-decoration: underline; filter: none; }
