/* ========================================
   VARIABLES
======================================== */
:root {
  /* Colors */
  --color-background: #1b1f29;
  --color-surface: #272f3e;
  --color-text: #f1f1f4;
  --color-primary: #ffb300;
  --color-success: #56e39f;
  --color-warning: #f7b32b;
  --color-danger: #ee4266;
  --color-gray-100: #e3e4e8;
  --color-gray-200: #cfd2dc;
  --color-gray-300: #abafbc;
  --color-gray-400: #868ca0;
  --color-gray-500: #585e72;
  --color-gray-600: #383e4e;

  /* Typography */
  --font-family-sans: 'Poppins', 'Segoe UI', Arial, sans-serif;
  --font-family-head: 'Montserrat', 'Poppins', 'Segoe UI', Arial, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.25rem;
  --font-size-xl: 1.5rem;
  --font-size-2xl: 2rem;
  --font-size-3xl: 2.5rem;
  --line-height-base: 1.5;
  --line-height-tight: 1.2;
  --line-length: 60ch;

  /* Spacing (0-96px, 4px step) */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-24: 96px;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 10px;
  --radius-lg: 20px;

  /* Shadow */
  --shadow-xs: 0 2px 4px rgba(0,0,0,0.08);
  --shadow-md: 0 6px 20px -4px rgba(38,30,47,0.19);
  --shadow-lg: 0 16px 40px -8px rgba(38,30,47,0.32);

  /* Transition */
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --duration-slow: 350ms;
}

/* ========================================
   RESET / NORMALIZE
======================================== */
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd {
  margin: 0;
}
ul[role], ol[role], ul, ol {
  padding-left: 0;
  margin: 0;
  list-style: none;
}
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}
input, button, textarea, select {
  font: inherit;
}

/* Prevent font size inflation on mobile */
html {
  -webkit-text-size-adjust: 100%;
}
a {
  text-decoration-skip-ink: auto;
}

/* ========================================
   BASE STYLES
======================================== */
body {
  background: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
main {
  display: block;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-head);
  font-weight: 700;
  line-height: var(--line-height-tight);
  color: var(--color-primary);
  margin-top: var(--space-8);
  margin-bottom: var(--space-2);
}
h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

/* Paragraphs */
p {
  max-width: var(--line-length);
  margin-bottom: var(--space-4);
  color: var(--color-text);
  font-size: 1rem;
}

/* Links */
a {
  color: var(--color-primary);
  text-underline-offset: 2px;
  text-decoration: none;
  transition: color var(--duration-normal);
}
a:hover,
a:focus-visible {
  color: var(--color-success);
  text-decoration: underline;
  outline: none;
}
a:active {
  color: var(--color-danger);
}

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

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* ========================================
   UTILITIES
======================================== */
.container {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.flex {
  display: flex;
}
.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}
.flex-col {
  display: flex;
  flex-direction: column;
}
.grid {
  display: grid;
  gap: var(--space-6);
}
.grid-3col {
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 900px) {
  .grid-3col { grid-template-columns: 1fr; }
}

.sr-only {
  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;
  border: 0 !important;
}

/* ========================================
   HEADER & FOOTER STYLES
======================================== */
.site-header {
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-row {
  justify-content: space-between;
  align-items: center;
}
.site-logo {
  font-family: var(--font-family-head);
  font-size: var(--font-size-2xl);
  font-weight: bold;
  color: var(--color-primary);
  letter-spacing: 2px;
}
.main-nav {
  position: relative;
}
.nav-toggle {
  background: none;
  border: none;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: 3px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  margin-right: 0;
}
.nav-toggle:focus-visible {
  outline: 2px solid var(--color-primary);
}
.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 4px;
  background: var(--color-primary);
  border-radius: 2px;
  transition: background 140ms, transform 180ms;
}
.nav-menu {
  display: flex;
  gap: var(--space-6);
  align-items: center;
}
.nav-link {
  font-size: var(--font-size-lg);
  color: var(--color-gray-100);
  font-family: var(--font-family-head);
  font-weight: 600;
  letter-spacing: 1px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: background 140ms;
}
.nav-link:hover, .nav-link:focus-visible {
  color: var(--color-background);
  background: var(--color-primary);
}
.nav-link.active {
  color: var(--color-background);
  background: var(--color-primary);
}
@media (max-width: 900px) {
  .nav-menu {
    position: absolute;
    top: 110%;
    right: 0;
    flex-direction: column;
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-md);
    gap: 0;
    min-width: 180px;
    padding: var(--space-2) 0;
    display: none;
    z-index: 30;
  }
  .nav-menu.open {
    display: flex;
  }
  .nav-link {
    width: 100%;
    padding: var(--space-3) var(--space-6);
    border-radius: 0;
    text-align: right;
  }
  .nav-toggle {
    display: flex;
  }
}

