/* Sign-in / sign-up screen, shared by the web page (public/login.html) and the native app overlay (public/js/native-auth.js). */
/* Markup comes from public/js/auth-screen.js. Everything is scoped under .auth-page (web) or .auth-overlay (native) so it never leaks into the app. */
:root {
  --auth-accent-soft: color-mix(in srgb, var(--accent) 18%, var(--panel));
  --auth-panel-soft: color-mix(in srgb, var(--panel) 72%, transparent);
  --auth-card-shadow: 0 24px 80px -34px rgba(55, 52, 48, 0.46);
}
:root[data-theme="dark"] { --auth-card-shadow: 0 24px 80px -32px rgba(0, 0, 0, 0.8); }

/* --- Page shell (web only) --- */
html.auth-page { min-height: 100%; background: var(--shell); }
body.auth-page { position: relative; display: flex; align-items: center; justify-content: center; min-height: 100dvh; margin: 0;
  padding: max(32px, env(safe-area-inset-top)) max(32px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(32px, env(safe-area-inset-left));
  overflow-x: hidden; background: var(--shell); color: var(--text); font-family: var(--font-sans); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
body.auth-page *, body.auth-page *::before, body.auth-page *::after { box-sizing: border-box; }
.auth-shell { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(390px, 440px); align-items: center; gap: clamp(48px, 8vw, 104px); width: min(100%, 1020px); }
.auth-intro { position: relative; padding: 28px 0; }
.auth-intro > * { position: relative; z-index: 1; }
/* A giant whisper-quiet copy of the mark behind the intro copy; each bar breathes slowly like a voice. */
.auth-bg-mark { position: absolute; top: -30px; right: -30px; z-index: 0; height: 540px; width: auto; color: var(--accent); opacity: 0.07; pointer-events: none; }
.auth-bg-mark line { transform-origin: 50% 50%; transform-box: view-box; animation: auth-bar-breathe 4.2s ease-in-out infinite; animation-delay: var(--bd, 0s); }
@keyframes auth-bar-breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(0.72); } }
@media (prefers-reduced-motion: reduce) { .auth-bg-mark line { animation: none; } }
.auth-eyebrow { margin: 36px 0 14px; color: var(--accent-2); font-size: 0.78rem; font-weight: 750; letter-spacing: 0.13em; text-transform: uppercase; }
.auth-intro h1 { max-width: 9ch; margin: 0; font-size: clamp(3.4rem, 6vw, 5.2rem); font-weight: 680; letter-spacing: -0.065em; line-height: 0.94; }
.auth-intro h1 span { color: var(--accent); }
.auth-intro-copy { max-width: 34ch; margin: 40px 0 0; color: var(--muted); font-size: 1.3rem; line-height: 1.55; }

