/* Server rendered pages: login (home), access request, password pages, consent, messages.
   Builds on base.css (tokens, buttons, forms, links, motion). */

.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
@media (min-width: 768px) { .wrap { padding-left: 32px; padding-right: 32px; } }
@media (min-width: 1100px) { .wrap { padding-left: 48px; padding-right: 48px; } }

.site-body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.site-main { flex: 1; display: flex; flex-direction: column; }
.skip-link { position: absolute; left: 16px; top: -64px; z-index: 100; background: var(--primary); color: var(--on-primary); padding: 10px 16px; border-radius: var(--r-md); transition: top var(--d-fast) var(--ease); }
.skip-link:focus { top: 12px; }

/* ------------------------------------------------------------ top bar */
.site-nav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); }
.site-nav-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.site-nav-right { display: flex; align-items: center; gap: 8px; }
.theme-toggle .theme-icon { display: grid; place-items: center; }
.theme-toggle .theme-icon-dark { display: none; }
:root[data-theme='dark'] .theme-toggle .theme-icon-light { display: none; }
:root[data-theme='dark'] .theme-toggle .theme-icon-dark { display: grid; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .theme-toggle .theme-icon-light { display: none; }
  :root:not([data-theme='light']) .theme-toggle .theme-icon-dark { display: grid; }
}

