/* Standalone auth page — bespoke styling for the login screen, which is a
   self-contained document and does not extend core/base.html. Relies on the
   CSS custom properties defined in toko.css (link that first). */

.toko-auth {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
  /* Light-by-design: stop OS dark mode from inverting the white card's inputs,
     autofill, and checkbox. */
  color-scheme: light;
  /* "Tokonatsu" = everlasting summer: a warm dusk-sky mesh. */
  background:
    radial-gradient(120% 90% at 12% 8%,  rgba(255, 179, 55, 0.95) 0%,  rgba(255, 179, 55, 0) 55%),
    radial-gradient(120% 90% at 92% 18%, rgba(255, 137, 34, 0.95) 0%,  rgba(255, 137, 34, 0) 60%),
    radial-gradient(140% 120% at 85% 100%, rgba(249, 0, 72, 0.55) 0%,  rgba(249, 0, 72, 0) 55%),
    linear-gradient(160deg, var(--toko-deep-orange) 0%, #c8390f 100%);
}

/* Soft drifting glow + faint dot texture for depth. */
.toko-auth::before {
  content: "";
  position: absolute;
  inset: -25%;
  background: radial-gradient(closest-side, rgba(255, 240, 214, 0.55), rgba(255, 240, 214, 0) 70%);
  filter: blur(8px);
  animation: toko-drift 22s ease-in-out infinite alternate;
  pointer-events: none;
}
.toko-auth::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(0, 0, 0, 0.10) 1px, transparent 1.4px);
  background-size: 22px 22px;
  opacity: 0.5;
  mix-blend-mode: overlay;
  pointer-events: none;
}

@keyframes toko-drift {
  from { transform: translate3d(-4%, -3%, 0) scale(1); }
  to   { transform: translate3d(5%, 4%, 0) scale(1.08); }
}

.toko-auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 26rem;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 24px 60px -12px rgba(80, 24, 0, 0.45),
    var(--shadow-lg);
  padding: 2.5rem 2.25rem 2rem;
  overflow: hidden;
  animation: toko-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
/* Amber filament across the top edge of the card. */
.toko-auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--toko-amber), var(--toko-orange), var(--toko-red));
}

.toko-auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  animation: toko-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.06s both;
}
/* The Tokonatsu logo is the brand mark on the entrance card, at the footprint the
   retired amber-gradient badge chip used to occupy (so the card's rhythm is unchanged). */
.toko-auth-brand .toko-brand-logo {
  flex: 0 0 auto;
  width: 2.75rem;
  height: 2.75rem;
  display: block;
}
.toko-auth-brand .name {
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.1;
  color: #1f1f1f;
}
.toko-auth-brand .kicker {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--toko-deep-orange);
  font-weight: 600;
}

.toko-auth-head {
  margin-bottom: 1.5rem;
  animation: toko-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.12s both;
}
.toko-auth-head h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  color: #1f1f1f;
}
.toko-auth-head p {
  margin: 0;
  color: var(--toko-mid-grey);
  font-size: 0.9375rem;
}

/* Interruption-page status heading (sign-in cancelled / sign-in failed).
   The heading leads with a tinted icon chip — the identity-avatar treatment
   reused — so status reads as icon AND words, never colour alone, and the
   glyph never renders as bare heading-black. Flexed so wrapped heading text
   hangs clear of the chip on narrow screens instead of falling underneath. */
.toko-auth-head--status h1 {
  display: flex;
  /* Anchor the chip to the FIRST text line: on narrow screens a two-line
     heading must not float the chip between its lines. The negative offset
     optically re-centres the 2.25rem chip on the 1.8rem first line box
     (1.5rem x 1.2 line-height): (1.8 - 2.25) / 2 = -0.225rem. */
  align-items: flex-start;
  gap: 0.6rem;
}
.toko-auth-head--status h1 .ic {
  flex: 0 0 auto;
  margin-top: -0.225rem;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--toko-amber-subtle);
  color: var(--toko-deep-orange-text);
  font-size: 1.2rem;
}
/* Quiet second line under the head copy (trust/help note). Mid Grey is the
   contrast floor for muted text — do not go lighter. */
