/* Sign-in sheet, step 1 (docs/research/ads/DESIGN-auth-sheet-2026-11-13.md). Sheet-only rules: the dialog and its
   backdrop, grabber, header row, tabs, Show button, password rule, recovery code box, text button, icon button and
   spinner. The <dialog> sits inside <main>, so buttons, fields, chips, result boxes and tokens come from system.css
   and are not written twice. Loaded on /plans/, /profile/ and /sign-in/ only (src/render.js). */

/* Sheet (phone): slides up from below the screen; 16 px top corners; sits above the iOS keyboard (--auth-kb). */
main dialog.auth-sheet{position:fixed;inset:auto 0 var(--auth-kb,0px) 0;width:100%;max-width:none;max-height:calc(100dvh - 28px - var(--auth-kb,0px));margin:0;padding:0;border:0;border-radius:16px 16px 0 0;background:#fff;color:var(--ink);overflow:hidden;transition:transform 240ms cubic-bezier(.2,0,0,1)}
main dialog.auth-sheet[open]{display:flex;flex-direction:column;animation:auth-sheet-in 360ms cubic-bezier(.32,.72,0,1)}
main dialog.auth-sheet::backdrop{background:var(--scrim);animation:auth-fade-in 200ms cubic-bezier(.2,0,0,1)}
main dialog.auth-sheet[data-state=closing]{animation:auth-sheet-out 220ms cubic-bezier(.4,0,1,1) forwards}
main dialog.auth-sheet[data-state=closing]::backdrop{animation:auth-fade-out 220ms linear forwards}
main dialog.auth-sheet.is-dragging{transition:none}
@keyframes auth-sheet-in{from{transform:translateY(100%)}}
@keyframes auth-sheet-out{from{transform:translateY(var(--auth-from,0px))}to{transform:translateY(105%)}}
@keyframes auth-fade-in{from{opacity:0}}
@keyframes auth-fade-out{to{opacity:0}}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-sheet-box{display:flex;flex-direction:column;min-height:0;max-height:inherit;outline:none}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-sheet-grab{display:flex;justify-content:center;padding:8px 0 2px;touch-action:none;cursor:grab}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-sheet-grab span{width:36px;height:5px;border-radius:3px;background:var(--grabber)}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-sheet-head{display:flex;align-items:center;gap:4px;min-height:44px;padding:0 8px 0 20px;touch-action:none}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-sheet-plan{flex:1;min-width:0;margin:0;font-size:14px;line-height:1.5;color:var(--muted)}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-sheet-plan strong{color:var(--ink);font-weight:650}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-sheet-body{overflow-y:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:8px 20px calc(24px + env(safe-area-inset-bottom,0px))}
/* Dialog (desktop): centred, 440 px wide, fades in and scales from 97%. */
@media (min-width:701px){
 main dialog.auth-sheet{inset:0;margin:auto;width:440px;max-height:calc(100dvh - 64px);border-radius:16px}
 main dialog.auth-sheet[open]{animation:auth-dialog-in 200ms cubic-bezier(.2,0,0,1)}
 main dialog.auth-sheet[data-state=closing]{animation:auth-fade-out 150ms linear forwards}
 body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-sheet-grab{display:none}
 body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-sheet-head{padding:12px 12px 0 24px}
 body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-sheet-body{padding:8px 24px 28px}
}
@keyframes auth-dialog-in{from{opacity:0;transform:scale(.97)}}
/* Inline card (/profile/, /sign-in/): the card frame is .auth-panel (system.css). */
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet.auth-panel .auth-sheet-body{overflow:visible;padding:0}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet[data-recovery-code]{margin-top:24px}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet[data-recovery-code]:empty{display:none}

/* Step change: the next step fades in and moves 16 px from the right; going back, from the left. */
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-view-in{animation:auth-view-in 220ms cubic-bezier(.2,0,0,1) both}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-view-in.is-back{animation-name:auth-view-back}
@keyframes auth-view-in{from{opacity:0;transform:translateX(16px)}to{opacity:1;transform:none}}
@keyframes auth-view-back{from{opacity:0;transform:translateX(-16px)}to{opacity:1;transform:none}}

/* Type inside the sheet: card title (sub role), small text, body text. */
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-sheet-title{margin:0;font-size:var(--t-sub);line-height:1.4;font-weight:700;letter-spacing:-.01em;outline:none}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-sheet-sub{margin:4px 0 0;font-size:14px;line-height:1.5;color:var(--muted)}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-sheet-text{margin:8px 0 0;font-size:16px;line-height:1.65;color:var(--ink)}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-sheet-foot{margin:12px 0 0;font-size:14px;line-height:1.5;color:var(--muted)}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-form .auth-sheet-foot{margin:-8px 0 0}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-quiet{margin:-4px 0 0;font-size:14px;line-height:1.5}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .check-result{margin:16px 0 0;padding:12px 14px;font-size:14px;line-height:1.5;font-weight:650}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .check-result.is-error{color:var(--error)}

/* Step 2, the ways: Google's slot, then the quieter username path. Google draws its own button (about 40 px tall, its
   own font and corners); the slot keeps the placeholder's 48 px so nothing moves when Google's button replaces it. */
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-ways{display:grid;gap:12px;margin:20px 0 0}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-way-last{margin:0 0 4px;font-size:14px;line-height:1.5;color:var(--muted)}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-google{display:flex;align-items:center;justify-content:center;min-height:48px}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-ways+.auth-quiet{margin:16px 0 0}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-quiet-row{display:flex;flex-wrap:wrap;justify-content:space-between;gap:4px 16px}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-sheet-head.has-back{padding-left:8px}
/* Profile page: read-only sign-in methods and the public name. */
body.site-v2.v2-ui:not(.focus-layout) main .auth-profile .auth-methods{list-style:none;margin:0;padding:0;border-top:1px solid var(--line)}
body.site-v2.v2-ui:not(.focus-layout) main .auth-profile .auth-methods li{display:flex;flex-wrap:wrap;justify-content:space-between;gap:4px 16px;margin:0;padding:12px 0;border-bottom:1px solid var(--line);font-size:16px;line-height:1.5}
body.site-v2.v2-ui:not(.focus-layout) main .auth-profile .auth-methods span{color:var(--muted);overflow-wrap:anywhere}
body.site-v2.v2-ui:not(.focus-layout) main .auth-profile .auth-name{margin:0;font-size:16px;line-height:1.5}
/* Tabs (step 1): two chips side by side; the selected tab is the selected chip. */
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-tabs{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:20px 0 0;padding:0;overflow:visible}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-tabs button{width:100%;padding-inline:8px;transition:border-color .15s ease-out,background-color .15s ease-out,color .15s ease-out}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-tabs button[aria-selected=true]{background:var(--ink);color:#fff;border-color:var(--ink)}

/* Form: fields 20 px apart, label 8 px above its field, help and error 8 px below. */
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-form{display:grid;gap:20px;margin:20px 0 0}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-field{min-width:0}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-label-row{display:flex;justify-content:space-between;align-items:baseline;gap:12px;margin:0 0 8px}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet label{display:block;margin:0;font-size:14px;font-weight:650;line-height:1.5;color:var(--ink)}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .field{display:block;width:100%;margin:0}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .field[readonly]{color:var(--muted)}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet :is(.field-help,.field-error){margin:8px 0 0}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-rule+.field-help{margin-top:4px}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .button{width:100%;gap:8px;white-space:normal}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .button[aria-busy=true]{cursor:progress}
/* Show button: inside the password field, 44 px target. */
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-pw{position:relative}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-pw .field{padding-right:76px}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-pw-toggle{position:absolute;right:2px;top:50%;transform:translateY(-50%);min-width:64px;height:44px;padding:0 12px;border:0;background:transparent;border-radius:10px;color:var(--ink);font:inherit;font-size:14px;font-weight:650;line-height:1;cursor:pointer;-webkit-tap-highlight-color:transparent}
/* Password rule: a live check. */
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-rule{display:flex;align-items:center;gap:8px;margin:8px 0 0;font-size:14px;line-height:1.5;color:var(--muted);transition:color .15s ease-out}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-rule-dot{flex:none;display:grid;place-items:center;width:18px;height:18px;border-radius:50%;box-shadow:inset 0 0 0 1.5px var(--field-line);transition:background-color .15s ease-out}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-rule-dot svg{width:12px;height:12px}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-rule.is-met{color:var(--ink)}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-rule.is-met .auth-rule-dot{background:var(--ink);box-shadow:none;color:#fff}

/* Code: the monospace role, for the recovery code and its field. */
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-mono{font-family:ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;font-size:16px}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-code{display:flex;flex-wrap:wrap;margin:20px 0 0;padding:16px 20px;background:var(--tint);border-radius:12px;font-family:ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;font-size:19px;line-height:1.5;letter-spacing:.02em;font-variant-numeric:tabular-nums;color:var(--ink);-webkit-user-select:all;user-select:all}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-row2{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin:12px 0 0}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-row2 .button{padding-inline:12px}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-stack{display:grid;gap:12px;margin:24px 0 0}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-handoff{display:grid;justify-items:start;gap:4px;padding:12px 0 8px}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-handoff .auth-spinner{margin-bottom:12px;color:var(--ink)}

/* Text button: a link-green underlined label with a 44 px target. */
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .text-button{display:inline-flex;align-items:center;min-height:44px;margin:-12px 0;padding:0;border:0;background:none;font:inherit;font-size:14px;font-weight:650;line-height:1.5;color:var(--link);text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:3px;cursor:pointer;-webkit-tap-highlight-color:transparent}
/* Icon button: 44 px target, 30 px tint disc. */
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .icon-button{flex:none;display:grid;place-items:center;width:44px;height:44px;padding:0;border:0;background:transparent;color:var(--ink);border-radius:10px;cursor:pointer;-webkit-tap-highlight-color:transparent}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .icon-button span{display:grid;place-items:center;width:30px;height:30px;border-radius:50%;background:var(--tint);transition:background-color .15s ease-out}
@media (hover:hover){
 body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .text-button:hover{text-decoration-thickness:2px}
 body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .icon-button:hover span{background:var(--line)}
 body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-pw-toggle:hover{background:var(--tint)}
}
/* Busy: the spinner turns once in 0.8 s; the label says what is happening. */
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-spinner{flex:none;width:16px;height:16px;border-radius:50%;border:2px solid currentColor;border-right-color:transparent;animation:auth-spin .8s linear infinite}
body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-spinner.is-large{width:28px;height:28px;border-width:3px}
@keyframes auth-spin{to{transform:rotate(360deg)}}

/* Success card on /profile/?checkout=success: a result box whose heading takes focus. */
body.site-v2.v2-ui:not(.focus-layout) main [data-checkout-done]{display:grid;gap:8px;justify-items:start;margin:0 0 var(--gap-section,40px)}
body.site-v2.v2-ui:not(.focus-layout) main [data-checkout-done] h2{margin:0;outline:none}
body.site-v2.v2-ui:not(.focus-layout) main [data-checkout-done] p{margin:0;font-size:14px;line-height:1.5;color:var(--muted)}
body.site-v2.v2-ui:not(.focus-layout) main [data-checkout-done] .button{margin-top:8px}

/* Reduced motion: fades of 120 ms, no slides or scaling; the spinner turns at half speed. style.css switches every
   animation off under this setting (*{animation:none!important}); the sheet keeps its short fades and a slow
   spinner, so opening, closing and "busy" stay visible. That is why these rules carry !important. */
@media (prefers-reduced-motion:reduce){
 main dialog.auth-sheet[open]{animation:auth-fade-in 120ms linear!important}
 main dialog.auth-sheet::backdrop{animation-duration:120ms}
 main dialog.auth-sheet[data-state=closing]{animation:auth-fade-out 120ms linear forwards!important}
 main dialog.auth-sheet[data-state=closing]::backdrop{animation:auth-fade-out 120ms linear forwards}
 body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-view-in,body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-view-in.is-back{animation:auth-fade-in 120ms linear both!important}
 body.site-v2.v2-ui:not(.focus-layout) main .auth-sheet .auth-spinner{animation:auth-spin 1.6s linear infinite!important}
}
