/* Sign-in page for Vidsy Insights. Layer 2 of the auth model: the branded surface
 * a reader meets before the gate lets them through.
 *
 * This file is served straight out of public/, before any Astro bundle, so it
 * cannot import src/styles/tokens.css. The block below is the one place on the
 * site that repeats a token value. Keep it in step with tokens.css, and keep it
 * short: only the values the gate actually uses.
 *
 * Layer 2 rules apply here. Flat surfaces, no glass, no grain, no shimmer, and
 * 150-200ms ease-out on anything that moves. The expressive layer belongs to the
 * editions, not to a sign-in page.
 */

:root {
  --mono-1: #ffffff;
  --mono-4: #e0e0e0;
  /* Matches --mono-5-lift in src/styles/tokens.css: mono-5 lands under AA on the
     raised surfaces, and this page has one. */
  --mono-5: #9a9a9a;
  --mono-8: #242429;
  --mono-9: #17171a;

  --vidsy-pink: #ff0657;
  --vidsy-pink-deep: #c60043;
  /* Ink for text on a pink fill. White on pink is 3.9:1; this is 5.4:1. */
  --pink-ink: #0a0a0b;
  --sentiment-negative: #e3274e;

  --font-sans: 'Google Sans Flex', 'Google Sans', -apple-system, BlinkMacSystemFont,
    'Segoe UI', sans-serif;

  --border-hairline: rgba(255, 255, 255, 0.08);
  --shadow-medium: 0 4px 8px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.2);
  --motion-product: 180ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  background: var(--mono-9);
  color: var(--mono-1);
  -webkit-font-smoothing: antialiased;
}

.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.gate__card {
  width: 100%;
  max-width: 26rem;
  padding: 2.5rem 2rem 2rem;
  border-radius: 16px;
  background: var(--mono-8);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-medium);
  text-align: center;
}

.gate__mark {
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 1.5rem;
}

.gate__series {
  margin: 0 0 0.5rem;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mono-5);
}

.gate__title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: -0.02rem;
  line-height: 1.25;
}

.gate__sub {
  margin: 0 0 1.75rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--mono-4);
}

.gate__action {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
}

/* The one pink thing on the page. Pink is emphasis, and on this surface the
   emphasis is the single action there is. */
.gate__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  min-width: 15rem;
  /* 44px minimum, the touch floor. */
  min-height: 2.75rem;
  padding: 0.75rem 1.375rem;
  border: 0;
  border-radius: 9999px;
  background: var(--vidsy-pink);
  color: var(--pink-ink);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--motion-product) var(--ease-out),
    transform var(--motion-product) var(--ease-out);
}

/* Hover lightens rather than darkens, because the ink on this button is now near
   black: pink-deep under black ink is 3.0:1, and a hover state that fails is still a
   fail. Lighter pink under black ink goes the right way. */
.gate__btn:hover {
  background: color-mix(in srgb, var(--vidsy-pink) 84%, #ffffff);
  transform: translateY(-1px);
}

.gate__btn:focus-visible {
  outline: 2px solid var(--vidsy-pink);
  outline-offset: 3px;
}

.gate__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.gate__btn-icon {
  display: inline-flex;
  align-items: center;
  /* The Google mark is fixed brand artwork, so it sits on its own white chip
     rather than being recoloured to fit the button. */
  background: var(--mono-1);
  border-radius: 9999px;
  padding: 3px;
}

.gate__spinner {
  display: none;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 2.5px solid var(--border-hairline);
  border-top-color: var(--vidsy-pink);
  animation: gate-spin 0.8s linear infinite;
}

@keyframes gate-spin {
  to {
    transform: rotate(360deg);
  }
}

.gate__card[data-state='loading'] .gate__btn {
  display: none;
}
.gate__card[data-state='loading'] .gate__spinner {
  display: block;
}
.gate__card[data-state='error'] .gate__spinner {
  display: none;
}

.gate__error {
  margin: 1rem 0 0;
  min-height: 1.125rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--sentiment-negative);
  opacity: 0;
  transition: opacity var(--motion-product) var(--ease-out);
}

.gate__error[data-shown='true'] {
  opacity: 1;
}

.gate__foot {
  margin: 1.75rem 0 0;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mono-5);
}

@media (prefers-reduced-motion: reduce) {
  .gate__btn {
    transition: none;
  }
  .gate__btn:hover {
    transform: none;
  }
  .gate__spinner {
    animation: none;
  }
}
