/*
 * base.css
 * CSS reset + base typography + animations
 * Merged from: reset.css + base.css + animations.css
 */

/* ============================
   1. CSS Reset
   ============================ */

/* Apply box-sizing to all elements */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Remove default margins and paddings */
body,
h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

/* Remove list styles */
ul,
ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Image and media defaults */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Form element font inheritance */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* Remove default button styles */
button {
  background: none;
  border: none;
  cursor: pointer;
}

/* Table border collapse */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* Anchor defaults */
a {
  text-decoration: none;
  color: inherit;
}

/* Remove default focus outline (add custom focus styles in components) */
:focus {
  outline: none;
}

/* Prevent text overflow */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* Create stacking context */
#root,
#__next {
  isolation: isolate;
}

/* ============================
   2. Base Typography & Elements
   ============================ */

/* === BODY === */
body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* === HEADINGS === */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
  letter-spacing: -0.02em;
}

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);
}

/* Responsive heading sizes */
@media (max-width: 768px) {
  h1 {
    font-size: var(--text-4xl);
  }

  h2 {
    font-size: var(--text-3xl);
  }

  h3 {
    font-size: var(--text-2xl);
  }
}

/* === PARAGRAPHS === */
p {
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: var(--text-base);
}

/* === LINKS === */
a {
  color: inherit;
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--accent-400);
}

/* === IMAGES === */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* === BUTTONS === */
button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
  padding: 0;
  color: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* === FORM ELEMENTS === */
input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  transition: border-color var(--duration-fast) var(--ease-out);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--input-border-focus);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-dim);
}

/* === CODE === */
code,
pre {
  font-family: 'Fira Code', 'SF Mono', Monaco, monospace;
  font-size: 0.9em;
}

code {
  background-color: var(--glass-bg);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--accent-400);
}

pre {
  background-color: var(--glass-bg);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
}

/* === SELECTION === */
::selection {
  background-color: var(--accent-400);
  color: var(--surface-950);
}

::-moz-selection {
  background-color: var(--accent-400);
  color: var(--surface-950);
}

/* === SCROLLBAR === */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--glass-bg);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--glass-bg-hover);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--glass-bg) var(--bg-secondary);
}

/* === HORIZONTAL RULE === */
hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: var(--space-8) 0;
}

/* === FOCUS VISIBLE === */
*:focus-visible {
  outline: 2px solid var(--accent-400);
  outline-offset: 2px;
}

/* === STRONG & EMPHASIS === */
strong,
b {
  font-weight: var(--fw-bold);
  color: var(--text-primary);
}

em,
i {
  font-style: italic;
}

/* ============================
   3. Animations & Keyframes
   ============================ */

/* ========================================================== */
/* KEYFRAME ANIMATIONS                                        */
/* ========================================================== */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(2.5rem);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-3rem);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
    filter: blur(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(3rem);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
    filter: blur(0);
  }
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  33% {
    transform: translateY(-12px) rotate(0.5deg);
  }
  66% {
    transform: translateY(-6px) rotate(-0.3deg);
  }
}

@keyframes meshDrift {
  0% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(30px, -20px) scale(1.05);
  }
  50% {
    transform: translate(-10px, 15px) scale(0.98);
  }
  75% {
    transform: translate(20px, 10px) scale(1.03);
  }
  100% {
    transform: translate(0, 0) scale(1);
  }
}

@keyframes marquee {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

@keyframes pulseAccent {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(212, 168, 83, 0);
  }
  50% {
    box-shadow: 0 0 40px -5px rgba(212, 168, 83, 0.15);
  }
}

/* ========================================================== */
/* SCROLL REVEAL TRIGGERS                                     */
/* ========================================================== */

/* Base reveal - fade in from bottom */
.reveal {
  opacity: 0;
  transform: translateY(2.5rem);
  filter: blur(6px);
}

.reveal.visible {
  animation: fadeInUp 1s var(--ease-spring) forwards;
}

/* Reveal from left */
.reveal-left {
  opacity: 0;
  transform: translateX(-3rem);
  filter: blur(6px);
}

.reveal-left.visible {
  animation: fadeInLeft 1s var(--ease-spring) forwards;
}

/* Reveal from right */
.reveal-right {
  opacity: 0;
  transform: translateX(3rem);
  filter: blur(6px);
}

.reveal-right.visible {
  animation: fadeInRight 1s var(--ease-spring) forwards;
}

/* Reveal with scale */
.reveal-scale {
  opacity: 0;
  transform: scale(0.95);
  filter: blur(4px);
}

.reveal-scale.visible {
  animation: fadeInScale 1s var(--ease-spring) forwards;
}

/* ========================================================== */
/* STAGGER DELAYS                                             */
/* ========================================================== */

.stagger-1 {
  animation-delay: 100ms !important;
}

