/* Account block (ac-): the sign-in sheet, the account page, the header menu. Tokens only; phone breakpoint 720. */

/* buttons that wait: the spinner and the verb come in with aria-busy */
.ac .k-btn .k-spin, .ac .ac-t-busy { display: none; }
.ac .k-btn[aria-busy="true"] .k-spin { display: inline-block; }
.ac .k-btn[aria-busy="true"] .ac-t-idle { display: none; }
.ac .k-btn[aria-busy="true"] .ac-t-busy { display: inline; }
.ac .k-err:empty, .ac .k-alert:empty { display: none; }
.ac .k-err:not(:empty) { animation: k-fade var(--d) ease; }
.ac-title { font-size: var(--t-h1); line-height: 1.1; letter-spacing: -0.02em; }
.ac-lead { color: var(--muted); font-size: 17px; max-width: 46ch; }
.ac-link { min-height: 44px; display: inline-flex; align-items: center; padding: 0; border: 0; background: none; color: var(--brand); font-weight: 600; font-size: 15px;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; text-decoration-color: color-mix(in srgb, var(--brand) 40%, transparent); transition: text-decoration-color var(--d-fast) ease; }

/* ---- sign-in sheet --------------------------------------------------------------------------------------------------- */
.ac-wrap { max-width: 488px; }
.ac-sheet { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(24px, 4vw, 40px); display: grid; gap: 24px; }
.ac-head { display: grid; gap: 10px; }
.ac-steps { display: grid; }
.ac-first, .ac-check, .ac-done { display: none; gap: 16px; min-width: 0; }
.ac[data-step="email"] .ac-first, .ac[data-step="code"] .ac-check, .ac[data-step="done"] .ac-done { display: grid; }
.ac[data-step] .ac-check, .ac[data-step] .ac-done { animation: k-in var(--d-tick) var(--ease) backwards; }
.ac-google { width: 100%; }
.ac-g { flex: none; }
.ac-or { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 14px; margin: 2px 0; }
.ac-or::before, .ac-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.ac-ask { display: grid; gap: 16px; }
.ac-send, .ac-verify { width: 100%; }
.ac-sent { outline: none; max-width: 44ch; overflow-wrap: anywhere; }

/* the code: one input; without JavaScript a wide, spaced field, with it six drawn boxes that mirror the input */
.ac-otp { position: relative; }
.k-field .ac-otp-in { width: 100%; min-height: 56px; font: 600 24px/1 var(--font-mono); letter-spacing: .5em; text-indent: .5em; text-align: center; font-variant-numeric: tabular-nums; }
.ac-boxes { display: none; }
.ac-otp[data-live] .ac-boxes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: clamp(6px, 2vw, 10px); }
.ac-otp[data-live] .ac-otp-in { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; background: transparent; box-shadow: none; color: transparent; caret-color: transparent; font-size: 16px; letter-spacing: 0; text-indent: 0; cursor: text; }
.ac-otp[data-live] .ac-otp-in, .ac-otp[data-live] .ac-otp-in:disabled { -webkit-text-fill-color: transparent; }
.ac-otp[data-live] .ac-otp-in::selection { background: transparent; color: transparent; -webkit-text-fill-color: transparent; }
.ac-box { --n: 0; aspect-ratio: 5 / 6; max-height: 68px; display: grid; place-items: center; border: 1px solid var(--field); border-radius: var(--radius-sm); background: var(--surface);
  font: 600 clamp(22px, 6.4vw, 28px)/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink);
  transition: border-color var(--d-fast) ease, box-shadow var(--d-fast) ease, background-color var(--d) var(--ease), color var(--d) var(--ease); }
