/* Espace Publishing — modern responsive layout */
:root {
  --color-bg: rgb(0, 128, 0);
  --color-surface: #ffffff;
  --color-game-tile: rgb(0, 128, 255);
  --color-game-tile-border: rgb(0, 64, 128);
  --color-primary: #7a3310;
  --color-primary-dark: #5c2608;
  --color-accent: #fff8e7;
  --color-text: #1a1a1a;
  --color-text-muted: #4a3520;
  --color-text-on-tile: #1a1a1a;
  --color-border: rgba(162, 99, 0, 0.35);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 20px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
  --radius: 12px;
  --radius-lg: 16px;
  --header-h: 72px;
  --facebook-inset: 1rem;
  --facebook-top: calc(var(--header-h) + var(--facebook-inset));
  --max-width: 1200px;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--color-primary-dark);
}

/* —— Site header —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-link img {
  height: 48px;
  width: auto;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--color-text);
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.site-nav {
  display: flex;
  gap: 0.25rem;
}

.site-nav a {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--color-text-muted);
}

.site-nav a:hover {
  color: var(--color-game-tile-border);
  background: rgba(255, 156, 1, 0.15);
}

.site-nav a.is-active {
  color: var(--color-game-tile-border);
  background: rgba(255, 156, 1, 0.28);
}

/* —— Main layout —— */
.site-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

/* —— Hero carousel (slides are 1024×500) —— */
.hero {
  margin-bottom: 2rem;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--color-surface);
  position: relative;
}

.hero-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1024 / 500;
  overflow: hidden;
}

.hero-track {
  display: flex;
  height: 100%;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
}

.hero-slide a {
  display: block;
  width: 100%;
  height: 100%;
  line-height: 0;
}

.hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.hero-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem 1.25rem 1.25rem;
  background: linear-gradient(transparent, rgba(15, 23, 42, 0.85));
  color: #fff;
  font-weight: 600;
  font-size: clamp(0.875rem, 2.5vw, 1.125rem);
  pointer-events: none;
}

.hero-controls {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0.5rem;
  pointer-events: none;
}

.hero-btn {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--color-text);
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: background 0.15s ease, transform 0.15s ease;
}

.hero-btn:hover {
  background: #fff;
  transform: scale(1.05);
}

.hero-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.95);
}

.hero-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: var(--color-border);
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.hero-dot.is-active {
  background: var(--color-game-tile-border);
  transform: scale(1.25);
}

/* —— Game cards —— */
.games-section h1.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.gameItem {
  display: grid;
  grid-template-columns: 1fr minmax(200px, 340px);
  gap: 1.5rem;
  align-items: start;
  background: var(--color-game-tile);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 3px solid var(--color-game-tile-border);
}

.supportPageItem {
  display: grid;
  gap: 1.5rem;
  align-items: start;
  background: var(--color-game-tile);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 3px solid var(--color-game-tile-border);
}

.aboutPageItem {
  display: grid;
  gap: 1.5rem;
  align-items: start;
  background: var(--color-game-tile);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-md);
  border: 3px solid var(--color-game-tile-border);
}

.gameItem + .spacer {
  display: none;
}

.gameIconAndText {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

@media (min-width: 768px) {
  .gameIconAndText {
    flex-direction: row;
    align-items: flex-start;
  }
}

.gameIcon {
  flex-shrink: 0;
  text-align: center;
}

.gameIcon .iconpic {
  width: 120px;
  height: 120px;
  border-radius: 22%;
  box-shadow: var(--shadow-sm);
}

.gameIcon img:not(.iconpic) {
  max-width: 80px;
  margin-top: 0.5rem;
}

.ageRange {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gameText {
  flex: 1;
  min-width: 0;
}

.gameText h2 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.125rem, 2.5vw, 1.375rem);
  line-height: 1.3;
}

.gameText h2 a,
.gameText h2 a.dontEmboss {
  color: var(--color-text-on-tile);
  text-decoration: none;
}

.gameText h2 a:hover {
  color: var(--color-primary-dark);
}

.gameText h3 {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #993300;
}

