/* =========================================================================
   OnBox Games — landing page styles
   Vanilla CSS, no framework. Colours are taken from the Watts Ahead
   itch.io page theme (https://onbox.itch.io/watts-ahead):
     button/link  #c86853   hover         #b0563f
     text         #222222   border        #d8d8d8
     panel        #e5e5e5   light bg      #f8f8f8
   Change a colour here, in :root, and nowhere else.
   ========================================================================= */

:root {
  --color-primary: #c86853;
  --color-primary-dark: #b0563f;
  --color-primary-light: #e08a75;
  --color-on-primary: #ffffff;

  --color-text: #222222;
  --color-text-muted: #5f6269;
  --color-border: #d8d8d8;
  --color-panel: #e5e5e5;
  --color-bg: #ffffff;
  --color-bg-alt: #f8f8f8;
  --color-dark: #2b2d31;
  --color-dark-2: #4d5057;
  --color-on-dark: #ffffff;
  --color-on-dark-muted: #c4c6ca;

  --font: "Lato", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 12px;
  --radius-sm: 6px;
  --shadow: 0 10px 30px rgba(34, 34, 34, 0.08);
  --container: 1120px;
  --gutter: 16px;
  --section-pad: clamp(64px, 10vw, 120px);
}

/* ---------- Base ---------- */

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 72px; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--color-primary); }
a:hover { color: var(--color-primary-dark); }

h1, h2, h3 { line-height: 1.15; margin: 0 0 0.5em; font-weight: 900; }

::selection { background: var(--color-primary); color: var(--color-on-primary); }

:focus-visible { outline: 3px solid var(--color-primary); outline-offset: 3px; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container.narrow { max-width: 760px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute; left: 8px; top: -60px;
  background: var(--color-primary); color: var(--color-on-primary);
  padding: 8px 14px; border-radius: var(--radius-sm); z-index: 100;
}
.skip-link:focus { top: 8px; color: var(--color-on-primary); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 900;
  letter-spacing: 0.01em;
  text-decoration: none;
  border: 0;
  border-radius: 2px;
  padding: 14px 26px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
/* Flat buttons: no shadow, barely rounded corners. */
.btn-primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
}
.btn-primary:hover {
  color: var(--color-on-primary);
  background: var(--color-primary-dark);
}
.btn-primary:active { background: var(--color-primary-dark); }
.btn[disabled] { opacity: 0.7; cursor: wait; }

/* ---------- Top navigation ----------
   Fixed over the hero and fully transparent at the top of the page.
   js/main.js adds .is-scrolled once the page scrolls, which gives it a
   translucent dark background with a blur behind it. */

.site-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: transparent;
  color: var(--color-on-dark);
  transition: background-color 0.25s ease, backdrop-filter 0.25s ease;
}
.site-nav.is-scrolled {
  background: rgba(43, 45, 49, 0.75);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 60px;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--color-on-dark); text-decoration: none; font-weight: 900;
}
.nav-brand:hover { color: var(--color-on-dark); }
.nav-links {
  list-style: none; margin: 0; padding: 0;
  display: flex; align-items: center; gap: clamp(12px, 3vw, 28px);
}
.nav-links a { color: var(--color-on-dark-muted); text-decoration: none; font-weight: 700; }
.nav-links a:hover { color: var(--color-on-dark); }
.nav-links .nav-cta { color: var(--color-primary); }
.nav-links .nav-cta:hover { color: var(--color-primary-light); }

