/* ==========================================================
   HajFun — shared stylesheet
   Colors live in :root so you can retheme the whole site here.
   ========================================================== */

:root {
  --bg: #fff8ef;
  --surface: #ffffff;
  --ink: #1f1a2e;
  --muted: #6b6480;
  --line: #eadfce;
  --accent: #ff5a3c;      /* tomato */
  --accent-2: #2bb3a3;    /* teal */
  --accent-3: #ffc531;    /* sun */
  --shadow: 4px 4px 0 var(--ink);
  --radius: 14px;
  --ad-w: 160px;          /* side ad width (160x600 skyscraper) */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17141f;
    --surface: #221e2e;
    --ink: #f4efe6;
    --muted: #a59fb8;
    --line: #353047;
    --shadow: 4px 4px 0 #000;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); }
img { max-width: 100%; display: block; }

/* ---------- Header / nav ---------- */
.site-header {
  border-bottom: 2px solid var(--ink);
  background: var(--surface);
}
.site-header .inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 700;
  font-size: 1.8rem;
  letter-spacing: -0.5px;
  color: var(--ink);
  text-decoration: none;
  line-height: 1;
}
.logo .fun { color: var(--accent); }
.logo .dot { color: var(--accent-2); }

.nav { display: flex; gap: 18px; flex-wrap: wrap; }
.nav a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--accent); }

/* ---------- Page layout with side ads ---------- */
.layout {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 16px 40px;
  display: grid;
  grid-template-columns: var(--ad-w) minmax(0, 1fr) var(--ad-w);
  gap: 24px;
  align-items: start;
}

.ad-side {
  position: sticky;
  top: 16px;
  width: var(--ad-w);
  min-height: 600px;
}

/* Placeholder look — disappears once real ad code fills the slot */
.ad-slot:empty::before,
.ad-slot .ad-placeholder {
  content: "Ad";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: inherit;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.85rem;
}

/* Bottom ad shown only on smaller screens instead of side ads */
.ad-bottom {
  display: none;
  max-width: 728px;
  min-height: 100px;
  margin: 24px auto 0;
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .ad-side { display: none; }
  .ad-bottom { display: block; }
}

main { min-width: 0; }

/* ---------- Home page ---------- */
.hero {
  text-align: center;
  padding: 24px 0 32px;
}
.hero h1 {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.1;
  margin: 0 0 10px;
}
.hero h1 .squiggle {
  background: linear-gradient(transparent 62%, var(--accent-3) 62%);
  padding: 0 4px;
}
.hero p {
  color: var(--muted);
  font-size: 1.1rem;
  margin: 0 auto;
  max-width: 34rem;
}

.section-title {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 1.4rem;
  margin: 0 0 16px;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 22px;
}

.game-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.game-card:hover, .game-card:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}
.game-card .thumb {
  aspect-ratio: 16 / 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.4rem;
  border-bottom: 2px solid var(--ink);
}
.game-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.game-card .body { padding: 14px 16px 16px; }
.game-card h3 {
  font-family: "Fredoka", "Nunito", sans-serif;
  margin: 0 0 4px;
  font-size: 1.25rem;
}
.game-card p { margin: 0; color: var(--muted); font-size: 0.95rem; }
.game-card .tag {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-3);
  color: #1f1a2e;
}

.game-card.soon {
  border-style: dashed;
  box-shadow: none;
  cursor: default;
  opacity: 0.75;
}
.game-card.soon:hover { transform: none; box-shadow: none; }

/* ---------- Game page ---------- */
.game-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.game-header h1 {
  font-family: "Fredoka", "Nunito", sans-serif;
  margin: 0;
  font-size: 2rem;
}
.back-link { font-weight: 700; text-decoration: none; }

.game-frame {
  background: var(--surface);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  aspect-ratio: 16 / 10;    /* change per game if needed */
  width: 100%;
}
.game-frame canvas, .game-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.game-info {
  margin-top: 24px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 22px;
}
.game-info h2 {
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 1.2rem;
  margin: 0 0 8px;
}

/* ---------- Text pages (about / privacy) ---------- */
.prose { max-width: 46rem; margin: 0 auto; }
.prose h1 { font-family: "Fredoka", "Nunito", sans-serif; font-size: 2.2rem; margin-top: 0; }
.prose h2 { font-family: "Fredoka", "Nunito", sans-serif; margin-top: 2rem; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 2px solid var(--ink);
  background: var(--surface);
  font-size: 0.9rem;
  color: var(--muted);
}
.site-footer .inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 16px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}
.site-footer a { color: var(--muted); margin-left: 14px; }
.site-footer a:first-child { margin-left: 0; }
