/* ============================================
   BASE CSS - It Takes Two Review Website
   A vibrant, playful foundation for cooperative gaming content
   ============================================ */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
  /* Color Palette - Inspired by It Takes Two's whimsical environments */
  --color-primary: #FF6B9D;
  --color-primary-light: #FFB3D0;
  --color-primary-dark: #E63576;
  
  --color-secondary: #4ECDC4;
  --color-secondary-light: #7FEDE5;
  --color-secondary-dark: #2BA99F;
  
  --color-accent: #FFE66D;
  --color-accent-light: #FFF4A3;
  --color-accent-dark: #FFD93D;
  
  --color-background: #FFF9F5;
  --color-background-alt: #FFFFFF;
  --color-background-dark: #2D3142;
  
  --color-text: #2D3142;
  --color-text-light: #5F6C7B;
  --color-text-inverse: #FFFFFF;
  
  --color-success: #4CAF50;
  --color-warning: #FF9800;
  --color-danger: #F44336;
  
  /* Neutral Grays */
  --color-gray-50: #F8F9FA;
  --color-gray-100: #F0F2F5;
  --color-gray-200: #E4E6EB;
  --color-gray-300: #CED4DA;
  --color-gray-400: #ADB5BD;
  --color-gray-500: #868E96;
  --color-gray-600: #495057;
  --color-gray-700: #343A40;
  --color-gray-800: #212529;
  --color-gray-900: #0D1117;
  
  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
  --font-heading: 'Poppins', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  
  /* Font Sizes - Fluid Typography */
  --font-size-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --font-size-sm: clamp(0.875rem, 0.8rem + 0.375vw, 1rem);
  --font-size-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --font-size-lg: clamp(1.125rem, 1.05rem + 0.375vw, 1.25rem);
  --font-size-xl: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
  --font-size-2xl: clamp(1.5rem, 1.35rem + 0.75vw, 1.875rem);
  --font-size-3xl: clamp(1.875rem, 1.65rem + 1.125vw, 2.25rem);
  --font-size-4xl: clamp(2.25rem, 1.95rem + 1.5vw, 3rem);
  --font-size-5xl: clamp(3rem, 2.5rem + 2.5vw, 4rem);
  
  /* Line Heights */
  --line-height-tight: 1.2;
  --line-height-snug: 1.375;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.75;
  --line-height-loose: 2;
  
  /* Font Weights */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  
  /* Spacing Scale (0-96px) */
  --space-0: 0;
  --space-1: 0.25rem;    /* 4px */
  --space-2: 0.5rem;     /* 8px */
  --space-3: 0.75rem;    /* 12px */
  --space-4: 1rem;       /* 16px */
  --space-5: 1.25rem;    /* 20px */
  --space-6: 1.5rem;     /* 24px */
  --space-8: 2rem;       /* 32px */
  --space-10: 2.5rem;    /* 40px */
  --space-12: 3rem;      /* 48px */
  --space-16: 4rem;      /* 64px */
  --space-20: 5rem;      /* 80px */
  --space-24: 6rem;      /* 96px */
  
  /* Border Radius */
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  --radius-3xl: 2rem;     /* 32px */
  --radius-full: 9999px;
  
  /* Shadows - Playful and Vibrant */
  --shadow-sm: 0 2px 4px rgba(255, 107, 157, 0.08);
  --shadow-md: 0 4px 8px rgba(255, 107, 157, 0.12), 0 2px 4px rgba(78, 205, 196, 0.08);
  --shadow-lg: 0 8px 16px rgba(255, 107, 157, 0.15), 0 4px 8px rgba(78, 205, 196, 0.1);
  --shadow-xl: 0 16px 32px rgba(255, 107, 157, 0.2), 0 8px 16px rgba(78, 205, 196, 0.12);
  --shadow-2xl: 0 24px 48px rgba(255, 107, 157, 0.25), 0 12px 24px rgba(78, 205, 196, 0.15);
  --shadow-inner: inset 0 2px 4px rgba(45, 49, 66, 0.06);
  
  /* Transition Durations */
  --transition-fast: 150ms;
  --transition-base: 250ms;
  --transition-slow: 350ms;
  --transition-slower: 500ms;
  
  /* Easing Functions */
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  
  /* Z-Index Scale */
  --z-index-dropdown: 1000;
  --z-index-sticky: 1020;
  --z-index-fixed: 1030;
  --z-index-modal-backdrop: 1040;
  --z-index-modal: 1050;
  --z-index-popover: 1060;
  --z-index-tooltip: 1070;
  
  /* Max Widths */
  --max-width-xs: 20rem;    /* 320px */
  --max-width-sm: 24rem;    /* 384px */
  --max-width-md: 28rem;    /* 448px */
  --max-width-lg: 32rem;    /* 512px */
  --max-width-xl: 36rem;    /* 576px */
  --max-width-2xl: 42rem;   /* 672px */
  --max-width-3xl: 48rem;   /* 768px */
  --max-width-4xl: 56rem;   /* 896px */
  --max-width-5xl: 64rem;   /* 1024px */
  --max-width-6xl: 72rem;   /* 1152px */
  --max-width-7xl: 80rem;   /* 1280px */
  --max-width-full: 100%;
}

