/* auth.css — the auth surfaces (login + register) as one self-contained file.
 *
 * SCOPE: everything inside `.login-page` only. The My Songs / Albums overlays
 * (.cloud-modal*, .cloud-search) stay in styles/components/gallery.css untouched; the six `.cloud-*`
 * classes that WERE login-only (cloud-google-btn, cloud-divider, cloud-field,
 * cloud-email-form, cloud-auth-error, cloud-auth-actions) now live here,
 * scoped under .login-page so they can never leak into the app chrome.
 *
 * TOKEN CONTRACT (for the later app-wide phases): the --auth-* tokens below
 * are the first draft of the refreshed design system — warm cream canvas,
 * deep-green brand moment, lime as a spark (never a surface), borderless-
 * until-focus inputs, larger radii, one layered card shadow. Later phases
 * can lift these into the app-wide :root without renaming.
 *
 * PRINT: auth pages are screen-only. The print-hide rule for .login-page
 * lives in styles/base/print.css (@media print). This file defines no print rules and no
 * --print-* tokens (print geometry is PROTECTED — see styles/base/print.css and styles/score/preview.css).
 *
 * FONTS: "Sora" is the display voice (headings, primary buttons), Inter the
 * body voice. Both self-hosted via styles/base/fonts.css.
 *
 * Version token: this stylesheet is referenced as styles/pages/auth.css?v=r31-87808f4
 * in index.html and precached by sw.js; the deploy stamps it in one pass.
 */

/* =====================================================================
   Tokens (light) + dark remap
   ===================================================================== */
:root {
   --auth-bg: #faf9f2;               /* warm cream canvas */
   --auth-panel: #175c3e;            /* deep brand-panel green */
   --auth-panel-ink: #f2f7f0;
   --auth-panel-muted: rgba(242, 247, 240, 0.72);
   --auth-card: #ffffff;
   --auth-field: #f4f3ea;            /* borderless input fill */
   --auth-field-focus: #ffffff;
   --auth-ring: rgba(35, 122, 80, 0.28);
   --auth-spark: #b8e85c;            /* lime — spark only, never a surface */
   --auth-danger: #b42318;
   --auth-danger-bg: rgba(180, 35, 24, 0.08);
   --auth-radius-card: 28px;
   --auth-radius-field: 12px;
   --auth-radius-btn: 14px;
   --auth-shadow-card:
      0 1px 2px rgba(20, 58, 41, 0.04),
      0 24px 60px -20px rgba(20, 58, 41, 0.18);
   --auth-ease: cubic-bezier(0.22, 1, 0.36, 1);
}
html[data-theme="dark"] {
   --auth-bg: #0d0f0d;
   --auth-panel: #123526;
   --auth-panel-ink: #eef4ef;
   --auth-panel-muted: rgba(238, 244, 239, 0.66);
   --auth-card: #161816;
   --auth-field: #1d211e;
   --auth-field-focus: #222622;
   --auth-ring: rgba(85, 185, 130, 0.3);
   --auth-danger: #ff9b8f;
   --auth-danger-bg: rgba(255, 100, 85, 0.1);
}

/* =====================================================================
   Page shell
   ===================================================================== */
.login-page {
   position: fixed;
   inset: 0;
   z-index: 140;
   display: grid;
   grid-template-columns: 1.1fr 1fr;
   background: var(--auth-bg);
   opacity: 0;
   transition: opacity 0.3s ease;
}
.login-page[hidden] {
   display: none;
}
.login-page.is-open {
   opacity: 1;
}

/* =====================================================================
   Aside — the one deep-green brand moment
   ===================================================================== */
.login-aside {
   position: relative;
   display: flex;
   align-items: center;
   justify-content: center;
   padding: 48px;
   color: var(--auth-panel-ink);
   background: var(--auth-panel);
   overflow: hidden;
}
/* Brand-relevant motif instead of generic glow blobs: oversized Nashville
   numerals + an accidental at very low opacity, top-right bleed. */
