:root {
  --bg: #fff8ee;
  --surface: #ffffff;
  --text: #4a3426;
  --muted: #7a5f4d;
  --accent-soft: #fde3ea;
  --gold: #f5b83d;
  --on-gold: #4a2a0c;
  --badge: #c2264a;
  --shadow: 0 10px 30px rgba(74, 52, 38, 0.12);
  --radius: 20px;
  --steam-panel: #363e4b; /* matches the inside of Steam's widget */
  --max: 1100px;
  --font-head: "Fredoka", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #2b1d15;
    --surface: #3a281d;
    --text: #fbeee0;
    --muted: #d9c2b0;
    --accent-soft: #4e3326;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

img { display: block; max-width: 100%; height: auto; }

h1, h2, h3 { margin: 0; font-family: var(--font-head); line-height: 1.15; }

a { color: inherit; }

a:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }

/* Top bar */
.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px clamp(16px, 4vw, 40px);
  transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.topbar.is-scrolled { background: var(--bg); box-shadow: var(--shadow); }

.topbar__brand img { width: 40px; height: 40px; }

.topbar__steam {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--text);
}

.topbar__steam:hover { background: var(--accent-soft); }

.icon { display: block; width: 26px; height: 26px; background-color: currentColor; }

.icon--steam {
  -webkit-mask: url("../assets/steam.svg") center / contain no-repeat;
  mask: url("../assets/steam.svg") center / contain no-repeat;
}

/* Hero */
.hero {
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 88vh;
  padding: 96px 16px 64px;
  text-align: center;
  background: radial-gradient(ellipse at top, var(--accent-soft), var(--bg) 70%);
}

.hero__content { position: relative; z-index: 1; max-width: 560px; }

.hero__logo { width: clamp(110px, 20vw, 160px); margin: 0 auto 16px; }

.hero__title { font-size: clamp(2.6rem, 8vw, 4.75rem); }

.hero__subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}


/* Motto */
.motto { padding: 56px 16px; text-align: center; }

.motto__text {
  margin: 0;
  font-family: var(--font-head);
  font-size: clamp(1.3rem, 6vw, 2.6rem);
  font-weight: 600;
}

/* Games */
.games { max-width: var(--max); margin: 0 auto; padding: 24px 16px 56px; }

.games__heading { margin-bottom: 32px; font-size: clamp(1.8rem, 4vw, 2.4rem); text-align: center; }

.game {
  display: grid;
  gap: 24px;
  padding: clamp(16px, 3vw, 32px);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.game__banner { display: block; overflow: hidden; border-radius: var(--radius); }

.game__banner img { width: 100%; transition: transform 0.3s ease; }

.game__banner:hover img { transform: scale(1.03); }

/* Below the key art: trailer on the left, wishlist and demo on the right (stacked on narrow screens) */
.game__media { display: grid; gap: 24px; }

@media (min-width: 960px) {
  .game__media { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; }
}

.game__trailer {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  background: #000;
}

.game__trailer video { display: block; width: 100%; height: 100%; object-fit: cover; }

.game__side { display: grid; gap: 20px; justify-self: center; width: 100%; max-width: 480px; min-width: 0; }

/* Steam's own wishlist widget: below 430px its purchase bar covers the platform icons,
   so it is laid out at 430px and main.js scales it to fill the panel */
.game__wishlist { overflow: hidden; border-radius: var(--radius); background: var(--steam-panel); }

.game__wishlist-frame { height: 190px; overflow: hidden; }

.game__wishlist iframe { display: block; width: 430px; height: 190px; border: 0; transform-origin: top left; }

.game__actions { display: flex; }

.game__actions .btn { flex: 1; text-align: center; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease;
}

.btn:hover { transform: translateY(-2px) scale(1.03); }

.btn:active { transform: scale(0.96); }


.btn--demo {
  position: relative;
  background:
    linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.65) 50%, transparent 65%) -150% 0 / 250% 100% no-repeat,
    var(--gold);
  color: var(--on-gold);
}