.toko-auth-head .note {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--toko-mid-grey);
}
/* On interruption pages the head paragraph IS the message, not a subtitle:
   it reads in ink for daylight legibility, leaving only the .note muted. */
.toko-auth--status .toko-auth-head p:not(.note) {
  color: #1f1f1f;
}

.toko-auth-providers {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  animation: toko-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.18s both;
}
.toko-auth-providers form { margin: 0; }

.toko-auth-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.2;
  border: 1px solid transparent;
  cursor: pointer;
  /* Anchors can wear this class (e.g. the sign-out "Back to dashboard"); keep
     them looking like buttons, not underlined links. */
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}
.toko-auth-btn:hover { text-decoration: none; }
.toko-auth-btn i { font-size: 1.15rem; }
.toko-auth-btn:active { transform: translateY(1px); }

/* Keyboard focus — a deliberate brand-warm ring on every button and the dark
   submit. Deep Orange Text, not raw amber: amber is ~1.8:1 against the white
   card, under WCAG 1.4.11's 3:1 non-text floor, and invisible ringing an
   amber button. The offset gap keeps the two-tone separation. */
.toko-auth-btn:focus-visible,
.toko-auth-submit:focus-visible {
  outline: 3px solid var(--toko-deep-orange-text);
  outline-offset: 2px;
}

.toko-auth-btn--primary {
  background: var(--toko-amber);
  color: #1a1100;
  box-shadow: 0 8px 20px -8px rgba(255, 179, 55, 0.9);
}
.toko-auth-btn--primary:hover {
  background: #ffc257;
  box-shadow: 0 10px 24px -8px rgba(255, 179, 55, 1);
}

.toko-auth-btn--secondary {
  background: #fff;
  color: #1f1f1f;
  border-color: var(--toko-border);
}
.toko-auth-btn--secondary:hover {
  background: var(--toko-amber-subtle);
  border-color: var(--toko-amber-border);
}

.toko-auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  color: var(--toko-mid-grey);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: toko-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.24s both;
}
.toko-auth-divider::before,
.toko-auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--toko-border);
}

/* De-emphasized password sign-in — native collapsible, no JS. */
.toko-auth-password {
  animation: toko-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.24s both;
}
.toko-auth-password > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0 auto;
  width: fit-content;
  min-height: 2.75rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--bs-link-color);
  font-size: 0.875rem;
  font-weight: 600;
  user-select: none;
  transition: color 0.12s ease, background-color 0.12s ease;
}
.toko-auth-password > summary::-webkit-details-marker { display: none; }
.toko-auth-password > summary:hover {
  color: var(--bs-link-hover-color);
  background: var(--toko-amber-subtle);
}
.toko-auth-password > summary:focus-visible {
  outline: 3px solid var(--toko-deep-orange-text);
  outline-offset: 2px;
}
.toko-auth-password > summary .chev {
  transition: transform 0.18s ease;
  font-size: 0.85rem;
}
.toko-auth-password[open] > summary .chev { transform: rotate(180deg); }

.toko-auth-fields {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.toko-auth-field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 0.3rem;
}
.toko-auth-field input[type="text"],
.toko-auth-field input[type="email"],
.toko-auth-field input[type="password"] {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--toko-border);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  font-family: inherit;
  color: #1f1f1f;
  background: #fff;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.toko-auth-field input:focus {
  outline: none;
  border-color: var(--toko-amber);
  box-shadow: 0 0 0 3px rgba(255, 179, 55, 0.3);
}
.toko-auth-field--check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.toko-auth-field--check label {
  margin: 0;
  font-weight: 400;
  color: var(--toko-mid-grey);
}
.toko-auth-field--check input { accent-color: var(--toko-orange); }