.login-aside-motif {
   position: absolute;
   top: -40px;
   right: -20px;
   display: flex;
   gap: 0.08em;
   font-family: "Sora", Inter, ui-sans-serif, system-ui, sans-serif;
   font-size: clamp(180px, 22vw, 300px);
   font-weight: 700;
   line-height: 1;
   color: var(--auth-panel-ink);
   opacity: 0.07;
   pointer-events: none;
   user-select: none;
}
.login-aside-motif span:nth-child(2) {
   font-family: Georgia, "Times New Roman", serif; /* ♯ glyph */
   font-weight: 400;
}
.login-aside-inner {
   position: relative;
   /* Wide enough that the two-line headline never re-wraps to a third line
      (house rule: every headline is two lines or fewer at every width). */
   max-width: 500px;
}
.login-aside-brand {
   margin-bottom: 30px;
}
/* Logo shows bare on the green panel — no tinted tile / blur behind it.
   (backdrop-filter: none is a RESET of styles/components/gallery.css's blur, not glass: taste-skill-ignore) */
.login-aside-brand .home-brand-icon {
   width: 46px;
   height: 46px;
   border-radius: 0;
   background: none;
   -webkit-backdrop-filter: none; /* taste-skill-ignore: reset, not glass */
   backdrop-filter: none; /* taste-skill-ignore: reset, not glass */
}
.login-aside-brand .home-brand-icon img {
   width: 46px;
   height: 46px;
}
.login-aside-brand .home-brand-text {
   color: var(--auth-panel-ink);
   font-size: 16px;
}
.login-aside-brand .home-brand-text small {
   color: var(--auth-panel-muted);
}
.login-aside-title {
   margin: 0;
   font-family: "Sora", Inter, ui-sans-serif, system-ui, sans-serif;
   font-size: clamp(28px, 3vw, 40px);
   font-weight: 700;
   letter-spacing: -0.02em;
   line-height: 1.12;
}
.login-aside-tag {
   margin: 14px 0 30px;
   font-size: 14.5px;
   line-height: 1.55;
   color: var(--auth-panel-muted);
}
.login-aside-points {
   list-style: none;
   margin: 0;
   padding: 0;
   display: flex;
   flex-direction: column;
   gap: 14px;
}
.login-aside-points li {
   display: flex;
   align-items: flex-start;
   gap: 12px;
   font-size: 14.5px;
   font-weight: 500;
}
/* Bare 18px stroke icon in the brand spark colour — no tinted-square chip
   container (an app-screen house rule: icons never sit in tinted squares). */
.login-point-icon {
   flex: none;
   margin-top: 1px;
   color: var(--auth-spark);
}
.login-point-icon svg {
   display: block;
   width: 18px;
   height: 18px;
}

/* =====================================================================
   Main column + card
   ===================================================================== */
.login-main {
   display: grid;
   place-items: center;
   padding: 40px 28px;
   overflow-y: auto;
}
.login-card {
   width: min(420px, 100%);
   display: flex;
   flex-direction: column;
   gap: 16px;
   padding: 40px;
   border-radius: var(--auth-radius-card);
   background: var(--auth-card);
   box-shadow: var(--auth-shadow-card);
}
.login-card-head {
   text-align: center;
   display: flex;
   flex-direction: column;
   align-items: center;
   gap: 6px;
   margin-bottom: 4px;
}
/* Compact brand lockup at the top of the form. Only shows on narrow screens
   where the green brand panel is hidden — on wide layouts the panel already
   carries the brand. (Scoped under .login-card so it outranks the shared
   .home-brand display rule.) */
.login-card .login-card-brand {
   display: none;
   margin-bottom: 10px;
}
.login-card-brand .home-brand-icon {
   width: 40px;
   height: 40px;
}
.login-card-brand .home-brand-text {
   font-size: 15px;
}
.login-card-title {
   margin: 4px 0 0;
   font-family: "Sora", Inter, ui-sans-serif, system-ui, sans-serif;
   font-size: 26px;
   font-weight: 600;
   letter-spacing: -0.02em;
   color: var(--ink);
}
.login-card-sub {
   margin: 0;
   font-size: 14px;
   color: var(--muted);
}

/* =====================================================================
   Auth views (login ↔ register modes on one page element)
   ===================================================================== */
.auth-view {
   display: flex;
   flex-direction: column;
   gap: 14px;
}
.auth-view[hidden] {
   display: none;
}

/* =====================================================================
   Google button (moved from ui.css, re-scoped under .login-page)
   ===================================================================== */