@media (max-width: 560px) {
  .nav-brand span { display: none; }
  .nav-links { font-size: 0.95rem; }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  color: var(--color-on-dark);
  background-color: var(--color-dark);
  /* Faint isometric grid, a nod to the games' look. */
  background-image:
    linear-gradient(180deg, rgba(43, 45, 49, 0) 55%, var(--color-dark) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='46' viewBox='0 0 80 46'%3E%3Cpath d='M0 23 L40 0 L80 23 L40 46 Z' fill='none' stroke='%23ffffff' stroke-opacity='0.06' stroke-width='1'/%3E%3C/svg%3E");
  /* Centre the grid tile horizontally: the tile's middle (x=40) is where two
     diamonds touch corner to corner, so that meeting line runs down the exact
     centre of the screen, under the logo, at any width. */
  background-position: 0 0, 50% 0;
  /* Always exactly fills the screen, so the next section starts below the fold.
     svh = the visible height on mobile browsers with a collapsing address bar;
     plain vh is the fallback for browsers without it. min-height (not height)
     lets the content grow past a very short screen instead of being cut off. */
  min-height: 100vh;
  min-height: 100svh;
  display: flex; align-items: center; justify-content: center;
  padding-block: 88px 48px;  /* top clears the fixed nav bar */
  text-align: center;
  overflow: hidden;
}
.hero-inner { display: flex; flex-direction: column; align-items: center; }
.hero-logo {
  width: clamp(120px, 22vw, 200px);
  margin-bottom: 28px;
  animation: float 6s ease-in-out infinite;
}
.hero-title {
  font-size: clamp(2.75rem, 9vw, 6rem);
  letter-spacing: -0.02em;
  margin-bottom: 0.15em;
}
.hero-tagline {
  font-size: clamp(1.15rem, 2.6vw, 1.6rem);
  color: var(--color-on-dark-muted);
  margin: 0 0 40px;
}
/* The emphasised word ("remarkable") stands out by colour only: bright white
   against the muted grey, same weight and size as the rest of the line. */
.hero-tagline .tagline-accent { color: var(--color-on-dark); }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ---------- Sections ---------- */

.section { padding-block: var(--section-pad); }

.section-title {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: 0.75em;
  position: relative;
}
.section-title::after {
  content: "";
  display: block;
  width: 56px; height: 5px;
  margin-top: 14px;
  border-radius: 3px;
  background: var(--color-primary);
}

.lead { font-size: clamp(1.2rem, 2.4vw, 1.45rem); font-weight: 700; }
.about p:not(.lead) { color: var(--color-text-muted); }

/* ---------- Games ---------- */

.games {
  background: var(--color-bg-alt);
  border-block: 1px solid var(--color-border);
  /* Jumping to #games skips most of the section's top padding, so the title
     lands just under the nav bar and the first card fits on screen. A negative
     margin only moves the jump target; the layout itself is unchanged. */
  scroll-margin-top: calc(24px - var(--section-pad));
}

.game-list { display: grid; gap: clamp(32px, 5vw, 56px); }

.game-card {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
/* Alternate the image side on every second card, Deconstructeam style. */
.game-card:nth-child(even) .game-media { order: 2; }

.game-media {
  display: block;
  background: var(--color-panel);
  overflow: hidden;
}
.game-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}
.game-media:hover img { transform: scale(1.04); }

.game-body {
  padding: clamp(24px, 4vw, 48px);
  display: flex; flex-direction: column; align-items: flex-start;
}
.game-status {
  margin: 0 0 8px;
  font-size: 0.9rem; font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  display: flex; align-items: center; gap: 10px;
}
.badge {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
}
.game-title { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.game-pitch { font-size: 1.2rem; font-weight: 700; margin-top: 0; }
.game-body p:not(.game-pitch):not(.game-status) { color: var(--color-text-muted); }

.tags {
  list-style: none; padding: 0; margin: 4px 0 28px;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.tags li {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 0.85rem; font-weight: 700;
  color: var(--color-text-muted);
}

@media (max-width: 820px) {
  .game-card { grid-template-columns: 1fr; }
  .game-card:nth-child(even) .game-media { order: 0; }
  .game-media img { aspect-ratio: 630 / 500; height: auto; }
  .game-body .btn { width: 100%; text-align: center; }
}

/* ---------- Newsletter ---------- */

.newsletter { background: var(--color-dark); color: var(--color-on-dark); text-align: center; }
.newsletter .section-title::after { margin-inline: auto; }
.newsletter p { color: var(--color-on-dark-muted); }

.subscribe { margin-top: 32px; }
.subscribe-row {
  display: flex; gap: 12px;
  max-width: 560px; margin-inline: auto;
}
.subscribe input[type="email"] {
  flex: 1; min-width: 0;
  font: inherit;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-dark-2);
  background: #ffffff;
  color: var(--color-text);
}
.subscribe input[type="email"]:focus { outline: none; border-color: var(--color-primary); }
.subscribe input[aria-invalid="true"] { border-color: var(--color-primary); }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.form-message { min-height: 1.65em; margin: 16px 0 0; font-weight: 700; }
.form-message.is-success { color: #8fe3b4; }
.form-message.is-error { color: #ff9a9a; }

@media (max-width: 520px) {
  .subscribe-row { flex-direction: column; }
}

/* ---------- Footer ---------- */

.site-footer {
  background: #1f2023;
  color: var(--color-on-dark-muted);
  font-size: 0.95rem;
}
.footer-inner {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 12px; padding-block: 28px;
}
.footer-inner p { margin: 0; }
.footer-links { list-style: none; display: flex; gap: 20px; margin: 0; padding: 0; }
.footer-links a { color: var(--color-on-dark-muted); }
.footer-links a:hover { color: var(--color-primary); }

/* ---------- Motion preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
