/* =====================================================================
   FPL Analyzer — Home / Landing redesign
   Layout & component language adapted from the "Mercury" style reference
   (DESIGN.md), re-themed to the FPL Analyzer purple/green palette.

   Mercury token  ->  FPL mapping
   ----------------------------------------------------------------
   Deep Space   #171721  -> --pl-purple3  #1d0024   (page abyss)
   Midnight     #1e1e2a  -> --pl-purple2  #2a0032   (surface)
   Graphite     #272735  -> --pl-card2    #3c0845   (interactive)
   Mercury Blue #5266eb  -> --pl-green    #00ff87   (single accent / CTA)
   Ghost Blue   #cdddff  -> rgba(0,255,135,.14)     (secondary surface)
   Lead         #70707d  -> rgba(192,168,200,.16)   (borders / dividers)
   Starlight    #ededf3  -> #ffffff                 (primary text)
   Silver       #c3c3cc  -> --text-secondary        (secondary text)

   All rules are scoped under #viewLanding so the rest of the app is
   untouched. Density is "spacious": 80px+ gaps between sections,
   light-weight large display headlines, pill buttons, flat surfaces.
   ===================================================================== */

#viewLanding {
  /* Local design tokens (Mercury structure, FPL colors) */
  --mc-abyss: var(--pl-purple3, #1d0024);
  --mc-surface: var(--pl-purple2, #2a0032);
  --mc-interactive: var(--pl-card2, #3c0845);
  --mc-accent: var(--pl-green, #00ff87);
  --mc-accent-ghost: rgba(0, 255, 135, 0.12);
  --mc-on-accent: #06130d;            /* dark text on the bright green pill */
  --mc-border: rgba(192, 168, 200, 0.16);
  --mc-border-strong: rgba(192, 168, 200, 0.28);
  --mc-text: #ffffff;
  --mc-text-2: var(--text-secondary, #c0a8c8);
  --mc-text-3: var(--text-muted, #7a5a82);

  --mc-page-max: 1180px;
  --mc-section-gap: clamp(64px, 9vw, 120px);

  --mc-font-display: 'Space Grotesk', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --mc-font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
}

/* ─── Section scaffolding ──────────────────────────────────────────── */

.mc-section {
  max-width: var(--mc-page-max);
  margin: 0 auto;
  padding: 0 24px;
}

.mc-section + .mc-section,
.landing-grid + .mc-section,
.mc-section + .landing-bar {
  margin-top: var(--mc-section-gap);
}

.mc-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mc-font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--mc-accent);
  margin: 0 0 20px;
}

.mc-eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mc-accent);
  box-shadow: 0 0 10px var(--mc-accent);
}

.mc-section-title {
  font-family: var(--mc-font-display);
  font-weight: 500;                  /* light/medium = "authority through restraint" */
  font-size: clamp(1.9rem, 3.6vw, 2.9rem);
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: var(--mc-text);
  margin: 0 0 16px;
  max-width: 18ch;
}

.mc-section-sub {
  font-family: var(--mc-font-body);
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--mc-text-2);
  max-width: 56ch;
  margin: 0;
}

/* ─── Hero ─────────────────────────────────────────────────────────── */

#viewLanding .hero {
  position: relative;
  overflow: hidden;
}

#viewLanding .hero-inner {
  max-width: var(--mc-page-max);
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(24px, 4vw, 64px);
  padding: clamp(48px, 8vw, 110px) 24px clamp(40px, 6vw, 72px);
}

#viewLanding .hero-eyebrow {
  background: var(--mc-accent-ghost);
  border: 1px solid rgba(0, 255, 135, 0.28);
  color: var(--mc-accent);
  font-size: 0.72rem;
  letter-spacing: 1.6px;
  font-weight: 600;
  padding: 7px 16px;
}

#viewLanding .hero-eyebrow::before {
  background: var(--mc-accent);
  box-shadow: 0 0 10px var(--mc-accent);
}

#viewLanding .hero-title {
  font-family: var(--mc-font-display);
  font-weight: 500;                  /* Mercury: light weight at large size */
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin-bottom: 22px;
  color: var(--mc-text);
}

#viewLanding .hero-title em {
  font-style: normal;
  background: linear-gradient(110deg, var(--mc-accent) 0%, var(--pl-cyan, #00d4ff) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 4px 30px rgba(0, 255, 135, 0.22));
}

#viewLanding .hero-sub {
  font-family: var(--mc-font-body);
  font-size: 1.1rem;
  line-height: 1.65;
  color: var(--mc-text-2);
  max-width: 46ch;
  margin-bottom: 32px;
}