.login-page .cloud-google-btn {
   width: 100%;
   min-height: 48px;
   margin-top: 2px;
   display: inline-flex;
   align-items: center;
   justify-content: center;
   gap: 10px;
   border: none;
   border-radius: var(--auth-radius-btn);
   background: var(--auth-field);
   color: var(--ink);
   font: 600 14px Inter, ui-sans-serif, system-ui, sans-serif;
   cursor: pointer;
   transition:
      transform 0.16s var(--auth-ease),
      box-shadow 0.16s var(--auth-ease),
      background 0.16s var(--auth-ease);
}
.login-page .cloud-google-btn:hover {
   transform: translateY(-1px);
   background: var(--auth-field-focus);
   box-shadow: var(--shadow-sm);
}
.login-page .cloud-google-btn:active {
   transform: none;
}
.login-page .cloud-google-btn:focus-visible {
   outline: 2px solid var(--auth-panel);
   outline-offset: 2px;
}
.login-page .cloud-google-mark {
   display: grid;
   place-items: center;
   width: 18px;
   height: 18px;
}

/* =====================================================================
   Divider
   ===================================================================== */
.login-page .cloud-divider {
   width: 100%;
   display: flex;
   align-items: center;
   gap: 12px;
   color: var(--muted);
   font-size: 12px;
}
.login-page .cloud-divider::before,
.login-page .cloud-divider::after {
   content: "";
   flex: 1;
   height: 1px;
   background: color-mix(in srgb, var(--ink) 10%, transparent);
}

/* =====================================================================
   Fields — borderless until focus
   ===================================================================== */
.login-page .cloud-email-form {
   width: 100%;
   display: flex;
   flex-direction: column;
   gap: 14px;
}
.login-page .cloud-field {
   display: flex;
   flex-direction: column;
   gap: 6px;
   text-align: left;
}
.login-page .cloud-field > span:first-child {
   font-size: 13px;
   font-weight: 600;
   color: var(--muted);
}
.login-page .cloud-field input {
   width: 100%;
   min-height: 48px;
   padding: 10px 14px;
   border: 1px solid transparent;
   border-radius: var(--auth-radius-field);
   background: var(--auth-field);
   color: var(--ink);
   font-size: 15px;
   transition:
      border-color 0.16s ease,
      background 0.16s ease,
      box-shadow 0.16s ease;
}
.login-page .cloud-field input:focus-visible {
   outline: none;
   background: var(--auth-field-focus);
   border-color: var(--green);
   box-shadow: 0 0 0 3px var(--auth-ring);
}
.login-page .cloud-field input::placeholder {
   color: var(--muted);
}
/* Password field row: input + visibility toggle */
.login-page .cloud-field-row {
   position: relative;
   display: block;
}
.login-page .cloud-field-row input {
   padding-right: 46px;
}
.login-page .cloud-pass-toggle {
   position: absolute;
   top: 50%;
   right: 6px;
   transform: translateY(-50%);
   display: grid;
   place-items: center;
   width: 36px;
   height: 36px;
   border: none;
   border-radius: 9px;
   background: transparent;
   color: var(--muted);
   cursor: pointer;
   transition: background 0.16s ease, color 0.16s ease;
}
.login-page .cloud-pass-toggle:hover {
   background: color-mix(in srgb, var(--ink) 6%, transparent);
   color: var(--ink);
}
.login-page .cloud-pass-toggle:focus-visible {
   outline: 2px solid var(--auth-panel);
   outline-offset: 1px;
}
.login-page .cloud-pass-toggle .ic-eye,
.login-page .cloud-pass-toggle .ic-eye-off {
   display: none;
}
.login-page .cloud-pass-toggle .ic-eye {
   display: block;
}
.login-page .cloud-pass-toggle[aria-pressed="true"] .ic-eye {
   display: none;
}
.login-page .cloud-pass-toggle[aria-pressed="true"] .ic-eye-off {
   display: block;
}

/* =====================================================================
   Buttons
   ===================================================================== */
