/* ===================================
   BASE STYLES - FOUNDATION
   =================================== */

/* ============ MODERN CSS RESET ============ */

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

html {
  font-size: 16px;
  line-height: 1.5;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-primary);
  font-weight: var(--font-normal);
  color: var(--text-primary);
  background: var(--bg-primary);
  overflow-x: hidden;
  min-height: 100vh;
  position: relative;
  overflow-y: hidden;
}

/* Hide default cursor when custom cursor is active */
@media (hover: hover) and (pointer: fine) {
  *, *::before, *::after {
    cursor: none !important;
  }
  
  /* Ensure custom cursor is always visible */
  .custom-cursor {
    display: block !important;
    opacity: 1 !important;
  }
}

/* ============ FOCUS MANAGEMENT ============ */

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

:focus:not(:focus-visible) {
  outline: none;
}

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

/* ============ SELECTION STYLES ============ */

::selection {
  background: var(--color-primary-200);
  color: var(--color-primary-900);
}

::-moz-selection {
  background: var(--color-primary-200);
  color: var(--color-primary-900);
}

/* ============ SCROLLBAR STYLES ============ */

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

::-webkit-scrollbar-track {
  background: var(--color-gray-100);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  border: 2px solid var(--color-gray-100);
}

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

/* Firefox */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--color-primary) var(--color-gray-100);
}

/* ============ TYPOGRAPHY ============ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
  letter-spacing: -0.025em;
}

h1 {
  font-size: clamp(var(--text-4xl), 5vw, var(--text-6xl));
  font-weight: var(--font-extrabold);
  line-height: var(--leading-none);
}

h2 {
  font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl));
  font-weight: var(--font-bold);
}

h3 {
  font-size: clamp(var(--text-2xl), 3vw, var(--text-4xl));
  font-weight: var(--font-semibold);
}

h4 {
  font-size: clamp(var(--text-xl), 2.5vw, var(--text-2xl));
  font-weight: var(--font-medium);
}

h5 {
  font-size: var(--text-lg);
  font-weight: var(--font-medium);
}

h6 {
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

p {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  margin-bottom: var(--space-4);
}

.text-large {
  font-size: var(--text-lg);
}

.text-small {
  font-size: var(--text-sm);
}

.text-xs {
  font-size: var(--text-xs);
}

/* ============ LINKS ============ */

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: all var(--duration-200) var(--ease-out);
}

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

a:focus {
  outline-color: var(--color-primary);
}

/* ============ LISTS ============ */

ul, ol {
  list-style: none;
}

ul[role="list"],
ol[role="list"] {
  list-style: revert;
  padding-left: var(--space-6);
}

li {
  margin-bottom: var(--space-2);
}

/* ============ IMAGES & MEDIA ============ */

img, 
picture, 
video, 
canvas, 
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  border-radius: var(--radius-base);
}

svg {
  fill: currentColor;
  width: 1em;
  height: 1em;
}

/* ============ FORMS ============ */

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

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

input,
textarea,
select {
  width: 100%;
  border: var(--border) solid var(--color-gray-300);
  border-radius: var(--form-input-radius);
  padding: var(--form-input-padding);
  font-size: var(--text-base);
  transition: all var(--duration-200) var(--ease-out);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-100);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* ============ TABLES ============ */

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  border-bottom: var(--border) solid var(--color-gray-200);
}

th {
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  background: var(--bg-secondary);
}

/* ============ UTILITY CLASSES ============ */

/* 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;
}

/* Visually Hidden */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Skip Links */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--color-primary);
  color: var(--text-inverse);
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
  border-radius: var(--radius-base);
  z-index: var(--z-max);
  transition: top var(--duration-300) var(--ease-out);
}

.skip-link:focus {
  top: 6px;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.container-narrow {
  max-width: var(--content-width-narrow);
}

.container-wide {
  max-width: var(--content-width-wide);
}

/* Flexbox Utilities */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.items-center {
  align-items: center;
}

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-around {
  justify-content: space-around;
}

.justify-evenly {
  justify-content: space-evenly;
}

/* Grid Utilities */
.grid {
  display: grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

.grid-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.gap-2 {
  gap: var(--space-2);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-6 {
  gap: var(--space-6);
}

.gap-8 {
  gap: var(--space-8);
}

/* Text Utilities */
.text-center {
  text-align: center;
}

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

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

.font-light {
  font-weight: var(--font-light);
}

.font-normal {
  font-weight: var(--font-normal);
}

.font-medium {
  font-weight: var(--font-medium);
}

.font-semibold {
  font-weight: var(--font-semibold);
}

.font-bold {
  font-weight: var(--font-bold);
}

.uppercase {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lowercase {
  text-transform: lowercase;
}

.capitalize {
  text-transform: capitalize;
}

/* Color Utilities */
.text-primary {
  color: var(--text-primary);
}

.text-secondary {
  color: var(--text-secondary);
}

.text-muted {
  color: var(--text-muted);
}

.text-white {
  color: var(--color-white);
}

.text-brand {
  color: var(--color-primary);
}

/* Background Utilities */
.bg-primary {
  background: var(--bg-primary);
}

.bg-secondary {
  background: var(--bg-secondary);
}

.bg-brand {
  background: var(--color-primary);
}

.bg-white {
  background: var(--color-white);
}

/* Gradient Text */
.gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  background-size: 200% 200%;
}

/* Border Radius */
.rounded-none {
  border-radius: var(--radius-none);
}

.rounded {
  border-radius: var(--radius-base);
}

.rounded-lg {
  border-radius: var(--radius-lg);
}

.rounded-xl {
  border-radius: var(--radius-xl);
}

.rounded-2xl {
  border-radius: var(--radius-2xl);
}

.rounded-full {
  border-radius: var(--radius-full);
}

/* Shadow */
.shadow {
  box-shadow: var(--shadow-base);
}

.shadow-lg {
  box-shadow: var(--shadow-lg);
}

.shadow-xl {
  box-shadow: var(--shadow-xl);
}

.shadow-none {
  box-shadow: var(--shadow-none);
}

/* Position */
.relative {
  position: relative;
}

.absolute {
  position: absolute;
}

.fixed {
  position: fixed;
}

.inset-0 {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}

/* Display */
.block {
  display: block;
}

.inline {
  display: inline;
}

.inline-block {
  display: inline-block;
}

.hidden {
  display: none;
}

/* Overflow */
.overflow-hidden {
  overflow: hidden;
}

.overflow-auto {
  overflow: auto;
}

/* Z-Index */
.z-10 {
  z-index: var(--z-10);
}

.z-20 {
  z-index: var(--z-20);
}

.z-30 {
  z-index: var(--z-30);
}

.z-40 {
  z-index: var(--z-40);
}

.z-50 {
  z-index: var(--z-50);
}

/* ============ RESPONSIVE UTILITIES ============ */

@media (min-width: 640px) {
  .sm\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  
  .sm\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  
  .sm\:flex-row {
    flex-direction: row;
  }
  
  .sm\:text-left {
    text-align: left;
  }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  
  .md\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  
  .md\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  
  .md\:flex-row {
    flex-direction: row;
  }
  
  .md\:text-left {
    text-align: left;
  }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  
  .lg\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  
  .lg\:flex-row {
    flex-direction: row;
  }
}

/* ============ PRINT STYLES ============ */

@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  a,
  a:visited {
    text-decoration: underline;
  }
  
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }
  
  h2, h3 {
    page-break-after: avoid;
  }
  
  p {
    orphans: 3;
    widows: 3;
  }
}