.btn--demo::before {
  content: "\25B6" / "";
  display: inline-block;
  margin-right: 8px;
  font-size: 0.8em;
  transition: transform 0.2s ease;
}

/* "It's free, please" ticker scrolling through the corner sticker */
.btn__ticker {
  position: absolute;
  top: -12px;
  right: -10px;
  width: 10.5em;
  overflow: hidden;
  padding: 2px 0;
  border-radius: 999px;
  background: var(--badge);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
  rotate: 6deg;
}

.btn__ticker-track { display: flex; width: max-content; animation: demo-ticker 5s linear infinite; }

.btn__ticker-item { padding: 0 0.8em; }

@keyframes demo-ticker { from { translate: -50% 0; } to { translate: 0 0; } }

@media (prefers-reduced-motion: reduce) {
  .btn__ticker { width: auto; }
  .btn__ticker-item + .btn__ticker-item { display: none; }
}

.btn--demo:hover { background-position: 150% 0, 0 0; transition: transform 0.15s ease, background-position 0.7s ease; }

.btn--demo:hover::before { transform: translateX(3px); }

/* One hop and one shine when the game card first appears */
.game.is-visible .btn--demo { animation: demo-hop 0.6s ease 0.7s, demo-shine 0.9s ease 0.9s; }

@keyframes demo-hop {
  0%, 100% { translate: 0 0; }
  40% { translate: 0 -6px; }
  70% { translate: 0 1px; }
}

@keyframes demo-shine {
  from { background-position: -150% 0, 0 0; }
  to { background-position: 150% 0, 0 0; }
}

/* Footer */
.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 40px 16px 48px;
  color: var(--muted);
  text-align: center;
}

.footer img { width: 48px; height: 48px; }

.contact { position: relative; }

.contact__email {
  padding: 2px 4px;
  border: 0;
  border-bottom: 2px dashed currentColor;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: copy;
}

.contact__email:hover { color: var(--muted); }

.contact__email:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; }

.contact__status { position: absolute; left: 100%; top: 50%; translate: 8px -50%; font-size: 0.85rem; white-space: nowrap; }

.footer p { margin: 0; font-size: 0.9rem; }

/* Pigs peeking in beside the game section (added by main.js) */
.games-stage { position: relative; overflow: hidden; }

.games-stage .games { position: relative; z-index: 1; }

.peekers { position: absolute; inset: 0; pointer-events: none; }

.sprite {
  position: absolute;
  width: auto;
  height: clamp(140px, 16vw, 260px);
  transition: translate 0.9s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.sprite[data-side="left"] { left: 0; scale: -1 1; translate: -110% 0; }
.sprite[data-side="right"] { right: 0; translate: 110% 0; }
.peekers.is-visible .sprite[data-side="left"] { translate: -35% 0; }
.peekers.is-visible .sprite[data-side="right"] { translate: 35% 0; }

.sprite:nth-child(1) { top: 40px; rotate: 8deg; }
.sprite:nth-child(2) { top: 330px; rotate: -6deg; transition-delay: 0.3s; }
.sprite:nth-child(3) { top: 620px; rotate: 6deg; transition-delay: 0.6s; }
.sprite:nth-child(4) { top: 160px; rotate: -8deg; transition-delay: 0.15s; }
.sprite:nth-child(5) { top: 470px; rotate: 6deg; transition-delay: 0.45s; }

/* No room beside the card: two pigs peek in above it instead */
@media (max-width: 1199px) {
  .games { padding-top: calc(clamp(72px, 10vw, 110px) + 16px); }
  .sprite:nth-child(n) { top: 8px; height: clamp(72px, 10vw, 110px); }
  .sprite:nth-child(2), .sprite:nth-child(3), .sprite:nth-child(5) { display: none; }
}

/* Fade-in (only when main.js is running) */
.js .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.js .reveal.is-visible { opacity: 1; transform: none; }

/* Phones */
@media (max-width: 719px) {
  .hero { min-height: auto; padding: 88px 16px 32px; }

  .motto { padding-block: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after { transition: none !important; animation: none !important; }
}