/* CTA group — pill buttons (Mercury signature) */
.mc-cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 40px;
}

.mc-btn {
  font-family: var(--mc-font-body);
  font-size: 1rem;
  font-weight: 600;
  border-radius: 999px;            /* pill */
  padding: 15px 28px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  line-height: 1;
}

.mc-btn-primary {
  background: var(--mc-accent);
  color: var(--mc-on-accent);
  box-shadow: 0 8px 30px rgba(0, 255, 135, 0.22);
}

.mc-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 38px rgba(0, 255, 135, 0.32);
}

.mc-btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--mc-text);
  border-color: var(--mc-border-strong);
}

.mc-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--mc-accent);
  transform: translateY(-2px);
}

/* Hero KPI row (IDs preserved from original markup) */
#viewLanding .hero-kpis {
  gap: 40px;
  border-top: 1px solid var(--mc-border);
  padding-top: 28px;
  max-width: 540px;
}

#viewLanding .kpi { padding-left: 0; }
#viewLanding .kpi::before { display: none; }

#viewLanding .kpi-val {
  font-family: var(--mc-font-display);
  font-weight: 500;
  font-size: 1.9rem;
  background: none;
  -webkit-text-fill-color: var(--mc-text);
  color: var(--mc-text);
}

#viewLanding .kpi-label {
  color: var(--mc-text-3);
  letter-spacing: 0.8px;
}

/* Atmospheric hero visual — keep the pitch but make it calm & glowing */
#viewLanding .hero-pitch {
  width: 100%;
  max-width: 300px;
  height: clamp(300px, 38vw, 380px);
  margin-left: auto;
  border-radius: 4px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(0, 255, 135, 0.16), transparent 60%),
    linear-gradient(165deg, rgba(74, 10, 82, 0.9), rgba(29, 0, 36, 0.95));
  border: 1px solid var(--mc-border);
}

/* ─── Feature cards (Mercury flat, bordered, "light up" on hover) ───── */

#viewLanding .landing-grid {
  max-width: var(--mc-page-max);
  margin-left: auto;
  margin-right: auto;
  padding: 0 24px;
  gap: 16px;
}

#viewLanding .landing-card {
  background: var(--mc-surface);
  border: 1px solid var(--mc-border);
  border-radius: 4px;                /* Mercury: crisp corners */
  box-shadow: none;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

#viewLanding .landing-card:hover {
  transform: translateY(-3px);
  background: var(--mc-interactive);
  border-color: var(--mc-accent);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

#viewLanding .landing-card:focus-visible {
  outline: 2px solid var(--mc-accent);
  outline-offset: 2px;
}

#viewLanding .lc-title {
  font-family: var(--mc-font-display);
  font-weight: 500;
  letter-spacing: 0.005em;
  color: var(--mc-text);
}

#viewLanding .lc-desc { color: var(--mc-text-2); }

#viewLanding .lc-cta {
  color: var(--mc-accent);
  font-weight: 600;
}

#viewLanding .lc-stat-val { color: var(--mc-text); }
#viewLanding .lc-stat-lbl { color: var(--mc-text-3); }

/* ─── Stats band ───────────────────────────────────────────────────── */

.mc-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  border-top: 1px solid var(--mc-border);
  border-bottom: 1px solid var(--mc-border);
  padding: clamp(36px, 5vw, 56px) 0;
}

.mc-stat-item { text-align: left; }

.mc-stat-num {
  font-family: var(--mc-font-display);
  font-weight: 500;
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  line-height: 1;
  color: var(--mc-text);
  letter-spacing: 0.01em;
}

.mc-stat-num span { color: var(--mc-accent); }

.mc-stat-cap {
  font-family: var(--mc-font-body);
  font-size: 0.85rem;
  color: var(--mc-text-2);
  margin-top: 12px;
  line-height: 1.4;
}

/* ─── Pull quote ───────────────────────────────────────────────────── */

.mc-quote {
  text-align: center;
  max-width: 900px;
}

.mc-quote blockquote {
  font-family: var(--mc-font-display);
  font-weight: 500;
  font-size: clamp(1.5rem, 3.4vw, 2.4rem);
  line-height: 1.3;
  letter-spacing: 0.01em;
  color: var(--mc-text);
  margin: 0 0 28px;
}

.mc-quote blockquote .mc-mark { color: var(--mc-accent); }