.toko-auth-submit {
  width: 100%;
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: #2a2a2a;
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease;
}
.toko-auth-submit:hover { background: #1a1a1a; }
.toko-auth-submit:active { transform: translateY(1px); }

.toko-auth-error {
  background: #ffe1e9;
  color: #8a0026;
  border: 1px solid #ffc2d2;
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  font-size: 0.8125rem;
  margin-bottom: 0.875rem;
}
.toko-auth-field .toko-auth-error {
  margin: 0.4rem 0 0;
}

/* Django messages, styled by level. A sign-out confirmation is a neutral
   notice; only error/warning levels take the red pill (--error). */
.toko-auth-msg {
  background: var(--toko-bg-2);
  color: #1f1f1f;
  border: 1px solid var(--toko-border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  font-size: 0.8125rem;
  margin-bottom: 0.875rem;
}
.toko-auth-msg--error {
  background: #ffe1e9;
  color: #8a0026;
  border-color: #ffc2d2;
}

/* Sign-out confirmation — the exit bookend to the login entrance.
   Reuses the card, brand, and button vocabulary above; only the identity
   chip and the stacked action pair are specific to this surface. */
.toko-auth-identity {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  margin-bottom: 1.25rem;
  border: 1px solid var(--toko-border);
  border-radius: var(--radius-md);
  background: var(--toko-bg-2);
  animation: toko-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.18s both;
}
.toko-auth-identity .avatar {
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--toko-amber-subtle);
  color: var(--toko-deep-orange-text);
  font-size: 1.2rem;
}
.toko-auth-identity .who {
  min-width: 0;
}
.toko-auth-identity .label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--toko-mid-grey);
  line-height: 1.2;
}
.toko-auth-identity .name {
  display: block;
  font-weight: 600;
  font-size: 0.9375rem;
  color: #1f1f1f;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.toko-auth-actions {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  animation: toko-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.24s both;
}
.toko-auth-actions form { margin: 0; }

/* Interruption pages (.toko-auth--status on <body>) usually have no third
   content block between head and actions; compact the entrance stagger to
   keep the even 60ms beat (brand .06 → head .12 → actions .18 → foot .24)
   instead of skipping a slot. A rendered Django message IS a third block:
   it takes the .18s slot and the rows after it shift back one beat, so the
   rhythm stays truthful either way. The reduced-motion block disables all
   of it. */
.toko-auth--status .toko-auth-actions { animation-delay: 0.18s; }
.toko-auth--status .toko-auth-foot { animation-delay: 0.24s; }
.toko-auth--status .toko-auth-msg {
  animation: toko-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.18s both;
}
.toko-auth--status:has(.toko-auth-msg) .toko-auth-actions { animation-delay: 0.24s; }
.toko-auth--status:has(.toko-auth-msg) .toko-auth-foot { animation-delay: 0.3s; }

/* Leave action — the page's high-visibility CTA, in the same red ramp module
   submit buttons use, so the exit reads as the deliberate primary action. */
.toko-auth-btn--leave {
  background: var(--toko-red-cta);
  color: #fff;
  box-shadow: 0 8px 20px -8px rgba(var(--toko-red-cta-rgb), 0.7);
}
.toko-auth-btn--leave:hover {
  background: var(--toko-red-cta-hover);
  box-shadow: 0 10px 24px -8px rgba(var(--toko-red-cta-rgb), 0.85);
}

.toko-auth-foot {
  margin-top: 1.75rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--toko-mid-grey);
  animation: toko-rise 0.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.3s both;
}

@keyframes toko-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .toko-auth::before,
  .toko-auth-card,
  .toko-auth-brand,
  .toko-auth-head,
  .toko-auth-providers,
  .toko-auth-divider,
  .toko-auth-password,
  .toko-auth-identity,
  .toko-auth-msg,
  .toko-auth-actions,
  .toko-auth-foot {
    animation: none;
  }
}
