/*
  NexusMarket — Base Styles
  Dark theme with warm terracotta/orange accents
  ClaudeStore-inspired palette
  WCAG 2.1 Level AA compliant color contrast
*/

/* === RESET === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* === CSS CUSTOM PROPERTIES === */
:root {
  /* Background tones — warm dark, not cold */
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #242424;
  --bg-card: #1c1c1c;
  --bg-elevated: #2a2a2a;

  /* Legacy aliases for existing markup */
  --bg: #0a0a0b;
  --surface: #131316;
  --surface-hover: #1a1a1f;
  --surface-raised: #1e1e24;

  /* Accent — warm terracotta/orange */
  --accent-primary: #e87a3a;
  --accent-hover: #f09050;
  --accent-subtle: rgba(232, 122, 58, 0.1);
  --accent-glow: rgba(232, 122, 58, 0.15);

  /* Legacy accent aliases */
  --primary: #e8764b;
  --primary-hover: #d4623a;
  --primary-dim: rgba(232, 118, 75, 0.12);
  --primary-border: rgba(232, 118, 75, 0.25);
  --secondary: #f5a623;
  --secondary-dim: rgba(245, 166, 35, 0.1);

  /* Text hierarchy — WCAG AA compliant on dark backgrounds */
  --text-primary: #f5f5f5;
  --text-secondary: #a8a8a8;
  --text-muted: #6b6b6b;
  --text-on-accent: #0f0f0f;

  /* Borders and dividers */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border: #2a2a30;
  --border-hover: #3a3a42;

  /* Status colors */
  --success: #4caf7a;
  --success-dim: rgba(76, 175, 80, 0.1);
  --warning: #e8a73a;
  --danger: #e85a5a;
  --error: #e74c3c;
  --info: #5a9ce8;

  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font: var(--font-sans);

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius: 8px;

  /* Layout */
  --nav-height: 56px;
  --max-width: 1380px;

  /* Transitions */
  --ease: 200ms ease;
  --ease-spring: 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: 280ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Noise texture (SVG-based grain overlay) */
  --noise: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
}

/* === BASE TYPOGRAPHY === */
html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Subtle noise texture on body */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--noise);
  background-repeat: repeat;
  background-size: 256px 256px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.12;
  mix-blend-mode: overlay;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.3px;
}

h1 { font-size: 2.6rem; letter-spacing: -2.5px; font-weight: 700; }
h2 { font-size: 1.5rem; letter-spacing: -0.8px; }
h3 { font-size: 1.1rem; }
h4 { font-size: 0.95rem; }

p {
  color: var(--text-secondary);
  line-height: 1.6;
}

strong { font-weight: 600; }

/* === LINKS & INTERACTIVE === */
a {
  color: inherit;
  text-decoration: none;
  transition: color var(--ease);
}

a:hover { color: var(--text-primary); }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(232, 122, 58, 0.15);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: inherit;
  color: var(--text-primary);
}

/* === SELECTION === */
::selection {
  background: var(--primary-dim);
  color: var(--primary);
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* === SCROLL-TRIGGERED ANIMATIONS === */
/* Progressive enhancement: sections are visible by default.
   Only when JS is active (html.js) do we hide them for animate-in.
   This guarantees content NEVER stays blank if JS fails or the
   observer misfires on tall sections. */
.fade-in-section {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

html.js .fade-in-section {
  opacity: 0;
  transform: translateY(16px);
}

html.js .fade-in-section.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  html.js .fade-in-section {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* staggered children */
.fade-in-section .feature-card,
.fade-in-section .step-item,
.fade-in-section .stat-item,
.fade-in-section .payment-icon {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in-section.visible .feature-card,
.fade-in-section.visible .step-item,
.fade-in-section.visible .stat-item,
.fade-in-section.visible .payment-icon {
  opacity: 1;
  transform: translateY(0);
}

.fade-in-section.visible .feature-card:nth-child(1),
.fade-in-section.visible .step-item:nth-child(1),
.fade-in-section.visible .stat-item:nth-child(1),
.fade-in-section.visible .payment-icon:nth-child(1) { transition-delay: 0ms; }

.fade-in-section.visible .feature-card:nth-child(2),
.fade-in-section.visible .step-item:nth-child(2),
.fade-in-section.visible .stat-item:nth-child(2),
.fade-in-section.visible .payment-icon:nth-child(2) { transition-delay: 80ms; }

.fade-in-section.visible .feature-card:nth-child(3),
.fade-in-section.visible .step-item:nth-child(3),
.fade-in-section.visible .stat-item:nth-child(3),
.fade-in-section.visible .payment-icon:nth-child(3) { transition-delay: 160ms; }

.fade-in-section.visible .feature-card:nth-child(4),
.fade-in-section.visible .stat-item:nth-child(4),
.fade-in-section.visible .payment-icon:nth-child(4) { transition-delay: 240ms; }

/* === UTILITY CLASSES === */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-accent { color: var(--accent-primary); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

.font-mono { font-family: var(--font-mono); }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Dot separator utility */
.dot-sep::before {
  content: '·';
  margin: 0 8px;
  color: var(--text-muted);
}

/* === IMAGES === */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Verified-tick badge — shared component, kept vertically centred next to text
   on every page (profile heading, seller rows, navbar, listings). */
.verified-tick {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  line-height: 0;
  color: var(--accent-primary);
}
.verified-tick svg { display: block; }