.ac-box:nth-child(2) { --n: 1; } .ac-box:nth-child(3) { --n: 2; } .ac-box:nth-child(4) { --n: 3; } .ac-box:nth-child(5) { --n: 4; } .ac-box:nth-child(6) { --n: 5; }
.ac-box[data-on] { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.ac-box[data-on]:empty::after { content: ""; width: 2px; height: 1.1em; background: var(--brand); animation: ac-caret 1.1s steps(1) infinite; }
.ac-otp:has(> [aria-invalid="true"]) .ac-box { border-color: var(--danger); }
.ac-otp:has(> :disabled) .ac-box { opacity: .55; }
.ac-again { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 20px; margin-top: -4px; }
/* expired: the only way on is a new code, so that becomes the button */
.ac[data-state="expired"] .ac-verify { display: none; }
.ac[data-state="expired"] .ac-again { display: grid; justify-content: stretch; gap: 4px; margin-top: 0; }
.ac[data-state="expired"] .ac-resend { width: 100%; padding: 0 24px; min-height: 56px; justify-content: center; border-radius: var(--radius); background: var(--brand); color: var(--on-brand); font-size: 17px; text-decoration: none; transition: transform .16s var(--ease); }
.ac[data-state="expired"] .ac-resend:active { transform: scale(.98); }
.ac[data-state="expired"] .ac-change { justify-self: center; }

/* the authored moment: the boxes fill left to right, then the sheet settles on the spring and hands over */
.ac-otp.ac-unlock .ac-box { animation: ac-fill .26s calc(var(--n) * 40ms) var(--ease) both; }
.ac[data-step="done"] .ac-sheet { opacity: 1; transform: none; animation: ac-settle var(--d-spring) var(--spring); } /* replaces k-in, so it must also hold the end state */
.ac-done { grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 20px; outline: none; }
.ac-done .k-mark { margin: 10px; }
.ac-done-t { font-size: clamp(24px, 3vw, 28px); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.ac-done-p { color: var(--muted); margin-top: 4px; }
.ac-go { margin-top: 2px; }

.ac-status { display: grid; gap: 8px; }
.ac-status:has(> :empty + :empty) { display: none; }
.ac-note { font-size: 14px; color: var(--muted); }
.ac-note:empty { display: none; }
.ac-fine { font-size: 14px; color: var(--muted); max-width: 52ch; }
.ac-fine a { color: inherit; text-decoration-color: color-mix(in srgb, var(--ink) 35%, transparent); }

/* ---- account page ---------------------------------------------------------------------------------------------------- */
.ac-page { display: grid; gap: clamp(28px, 4vw, 40px); }
.ac-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px 24px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.ac-top-t { display: grid; gap: 8px; min-width: 0; }
.ac-as { color: var(--muted); overflow-wrap: anywhere; }
.ac-as strong { color: var(--ink); font-weight: 600; }
.ac-wait, .ac-gate, .ac-fail, .ac-gone, .ac-body { display: none; }
.ac[data-state="loading"] .ac-wait { display: flex; }
.ac[data-state="out"] .ac-gate, .ac[data-state="deleted"] .ac-gone { display: grid; }
.ac[data-state="error"] .ac-fail { display: block; }
.ac[data-state="ready"] .ac-body { display: grid; }
.ac[data-state="out"] .ac-out, .ac[data-state="deleted"] .ac-out, .ac[data-state="deleted"] .ac-as { display: none; }
.ac-wait { align-items: center; gap: 12px; color: var(--muted); min-height: 120px; }
@media (scripting: none) { .ac-wait { display: none !important; } }
.ac-gate, .ac-gone { justify-items: start; gap: 12px; max-width: 520px; padding: 8px 0 24px; animation: k-in var(--d-enter) var(--ease) backwards; }
.ac-gate-i { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); margin-bottom: 4px; }
.ac-gate-p { color: var(--muted); max-width: 46ch; }
.ac-gate-b, .ac-gone .k-btn { margin-top: 8px; }
.ac-gone .k-mark { margin: 10px 10px 14px; }
.ac-gone .ac-part-t { outline: none; }

.ac-body { grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); column-gap: clamp(32px, 5vw, 72px); row-gap: 40px; align-items: start; }
.ac-side { display: grid; gap: 40px; min-width: 0; }
@media (min-width: 721px) and (min-height: 760px) { .ac-side { position: sticky; top: calc(var(--header-h) + 24px); } }
.ac-part-t { font-size: var(--t-h3); line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
.ac-part-lead { color: var(--muted); font-size: 15px; max-width: 60ch; }

/* profile: a ruled ledger on the one card, each row edits in place */
.ac-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: clamp(20px, 3vw, 28px); display: grid; gap: 10px; min-width: 0; }
.ac-rows { display: grid; }
.ac-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line); }
.ac-row:last-child { padding-bottom: 0; }
.ac-row-main { display: grid; gap: 2px; min-width: 0; }
.ac-key { font-size: 14px; font-weight: 500; color: var(--muted); }
.ac-val { font-size: 17px; font-weight: 600; overflow-wrap: anywhere; white-space: pre-line; }
.ac-val[data-empty] { color: var(--muted); font-weight: 400; }
.ac-hint { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ac-row[data-open] .ac-val { display: none; }
.ac-edit { min-height: 44px; padding: 0 12px; margin: -6px -12px 0 0; border: 0; border-radius: var(--radius-sm); background: none; color: var(--brand); font-weight: 600; font-size: 15px;
  display: inline-flex; align-items: center; gap: 6px; transition: background-color var(--d-fast) ease, color var(--d-fast) ease; }
.ac-row[data-open] .ac-edit { color: var(--muted); }
.ac-edit-form { grid-column: 1 / -1; display: grid; gap: 10px; animation: k-in var(--d-tick) var(--ease) backwards; }
.ac-edit-form .k-field textarea { min-height: 96px; }
.ac-edit-act { display: flex; flex-wrap: wrap; gap: 8px; }

/* delete: quiet until asked, then a confirm block that says plainly what goes */
.ac-danger { display: grid; gap: 12px; justify-items: start; }
.ac-del { color: var(--danger); }
.ac-confirm { display: none; gap: 12px; width: 100%; padding: 20px; border-radius: var(--radius-sm); background: var(--danger-soft); }
.ac-danger:not([data-del="idle"]) .ac-confirm { display: grid; animation: k-in var(--d-tick) var(--ease) backwards; }
.ac-danger:not([data-del="idle"]) .ac-del { display: none; }
.ac-confirm-t { font-size: 18px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; color: var(--danger); outline: none; }
.ac-confirm p { font-size: 15px; }
.ac-confirm .k-alert { background: var(--surface); }
.ac-confirm-act { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.ac-confirm-act .k-btn { flex: 1 1 auto; }
.ac-del-yes { background: var(--danger); color: var(--surface); }

/* the parts other blocks fill */
.ac-feed { display: grid; gap: clamp(36px, 4vw, 48px); min-width: 0; }
.ac-part { display: grid; gap: 12px; min-width: 0; }
.ac-part-head { display: flex; align-items: center; gap: 10px; }
.ac-part-msg { color: var(--muted); }
.ac-part[data-state="empty"] .ac-part-msg { padding: 18px 20px; border: 1px dashed var(--field); border-radius: var(--radius-sm); }
.ac-part[data-state="error"] .ac-part-msg { color: var(--danger); }
.ac-part:not([data-state="ready"]) :is(.ac-list, .ac-sws), .ac-part[data-state="ready"] .ac-part-msg { display: none; }
.ac-list { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.ac-item { display: grid; grid-template-columns: minmax(0, 1fr) 7.5em 6.5em 8em; grid-template-areas: "main date total st"; gap: 4px 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); animation: k-in var(--d-enter) var(--ease) backwards; }
.ac-item:nth-child(2) { animation-delay: 50ms; } .ac-item:nth-child(3) { animation-delay: 100ms; } .ac-item:nth-child(4) { animation-delay: 150ms; } .ac-item:nth-child(n+5) { animation-delay: 200ms; }
.ac-main { grid-area: main; display: grid; gap: 2px; min-width: 0; }
.ac-what { font-weight: 600; overflow-wrap: anywhere; }
.ac-where { display: block; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.ac-ref { color: var(--ink); overflow-wrap: anywhere; }
.ac-ref a { color: inherit; }
.ac-joinbox { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 6px; }
.ac-join-note { color: var(--muted); font-size: 14px; }
.ac-date { grid-area: date; color: var(--muted); }
.ac-total { grid-area: total; text-align: right; font-weight: 600; }
.ac-st { grid-area: st; justify-self: end; }
.ac-learn { display: grid; gap: 4px; justify-items: start; padding: 16px 0 6px; border-top: 1px solid var(--line); }
.ac-learn-n { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.ac-learn-c { color: var(--ink); }

/* messaging switches: a checkbox with role="switch", 44 px tall, the track drawn on the input itself */
.ac-sws { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); }
.ac-sw-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.ac-sw-row label { display: grid; gap: 2px; padding-top: 10px; cursor: pointer; }
.ac-sw-row strong { font-weight: 600; }
.ac-sw-c { font-size: 14px; color: var(--muted); max-width: 58ch; overflow-wrap: anywhere; }
.ac-switch { appearance: none; -webkit-appearance: none; position: relative; width: 52px; height: 44px; margin: 0; border-radius: 999px; background: none; cursor: pointer; flex: none; }
.ac-switch::before { content: ""; position: absolute; left: 2px; top: 8px; width: 48px; height: 28px; border-radius: 999px; background: var(--line); box-shadow: inset 0 0 0 1px var(--field); transition: background-color var(--d) var(--ease), box-shadow var(--d) var(--ease); }
.ac-switch::after { content: ""; position: absolute; left: 6px; top: 12px; width: 20px; height: 20px; border-radius: 50%; background: var(--field); transition: transform var(--d) var(--ease), background-color var(--d) var(--ease); }
.ac-switch:checked::before { background: var(--brand); box-shadow: none; }
.ac-switch:checked::after { transform: translateX(20px); background: var(--on-brand); }
.ac-switch:focus-visible { outline: 2px solid var(--brand); outline-offset: 0; }
.ac-switch:disabled { opacity: .5; cursor: not-allowed; }
.ac-switch:disabled + label { cursor: default; }
.ac-sw-need { font-size: 14px; color: var(--muted); }

/* ---- header menu ----------------------------------------------------------------------------------------------------- */
.ac[data-variant="menu"] { padding: 4px 0; }
.ac-bar { display: flex; justify-content: flex-end; align-items: center; min-height: 52px; }
.ac[data-slotted] .ac-bar { min-height: 0; padding: 0; margin: 0; } /* inside the shell header (site.shell.menuSlot) */
/* the header row is tight below a wide screen (seven links, a button, the cart): the icon shows, the words stay for screen readers */
@media (max-width: 1280px) { .ac[data-slotted] .ac-in span, .ac[data-slotted] .ac-me-n { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } }
.ac-in { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px; color: var(--ink); font-weight: 600; font-size: 15px; text-decoration: none; border-radius: var(--radius-sm); transition: color var(--d-fast) ease; }
.ac-in svg { color: var(--brand); }
.ac-who { position: relative; }
.ac-me { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 12px 4px 4px; border: 0; border-radius: 999px; background: transparent; font-weight: 600; font-size: 15px; transition: background-color var(--d-fast) ease; }
.ac-av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: 15px; }
.ac-me-n { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-chev { color: var(--muted); transform: rotate(90deg); transition: transform var(--d) var(--ease); }
.ac-me[aria-expanded="true"] .ac-chev { transform: rotate(-90deg); }
.ac-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 212px; padding: 6px; display: grid; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); transform-origin: top right; animation: ac-pop var(--d) var(--ease); }
.ac-pop form { display: contents; }
.ac-pop-i { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--ink); font-size: 15px; font-weight: 500; text-align: left; text-decoration: none; transition: background-color var(--d-fast) ease; }
.ac-pop-i svg { color: var(--muted); }
.ac-pop-i:focus-visible { outline-offset: -2px; }

