/* ============================================
   PLAYPIP — "Bush Paper" Theme
   Australian outdoors meets papercraft
   ============================================ */

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

/* Base sizing */
html {
  font-size: 62.5%;
}

/* ============================================
   Theme Variables
   ============================================ */
:root {
  /* Australian bush palette */
  --bush-deep: #1a2e1f;
  --bush-mid: #243728;
  --bush-light: #2d4232;
  
  /* Paper & earth tones */
  --paper: #f5efe6;
  --paper-shadow: #e8dfd2;
  --ochre: #d4a853;
  --terracotta: #c4705b;
  --sage: #7d9a78;
  --bark: #5c4a3d;
  
  /* Text */
  --text-light: #ebe5d9;
  --text-muted: #a8b5a3;
  --text-dark: #2d3a2e;
  
  /* Shadows & effects */
  --card-shadow: 
    0 2px 4px rgba(0,0,0,0.08),
    0 8px 16px rgba(0,0,0,0.12),
    0 24px 48px rgba(0,0,0,0.16);
  --card-shadow-hover:
    0 4px 8px rgba(0,0,0,0.1),
    0 16px 32px rgba(0,0,0,0.18),
    0 32px 64px rgba(0,0,0,0.22);
  
  /* Spacing */
  --space-xs: 0.8rem;
  --space-sm: 1.6rem;
  --space-md: 2.4rem;
  --space-lg: 4rem;
  --space-xl: 6.4rem;
}

/* ============================================
   Typography (Google Fonts loaded in HTML)
   ============================================ */
body {
  font-family: 'Nunito', system-ui, sans-serif;
  font-weight: 400;
  font-size: 1.6rem;
  line-height: 1.6;
  color: var(--text-light);
  -webkit-font-smoothing: antialiased;
}

/* ============================================
   Page Background — layered bush atmosphere
   ============================================ */
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: 
    /* Gradient layers for depth */
    radial-gradient(ellipse 120% 80% at 20% 10%, rgba(125,154,120,0.2) 0%, transparent 50%),
    radial-gradient(ellipse 130% 80% at 80% 90%, rgba(212,168,83,0.25) 0%, transparent 55%),
    radial-gradient(ellipse 100% 120% at 100% 50%, rgba(196,112,91,0.15) 0%, transparent 45%),
    radial-gradient(ellipse 90% 70% at 50% 50%, rgba(212,168,83,0.12) 0%, transparent 40%),
    linear-gradient(175deg, var(--bush-deep) 0%, var(--bush-mid) 50%, var(--bush-deep) 100%);
  background-attachment: fixed;
}

/* ============================================
   Main Container
   ============================================ */
main {
  position: relative;
  max-width: 110rem;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-sm);
}

/* ============================================
   Hero / Header
   ============================================ */
.hero {
  text-align: center;
  padding: var(--space-xl) var(--space-sm) var(--space-lg);
  position: relative;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 400;
  font-size: clamp(4.8rem, 12vw, 9rem);
  color: var(--paper);
  letter-spacing: -0.02em;
  line-height: 1;
  display: inline-block;
  position: relative;
  cursor: default;
  
  /* Subtle text shadow for depth */
  text-shadow: 
    0 2px 0 rgba(0,0,0,0.1),
    0 4px 8px rgba(0,0,0,0.15);
}

h1:focus-visible {
  outline: 0.3rem solid var(--ochre);
  outline-offset: 0.6rem;
  border-radius: 0.4rem;
}