.mc-quote cite {
  font-family: var(--mc-font-body);
  font-style: normal;
  font-size: 0.92rem;
  color: var(--mc-text-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ─── Press / "in the spotlight" strip ─────────────────────────────── */

.mc-press {
  text-align: center;
}

.mc-press .mc-press-label {
  font-family: var(--mc-font-body);
  font-size: 0.74rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--mc-text-3);
  margin-bottom: 28px;
}

.mc-press-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: clamp(28px, 6vw, 72px);
}

.mc-press-row span {
  font-family: var(--mc-font-display);
  font-weight: 500;
  font-size: clamp(1.1rem, 2.4vw, 1.6rem);
  color: var(--mc-text-2);
  opacity: 0.78;
  letter-spacing: 0.04em;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.mc-press-row span:hover { opacity: 1; color: var(--mc-text); }

/* ─── Final dual CTA ───────────────────────────────────────────────── */

.mc-final {
  text-align: center;
}

.mc-final .mc-section-title { margin-left: auto; margin-right: auto; max-width: 22ch; }
.mc-final .mc-section-sub { margin-left: auto; margin-right: auto; text-align: center; }

.mc-final-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-top: 44px;
  text-align: left;
}

.mc-final-card {
  background: var(--mc-surface);
  border: 1px solid var(--mc-border);
  border-radius: 4px;
  padding: 32px;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.mc-final-card:hover {
  transform: translateY(-3px);
  background: var(--mc-interactive);
  border-color: var(--mc-accent);
}

.mc-final-card h3 {
  font-family: var(--mc-font-display);
  font-weight: 500;
  font-size: 1.4rem;
  color: var(--mc-text);
  margin: 0 0 10px;
}

.mc-final-card p {
  font-family: var(--mc-font-body);
  font-size: 0.96rem;
  line-height: 1.6;
  color: var(--mc-text-2);
  margin: 0 0 20px;
}

.mc-final-card .mc-arrow {
  font-family: var(--mc-font-body);
  font-weight: 600;
  color: var(--mc-accent);
}

/* ─── Stats bar (existing, re-skinned) ─────────────────────────────── */

#viewLanding .landing-bar {
  background: var(--mc-surface);
  border: 1px solid var(--mc-border);
  border-radius: 4px;
  box-shadow: none;
}

#viewLanding .lb-val { color: var(--mc-text); font-family: var(--mc-font-display); font-weight: 500; }
#viewLanding .lb-lbl { color: var(--mc-text-3); }

/* ─── Responsive ───────────────────────────────────────────────────── */

@media (max-width: 900px) {
  #viewLanding .hero-inner { grid-template-columns: 1fr; }
  #viewLanding .hero-pitch { display: none; }
  .mc-stats { grid-template-columns: repeat(2, 1fr); row-gap: 36px; }
}

@media (max-width: 600px) {
  #viewLanding .hero-kpis { gap: 24px; }
  .mc-final-cards { grid-template-columns: 1fr; }
  .mc-cta-group .mc-btn { flex: 1 1 100%; justify-content: center; }
}

@media (max-width: 440px) {
  .mc-stats { grid-template-columns: 1fr 1fr; gap: 20px; }
}

/* Light mode — re-skin surfaces to the app's light palette */
:root.light-mode #viewLanding {
  --mc-surface: var(--pl-card2, #faf7f4);
  --mc-interactive: var(--pl-card, #ffffff);
  --mc-on-accent: #04140c;
  --mc-border: rgba(26, 8, 32, 0.10);
  --mc-border-strong: rgba(26, 8, 32, 0.18);
  --mc-text: var(--text-primary, #0d0a14);
  --mc-text-2: var(--text-secondary, #5b525d);
  --mc-text-3: var(--text-muted, #8b8190);
}

:root.light-mode #viewLanding .hero-title,
:root.light-mode #viewLanding .kpi-val { color: var(--text-primary); -webkit-text-fill-color: var(--text-primary); }

@media (prefers-reduced-motion: reduce) {
  #viewLanding .mc-btn,
  #viewLanding .landing-card,
  #viewLanding .mc-final-card { transition: none; }
  #viewLanding .mc-btn:hover,
  #viewLanding .landing-card:hover,
  #viewLanding .mc-final-card:hover { transform: none; }
}

/* ─── Skeleton loaders (shown while the FPL API data is loading) ─────── */

.skel {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(255, 255, 255, 0.17) 40%,
    rgba(255, 255, 255, 0.06) 80%
  ) !important;
  background-size: 200% 100% !important;
  background-repeat: no-repeat !important;
  border-radius: 6px;
  animation: skel-shimmer 1.25s ease-in-out infinite;
  display: inline-block;
  min-width: 2.5em;
  user-select: none;
  pointer-events: none;
}

/* Elements that are empty until data arrives still need to occupy space */
.skel:empty::before { content: "\00a0\00a0\00a0\00a0"; }

@keyframes skel-shimmer {
  0%   { background-position: 150% 0; }
  100% { background-position: -50% 0; }
}

:root.light-mode .skel {
  background-image: linear-gradient(
    90deg,
    rgba(26, 8, 32, 0.05) 0%,
    rgba(26, 8, 32, 0.13) 40%,
    rgba(26, 8, 32, 0.05) 80%
  ) !important;
}

@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; background-position: 50% 0 !important; }
}

/* ─── Footer links + X "Follow us" button (FPL themed) ──────────────── */

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px 20px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(192, 168, 200, 0.14);
}