@media (hover: hover) and (pointer: fine) {
  .ac-link:hover { text-decoration-color: currentColor; }
  .ac-edit:hover { background: var(--brand-soft); }
  .ac-in:hover { color: var(--brand); }
  .ac-me:hover { background: var(--line); }
  .ac-pop-i:hover { background: var(--ground); }
  .ac[data-state="expired"] .ac-resend:hover { box-shadow: 0 10px 24px color-mix(in srgb, var(--brand) 30%, transparent); }
}

@media (max-width: 720px) {
  .ac-sheet { padding: 24px 20px; gap: 20px; }
  .ac-body { grid-template-columns: minmax(0, 1fr); }
  .ac-side { display: contents; }
  .ac-card { order: 0; } .ac-feed { order: 1; } .ac-danger { order: 2; }
  .ac-top { align-items: flex-start; }
  .ac-item { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main st" "date total"; row-gap: 6px; }
  .ac-st { align-self: start; }
  .ac-bar { min-height: 48px; }
}

@keyframes ac-fill { to { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: none; } }
@keyframes ac-settle { from { transform: translateY(8px) scale(.985); } }
@keyframes ac-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes ac-caret { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .ac[data-step] .ac-check, .ac[data-step] .ac-done, .ac-edit-form, .ac-gate, .ac-gone, .ac-item, .ac-pop,
  .ac-danger:not([data-del="idle"]) .ac-confirm { animation: k-fade .3s ease both; }
  .ac-otp.ac-unlock .ac-box { animation: ac-fill .2s ease both; }
  .ac[data-step="done"] .ac-sheet { animation: none; }
  .ac-box[data-on]:empty::after { animation: none; }
  .ac-switch::after { transition: background-color var(--d) ease; }
  .ac-chev { transition: none; }
  .ac[data-state="expired"] .ac-resend:active { transform: none; }
}
