/* Reefpirate Games — one page, one accent, no framework. */

:root {
  --ink:    #0a0d14;   /* near-black navy, the game's backdrop */
  --panel:  #11151f;
  --line:   #1e2533;
  --text:   #d6dbe4;
  --muted:  #78839a;
  --teal:   #2ec3b5;   /* sampled from the RP GAMES mark */
  --teal-lit: #46dfd0;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font: 400 17px/1.6 'Exo 2', system-ui, -apple-system, 'Segoe UI', sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.lb-open { overflow: hidden; }

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

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ---- masthead: the studio, centred, above its own work ---- */

.masthead {
  padding: 36px 24px 28px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.wordmark { height: 62px; width: auto; }

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  font-style: italic;
  letter-spacing: 0.16em;
}

/* ---- hero ---- */

main { flex: 1; }

.hero {
  max-width: 760px;
  margin: 0 auto;
  padding: 44px 24px 0;
  text-align: center;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.game-logo { width: 100%; max-width: 440px; margin: 0 auto 26px; }

.pitch {
  font-size: 19px;
  margin: 0 0 30px;
  text-wrap: balance;
}

.cta {
  display: inline-block;
  padding: 14px 34px;
  background: var(--teal);
  color: var(--ink);
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: 3px;
  transition: background 120ms ease, transform 120ms ease;
}

.cta:hover { background: var(--teal-lit); transform: translateY(-1px); }
.cta:active { transform: translateY(0); }

.note { color: var(--muted); font-size: 15px; margin: 18px 0 0; }

.note a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.note a:hover { color: var(--teal); }

/* ---- itch store widget ---- */

/* The widget is a fixed 552x167 iframe, so it cannot reflow. The wrapper
   reserves the scaled box and gallery.js sets --widget-scale to fit. */
.widget-wrap {
  width: min(552px, 100%);
  height: calc(167px * var(--widget-scale, 1));
  margin: 0 auto;
}

.itch-widget {
  display: block;
  width: 552px;
  height: 167px;
  border: 0;
  transform: scale(var(--widget-scale, 1));
  transform-origin: top left;
}

/* ---- the playable embed ---- */

.play {
  max-width: 1280px;
  margin: 0 auto;
  padding: 60px 24px 0;
  text-align: center;
}

.play-lead {
  margin: 0 0 26px;
  font-size: 19px;
  text-wrap: balance;
}

.player {
  position: relative;
  width: 100%;
  aspect-ratio: 1280 / 820;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  background: var(--panel);
}

.player iframe { width: 100%; height: 100%; border: 0; display: block; }

.player-facade {
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  display: block;
  width: 100%;
}

.player-facade img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Dimmed so the badge reads; undimmed on hover as a hint it is live. */
  opacity: 0.5;
  transition: opacity 200ms ease;
}

.player-facade:hover img,
.player-facade:focus-visible img { opacity: 0.72; }

.play-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 16px 36px;
  background: var(--teal);
  color: var(--ink);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 3px;
  white-space: nowrap;
  transition: background 120ms ease;
}

.player-facade:hover .play-badge,
.player-facade:focus-visible .play-badge { background: var(--teal-lit); }

.play-badge svg { width: 22px; height: 22px; fill: currentColor; stroke: none; }

/* Covers the iframe until it fires `load`, then removes itself. Above rather
   than behind it: a loading iframe may paint opaque, which would hide a
   message sitting underneath. */
.player-loading {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--panel);
  pointer-events: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.player-loading small {
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: none;
  opacity: 0.7;
}

.play-note { margin: 16px 0 0; color: var(--muted); font-size: 15px; }
.play-note a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.play-note a:hover { color: var(--teal); }

/* Swapped in for the player below the breakpoint; see the note in index.html. */
.play-small-screen {
  display: none;
  margin: 0;
  padding: 34px 22px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  color: var(--muted);
  font-size: 16px;
  text-wrap: balance;
}

.play-small-screen a { color: var(--teal); text-decoration: underline; text-underline-offset: 3px; }

/* ---- gallery ---- */

.gallery {
  max-width: 1140px;
  margin: 0 auto;
  padding: 64px 24px 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px 32px;
}

.shot { margin: 0; }

.shot button {
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  cursor: zoom-in;
  overflow: hidden;
  transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.shot button:hover,
.shot button:focus-visible {
  border-color: var(--teal);
  transform: translateY(-3px);
  box-shadow: 0 10px 34px -12px rgba(46, 195, 181, 0.55);
  outline: none;
}

.shot img { width: 100%; }

.shot figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  text-wrap: balance;
}

/* ---- lightbox ---- */

/* `display: flex` below would otherwise beat the `hidden` attribute. */
.lightbox[hidden] { display: none; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(5, 7, 12, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
}

.lightbox figure {
  margin: 0;
  max-width: min(1400px, 100%);
}

.lightbox img {
  max-height: 82vh;
  width: auto;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.lightbox figcaption {
  margin-top: 14px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

.lightbox button {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  line-height: 1;
  transition: color 120ms ease;
}

.lightbox button:hover,
.lightbox button:focus-visible { color: var(--teal); outline: none; }

.lb-nav { font-size: 44px; padding: 8px 14px; flex: 0 0 auto; }

.lb-close {
  position: absolute;
  top: 14px;
  right: 20px;
  font-size: 36px;
  padding: 4px 10px;
}

/* ---- footer ---- */

footer {
  margin-top: 76px;
  padding: 22px 24px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  align-items: center;
  justify-content: space-between;
}

.social { display: flex; gap: 24px; flex-wrap: wrap; }

.social a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 15px;
  transition: color 120ms ease;
}

.social a:hover { color: var(--teal); }

.social svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.copyright { margin: 0; color: var(--muted); font-size: 14px; }

/* ---- small screens ---- */

/* The player gets its own, wider threshold than the rest of the layout: a
   768px tablet reflows the page fine but still cannot play the board. */
.if-no-player { display: none; }

@media (max-width: 899px) {
  .player, .play-note, .if-player { display: none; }
  .play-small-screen, .if-no-player { display: inline; }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  .masthead { padding: 28px 24px 22px; gap: 9px; }
  .wordmark { height: 44px; }
  .tagline { font-size: 13px; }
  .hero { padding-top: 36px; }
  .play { padding-top: 44px; }
  .play-lead { font-size: 17px; margin-bottom: 20px; }
  .gallery { padding-top: 44px; }
  .grid { grid-template-columns: 1fr; gap: 36px; }
  footer { margin-top: 56px; justify-content: center; text-align: center; }
  .lb-nav { font-size: 34px; padding: 6px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .cta, .shot button, .player-facade img { transition: none; }
  .cta:hover, .shot button:hover { transform: none; }
}
