/* ============================================
   FlowStash — Base Styles
   Cinematic reset · Typographic foundation
   ============================================ */

/* ── Modern Reset ── */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-main);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center center;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Typography ──
   Headlines: tight, bold, cinematic
   Body: relaxed, secondary color for contrast */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
}

h1 {
  font-size: var(--text-5xl);
  letter-spacing: var(--tracking-tighter);
  font-weight: var(--weight-bold);
}

h2 {
  font-size: var(--text-4xl);
  letter-spacing: var(--tracking-tighter);
}

h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* ── Links ── */
a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-default);
}

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

/* ── Lists ── */
ul, ol {
  list-style: none;
}

/* ── Images ── */
img, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ── Form Elements ── */
button, input, textarea, select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
}

/* ── Table ── */
table {
  border-collapse: collapse;
  width: 100%;
}

/* ── Selection ── */
::selection {
  background-color: var(--accent-muted);
  color: var(--text-primary);
}

::-moz-selection {
  background-color: var(--accent-muted);
  color: var(--text-primary);
}

/* ── Scrollbar ──
   Nearly invisible — content first */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

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

::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255, 255, 255, 0.10);
}

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

/* ── Focus Styles ── */
:focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* ── Screen Reader Only ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Intent-based UI Visibility ── */
body[data-intent="buy"] .earn-only,
[data-intent="buy"] #earn-view {
  display: none !important;
}

[data-intent="earn"] .buy-only,
[data-intent="earn"] #buy-view {
  display: none !important;
}



/* ── Utility Classes ── */
.text-gradient {
  background: linear-gradient(
    135deg,
    var(--text-primary) 0%,
    var(--accent) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Uppercase label utility — Obsidian style */
.label {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--text-muted);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ── Spatial UI & Glassmorphism ── */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-spatial);
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
}

/* ── Lattice Background (Cyber Grid) ── */
.lattice-bg {
  background-color: var(--bg-primary);
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  background-position: center center;
  /* Add perspective and depth for spatial layout */
  perspective: 1000px;
}

/* ── Laser Accents ── */
.laser-line-cobalt {
  height: 1px;
  background: var(--laser-cobalt);
  box-shadow: var(--shadow-laser-cobalt);
  width: 100%;
}

.laser-line-neon {
  height: 1px;
  background: var(--laser-neon);
  box-shadow: var(--shadow-laser-neon);
  width: 100%;
}

/* ── Loading Spinner ── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner--lg {
  width: 36px;
  height: 36px;
  border-width: 2px;
}

/* ── Skeleton Loading ── */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-secondary) 25%,
    var(--bg-tertiary) 50%,
    var(--bg-secondary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 2s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton--text {
  height: 1em;
  width: 100%;
  margin-bottom: var(--space-2);
}

.skeleton--title {
  height: 1.5em;
  width: 60%;
  margin-bottom: var(--space-4);
}

.skeleton--card {
  height: 200px;
  width: 100%;
  border-radius: var(--radius-lg);
}

.skeleton--avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-full);
}

/* ── Animations ──
   Cinematic easing with subtle movement */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

.animate-in {
  animation: fadeIn var(--duration-slow) var(--ease-cinematic) both;
}

.animate-in-up {
  animation: fadeInUp var(--duration-slower) var(--ease-cinematic) both;
}

/* Staggered children — cinematic cascade */
.stagger > * {
  animation: fadeIn var(--duration-slow) var(--ease-cinematic) both;
}

.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 60ms; }
.stagger > *:nth-child(3) { animation-delay: 120ms; }
.stagger > *:nth-child(4) { animation-delay: 180ms; }
.stagger > *:nth-child(5) { animation-delay: 240ms; }
.stagger > *:nth-child(6) { animation-delay: 300ms; }
.stagger > *:nth-child(7) { animation-delay: 360ms; }
.stagger > *:nth-child(8) { animation-delay: 420ms; }
.stagger > *:nth-child(9) { animation-delay: 480ms; }

/* ── Responsive Typography ── */
@media (max-width: 768px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-3xl); }
  h3 { font-size: var(--text-2xl); }
  h4 { font-size: var(--text-xl); }
}

@media (max-width: 480px) {
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }
}

/* ── Horizontal rule / Divider ── */
hr {
  border: none;
  height: 1px;
  background: var(--border-subtle);
}
