/* The Rookit — shared UI primitives (buttons + modals).
 *
 * Single source of truth, loaded by every surface: the Astro landing imports it
 * from global.css, the standalone pages in public/ link it directly.
 *
 * Before this existed the same blue button was written six different ways
 * (three gradients, three heights, five class names) depending on which page you
 * landed on. Anything new should use these classes rather than restyle a button
 * locally.
 */

:root {
  --rk-blue: #0066ff;
  --rk-blue-deep: #0055dd;
  --rk-blue-light: #00a3ff;
  --rk-dark: #0f172a;
  --rk-muted: #64748b;
  --rk-muted-light: #94a3b8;

  /* One gradient. Every primary action uses this and nothing else. */
  --rk-grad: linear-gradient(135deg, var(--rk-blue) 0%, var(--rk-blue-deep) 100%);

  --rk-btn-h: 52px;
  --rk-btn-h-sm: 44px;
  --rk-radius-card: 24px;
  --rk-radius-card-lg: 32px;

  /* Copied from the landing's .btn-primary, which is the reference. */
  --rk-blue-glow: rgba(0, 102, 255, 0.35);
  --rk-shadow-btn: 0 4px 20px var(--rk-blue-glow), 0 1px 3px rgba(0, 102, 255, 0.2);
  --rk-shadow-btn-hover: 0 12px 40px var(--rk-blue-glow), 0 2px 6px rgba(0, 102, 255, 0.25);
  --rk-shadow-card: 0 32px 100px rgba(0, 0, 0, 0.24);

  --rk-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------------------------------------------------------------- buttons */

/* The legacy class names are grouped onto these rules rather than rewritten in
   markup: .btn-primary appears across the landing, .login-btn in both guides,
   .share-btn on the thank-you page. Grouping them means every existing button
   inherits the system without touching a single template, and the old
   definitions can then be deleted from their local stylesheets. */
.rk-btn,
.btn-primary,
.btn-white,
.login-btn,
.share-btn {
  /* inline-flex + padding:0 on the block axis: a fixed height alone leaves the
     label riding on the browser's default button padding. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--rk-btn-h);
  padding: 0 28px;
  border: none;
  border-radius: 100px;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.25s var(--rk-ease), box-shadow 0.25s var(--rk-ease),
              background-color 0.25s var(--rk-ease), opacity 0.2s linear;
}

.rk-btn:disabled,
.btn-primary:disabled,
.login-btn:disabled,
.rk-btn[aria-disabled='true'] {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.rk-btn:focus-visible,
.btn-primary:focus-visible,
.btn-white:focus-visible,
.login-btn:focus-visible {
  outline: 3px solid rgba(0, 102, 255, 0.4);
  outline-offset: 2px;
}

/* Primary — the one blue button, used for every main action. */
.rk-btn--primary,
.btn-primary,
.login-btn {
  background: var(--rk-grad);
  color: #fff;
  box-shadow: var(--rk-shadow-btn);
}
.rk-btn--primary:hover,
.btn-primary:hover,
.login-btn:hover { transform: translateY(-3px) scale(1.02); box-shadow: var(--rk-shadow-btn-hover); }
.rk-btn--primary:active,
.btn-primary:active,
.login-btn:active { transform: translateY(0) scale(1); }

/* Light sweep across the button on hover — the landing had this and no other
   surface did, which is a large part of why they felt like different products. */
.rk-btn--primary,
.btn-primary,
.login-btn,
.rk-btn--white,
.btn-white { position: relative; overflow: hidden; }

.rk-btn--primary::after,
.login-btn::after,
.rk-btn--white::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -75%;
  width: 30%;
  height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transform: rotate(30deg);
  transition: left 0.6s var(--rk-ease);
  pointer-events: none;
}
.rk-btn--white::after {
  background: linear-gradient(90deg, transparent, rgba(0, 102, 255, 0.12), transparent);
}
.rk-btn--primary:hover::after,
.login-btn:hover::after,
.rk-btn--white:hover::after { left: 130%; }

@media (prefers-reduced-motion: reduce) {
  .rk-btn--primary::after,
  .login-btn::after,
  .rk-btn--white::after { display: none; }
}

/* Secondary — same shape, on a light surface. */
.rk-btn--secondary {
  background: #fff;
  color: var(--rk-dark);
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}
.rk-btn--secondary:hover { transform: translateY(-2px); border-color: rgba(15, 23, 42, 0.2); }

/* White — for dark blocks, where the blue would sink into the background. */
.rk-btn--white,
.btn-white {
  background: #fff;
  color: var(--rk-dark);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}
.rk-btn--white:hover,
.btn-white:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12); }