.hero-sub {
  margin-top: var(--space-md);
  font-size: 1.8rem;
  color: var(--text-muted);
  font-weight: 300;
  max-width: 36ch;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

/* Easter egg spin */
h1.spinning {
  animation: spin360 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform-style: preserve-3d;
}

@keyframes spin360 {
  0% { transform: rotateY(0deg); }
  100% { transform: rotateY(360deg); }
}

/* ============================================
   Decorative Shapes — organic blobs
   ============================================ */
.hero-decor {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.blob {
  position: absolute;
  opacity: 0.06;
  filter: blur(60px);
  border-radius: 50%;
}

.blob--1 { 
  width: 50vw; height: 50vw; 
  top: -10%; left: -15%; 
  background: var(--sage);
}
.blob--2 { 
  width: 40vw; height: 40vw; 
  top: 30%; right: -10%; 
  background: var(--ochre);
}
.blob--3 { 
  width: 35vw; height: 35vw; 
  bottom: 10%; left: 20%; 
  background: var(--terracotta);
}
.blob--4 { 
  width: 45vw; height: 45vw; 
  bottom: -20%; right: 10%; 
  background: var(--sage);
}

/* Hide extra blobs from old design */
.blob--5, .blob--6, .blob--7, .blob--8, .blob--9, .blob--10 {
  display: none;
}

/* ============================================
   Content Section
   ============================================ */
#content {
  position: relative;
  z-index: 1;
}

#content > p {
  text-align: center;
  font-size: 1.7rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

#content > p:nth-of-type(2) {
  margin-bottom: var(--space-xl);
}

/* ============================================
   Games "Scattered" Layout
   ============================================ */
.games-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-lg);
  padding: var(--space-md) 0;
  max-width: 100rem;
  margin: 0 auto;
}

/* ============================================
   Game Cards — Papercraft Style
   ============================================ */
.game-card {
  position: relative;
  width: clamp(16rem, 28vw, 22rem);
  background: var(--paper);
  border-radius: 1.2rem;
  box-shadow: var(--card-shadow);
  transition: 
    box-shadow 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  
  /* Initial state for animation */
  opacity: 0;
  transform: translateY(30px) rotate(var(--rotation, 0deg));
  animation: cardAppear 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  animation-delay: var(--delay, 0s);
}

/* Scattered rotations — set via nth-child */
.game-card:nth-child(1) { --rotation: -2.5deg; --delay: 0.1s; }
.game-card:nth-child(2) { --rotation: 1.8deg; --delay: 0.15s; }
.game-card:nth-child(3) { --rotation: -1.2deg; --delay: 0.2s; }
.game-card:nth-child(4) { --rotation: 3deg; --delay: 0.25s; }
.game-card:nth-child(5) { --rotation: -2deg; --delay: 0.3s; }
.game-card:nth-child(6) { --rotation: 1.5deg; --delay: 0.35s; }
.game-card:nth-child(7) { --rotation: -3deg; --delay: 0.4s; }
.game-card:nth-child(8) { --rotation: 2.2deg; --delay: 0.45s; }
.game-card:nth-child(9) { --rotation: -1.8deg; --delay: 0.5s; }

/* Card entrance animation */
@keyframes cardAppear {
  0% {
    opacity: 0;
    transform: translateY(40px) rotate(calc(var(--rotation, 0deg) + 5deg));
  }
  100% {
    opacity: 1;
    transform: translateY(0) rotate(var(--rotation, 0deg));
  }
}

/* Paper texture overlay on cards */
.game-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0.4;
  pointer-events: none;
  z-index: 10;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='paper'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23paper)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

/* Colored edge accent (like washi tape) */
.game-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0.5rem;
  border-radius: 1.2rem 1.2rem 0 0;
  background: var(--card-accent, var(--ochre));
  opacity: 0.85;
}

/* Accent color variations */
.game-card:nth-child(1)::after { --card-accent: var(--ochre); }
.game-card:nth-child(2)::after { --card-accent: var(--terracotta); }
.game-card:nth-child(3)::after { --card-accent: var(--sage); }
.game-card:nth-child(4)::after { --card-accent: var(--ochre); }
.game-card:nth-child(5)::after { --card-accent: var(--terracotta); }
.game-card:nth-child(6)::after { --card-accent: var(--sage); }
.game-card:nth-child(7)::after { --card-accent: var(--ochre); }
.game-card:nth-child(8)::after { --card-accent: var(--terracotta); }
.game-card:nth-child(9)::after { --card-accent: var(--sage); }