/* ------------------------------------------------------------ login (home) and the other auth pages */
.auth { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; gap: 32px; padding-top: 32px; padding-bottom: 64px; max-width: 1120px; }
@media (min-width: 960px) { .auth { grid-template-columns: minmax(0, 1fr) 420px; gap: 96px; align-items: center; padding-top: 48px; padding-bottom: 96px; } }
.auth-intro { display: flex; flex-direction: column; gap: 16px; max-width: 34rem; animation: reveal var(--d-slow) var(--ease) both; }
.auth-intro h1 { letter-spacing: -0.02em; max-width: 16ch; }
.auth-lead { font-size: 16px; line-height: 1.55; color: var(--body); max-width: 46ch; }
.auth-points { list-style: none; margin: 8px 0 0; padding: 16px 0 0; border-top: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 12px; max-width: 30rem; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--ink); }
.auth-points .icon { color: var(--muted); margin-top: 1px; }
@media (max-width: 959px) { .auth-points { display: none; } .auth-intro h1 { font-size: 28px; } .auth-lead { font-size: 14px; } }
.auth-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; animation: reveal var(--d-slow) var(--ease) 60ms both; }
.auth-panel { width: 100%; background: var(--bg); border: 1px solid var(--hairline); border-radius: var(--r-lg); padding: 24px 20px; display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 600px) { .auth-panel { padding: 32px; } }
.auth-panel-title { color: var(--ink); }
.auth-alt { font-size: 14px; color: var(--muted); padding-left: 4px; }
.auth-single { grid-template-columns: minmax(0, 1fr) !important; justify-items: center; max-width: 520px; }
.auth-single .auth-panel { animation: reveal var(--d-slow) var(--ease) both; }
.auth-single .auth-alt { align-self: flex-start; }
.page-card .btn:not(.btn-block) { align-self: flex-start; }
.field-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field-top label { font-size: 14px; font-weight: 500; color: var(--ink); }
.field-aside { font-size: 13px; }
.stack-form { display: flex; flex-direction: column; gap: 16px; }
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ dialogs (request access, about the author) */
.modal { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100dvh; margin: auto; width: min(460px, calc(100vw - 32px)); overflow: visible; color: var(--body); }
.modal::backdrop { background: var(--scrim); animation: fade-in var(--d-med) var(--ease) both; }
.modal-body { position: relative; background: var(--bg); border: 1px solid var(--card-line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: 24px; animation: modal-in var(--d-med) var(--ease) both; }
@media (min-width: 600px) { .modal-body { padding: 32px; } }
.modal.is-closing .modal-body { animation: modal-out 160ms var(--ease-in) both; }
.modal.is-closing::backdrop { animation: fade-out 160ms linear both; }
.modal-pane { display: flex; flex-direction: column; gap: 16px; }
.modal-pane[data-pane='done'] { align-items: flex-start; animation: reveal var(--d-med) var(--ease) both; }
.modal-x { position: absolute; top: 12px; right: 12px; }
.author-head { display: flex; gap: 16px; align-items: center; padding-right: 40px; }
.author-mark { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--peach); color: #181d26; font-size: 18px; font-weight: 500; letter-spacing: 0.02em; flex: none; }
.author-role { font-size: 13px; color: var(--muted); margin-top: 2px; }
.modal-pane > h2:first-child { padding-right: 40px; }
.done-mark { width: 64px; height: 64px; border-radius: 50%; background: var(--forest); display: grid; place-items: center; }
.done-mark svg { width: 40px; height: 40px; }
.dm-c { fill: var(--mint); transform-origin: center; transform-box: fill-box; animation: pop-c var(--d-slow) var(--ease) both; }
.dm-p { fill: none; stroke: #0a2e0e; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; animation: draw-once 520ms 200ms var(--ease) both; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-c { from { transform: scale(0.4); opacity: 0; } }
@keyframes draw-once { from { stroke-dashoffset: 40; } to { stroke-dashoffset: 0; } }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ------------------------------------------------------------ password strength */
.meter { height: 6px; border-radius: 3px; background: var(--bg-strong); overflow: hidden; margin-top: -8px; }
.meter span { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--coral); transition: width var(--d-med) var(--ease), background-color var(--d-med) var(--ease); }
.meter span[data-level='1'] { background: var(--mustard); }
.meter span[data-level='2'] { background: var(--yellow); }
.meter span[data-level='3'], .meter span[data-level='4'] { background: var(--success); }
.done-mark.static { margin-bottom: 4px; }

/* ------------------------------------------------------------ footer (shared by pages and the app) */
.site-footer { border-top: 1px solid var(--hairline); padding: 24px 0 28px; margin-top: auto; }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.footer-line { font-size: 13px; color: var(--muted); }
.footer-note { font-size: 12px; color: var(--subtle); }
.author-link { font: inherit; color: var(--ink); font-weight: 500; }

/* ------------------------------------------------------------ OAuth consent + messages */
.consent { flex: 1; display: grid; place-items: start center; padding-top: 32px; padding-bottom: 64px; }
.consent-card { width: 100%; max-width: 560px; border: 1px solid var(--card-line); border-radius: var(--r-lg); padding: 24px 20px; display: flex; flex-direction: column; gap: 16px; animation: reveal var(--d-med) var(--ease) both; background: var(--bg); }
@media (min-width: 600px) { .consent-card { padding: 40px; } }
.consent-pair { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.pair-tile { width: 48px; height: 48px; border-radius: var(--r-md); background: var(--yellow); color: #181d26; display: grid; place-items: center; font-weight: 500; font-size: 20px; }
.pair-brand { background: var(--bg-soft); border: 1px solid var(--hairline); }
.pair-brand svg { width: 30px; height: 30px; }
.pair-link { width: 40px; height: 2px; border-radius: 2px; background: repeating-linear-gradient(90deg, var(--border-strong) 0 6px, transparent 6px 10px); }
.checklist { list-style: none; padding: 0; margin: 4px 0; display: flex; flex-direction: column; gap: 10px; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--ink); }
.checklist .icon { color: var(--success); margin-top: 2px; }
.checklist li.warn .icon { color: var(--danger); }
.checklist li.off { color: var(--muted); }
.checklist li.off .icon { color: var(--subtle); }
.consent-where { background: var(--bg-soft); border: 1px solid var(--hairline); border-radius: var(--r-md); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.consent-where p { font-size: 14px; }
.consent-actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.consent-actions .btn { flex: 1 1 140px; }
.message-card p { font-size: 16px; }
.message-card .btn { margin-top: 8px; align-self: flex-start; }