.gameText > h3:last-of-type {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  color: var(--color-primary-dark);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gameText p,
.gameText {
  color: var(--color-text-on-tile);
  font-size: 0.9375rem;
}

.gameText a.dontEmboss {
  color: var(--color-primary-dark);
}

.gameText .spacer {
  display: none;
}

/* Store badges */
.gameText > a img,
.gameText a img[src*="Store"],
.gameText a img[src*="store"],
.gameText img[src*="blankHalfStore"] {
  display: inline-block;
  vertical-align: middle;
  margin: 0.25rem 0.35rem 0.25rem 0;
  height: 40px;
  width: auto;
  max-height: 40px;
  border-radius: 6px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.gameText > a:hover img,
.gameText a:hover img {
  transform: translateY(-2px);
  opacity: 0.9;
}

.gameText img[src*="blankHalfStore"] {
  opacity: 0.3;
  pointer-events: none;
}

.gameScreenshot {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gameScreenshot img {
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 320px;
  width: auto;
}

/* —— Static pages —— */
.page-content {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  max-width: 720px;
}

.page-content h2 {
  margin: 0 0 1rem;
  font-size: 1rgb(255, 255, 0)r-text);
}

.page-content p,
.page-content {
  color: var(--color-text-muted);
}

.contact-grid {
  display: grid;
  gap: 2rem;
  margin-top: 1.5rem;
}

@media (min-width: 600px) {
  .contact-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

.contact-type {
  text-align: center;
  padding: 0.25rem;
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
}

.contact-type img {
  margin-bottom: 0.75rem;
}

.about-page .page-prose {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border);
  color: var(--color-text-muted);
  font-size: 0.9375rem;
  line-height: 1.7;
}

.about-page .page-prose h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  color: var(--color-text);
}

.about-page .page-prose a {
  font-weight: 600;
}

/* —— Facebook promo —— */
.facebook-promo,
.facebook-expand {
  position: fixed;
  top: var(--facebook-top);
  right: var(--facebook-inset);
  bottom: auto;
}

.facebook-promo {
  z-index: 90;
  max-width: 280px;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
  padding: 0.75rem;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.facebook-promo.is-collapsed {
  transform: translateX(calc(100% + 1rem));
  opacity: 0;
  pointer-events: none;
}

.facebook-promo-header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.25rem;
}

.facebook-close {
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  opacity: 0.6;
  line-height: 0;
}

.facebook-close:hover {
  opacity: 1;
}

.facebook-close img {
  width: 20px;
  height: 20px;
}

.facebook-promo iframe {
  border: none;
  width: 100%;
  max-width: 260px;
  height: 72px;
}

.facebook-promo p {
  margin: 0.5rem 0 0;
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-align: center;
}

.facebook-expand {
  z-index: 89;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  display: none;
  filter: drop-shadow(0 1px 3px rgba(15, 23, 42, 0.12));
  line-height: 0;
  opacity: 0.85;
  transition: opacity 0.15s ease;
}

.facebook-expand:hover {
  opacity: 1;
}

.facebook-expand.is-visible {
  display: block;
}

.facebook-expand img {
  width: 20px;
  height: auto;
  display: block;
}

/* —— Footer —— */
.site-footer {
  text-align: center;
  padding: 2rem 1.25rem;
  color: var(--color-text-muted);
  font-size: 0.875rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}

/* —— Responsive —— */
@media (max-width: 900px) {
  .gameItem {
    grid-template-columns: 1fr;
  }

  .gameScreenshot {
    order: -1;
  }

  .gameScreenshot img {
    max-height: 240px;
  }
}

@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.5rem;
    box-shadow: var(--shadow-md);
    display: none;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-header {
    position: relative;
  }

  .header-inner {
    flex-wrap: wrap;
    position: relative;
  }

  :root {
    --facebook-top: calc(3.75rem + var(--facebook-inset));
  }

  .facebook-promo {
    left: var(--facebook-inset);
    right: var(--facebook-inset);
    max-width: none;
  }

  .facebook-expand {
    left: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-track {
    transition: none;
  }
}