.rk-btn--ghost {
  background: transparent;
  color: var(--rk-blue);
  padding: 0 14px;
}
.rk-btn--ghost:hover { background: rgba(0, 102, 255, 0.07); }

.rk-btn--sm { height: var(--rk-btn-h-sm); padding: 0 20px; font-size: 14px; }
.rk-btn--block { width: 100%; }

/* On phones the primary action goes full width — a centred pill next to a
   full-width input reads as a mistake. */
@media (max-width: 560px) {
  .rk-btn, .btn-primary, .btn-white, .login-btn { height: 48px; font-size: 14.5px; }
  .rk-btn--block-mobile { width: 100%; }
}

/* ----------------------------------------------------------------- modals */

/* Values copied from the landing's .modal-overlay / .modal-content, the most
   refined of the three implementations — but deliberately NOT aliased onto
   those class names. That modal opens by toggling `display`, whereas this one
   sits at opacity 0 until .is-open; grouping them left the landing's signup
   modal invisible when opened. Same values, separate mechanics.
.rk-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.65);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s var(--rk-ease);
}
.rk-modal.is-open { opacity: 1; pointer-events: auto; }

.rk-modal__card {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 40px 32px;
  border-radius: var(--rk-radius-card-lg);
  background: #fff;
  box-shadow: var(--rk-shadow-card);
  transform: translateY(14px) scale(0.98);
  transition: transform 0.35s var(--rk-ease);
}
.rk-modal.is-open .rk-modal__card { transform: none; }

[data-theme='dark'] .rk-modal__card { background: #1e1e1e; color: #f5f5f5; }

.rk-modal__title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--rk-dark);
}
[data-theme='dark'] .rk-modal__title { color: #f5f5f5; }

.rk-modal__sub { margin: 0 0 22px; font-size: 14.5px; line-height: 1.55; color: var(--rk-muted); }

.rk-modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.05);
  color: var(--rk-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s linear;
}
.rk-modal__close:hover { background: rgba(15, 23, 42, 0.1); }

/* -------------------------------------------------------------- form bits */

.rk-field { margin-bottom: 14px; }
.rk-label {
  display: block;
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--rk-muted);
}
/* Pill inputs, like the landing's .modal-input — the auth pages used 12px
   rounded rectangles, which read as a different product. */
.rk-input {
  box-sizing: border-box;
  width: 100%;
  height: 56px;
  padding: 0 24px;
  border: 2px solid #f1f5f9;
  border-radius: 100px;
  background: rgba(15, 23, 42, 0.02);
  color: inherit;
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.2s linear, background 0.2s linear;
}
.rk-input:focus {
  outline: none;
  border-color: var(--rk-blue);
  box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.08);
  background: #fff;
}
.rk-input::placeholder { color: var(--rk-muted-light); }

[data-theme='dark'] .rk-input {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

.rk-error {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13.5px;
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .rk-btn,
  .rk-modal,
  .rk-modal__card { transition: none; }
  .rk-btn:hover { transform: none; }
}

/* ------------------------------------------------ auth pages (login/signup/reset)
 * These three pages each drew their own card (16px radius) and fields (11-12px
 * radius, 1-1.5px borders), none of which matched the landing's signup modal.
 * Scoped to .rk-auth on <body> rather than aliasing `.card` globally — the
 * landing uses that same class name for its content cards.
 */
.rk-auth .card {
  border-radius: var(--rk-radius-card-lg) !important;
  padding: 40px 32px !important;
  box-shadow: var(--rk-shadow-card) !important;
  border: 1px solid rgba(15, 23, 42, 0.05);
}

.rk-auth input[type='text'],
.rk-auth input[type='email'],
.rk-auth input[type='password'],
.rk-auth select {
  box-sizing: border-box;
  width: 100%;
  height: 56px;
  padding: 0 24px !important;
  border: 2px solid #f1f5f9 !important;
  border-radius: 100px !important;
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.2s linear, box-shadow 0.2s linear;
}
.rk-auth select { padding-right: 44px !important; }

.rk-auth input:focus,
.rk-auth select:focus {
  outline: none;
  border-color: var(--rk-blue) !important;
  box-shadow: 0 0 0 4px rgba(0, 102, 255, 0.08) !important;
}

/* The submit button on these pages is a bare #submit-btn with per-page styling. */
.rk-auth button[type='submit'] {
  width: 100%;
  height: var(--rk-btn-h);
  border: none;
  border-radius: 100px;
  background: var(--rk-grad);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--rk-shadow-btn);
  transition: transform 0.25s var(--rk-ease), box-shadow 0.25s var(--rk-ease);
}
.rk-auth button[type='submit']:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--rk-shadow-btn-hover);
}
.rk-auth button[type='submit']:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}
