/* ═══════════════════════════════════════════════════════════════
   Chance.Staking — Global Styles
   ═══════════════════════════════════════════════════════════════ */

:root {
  --primary: #FDC70C;
  --primary-light: #E9C46A;
  --primary-dark: #e3b209;
  --secondary: #38bdf8;
  --accent: #f472b6;
  --background: #0F0F13;
  --surface: #1A1A22;
  --surface-elevated: #252530;
  --text: #F0F0F5;
  --text-secondary: #8E8EA0;
  --border: #2A2A38;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 48px rgba(253, 199, 12, 0.12);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary);
}

button {
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  outline: none;
  transition: all 0.2s ease;
}

button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

input, textarea {
  font-family: var(--font-sans);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(253, 199, 12, 0.15);
}

::selection {
  background: rgba(253, 199, 12, 0.3);
  color: var(--text);
}

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

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

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* ═══ Animations ═══ */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes barGrow {
  from { width: 0%; }
}

@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(253, 199, 12, 0.08); }
  50% { box-shadow: 0 0 30px rgba(253, 199, 12, 0.16); }
}

.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out forwards;
}

.animate-fade-in {
  animation: fadeIn 0.4s ease-out forwards;
}

.animate-pulse {
  animation: pulse 2s ease-in-out infinite;
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ═══ Mobile burger button — hidden on desktop ═══ */
.header-burger {
  display: none !important;
}

/* ═══ Mobile nav drawer hover states ═══ */
.mobile-nav-drawer a:hover,
.mobile-nav-drawer a:active {
  background: rgba(253, 199, 12, 0.08);
  color: #F0F0F5;
}

.mobile-nav-drawer button:hover {
  border-color: rgba(253, 199, 12, 0.3);
}

/* ═══ Mobile Responsive ═══ */

@media (max-width: 768px) {
  /* Header — hide desktop nav + wallet, show burger */
  .header-inner {
    padding: 0 16px !important;
    height: 60px !important;
  }
  .header-nav-desktop {
    display: none !important;
  }
  .header-wallet-desktop {
    display: none !important;
  }
  .header-rpc-desktop {
    display: none !important;
  }
  .header-burger {
    display: flex !important;
  }

  /* Hero */
  .hero-content {
    padding: 0 16px !important;
  }
  .hero-title-1, .hero-title-2 {
    font-size: 42px !important;
  }
  .hero-subtitle {
    font-size: 15px !important;
    max-width: 100% !important;
  }
  .hero-stats-row {
    flex-direction: column !important;
    gap: 0 !important;
    padding: 16px !important;
  }
  .hero-stat-divider {
    display: none !important;
  }
  .hero-stat-value {
    font-size: 20px !important;
  }
  .hero-cta-primary, .hero-cta-secondary {
    padding: 14px 24px !important;
    font-size: 14px !important;
  }

  /* Staking */
  .staking-grid {
    grid-template-columns: 1fr !important;
  }
  .staking-section {
    padding: 60px 0 40px !important;
  }

  /* Draws */
  .draws-pool-grid {
    grid-template-columns: 1fr !important;
  }
  .draws-section-title {
    font-size: 28px !important;
  }

  /* Portfolio */
  .portfolio-overview-grid {
    grid-template-columns: 1fr !important;
  }

  /* Rewards Calculator */
  .rewards-calc-layout {
    grid-template-columns: 1fr !important;
  }
  .rewards-calc-stats-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  /* How it Works */
  .hiw-steps-grid {
    flex-direction: column !important;
    align-items: center !important;
  }
  .hiw-step-arrow {
    display: none !important;
  }
  .hiw-step-card {
    max-width: 100% !important;
    width: 100% !important;
    flex: 1 1 100% !important;
  }
  .hiw-title {
    font-size: 28px !important;
  }
  .hiw-split-legend {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
  }

  /* Footer */
  .footer-top {
    flex-direction: column !important;
    gap: 32px !important;
  }
  .footer-links-grid {
    gap: 32px !important;
  }

  /* Containers */
  .section-container {
    padding: 0 16px !important;
  }

  /* Draw detail */
  .draw-header {
    flex-direction: column !important;
    gap: 12px !important;
  }
  .draw-detail-container {
    padding: 0 16px !important;
  }
  .draw-detail-title {
    font-size: 24px !important;
  }
  .draw-detail-container .verify-step-title {
    flex-wrap: wrap !important;
  }

  /* Epoch countdown */
  .epoch-countdown-wrapper {
    padding: 12px 12px !important;
  }
  .epoch-unit-value {
    font-size: 20px !important;
  }
}

@media (max-width: 480px) {
  .hero-title-1, .hero-title-2 {
    font-size: 32px !important;
  }
  .hero-badge {
    font-size: 11px !important;
    padding: 6px 12px !important;
  }
  .hero-cta-row {
    flex-direction: column !important;
    align-items: center !important;
  }
  .hero-cta-row a {
    width: 100% !important;
    display: block !important;
  }
  .hero-cta-primary, .hero-cta-secondary {
    justify-content: center !important;
    width: 100% !important;
  }
  .footer-links-grid {
    flex-direction: column !important;
    gap: 24px !important;
  }
  .footer-bottom {
    flex-direction: column !important;
    text-align: center !important;
  }
}

/* ── New pages responsive ── */
@media (max-width: 768px) {
  /* Validators */
  .validators-grid {
    grid-template-columns: 1fr !important;
  }
  .validators-page-stats {
    flex-direction: column !important;
    align-items: center !important;
  }
  /* How It Works page */
  .hiw-page-math-steps {
    grid-template-columns: 1fr !important;
  }
  .hiw-page-security-grid {
    grid-template-columns: 1fr !important;
  }
  .hiw-page-timing-grid {
    grid-template-columns: 1fr !important;
  }
  .hiw-page-steps {
    flex-direction: column !important;
    align-items: center !important;
  }
  .hiw-page-step-arrow {
    transform: rotate(90deg);
    padding-top: 0 !important;
    padding: 4px 0 !important;
  }
  .hiw-page-timeline {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  .hiw-page-split-legend {
    flex-direction: column !important;
    align-items: center !important;
  }
  /* Staking page */
  .staking-page-stats {
    flex-direction: column !important;
    align-items: center !important;
  }
  /* Draws page */
  .draws-page-stats {
    flex-direction: column !important;
    align-items: center !important;
  }
  /* Docs page */
  .docs-layout {
    flex-direction: column !important;
  }
  .docs-sidebar {
    position: static !important;
    width: 100% !important;
    max-height: none !important;
    border-right: none !important;
    border-bottom: 1px solid #2A2A38 !important;
    padding-right: 0 !important;
    padding-bottom: 16px !important;
    margin-bottom: 24px !important;
    display: none !important;
  }
  .docs-sidebar.open {
    display: flex !important;
  }
  .docs-sidebar-toggle {
    display: flex !important;
  }
  /* Contracts page */
  .contracts-stats {
    flex-direction: column !important;
    align-items: center !important;
  }
  .contracts-query-buttons {
    flex-wrap: wrap !important;
  }
  /* Audit page */
  .audit-stats {
    flex-direction: column !important;
    align-items: center !important;
  }
  .audit-finding-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  .audit-finding-right {
    flex-wrap: wrap !important;
  }
}