.site-footer {
  background: var(--color-surface);
  color: var(--color-gray-100);
  padding: var(--space-8) 0 0 0;
  font-size: var(--font-size-base);
  border-top: 4px solid var(--color-primary);
}
.footer-disclaimer {
  background: #191e27;
  color: var(--color-warning);
  padding: var(--space-6) var(--space-8);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-8);
  font-size: var(--font-size-sm);
  line-height: 1.77;
}
.footer-main {
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}
.footer-brand, .footer-logo {
  font-family: var(--font-family-head);
  font-size: var(--font-size-xl);
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}
.footer-nav ul, .footer-legal ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: var(--space-6);
}
.footer-nav a, .footer-legal a {
  color: var(--color-gray-100);
  font-size: var(--font-size-base);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
  transition: background 140ms, color 140ms;
}
.footer-nav a:hover, .footer-nav a:focus-visible, .footer-legal a:hover, .footer-legal a:focus-visible {
  color: var(--color-background);
  background: var(--color-primary);
  outline: none;
}
.footer-copyright {
  color: var(--color-gray-400);
  font-size: var(--font-size-sm);
  padding: var(--space-8) 0 var(--space-2) 0;
  text-align: center;
}
@media (max-width: 900px) {
  .footer-main {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-4);
  }
  .footer-nav ul, .footer-legal ul {
    flex-direction: column;
    gap: var(--space-2);
  }
}

/* ========================================
   COMPONENTS
======================================== */
/* --- Buttons --- */
.button,
.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-family-head);
  font-weight: 700;
  font-size: var(--font-size-lg);
  line-height: 1;
  color: var(--color-background);
  background: linear-gradient(90deg, #ffe259 0%, #ffa751 100%);
  box-shadow: var(--shadow-md);
  border: none;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-8);
  margin: var(--space-2) 0;
  cursor: pointer;
  transition: background var(--duration-normal), box-shadow var(--duration-normal), transform var(--duration-fast);
  text-decoration: none;
}
.button:hover,
.cta-button:hover,
.button:focus-visible,
.cta-button:focus-visible {
  background: linear-gradient(90deg, #ffe383 0%, #faae35 100%);
  box-shadow: var(--shadow-lg);
  outline: none;
  transform: translateY(-2px) scale(1.025);
}
.button:active,
.cta-button:active {
  background: linear-gradient(90deg, #ffd700 0%, #ff9200 100%);
}
.button:disabled,
.cta-button:disabled {
  opacity: 0.6;
  pointer-events: none;
  background: var(--color-gray-400);
  color: var(--color-text);
}

/* --- Inputs --- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  background: var(--color-surface);
  color: var(--color-text);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--color-gray-500);
  transition: border var(--duration-normal), box-shadow var(--duration-normal);
  box-shadow: var(--shadow-xs);
  font-size: var(--font-size-base);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--color-primary);
  outline: none;
  box-shadow: 0 0 0 2px var(--color-primary);
}
input:disabled, select:disabled, textarea:disabled {
  background: var(--color-gray-500);
  color: var(--color-gray-200);
  opacity: 0.7;
}

/* --- Card --- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-6);
  color: var(--color-text);
  transition: box-shadow var(--duration-normal), transform var(--duration-fast);
  position: relative;
}
.card:hover,
.card:focus-within {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px) scale(1.01);
}

/* --- Modal (for Games) --- */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(25,20,35,0.74);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity var(--duration-slow);
}
.modal {
  max-width: 90vw;
  max-height: 90vh;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8);
  color: var(--color-text);
  position: relative;
  overflow: auto;
  animation: modal-in var(--duration-slow) cubic-bezier(.39,.58,.57,1) 1;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(40px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  background: transparent;
  border: none;
  color: var(--color-danger);
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
}

/* --- Games Section --- */
.games-section {
  margin: var(--space-16) 0;
}
.games-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-8);
}
@media (max-width: 900px) {
  .games-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}
.game-item {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-8) var(--space-4);
  transition: box-shadow var(--duration-normal), transform var(--duration-fast);
  position: relative;
}
.game-item:hover,
.game-item:focus-within {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px) scale(1.02);
}
.game-image {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
  margin-bottom: var(--space-4);
}
.game-title {
  font-size: var(--font-size-lg);
  font-family: var(--font-family-head);
  color: var(--color-primary);
  margin-bottom: var(--space-4);
  text-align: center;
}
.game-item .button {
  margin-top: auto;
  width: 100%;
}

/* --- CTA Button --- */
.cta-button {
  font-size: var(--font-size-xl);
  background: linear-gradient(90deg, #ffe259 0%, #ffb300 100%);
  color: var(--color-background);
  padding: var(--space-4) var(--space-10);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  letter-spacing: 1px;
  margin: var(--space-8) 0;
}

@media (max-width: 500px) {
  .games-section { margin: var(--space-8) 0; }
  .card, .modal { padding: var(--space-4); }
  .cta-button { font-size: var(--font-size-lg); padding: var(--space-3) var(--space-6); }
}
