/*
  Fncher shared theme. The look of index.html, applied to every app page.
  Selectors are prefixed with "html body" so they win over each page's own <style>
  regardless of load order (the agent/broker SPA re-appends page styles after links).
*/

:root {
  --fn-bg: #0f172a;
  --fn-ink: #e2e8f0;
  --fn-ink-strong: #f8fafc;
  --fn-muted: #94a3b8;
  --fn-faint: #64748b;
  --fn-line: rgba(148, 163, 184, 0.18);
  --fn-line-strong: rgba(148, 163, 184, 0.28);
  --fn-blue: #3b82f6;
  --fn-blue-2: #2563eb;
  --fn-blue-soft: #93c5fd;
  --fn-card: linear-gradient(180deg, rgba(30, 41, 59, 0.92), rgba(15, 23, 42, 0.72));
  --fn-card-solid: linear-gradient(180deg, #1e293b 0%, #172033 100%);
  /* Shadows stay within ~16px of the box so overflow:hidden parents (tab bars, sheets) don't slice them. */
  --fn-card-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 1px 2px rgba(2, 6, 23, 0.3), 0 10px 22px -14px rgba(2, 6, 23, 0.6);
  --fn-card-shadow-hover: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 1px 2px rgba(2, 6, 23, 0.3), 0 14px 28px -16px rgba(2, 6, 23, 0.7);
  --fn-hero-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 0 0 1px rgba(96, 165, 250, 0.06), 0 16px 32px -20px rgba(2, 6, 23, 0.75);
  --fn-modal-shadow: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 28px 56px -24px rgba(2, 6, 23, 0.75);
  --fn-btn-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 10px -6px rgba(59, 130, 246, 0.7);
  --fn-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Canvas ---------- */

html {
  background-color: var(--fn-bg);
  scrollbar-color: #334155 transparent;
}

/* The glow is a fixed layer (like .ambient on the index), not background-attachment: fixed,
   which repaints on every scroll and leaves streaks on some GPUs. Body must be transparent to show it. */
html body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: transparent !important;
  color: var(--fn-ink);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
html body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(980px 560px at 50% -8%, rgba(59, 130, 246, 0.16), transparent 62%),
    radial-gradient(640px 420px at 100% 28%, rgba(59, 130, 246, 0.06), transparent 58%),
    radial-gradient(520px 380px at -10% 78%, rgba(30, 58, 138, 0.24), transparent 60%),
    var(--fn-bg);
}
@media print {
  html body::before { display: none; }
}

::selection { background: rgba(59, 130, 246, 0.35); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 999px;
  border: 2px solid var(--fn-bg);
}
::-webkit-scrollbar-thumb:hover { background: #475569; }

html body a:focus-visible,
html body button:focus-visible {
  outline: 2px solid var(--fn-blue-soft);
  outline-offset: 3px;
}

/* Opacity only: a transform on <main> would re-anchor fixed children (modals, floating buttons) mid-animation. */
html body main {
  animation: fn-rise 0.6s var(--fn-ease) backwards;
}

html body main:has(.legal-content) { max-width: 62rem; width: 100%; }
html body .legal-content a { color: var(--fn-blue-soft); }

@keyframes fn-rise {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Type ---------- */

html body :is(h1, h2) { letter-spacing: -0.03em; }

html body .section-title {
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--fn-ink-strong);
}

html body :is(.auth-card, .login-card) h2 {
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--fn-ink-strong);
}

html body .section-label {
  color: var(--fn-muted);
  letter-spacing: 0.12em;
  font-weight: 700;
}

/* ---------- Wordmark (gradient logo from the index hero) ---------- */

.fncher-wordmark,
html body .navbar-title,
html body .adnav-brand {
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
  text-decoration: none;
  background: linear-gradient(180deg, #f8fafc 10%, #cbd5e1 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  /* No filter: drop-shadow on clipped text paints a dark band on some GPUs until the next repaint. */
  filter: none;
}
.fncher-wordmark { font-size: 1.75rem; display: inline-flex; align-items: baseline; }
.fncher-wordmark .tm,
html body .navbar-title .tm {
  font-size: 0.42em;
  vertical-align: super;
  margin-left: 0.08em;
  letter-spacing: 0;
  font-weight: 700;
  background: none;
  color: var(--fn-faint);
  -webkit-text-fill-color: var(--fn-faint);
}
.fncher-wordmark .wordmark-tag {
  margin-left: 0.55rem;
  align-self: center;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #bfdbfe;
  -webkit-text-fill-color: #bfdbfe;
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 999px;
  padding: 0.22rem 0.55rem;
}
.fncher-wordmark-lg { font-size: clamp(2.75rem, 7vw, 3.6rem); }

/* ---------- Public header (sign-in, legal, visitor pages) ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem clamp(1.25rem, 4vw, 2rem);
  background: rgba(15, 23, 42, 0.6);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.header-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1.05rem;
  border-radius: 999px;
  border: 1.5px solid rgba(96, 165, 250, 0.85);
  background: rgba(15, 23, 42, 0.35);
  color: var(--fn-ink-strong);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
@media (hover: hover) {
  .header-link:hover { background: rgba(59, 130, 246, 0.12); }
}

/* ---------- Footer (index footer) ---------- */

html body .site-footer {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding: 1.4rem 1.25rem calc(1.6rem + env(safe-area-inset-bottom));
  text-align: center;
  background: transparent;
  border: 0;
  box-shadow: none;
}
html body .site-footer p {
  margin: 0;
  color: var(--fn-faint);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}
html body .site-footer a { color: var(--fn-muted); text-decoration: none; }
@media (hover: hover) {
  html body .site-footer a:hover { color: var(--fn-ink); }
}

/* ---------- Surfaces ---------- */

html body :is(
  .dashboard-card, .auth-card, .login-card, .profile-card, .secondary-card,
  .earn-card, .earn-hero, .page-header, .sheet, .broker-card, .task-card,
  .table-wrapper, .form-section, .checkin-card, .metric
) {
  background: var(--fn-card);
  border: 1px solid var(--fn-line);
  border-radius: 1.25rem;
  box-shadow: var(--fn-card-shadow);
}

html body :is(.profile-card, .earn-hero, .auth-card, .login-card) {
  background: var(--fn-card-solid);
  box-shadow: var(--fn-hero-shadow);
  border-color: rgba(96, 165, 250, 0.2);
  border-radius: 1.5rem;
}

html body :is(.modal-content, .fx-shell) {
  background: var(--fn-card-solid);
  border: 1px solid var(--fn-line-strong);
  border-radius: 1.35rem;
  box-shadow: var(--fn-modal-shadow);
}

html body :is(.dashboard-card, .task-card, .broker-card, .metric) {
  transition: border-color 0.2s ease, transform 0.25s var(--fn-ease), box-shadow 0.25s ease;
}
@media (hover: hover) {
  html body :is(.task-card, .broker-card):hover {
    border-color: rgba(96, 165, 250, 0.4);
    box-shadow: var(--fn-card-shadow-hover);
    transform: translateY(-2px);
  }
  html body .dashboard-card:hover {
    border-color: rgba(96, 165, 250, 0.3);
    box-shadow: var(--fn-card-shadow-hover);
  }
}

html body .metric-tile {
  background: rgba(15, 23, 42, 0.55);
  border-color: var(--fn-line);
  border-radius: 0.9rem;
}

/* ---------- Inputs ---------- */

html body :is(.input-field, .input, .select-field, .invite-input, .search-input, .radius-select) {
  background-color: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--fn-line-strong);
  color: var(--fn-ink);
  border-radius: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
html body :is(.input-field, .input, .select-field, .invite-input, .search-input, .radius-select)::placeholder {
  color: var(--fn-faint);
}
html body :is(.input-field, .input, .select-field, .invite-input, .search-input, .radius-select):focus {
  border-color: var(--fn-blue);
  background-color: rgba(15, 23, 42, 0.8);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
  outline: none;
}
html body .label-text { color: #cbd5e1; }

/* ---------- Buttons ---------- */

html body :is(.btn-primary, .primary-button, .btn-submit, .dash-btn-primary, .plan-cta) {
  background-color: var(--fn-blue);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--fn-btn-shadow);
  transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}
html body :is(.btn-primary, .primary-button, .btn-submit) { border-radius: 999px; }
@media (hover: hover) {
  html body :is(.btn-primary, .primary-button, .btn-submit, .dash-btn-primary, .plan-cta):hover:not(:disabled) {
    background-color: var(--fn-blue-2);
  }
}
html body :is(.btn-primary, .primary-button, .btn-submit, .dash-btn-primary):active:not(:disabled) {
  transform: scale(0.985);
}

html body :is(.btn-secondary, .btn-ghost) {
  border-radius: 999px;
  border: 1.5px solid rgba(96, 165, 250, 0.6);
  background-color: rgba(15, 23, 42, 0.35);
  color: var(--fn-ink-strong);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
@media (hover: hover) {
  html body :is(.btn-secondary, .btn-ghost):hover:not(:disabled) {
    background-color: rgba(59, 130, 246, 0.12);
    border-color: rgba(96, 165, 250, 0.85);
  }
}

html body :is(button, a, input[type="submit"]).bg-blue-600 {
  background-color: var(--fn-blue);
  box-shadow: var(--fn-btn-shadow);
}
html body .hover\:bg-blue-700:hover,
html body .hover\:bg-blue-600:hover { background-color: var(--fn-blue-2); }

/* ---------- One palette: Tailwind gray → index slate ---------- */

html body .bg-gray-600 { background-color: #475569; }
html body .bg-gray-700 { background-color: #334155; }
html body .bg-gray-800 { background-color: #1e293b; }
html body .bg-gray-900 { background-color: var(--fn-bg); }
html body .hover\:bg-gray-600:hover { background-color: #475569; }
html body .hover\:bg-gray-700:hover { background-color: rgba(148, 163, 184, 0.12); }
html body .hover\:bg-gray-800:hover { background-color: #1e293b; }
html body .border-gray-600 { border-color: #475569; }
html body .border-gray-700 { border-color: #334155; }
html body .text-gray-300 { color: #cbd5e1; }
html body .text-gray-400 { color: var(--fn-muted); }
html body .text-gray-500 { color: var(--fn-faint); }
html body .text-gray-600 { color: #475569; }

/* ---------- App navbars ---------- */

html body .navbar {
  background: rgba(15, 23, 42, 0.72) !important;
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: none !important;
}
html body .navbar .nav-link {
  border-radius: 999px;
  color: #cbd5e1;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: background-color 0.2s ease, color 0.2s ease;
}
html body .navbar .nav-link:hover { background-color: rgba(59, 130, 246, 0.12); color: #fff; }
html body .navbar .nav-link.active,
html body .navbar .nav-link[aria-current="page"] {
  color: #fff;
  background-color: rgba(59, 130, 246, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  html body main { animation: none; }
  html body :is(.task-card, .broker-card):hover { transform: none; }
}
