/* =========================================
   BASE.CSS — Reset, Variables & Typography
   ========================================= */

/* ---- CSS Custom Properties ---- */
:root {
  --nav-height: 96px;

  /* Spacing grid (8px base) */
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 32px;
  --space-5: 40px;
  --space-6: 48px;
  --space-8: 64px;
  --space-10: 80px;
  --space-12: 96px;
  --space-16: 128px;

  /* Border radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
  --transition-theme: all 0.4s ease;

  /* Z-index layers */
  --z-base: 1;
  --z-card: 10;
  --z-nav: 100;
  --z-modal: 200;
  --z-toast: 300;
  --z-cursor: 9999;

  /* Font families */
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Fluid font sizes using clamp() */
  --text-xs:   clamp(0.70rem, 0.5vw + 0.6rem, 0.75rem);
  --text-sm:   clamp(0.80rem, 0.6vw + 0.7rem, 0.875rem);
  --text-base: clamp(0.95rem, 0.8vw + 0.8rem, 1rem);
  --text-lg:   clamp(1.05rem, 1vw + 0.9rem, 1.125rem);
  --text-xl:   clamp(1.15rem, 1.2vw + 1rem, 1.25rem);
  --text-2xl:  clamp(1.30rem, 1.5vw + 1rem, 1.5rem);
  --text-3xl:  clamp(1.60rem, 2vw + 1.1rem, 1.875rem);
  --text-4xl:  clamp(2.00rem, 3vw + 1.2rem, 2.5rem);
  --text-5xl:  clamp(2.50rem, 4vw + 1.5rem, 3.5rem);
  --text-6xl:  clamp(3.00rem, 5vw + 1.8rem, 4.5rem);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  cursor: none;
  transition: var(--transition-theme);
}

/* Restore default cursor for inputs on touch */
@media (hover: none) {
  body { cursor: auto; }
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* ---- Typography Defaults ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h1 { font-size: var(--text-6xl); }
h2 { font-size: var(--text-5xl); }
h3 { font-size: var(--text-4xl); }
h4 { font-size: var(--text-3xl); }
h5 { font-size: var(--text-2xl); }
h6 { font-size: var(--text-xl); }

p {
  color: var(--text-muted);
  line-height: 1.75;
  font-size: var(--text-base);
}

code, kbd, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ---- Selection ---- */
::selection {
  background: var(--accent-1);
  color: #fff;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--glass-border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-1);
}

/* ---- Focus Styles ---- */
:focus-visible {
  outline: 2px solid var(--accent-1);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ---- Image Placeholder ---- */
.portfolio-image:not([src]),
.portfolio-image[src=""] {
  display: block;
  background: var(--glass-bg);
  border: 2px dashed var(--glass-border);
  min-height: 200px;
  border-radius: var(--radius-md);
  position: relative;
}

.portfolio-image:not([src])::after,
.portfolio-image[src=""]::after {
  content: attr(data-placeholder);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
  opacity: 0.5;
  white-space: nowrap;
}

/* ---- Gradient Text Utility ---- */
.gradient-text {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2), var(--accent-3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Visually Hidden (Accessibility) ---- */
.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;
}
