/**
 * Gist /join Page Styles — Paid Onboarding
 *
 * SYNCED WITH: extension/ui/brand.css and src/styles/try.css.
 * /join is the canonical purchase entry point for both web-first and
 * store-first acquisitions. The page is intentionally narrow and quiet:
 * one column, generous whitespace, type doing all the work, a single
 * primary action below the fold.
 *
 * DESIGN INTENT (Jony Ive notes):
 * - The interface disappears so the offer leads.
 * - Every state is designed: signed-out, unpaid, paid, beta-ended, error.
 * - Motion only appears at the seams between states. No decorative animation.
 * - The price selector is a single segmented control, not two competing cards.
 *
 * TOKENS — match try.css and brand.css. Keep these in sync if brand.css moves.
 */

:root {
  --join-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --join-headline-font: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;

  --join-ink: #1C1C24;
  --join-ink-secondary: #4a4a4a;
  --join-ink-tertiary: #666666;
  --join-ink-faint: #b0b0b0;

  --join-paper: #ffffff;
  --join-wash: #FAFAFA;

  --join-border: #e8e8e8;
  --join-border-strong: #1C1C24;

  --join-gradient-start: #FF6B6B;
  --join-gradient-mid: #FFD93D;
  --join-gradient-end: #FF8E53;
  --join-gradient: linear-gradient(135deg, var(--join-gradient-start), var(--join-gradient-mid), var(--join-gradient-end));

  --join-success: #10B981;
  --join-error: #DC2626;

  --join-radius-sm: 8px;
  --join-radius: 12px;
  --join-radius-lg: 16px;
  --join-radius-pill: 999px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--join-wash);
  color: var(--join-ink);
  font-family: var(--join-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
}

.join-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================
   HEADER
   ============================================ */

.join-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 32px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.join-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.08em;
  text-decoration: none;
  color: var(--join-ink);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.join-wordmark svg {
  width: 0.9em;
  height: 1.5em;
}

.join-nav {
  display: inline-flex;
  align-items: center;
  gap: 28px;
}

.join-nav a {
  font-size: 14px;
  font-weight: 500;
  color: var(--join-ink-secondary);
  text-decoration: none;
  transition: color 0.18s ease;
}

.join-nav a:hover {
  color: var(--join-ink);
}

/* ============================================
   MAIN — single centered card
   ============================================ */

.join-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 24px 80px;
}

.join-card {
  width: 100%;
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* The whole hero block — headline, subhead — is a single quiet unit. */
.join-hero {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.join-eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--join-ink-tertiary);
  margin: 0;
}

.join-eyebrow--alert {
  color: var(--join-gradient-start);
}

.join-headline {
  font-family: var(--join-headline-font);
  font-size: clamp(2.4rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.02;
  margin: 0;
  color: var(--join-ink);
}

.join-headline-mark {
  background: var(--join-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.join-sub {
  font-size: 17px;
  line-height: 1.55;
  color: var(--join-ink-secondary);
  margin: 0;
}

.join-sub strong {
  color: var(--join-ink);
  font-weight: 600;
}

/* ============================================
   PRICE SELECTOR — segmented, single unit
   ============================================ */

.join-pricing {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.join-price-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--join-border);
  border-radius: var(--join-radius);
  background: var(--join-paper);
  padding: 6px;
  position: relative;
}

.join-price-option {
  appearance: none;
  background: transparent;
  border: none;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  border-radius: calc(var(--join-radius) - 6px);
  font-family: inherit;
  color: var(--join-ink-secondary);
  transition:
    background 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
  text-align: center;
  position: relative;
}

.join-price-option:hover:not([aria-pressed='true']) {
  color: var(--join-ink);
}

.join-price-option[aria-pressed='true'] {
  background: var(--join-ink);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.join-price-amount {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}

.join-price-amount span {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  opacity: 0.7;
}

.join-price-note {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
}

.join-price-note--save {
  color: var(--join-gradient-start);
}

.join-price-option[aria-pressed='true'] .join-price-note--save {
  color: var(--join-gradient-mid);
}

.join-price-fineprint {
  font-size: 13px;
  color: var(--join-ink-tertiary);
  margin: 0;
  text-align: center;
}

/* ============================================
   PRIMARY ACTION
   ============================================ */

.join-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.join-btn {
  appearance: none;
  border: none;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
  padding: 16px 20px;
  border-radius: var(--join-radius);
  cursor: pointer;
  transition:
    transform 0.12s ease,
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-decoration: none;
  width: 100%;
}

.join-btn:active {
  transform: translateY(1px);
}

.join-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.join-btn--primary {
  background: var(--join-ink);
  color: #ffffff;
}

.join-btn--primary:hover:not(:disabled) {
  background: #2c2c36;
}

.join-btn--google {
  background: var(--join-paper);
  color: var(--join-ink);
  border: 1px solid var(--join-border);
}

.join-btn--google:hover:not(:disabled) {
  border-color: var(--join-ink);
}

.join-btn--ghost {
  background: transparent;
  color: var(--join-ink-secondary);
  border: 1px solid var(--join-border);
}

.join-btn--ghost:hover:not(:disabled) {
  color: var(--join-ink);
  border-color: var(--join-ink);
}

.join-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.join-btn--loading {
  position: relative;
  color: transparent !important;
}

.join-btn--loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  color: #ffffff;
  animation: join-spin 0.8s linear infinite;
}

.join-btn--google.join-btn--loading::after {
  color: var(--join-ink);
}

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

/* ============================================
   ACCOUNT BAR — signed-in identity row
   ============================================ */

.join-identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--join-border);
  border-radius: var(--join-radius);
  background: var(--join-paper);
  font-size: 14px;
}

