/* Base Styles */

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

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

body {
  font-family: var(--font-primary);
  color: var(--white);
  background: var(--black);
  line-height: var(--lh-normal);
  overflow-x: hidden;
  min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  line-height: var(--lh-tight);
  font-weight: var(--fw-extrabold);
  text-rendering: optimizeLegibility;
}

p {
  line-height: var(--lh-relaxed);
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-base);
}

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

/* Selection */
::selection {
  background: var(--green);
  color: var(--black);
}

::-moz-selection {
  background: var(--green);
  color: var(--black);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 12px;
}

::-webkit-scrollbar-track {
  background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--green);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--green-light);
}

/* Firefox Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--green) var(--dark-bg);
}

/* Container */
.container {
  max-width: var(--container-2xl);
  margin: 0 auto;
  padding: 0 var(--space-10);
}

@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-5);
  }
}

/* Images */
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

/* Forms */
input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

/* Remove default button styles */
button, input[type="submit"], input[type="reset"] {
  background: none;
  color: inherit;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  outline: inherit;
}

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

/* Tables */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* Prevent text overflow */
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
}

/* Root stacking context */
#root, #__next {
  isolation: isolate;
}

/* Utility Classes */
.text-center {
  text-align: center;
}

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

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  white-space: nowrap;
  clip-path: inset(100%);
  clip: rect(0 0 0 0);
  overflow: hidden;
}

/* Loading State */
.loading {
  pointer-events: none;
  opacity: 0.6;
  cursor: not-allowed;
}

/* Disabled State */
[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Light Mode Adjustments */
body.light-mode {
  background: var(--white);
  color: var(--black);
}

body.light-mode ::selection {
  background: var(--green);
  color: var(--white);
}

/* Print Styles */
@media print {
  body {
    background: white;
    color: black;
  }
  
  .no-print,
  .sticky-cta,
  .back-to-top,
  .theme-toggle,
  .live-stats,
  .purchase-ticker,
  #matrix-canvas,
  .progress-bar,
  header,
  footer {
    display: none !important;
  }
  
  a[href]:after {
    content: " (" attr(href) ")";
  }
  
  h1, h2, h3 {
    page-break-after: avoid;
  }
}

/* Enhanced Focus Styles for Keyboard Navigation */
:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Remove focus outline for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Ensure buttons have visible focus */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

/* Improve link accessibility */
a:not([class]) {
  text-decoration-skip-ink: auto;
}

/* Better text rendering */
body {
  text-rendering: optimizeSpeed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Prevent horizontal scroll */
html, body {
  overflow-x: hidden;
  width: 100%;
}

/* Ensure proper box model */
html {
  box-sizing: border-box;
}

/* Better dark mode for inputs */
@media (prefers-color-scheme: dark) {
  input, textarea, select {
    background-color: var(--dark-bg);
    color: var(--white);
    border-color: rgba(255, 255, 255, 0.1);
  }
}