/* ============================================
   RESET & NORMALIZE
   ============================================ */

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

/* HTML & Body */
html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

html:focus-within {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }
  
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Remove default margins and paddings */
body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd,
ul, ol {
  margin: 0;
}

ul[role='list'],
ol[role='list'] {
  list-style: none;
  padding: 0;
}

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

img {
  font-style: italic;
  background-repeat: no-repeat;
  background-size: cover;
  shape-margin: 0.75rem;
}

/* Form Elements */
input,
button,
textarea,
select {
  font: inherit;
}

/* Remove button defaults */
button {
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
}

/* Text Wrapping */
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Root Stacking Context */
#root,
#__next {
  isolation: isolate;
}

/* ============================================
   BASE STYLES
   ============================================ */

body {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-background);
  min-height: 100vh;
  position: relative;
}

/* Typography - Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

h1 {
  font-size: var(--font-size-5xl);
  font-weight: var(--font-weight-extrabold);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

h2 {
  font-size: var(--font-size-4xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: -0.01em;
}

h3 {
  font-size: var(--font-size-3xl);
  font-weight: var(--font-weight-bold);
}

h4 {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-semibold);
}

h5 {
  font-size: var(--font-size-xl);
  font-weight: var(--font-weight-semibold);
}

h6 {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
}

/* Paragraphs */
p {
  margin-bottom: var(--space-4);
  max-width: 65ch;
}

p:last-child {
  margin-bottom: 0;
}

.lead {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-relaxed);
  color: var(--color-text-light);
  font-weight: var(--font-weight-normal);
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast) var(--ease-out);
  position: relative;
}

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

a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Lists */
ul, ol {
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
}

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

/* Blockquotes */
blockquote {
  margin: var(--space-6) 0;
  padding: var(--space-4) var(--space-6);
  border-left: 4px solid var(--color-primary);
  background: linear-gradient(to right, rgba(255, 107, 157, 0.05), transparent);
  font-style: italic;
  color: var(--color-text-light);
}

/* Code */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.125rem 0.25rem;
  background-color: var(--color-gray-100);
  border-radius: var(--radius-sm);
  color: var(--color-primary-dark);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  padding: var(--space-4);
  background-color: var(--color-gray-900);
  color: var(--color-gray-50);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  margin-bottom: var(--space-4);
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
}

/* Horizontal Rules */
hr {
  border: none;
  height: 2px;
  background: linear-gradient(to right, var(--color-primary-light), var(--color-secondary-light), var(--color-accent-light));
  margin: var(--space-8) 0;
  border-radius: var(--radius-full);
}

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