/* --- Native overlay shell: fills the app window, same phone layout as the web page --- */
.auth-overlay { position: fixed; inset: 0; z-index: var(--z-overlay, 80); display: flex; align-items: flex-start; justify-content: center; overflow-y: auto;
  padding: max(24px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: var(--shell); color: var(--text); font-family: var(--font-sans); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
.auth-overlay *, .auth-overlay *::before, .auth-overlay *::after { box-sizing: border-box; }
.auth-overlay .auth-shell { display: block; width: min(100%, 460px); margin: auto; }
.auth-overlay .auth-mobile-brand { display: inline-flex; margin-bottom: 22px; }
.auth-overlay .auth-card { padding: 28px 22px 24px; border-radius: 20px; }
.auth-overlay .auth-heading { margin-bottom: 24px; }
.auth-overlay .auth-heading h2 { font-size: 1.7rem; }

/* --- Wordmark --- */
.auth-wordmark { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-size: 1.7rem; font-weight: 750; letter-spacing: -0.02em; text-decoration: none; }
/* The waveform brand mark as bare orange bars; the tile is reserved for app icons. */
.auth-mark { height: 34px; width: 34px; color: var(--accent); }
.auth-mobile-brand { display: none; }

/* --- Card --- */
.auth-card { display: flex; flex-direction: column; width: 100%; padding: clamp(30px, 4.5vw, 44px); background: var(--auth-panel-soft); border: 1px solid var(--line);
  border-radius: 26px; box-shadow: var(--auth-card-shadow); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); }
.auth-heading { margin-bottom: 26px; text-align: center; }
.auth-heading h2 { margin: 0; font-size: 1.85rem; font-weight: 700; letter-spacing: -0.035em; line-height: 1.15; }
.auth-heading p { margin: 8px 0 0; color: var(--muted); font-size: 0.98rem; }
.auth-oauth { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 48px; padding: 12px 16px; background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 13px; font-family: inherit; font-size: 0.95rem; font-weight: 650; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .1s; }
.auth-oauth:disabled { opacity: 0.6; cursor: default; }
.auth-oauth:hover { background: var(--line-soft); border-color: var(--accent); box-shadow: 0 8px 20px -16px rgba(55, 52, 48, 0.8); }
.auth-oauth:active { transform: translateY(1px); }
.auth-oauth + .auth-oauth { margin-top: 11px; }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-error, .auth-note { margin: 0 0 16px; padding: 11px 13px; border-radius: 10px; font-size: 0.86rem; line-height: 1.4; }
.auth-error { background: color-mix(in srgb, var(--overdue) 10%, transparent); color: var(--overdue); }
.auth-note { background: var(--auth-accent-soft); color: var(--text); }
.auth-error[hidden], .auth-note[hidden] { display: none; }
.auth-forgot { display: block; width: fit-content; margin: 16px 0 0 auto; color: var(--muted); font-size: 0.85rem; text-decoration: none; }
.auth-forgot:hover { color: var(--accent); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-field { display: flex; flex-direction: column; gap: 7px; }
.auth-field label { padding-left: 1px; color: var(--text); font-size: 0.8rem; font-weight: 650; letter-spacing: 0.01em; }
.auth-field input { width: 100%; min-height: 49px; padding: 13px 15px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; color: var(--text);
  font-family: inherit; font-size: 1rem; outline: none; transition: background .15s, border-color .15s, box-shadow .15s; }
.auth-field input::placeholder { color: var(--muted); }
.auth-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--auth-accent-soft); }
.auth-pw { position: relative; }
.auth-pw input { padding-right: 48px; }
.auth-pw-toggle { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  background: none; border: none; border-radius: 8px; color: var(--muted); cursor: pointer; }
.auth-pw-toggle:hover { color: var(--accent); }
.auth-pw-toggle svg[hidden] { display: none; }
.auth-submit { min-height: 50px; margin-top: 7px; padding: 13px 18px; background: var(--grad, var(--accent)); color: var(--on-accent); border: none; border-radius: 12px;
  box-shadow: 0 12px 24px -14px rgba(179, 74, 32, 0.95); font-family: inherit; font-size: 1rem; font-weight: 700; cursor: pointer; transition: filter .15s, box-shadow .15s, transform .05s; }
.auth-submit:hover { filter: brightness(1.06); box-shadow: 0 14px 26px -14px rgba(179, 74, 32, 1); }
.auth-submit:active { transform: translateY(1px); }
.auth-submit:disabled { opacity: 0.62; cursor: default; }
.auth-card button:focus-visible, .auth-card a:focus-visible { outline: 3px solid var(--auth-accent-soft); outline-offset: 3px; }
.auth-alt { margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 0.875rem; text-align: center; }
.auth-alt a { color: var(--accent); text-decoration: none; font-weight: 600; }
.auth-alt a:hover { color: var(--accent-2); }
.auth-legal { margin: 8px 0 0; color: var(--muted); opacity: 0.8; font-size: 0.75rem; line-height: 1.4; text-align: center; }
.auth-legal a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.auth-legal a:hover { color: var(--accent); }

/* --- Phone layout (web); the native overlay uses the same values via the .auth-overlay rules above --- */
@media (max-width: 780px) {
  body.auth-page { align-items: flex-start; padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); }
  .auth-shell { display: block; width: min(100%, 460px); margin: auto; }
  .auth-intro { display: none; }
  .auth-mobile-brand { display: inline-flex; margin-bottom: 24px; }
  .auth-card { padding: clamp(28px, 8vw, 40px); border-radius: 24px; }
}
@media (max-width: 460px) {
  body.auth-page { padding-right: max(14px, env(safe-area-inset-right)); padding-left: max(14px, env(safe-area-inset-left)); }
  .auth-card { padding: 28px 22px 24px; border-radius: 20px; }
  .auth-mobile-brand { margin-bottom: 22px; }
  .auth-heading { margin-bottom: 24px; }
  .auth-heading h2 { font-size: 1.7rem; }
}
