/* =============================================
   RESET & BASE
   ============================================= */

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Hide the native cursor only when the custom cursor is active
   (added by js/main.js on desktop). Pages without the custom cursor
   keep a normal pointer. */
body.custom-cursor,
body.custom-cursor * {
  cursor: none;
}

@media (pointer: coarse) {
  body { cursor: auto; }
  a, button, [role="button"] { cursor: pointer; }
  .cursor, .cursor-ring { display: none !important; }
}

/* Custom Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-secondary); }

/* Selection */
::selection {
  background: rgba(var(--accent-rgb), 0.3);
  color: var(--text-primary);
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 { font-size: clamp(2.4rem, 5vw, 4rem); }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.8rem); }
h3 { font-size: clamp(1.1rem, 2vw, 1.4rem); }

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

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

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

ul { list-style: none; }

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: var(--font-body);
}

/* =============================================
   LAYOUT UTILITIES
   ============================================= */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 2rem;
}

.section {
  padding: 6rem 0;
  position: relative;
}

/* =============================================
   VISUAL UTILITIES
   ============================================= */

.gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* =============================================
   LOADING SCREEN
   ============================================= */

.loader {
  position: fixed;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-inner { text-align: center; }

.loader-logo {
  font-family: var(--font-heading);
  font-size: 3rem;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.5rem;
  animation: pulse 1.2s ease infinite;
}

.loader-bar {
  width: 200px;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 0 auto;
}

.loader-progress {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  animation: loadProgress 1.6s ease forwards;
  width: 0%;
}

/* =============================================
   CUSTOM CURSOR
   ============================================= */

.cursor {
  position: fixed;
  width: 8px;
  height: 8px;
  background: var(--color-primary);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: background 0.3s ease, transform 0.1s ease;
  mix-blend-mode: screen;
}

.cursor-ring {
  position: fixed;
  width: 36px;
  height: 36px;
  border: 1.5px solid rgba(var(--accent-rgb), 0.5);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease, border-color 0.3s ease;
}

.cursor.hover {
  background: var(--color-accent);
  transform: translate(-50%, -50%) scale(2.5);
}

.cursor-ring.hover {
  width: 56px;
  height: 56px;
  border-color: rgba(var(--accent-2-rgb), 0.35);
}

/* =============================================
   SCROLL REVEAL
   ============================================= */

.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.75s ease, transform 0.75s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: opacity 0.75s ease, transform 0.75s ease;
}

.reveal-left.visible {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: opacity 0.75s ease, transform 0.75s ease;
}

.reveal-right.visible {
  opacity: 1;
  transform: translateX(0);
}

/* Stagger delays */
.reveal:nth-child(2) { transition-delay: 0.1s; }
.reveal:nth-child(3) { transition-delay: 0.2s; }
.reveal:nth-child(4) { transition-delay: 0.3s; }

/* =============================================
   BACK TO TOP
   ============================================= */

.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: white;
  cursor: pointer;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-base);
  box-shadow: var(--shadow-glow);
  border: none;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow-strong);
}

/* =============================================
   ACCESSIBILITY — skip link & focus rings
   ============================================= */

.skip-link {
  position: absolute;
  top: -120px;
  left: 1rem;
  z-index: 2000;
  padding: 0.75rem 1.25rem;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transition: top var(--transition-base);
}

.skip-link:focus {
  top: 1rem;
}

/* Visible keyboard-only focus rings */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

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