.login-page .cloud-auth-primary {
   width: 100%;
   min-height: 48px;
   display: inline-flex;
   align-items: center;
   justify-content: center;
   margin-top: 2px;
   border: none;
   border-radius: var(--auth-radius-btn);
   background: var(--auth-panel);
   /* Force white text in BOTH themes: the dark-theme .button-primary rule
      (near-black text, for the app's lighter green) would otherwise win by
      specificity and leave near-black text on the deep green — unreadable. */
   color: #fff !important;
   font-family: "Sora", Inter, ui-sans-serif, system-ui, sans-serif;
   font-size: 15px;
   font-weight: 600;
   cursor: pointer;
   transition:
      transform 0.16s var(--auth-ease),
      filter 0.16s var(--auth-ease),
      box-shadow 0.16s var(--auth-ease);
}
.login-page .cloud-auth-primary:hover {
   transform: translateY(-1px);
   filter: brightness(1.08);
   box-shadow: 0 6px 18px rgba(23, 92, 62, 0.28);
}
.login-page .cloud-auth-primary:active {
   transform: none;
   filter: none;
}
.login-page .cloud-auth-primary:focus-visible {
   outline: 2px solid var(--auth-spark);
   outline-offset: 2px;
}
.login-page .cloud-auth-primary:disabled {
   opacity: 0.65;
   cursor: default;
   transform: none;
   filter: none;
   box-shadow: none;
}

/* =====================================================================
   Error pill — no border, tinted fill
   ===================================================================== */
.login-page .cloud-auth-error {
   margin: 0;
   padding: 10px 12px;
   font-size: 13px;
   text-align: left;
   color: var(--auth-danger);
   background: var(--auth-danger-bg);
   border: none;
   border-radius: 10px;
}
.login-page .cloud-auth-error[hidden] {
   display: none;
}
/* Inline action inside the error box (e.g. "Sign in instead"). */
.login-page .cloud-auth-error .auth-error-link {
   display: inline;
   margin-left: 6px;
   padding: 0;
   border: none;
   background: none;
   color: inherit;
   font: inherit;
   font-weight: 700;
   text-decoration: underline;
   text-underline-offset: 2px;
   cursor: pointer;
}

/* =====================================================================
   Auth switch links (login ↔ register)
   ===================================================================== */
.login-page .auth-switch {
   margin: 4px 0 0;
   text-align: center;
   font-size: 14px;
   color: var(--muted);
}
.login-page .auth-link {
   padding: 0;
   border: none;
   background: none;
   color: var(--green);
   font: inherit;
   font-weight: 700;
   cursor: pointer;
}
.login-page .auth-link:hover {
   text-decoration: underline;
   text-underline-offset: 3px;
}
.login-page .auth-link:focus-visible {
   outline: 2px solid var(--auth-panel);
   outline-offset: 2px;
   border-radius: 4px;
}

/* =====================================================================
   Motion — card entrance reuses the existing .is-open fade
   ===================================================================== */
.login-card {
   opacity: 0;
   transform: translateY(12px);
   transition:
      opacity 0.4s var(--auth-ease),
      transform 0.4s var(--auth-ease);
}
.login-page.is-open .login-card {
   opacity: 1;
   transform: none;
}
/* Aside content staggers in on first open. */
.login-aside-inner > * {
   opacity: 0;
   transform: translateY(10px);
   transition:
      opacity 0.5s var(--auth-ease),
      transform 0.5s var(--auth-ease);
}
.login-page.is-open .login-aside-inner > *:nth-child(1) { transition-delay: 0.05s; }
.login-page.is-open .login-aside-inner > *:nth-child(2) { transition-delay: 0.12s; }
.login-page.is-open .login-aside-inner > *:nth-child(3) { transition-delay: 0.19s; }
.login-page.is-open .login-aside-inner > *:nth-child(4) { transition-delay: 0.26s; }
.login-page.is-open .login-aside-inner > * {
   opacity: 1;
   transform: none;
}

@media (prefers-reduced-motion: reduce) {
   .login-card,
   .login-aside-inner > * {
      transform: none !important;
      transition: opacity 0.2s ease;
   }
   .login-page.is-open .login-aside-inner > * {
      transition-delay: 0s;
   }
}

/* =====================================================================
   Responsive — documented bands (phone ≤680 / tablet 681–1050 / desktop)
   ===================================================================== */
@media (max-width: 1050px) {
   .login-page {
      grid-template-columns: 1fr 1fr;
   }
   .login-aside {
      padding: 36px 28px;
   }
   .login-aside-inner {
      max-width: 340px;
   }
   .login-card {
      padding: 32px 28px;
   }
}
@media (max-width: 680px) {
   .login-page {
      grid-template-columns: 1fr;
   }
   .login-aside {
      display: none;
   }
   /* With the brand panel gone, surface the compact lockup above the form. */
   .login-card .login-card-brand {
      display: inline-flex;
   }
   .login-main {
      padding: 24px 20px;
      min-height: 100dvh;
   }
   .login-card {
      padding: 28px 22px;
   }
}