.stagger-2 {
  animation-delay: 200ms !important;
}

.stagger-3 {
  animation-delay: 300ms !important;
}

.stagger-4 {
  animation-delay: 400ms !important;
}

.stagger-5 {
  animation-delay: 500ms !important;
}

.stagger-6 {
  animation-delay: 600ms !important;
}

.stagger-7 {
  animation-delay: 700ms !important;
}

/* ========================================================== */
/* CONTINUOUS ANIMATIONS                                      */
/* ========================================================== */

/* Float animation for hero elements */
.float-animation {
  animation: float 8s ease-in-out infinite;
}

.float-animation-slow {
  animation: float 10s ease-in-out infinite;
}

.float-animation-fast {
  animation: float 6s ease-in-out infinite;
}

/* Mesh drift for background orbs */
.mesh-drift {
  animation: meshDrift 25s ease-in-out infinite;
}

.mesh-drift-slow {
  animation: meshDrift 35s ease-in-out infinite;
}

.mesh-drift-fast {
  animation: meshDrift 20s ease-in-out infinite;
}

/* Marquee animation */
.marquee-track {
  animation: marquee 30s linear infinite;
}

.marquee-track:hover {
  animation-play-state: paused;
}

/* Shimmer animation */
.shimmer-animation {
  animation: shimmer 3s ease-in-out infinite;
}

/* Pulse accent glow */
.pulse-accent {
  animation: pulseAccent 2s ease-in-out infinite;
}

.pulse-accent-slow {
  animation: pulseAccent 3s ease-in-out infinite;
}

/* ========================================================== */
/* SPRING TRANSITIONS (Global)                                */
/* ========================================================== */

a,
button,
.interactive,
input,
textarea,
select {
  transition: all 0.5s var(--ease-spring);
}

/* ========================================================== */
/* HOVER EFFECTS                                              */
/* ========================================================== */

/* Scale on hover */
.hover-scale {
  transition: transform var(--duration-normal) var(--ease-spring);
}

.hover-scale:hover {
  transform: scale(1.05);
}

.hover-scale:active {
  transform: scale(0.98);
}

/* Lift on hover */
.hover-lift {
  transition: transform var(--duration-normal) var(--ease-spring);
}

.hover-lift:hover {
  transform: translateY(-4px);
}

/* Rotate on hover */
.hover-rotate {
  transition: transform var(--duration-normal) var(--ease-spring);
}

.hover-rotate:hover {
  transform: rotate(3deg);
}

/* Glow on hover */
.hover-glow {
  transition: box-shadow var(--duration-normal) var(--ease-spring);
}

.hover-glow:hover {
  box-shadow: 0 0 30px rgba(212, 168, 83, 0.25);
}

/* ========================================================== */
/* LOADING & SKELETON ANIMATIONS                              */
/* ========================================================== */

@keyframes skeleton-loading {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--glass-bg) 0%,
    var(--glass-bg-hover) 50%,
    var(--glass-bg) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  animation: spin 1s linear infinite;
}

/* ========================================================== */
/* FADE TRANSITIONS                                           */
/* ========================================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.fade-in {
  animation: fadeIn var(--duration-normal) var(--ease-out) forwards;
}

.fade-out {
  animation: fadeOut var(--duration-normal) var(--ease-in) forwards;
}

/* ========================================================== */
/* SLIDE TRANSITIONS                                          */
/* ========================================================== */

@keyframes slideInRight {
  from {
    transform: translateX(100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(100%);
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

@keyframes slideOutLeft {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

.slide-in-right {
  animation: slideInRight var(--duration-normal) var(--ease-spring) forwards;
}

.slide-out-right {
  animation: slideOutRight var(--duration-normal) var(--ease-spring) forwards;
}

.slide-in-left {
  animation: slideInLeft var(--duration-normal) var(--ease-spring) forwards;
}

.slide-out-left {
  animation: slideOutLeft var(--duration-normal) var(--ease-spring) forwards;
}

/* ========================================================== */
/* BOUNCE ANIMATION                                           */
/* ========================================================== */

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

.bounce {
  animation: bounce 2s ease-in-out infinite;
}

/* ========================================================== */
/* PERFORMANCE OPTIMIZATIONS                                  */
/* ========================================================== */

/* Promote animated elements to their own layer */
.reveal,
.reveal-left,
.reveal-right,
.reveal-scale,
.float-animation,
.mesh-drift,
.marquee-track {
  will-change: transform, opacity;
}

/* Remove will-change after animation completes */
.reveal.visible,
.reveal-left.visible,
.reveal-right.visible,
.reveal-scale.visible {
  will-change: auto;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale {
    opacity: 1;
    transform: none;
    filter: none;
  }

  .float-animation,
  .mesh-drift,
  .marquee-track,
  .shimmer-animation,
  .pulse-accent {
    animation: none !important;
  }
}