.footer-link {
  color: var(--text-secondary, #c0a8c8);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-link:hover { color: var(--pl-green, #00ff87); }

/* X follow button — the X logo in FPL green on a dark purple pill */
.x-follow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  text-decoration: none;
  color: var(--pl-green, #00ff87);
  background: rgba(0, 255, 135, 0.08);
  border: 1px solid rgba(0, 255, 135, 0.30);
  transition: background-color 0.2s ease, transform 0.12s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.x-follow svg { flex: 0 0 auto; }

.x-follow:hover {
  transform: translateY(-1px);
  background: var(--pl-green, #00ff87);
  color: #06130d;
  box-shadow: 0 8px 24px rgba(0, 255, 135, 0.28);
}

:root.light-mode .footer-link { color: var(--text-secondary, #5b525d); }
:root.light-mode .x-follow { color: #04140c; }

@media (prefers-reduced-motion: reduce) {
  .x-follow:hover { transform: none; }
}

/* ─── Custom scrollbars (FPL themed, global) ───────────────────────────── */

* {
  scrollbar-width: thin;                              /* Firefox */
  scrollbar-color: rgba(0, 255, 135, 0.55) transparent;
}

::-webkit-scrollbar { width: 10px; height: 10px; }

::-webkit-scrollbar-track {
  background: rgba(29, 0, 36, 0.35);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--pl-green, #00ff87), #00b85e);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #4dffb0, var(--pl-green, #00ff87));
  background-clip: padding-box;
}

::-webkit-scrollbar-corner { background: transparent; }

:root.light-mode * { scrollbar-color: rgba(0, 184, 94, 0.6) transparent; }
:root.light-mode ::-webkit-scrollbar-track { background: rgba(26, 8, 32, 0.06); }
:root.light-mode ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #00b85e, #00934a);
  background-clip: padding-box;
}

/* ─── Google sign-in — fully custom button ─────────────────────────────── */
/* Our own markup driven by the OAuth 2.0 popup flow, so it is styled like the
   rest of the app instead of inheriting Google's cross-origin widget. */
.google-btn-wrapper {
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

.custom-google-signin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 320px;
  padding: 13px 22px;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.22);
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.12s ease, box-shadow 0.2s ease;
}

.custom-google-signin-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--pl-green, #00ff87);
  transform: translateY(-1px);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.28);
}

.custom-google-signin-btn:active { transform: translateY(0) scale(0.99); }

.custom-google-signin-btn:focus-visible {
  outline: 2px solid var(--pl-green, #00ff87);
  outline-offset: 2px;
}

.custom-google-signin-btn .google-g-logo { flex: 0 0 auto; }

/* Busy state — swap the label for a spinner while the popup is open */
.custom-google-signin-btn .cg-spinner {
  display: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: var(--pl-green, #00ff87);
  animation: cg-spin 0.7s linear infinite;
}

.custom-google-signin-btn.is-busy { cursor: progress; opacity: 0.85; }
.custom-google-signin-btn.is-busy .cg-spinner { display: inline-block; }
.custom-google-signin-btn.is-busy .cg-label { opacity: 0.7; }

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

:root.light-mode .custom-google-signin-btn {
  color: var(--text-primary, #0d0a14);
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(26, 8, 32, 0.14);
}

:root.light-mode .custom-google-signin-btn:hover { background: #ffffff; }

@media (prefers-reduced-motion: reduce) {
  .custom-google-signin-btn { transition: none; }
  .custom-google-signin-btn:hover { transform: none; }
  .custom-google-signin-btn .cg-spinner { animation: none; }
}

/* Compact X-follow pill when it sits in the top header bar */
.header-nav .x-follow {
  padding: 6px 13px;
  font-size: 0.78rem;
}