/* Hover state — NO SCALE, just shadow + slight rotation adjust */
.game-card:hover,
.game-card:focus-within {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-4px) rotate(calc(var(--rotation, 0deg) * 0.3));
}

.game-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
  border-radius: inherit;
  overflow: hidden;
}

.game-link:focus {
  outline: 0.3rem solid var(--ochre);
  outline-offset: 0.3rem;
  border-radius: 1.2rem;
}

/* Screenshot */
.screenshot {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  background: var(--paper-shadow);
}

.screenshot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: filter 0.3s ease;
  /* Fix white antialiasing edges - scale slightly and add inset shadow */
  transform: scale(1.01);
  box-shadow: inset 0 0 0 2px var(--paper-shadow);
}

.game-card:hover .screenshot img {
  filter: brightness(1.05) saturate(1.1);
}

/* Meta info */
.meta {
  padding: 1.4rem 1.6rem 1.6rem;
  text-align: left;
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-shadow) 100%);
}

.meta h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  font-size: 2rem;
  color: var(--text-dark);
  margin-bottom: 0.3rem;
  line-height: 1.2;
}

.meta .desc {
  font-size: 1.3rem;
  color: var(--bark);
  font-style: italic;
  opacity: 0.8;
}

/* ============================================
   Footer
   ============================================ */
footer {
  margin-top: var(--space-xl);
  padding: var(--space-lg) var(--space-sm);
  text-align: center;
  border-top: 1px solid rgba(255,255,255,0.08);
}

footer p {
  font-size: 1.4rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

footer a {
  color: var(--ochre);
  text-decoration: none;
  transition: color 0.2s ease;
}

footer a:hover {
  color: var(--paper);
}

/* ============================================
   Links
   ============================================ */
a {
  color: var(--ochre);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--paper);
}

/* ============================================
   Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .game-card {
    animation: none;
    opacity: 1;
    transform: rotate(var(--rotation, 0deg));
  }
  
  .game-card:hover,
  .game-card:focus-within {
    transform: rotate(var(--rotation, 0deg));
  }
  
  h1.spinning {
    animation: none;
  }
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 768px) {
  :root {
    --space-lg: 3.2rem;
    --space-xl: 4.8rem;
  }
  
  .hero {
    padding: var(--space-lg) var(--space-sm) var(--space-md);
  }
  
  .hero-sub {
    font-size: 1.6rem;
  }
  
  .games-grid {
    gap: var(--space-md);
    padding: var(--space-sm) 0;
  }
  
  .game-card,
  .game-card:nth-child(1),
  .game-card:nth-child(5) {
    width: clamp(14rem, 42vw, 18rem);
  }
  
  .meta {
    padding: 1.2rem 1.4rem 1.4rem;
  }
  
  .meta h3 {
    font-size: 1.7rem;
  }
  
  .meta .desc {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 58%;
  }
  
  .games-grid {
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
  }
  
  .game-card,
  .game-card:nth-child(1),
  .game-card:nth-child(5) {
    width: min(85vw, 30rem);
  }
  
  /* Reduce rotation intensity on mobile */
  .game-card:nth-child(1) { --rotation: -1.5deg; }
  .game-card:nth-child(2) { --rotation: 1deg; }
  .game-card:nth-child(3) { --rotation: -0.8deg; }
  .game-card:nth-child(4) { --rotation: 1.5deg; }
  .game-card:nth-child(5) { --rotation: -1deg; }
  .game-card:nth-child(6) { --rotation: 0.8deg; }
  .game-card:nth-child(7) { --rotation: -1.5deg; }
  .game-card:nth-child(8) { --rotation: 1.2deg; }
  .game-card:nth-child(9) { --rotation: -1deg; }
  
  .blob {
    opacity: 0.04;
  }
}