.join-identity-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.join-identity-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--join-ink-tertiary);
}

.join-identity-email {
  font-size: 14px;
  font-weight: 500;
  color: var(--join-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.join-identity-action {
  appearance: none;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--join-ink-tertiary);
  cursor: pointer;
  padding: 6px 8px;
  border-radius: var(--join-radius-sm);
  transition: color 0.18s ease, background 0.18s ease;
}

.join-identity-action:hover {
  color: var(--join-ink);
  background: var(--join-wash);
}

/* ============================================
   STATUS / ERROR LINE
   ============================================ */

.join-status {
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  min-height: 1.5em;
  text-align: center;
}

.join-status--error {
  color: var(--join-error);
}

.join-status--success {
  color: var(--join-success);
}

.join-status--info {
  color: var(--join-ink-tertiary);
}

/* ============================================
   FINEPRINT BLOCK
   ============================================ */

.join-fineprint {
  font-size: 12px;
  line-height: 1.55;
  color: var(--join-ink-tertiary);
  margin: 0;
  text-align: center;
}

.join-fineprint a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.join-fineprint a:hover {
  color: var(--join-ink);
}

/* ============================================
   FOOTER
   ============================================ */

.join-footer {
  padding: 24px 32px 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
  font-size: 13px;
  color: var(--join-ink-tertiary);
}

.join-footer a {
  color: inherit;
  text-decoration: none;
  transition: color 0.18s ease;
}

.join-footer a:hover {
  color: var(--join-ink);
}

/* ============================================
   STATE TRANSITIONS — quiet, only at the seams
   ============================================ */

.join-state {
  display: none;
  flex-direction: column;
  gap: 24px;
  animation: join-fade 220ms ease;
}

.join-state[data-active='true'] {
  display: flex;
}

@keyframes join-fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.join-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 0;
}

.join-loading-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--join-ink-faint);
  animation: join-pulse 1.2s ease-in-out infinite;
}

@keyframes join-pulse {
  0%, 100% {
    opacity: 0.3;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ============================================
   /join/success — confirmation state

   Motion lives here because this is the peak of the flow: the user has
   just paid. The mark scales in (420ms), then the check draws (360ms)
   after a 120ms beat. Honest little gesture — not decoration.
   ============================================ */

.join-success-mark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--join-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  margin: 0 auto;
  transform-origin: center;
  animation: join-mark-in 420ms cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

.join-success-mark svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  stroke-width: 3;
}

.join-success-mark svg path {
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: join-mark-draw 360ms ease-out 180ms forwards;
}

@keyframes join-mark-in {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes join-mark-draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 520px) {
  .join-header {
    padding: 20px 20px;
  }

  .join-main {
    padding: 12px 20px 60px;
  }

  .join-headline {
    font-size: 2.1rem;
  }

  .join-card {
    gap: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .join-state,
  .join-loading-dot,
  .join-success-mark,
  .join-success-mark svg path {
    animation: none !important;
  }

  .join-success-mark svg path {
    stroke-dashoffset: 0;
  }

  .join-btn {
    transition: none;
  }
}