/* Container */
.container {
  width: 100%;
  max-width: var(--max-width-7xl);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

@media (min-width: 640px) {
  .container {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

@media (min-width: 1024px) {
  .container {
    padding-left: var(--space-8);
    padding-right: var(--space-8);
  }
}

.container-sm { max-width: var(--max-width-4xl); }
.container-md { max-width: var(--max-width-5xl); }
.container-lg { max-width: var(--max-width-6xl); }

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

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

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

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

.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }
.items-baseline { align-items: baseline; }

.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-evenly { justify-content: space-evenly; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.flex-1 { flex: 1 1 0%; }
.flex-auto { flex: 1 1 auto; }
.flex-none { flex: none; }

/* 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)); }
.grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }

@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)); }
}

@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)); }
}

@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)); }
}

/* Text Alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

/* Display */
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.hidden { display: none; }

/* Visibility */
.invisible { visibility: hidden; }
.visible { visibility: visible; }

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

/* Skip to Content Link */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: var(--z-index-tooltip);
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-md);
  font-weight: var(--font-weight-semibold);
  transition: top var(--transition-fast) var(--ease-out);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ============================================
   COMPONENT STYLES
   ============================================ */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-heading);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  border: 2px solid transparent;
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-base) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width var(--transition-slow) var(--ease-out), height var(--transition-slow) var(--ease-out);
}

.btn:hover::before {
  width: 300px;
  height: 300px;
}

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

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button Variants */
.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: linear-gradient(135deg, var(--color-secondary), var(--color-secondary-dark));
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-md);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-accent {
  background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
  color: var(--color-text);
  box-shadow: var(--shadow-md);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-outline:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text);
}

.btn-ghost:hover {
  background: var(--color-gray-100);
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-sm);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--font-size-lg);
}

.btn-xl {
  padding: var(--space-5) var(--space-10);
  font-size: var(--font-size-xl);
}

/* Form Elements */
.input,
.textarea,
.select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-background-alt);
  border: 2px solid var(--color-gray-300);
  border-radius: var(--radius-lg);
  transition: all var(--transition-base) var(--ease-out);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--color-gray-400);
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--color-primary-light);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(255, 107, 157, 0.15);
}

.input:disabled,
.textarea:disabled,
.select:disabled {
  background-color: var(--color-gray-100);
  cursor: not-allowed;
  opacity: 0.6;
}

.textarea {
  min-height: 120px;
  resize: vertical;
}

/* Form Labels */
.label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
}

/* Form Groups */
.form-group {
  margin-bottom: var(--space-5);
}

/* Card Component */
.card {
  background: var(--color-background-alt);
  border-radius: var(--radius-2xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base) var(--ease-out);
  border: 1px solid rgba(255, 107, 157, 0.1);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.card-header {
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 2px solid var(--color-gray-100);
}

.card-body {
  margin-bottom: var(--space-4);
}

.card-footer {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 2px solid var(--color-gray-100);
}

/* Badge Component */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  border-radius: var(--radius-full);
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
}

.badge-secondary {
  background: var(--color-secondary-light);
  color: var(--color-secondary-dark);
}

.badge-accent {
  background: var(--color-accent-light);
  color: var(--color-text);
}

/* Alert Component */
.alert {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  border-left: 4px solid;
  margin-bottom: var(--space-4);
}

.alert-success {
  background-color: rgba(76, 175, 80, 0.1);
  border-left-color: var(--color-success);
  color: var(--color-success);
}

.alert-warning {
  background-color: rgba(255, 152, 0, 0.1);
  border-left-color: var(--color-warning);
  color: var(--color-warning);
}

.alert-danger {
  background-color: rgba(244, 67, 54, 0.1);
  border-left-color: var(--color-danger);
  color: var(--color-danger);
}

/* Divider */
.divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--color-gray-300), transparent);
  margin: var(--space-6) 0;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus Visible Styles */
:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  :root {
    --color-text: #000000;
    --color-background: #FFFFFF;
  }
  
  .btn {
    border-width: 3px;
  }
}

/* Dark Mode Support (optional) */
@media (prefers-color-scheme: dark) {
  :root {
    --color-background: #1A1B26;
    --color-background-alt: #24283B;
    --color-text: #C0CAF5;
    --color-text-light: #9AA5CE;
  }
}

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

@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}
