/* Dash Reel
   Look: the game's own menu — blue tiled sky, brown dialog panels, chunky green buttons. */

:root {
  --sky: #2f80ff;
  --navy: #0b2a6b;
  --navy-deep: #061a45;
  --panel: #8a4a22;
  --panel-edge: #3a1c0a;
  --panel-inset: #a8602f;
  --well: #3a1c0a;
  --lime: #7dea2e;
  --lime-edge: #24560a;
  --cyan: #3de0ff;
  --cyan-edge: #0a5a80;
  --yellow: #ffd93b;
  --text: #ffffff;
  --text-soft: #f3d9bd;
  --radius-panel: 18px;
  --radius-card: 12px;
  --radius-control: 10px;
  --font: "Nunito", ui-rounded, "SF Pro Rounded", "Trebuchet MS", system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font: 700 1rem/1.55 var(--font);
  color: var(--text);
  background: var(--navy);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Tiled background from Images/background.png, tinted blue */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url("Images/background.png") center / cover no-repeat, var(--sky);
  background-blend-mode: multiply;
  transform: scaleY(-1); /* light tiles at the top, dark toward the footer */
}

img { display: block; max-width: 100%; }
a { color: inherit; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

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

/* ---------- Navigation ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem 1.5rem;
  background: var(--navy);
  border-bottom: 5px solid var(--navy-deep);
}
.logo img { height: 30px; width: auto; }

.nav-links { display: flex; align-items: center; gap: .4rem; list-style: none; }
.nav-links a {
  display: block; padding: .45rem .9rem; border-radius: var(--radius-control);
  text-decoration: none; font-weight: 800; color: #cfe0ff;
  transition: background-color .15s, color .15s;
}
.nav-links a:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-links a[aria-current="page"] { color: var(--yellow); background: rgba(0,0,0,.25); }
.nav-links .nav-cta a {
  background: var(--lime); color: #123a02; box-shadow: 0 3px 0 var(--lime-edge);
}
.nav-links .nav-cta a:hover { background: #95f550; }
.nav-links .nav-cta a[aria-current="page"] { background: var(--yellow); color: #4a3600; box-shadow: 0 3px 0 #8a6a00; }

.nav-toggle {
  display: none; background: none; border: 0; color: #fff; cursor: pointer;
  padding: .5rem; border-radius: var(--radius-control);
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block; width: 24px; height: 3px; background: currentColor; border-radius: 2px; position: relative;
}
.nav-toggle span::before, .nav-toggle span::after { content: ""; position: absolute; left: 0; }
.nav-toggle span::before { top: -8px; }
.nav-toggle span::after { top: 8px; }

/* ---------- Hero (home) ---------- */
.hero { padding: 3.5rem 1.5rem 0; max-width: 1100px; margin: 0 auto; width: 100%; }
.hero h1 { display: flex; flex-direction: column; gap: .6rem; align-items: flex-start; }
.hero h1 img { height: clamp(64px, 12vw, 120px); width: auto; }
.hero p { margin-top: 1.25rem; max-width: 34rem; font-size: 1.2rem; color: #eaf2ff; text-shadow: 0 2px 0 rgba(6,26,69,.6); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .9rem; margin-top: 1.75rem; }

/* The runway: a cube jumping a spike, in sync, on loop */
.runway {
  --cx: 145px;
  --start: calc(var(--cx) - 20px);
  position: relative; height: 250px; margin-top: .5rem; overflow: hidden;
}
.runway-spikes {
  position: absolute; left: 0; right: 0; bottom: 80px; height: 44px;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='44' viewBox='0 0 240 44'><path d='M101 44 L120 4 L139 44 Z' fill='%23050d24' stroke='white' stroke-width='3' stroke-linejoin='round'/></svg>") repeat-x;
  background-position-x: var(--start);
  animation: scroll-spikes 1.2s linear infinite;
}
.runway-cube {
  position: absolute; left: calc(var(--cx) - 28px); bottom: 80px; width: 56px; height: 56px;
  animation: cube-jump 1.2s linear infinite;
}
.runway-ground {
  position: absolute; left: 0; right: 0; bottom: 0; height: 80px;
  /* Ground tile from the game, tinted blue. 3 tiles = 240px = one spike length, so it loops cleanly. */
  background: url("Images/ground.png") 0 0 / 80px 80px repeat-x, var(--sky);
  background-blend-mode: multiply;
  animation: scroll-ground 1.2s linear infinite;
}
@keyframes scroll-ground {
  from { background-position-x: 0; }
  to   { background-position-x: -240px; }
}
@keyframes scroll-spikes {
  from { background-position-x: var(--start); }
  to   { background-position-x: calc(var(--start) - 240px); }
}
@keyframes cube-jump {
  0%   { transform: translateY(0) rotate(0); animation-timing-function: cubic-bezier(.3,.7,.5,1); }
  50%  { transform: translateY(-86px) rotate(90deg); animation-timing-function: cubic-bezier(.5,0,.7,.3); }
  100% { transform: translateY(0) rotate(180deg); }
}

/* ---------- Panels ---------- */
.page { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 2.5rem 1.5rem 3rem; }
.page-title { margin-bottom: 1.5rem; }
.page-title img { height: clamp(36px, 6vw, 52px); width: auto; }
.page-lead { margin: -.5rem 0 1.5rem; color: #eaf2ff; max-width: 38rem; text-shadow: 0 2px 0 rgba(6,26,69,.6); }

.panel {
  background: var(--panel);
  border: 4px solid var(--panel-edge);
  border-radius: var(--radius-panel);
  box-shadow: inset 0 0 0 4px var(--panel-inset), 0 8px 0 rgba(6,26,69,.55);
  padding: 2rem;
}

/* ---------- Cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.5rem; }
.card {
  background: var(--panel-inset);
  border: 3px solid var(--panel-edge);
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.card-thumb {
  position: relative; aspect-ratio: 16 / 9;
  display: grid; place-items: center;
  background:
    linear-gradient(to bottom, rgba(6,26,69,0), rgba(6,26,69,.55)),
    url("Images/background.png") center / 220% no-repeat, var(--sky);
  background-blend-mode: normal, multiply, normal;
  border-bottom: 3px solid var(--panel-edge);
}
.card-thumb svg { width: 56px; height: 56px; filter: drop-shadow(0 3px 0 rgba(6,26,69,.6)); }
.card-body { padding: 1rem 1.1rem 1.2rem; }
.card h3 { font-size: 1.15rem; font-weight: 900; line-height: 1.25; }
.card p { margin-top: .3rem; font-size: .92rem; color: var(--text-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; cursor: pointer; text-decoration: none; text-align: center;
  font: 900 1.05rem var(--font); letter-spacing: .01em;
  padding: .75rem 1.5rem; border-radius: var(--radius-control);
  color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.35);
  background: var(--lime); border: 3px solid #123a02; box-shadow: 0 5px 0 var(--lime-edge);
  transition: transform .08s, box-shadow .08s, background-color .15s;
}
.btn:hover { background: #95f550; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--lime-edge); }
.btn-blue { background: var(--cyan); border-color: #063a52; box-shadow: 0 5px 0 var(--cyan-edge); }
.btn-blue:hover { background: #7aeaff; }
.btn-blue:active { box-shadow: 0 1px 0 var(--cyan-edge); }
.btn-block { display: block; width: 100%; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; margin-bottom: .4rem; font-weight: 900; }
.form-group input, .form-group textarea {
  width: 100%; padding: .75rem .9rem;
  font: 700 1rem var(--font); color: #fff;
  background: var(--well); border: 3px solid #1f0e04; border-radius: var(--radius-control);
  box-shadow: inset 0 3px 0 rgba(0,0,0,.35);
  transition: border-color .15s, box-shadow .15s;
}
.form-group textarea { min-height: 120px; resize: vertical; }
.form-group input::placeholder, .form-group textarea::placeholder { color: #d9b48f; opacity: 1; }
.form-group input:focus, .form-group textarea:focus {
  outline: none; border-color: var(--yellow);
  box-shadow: inset 0 3px 0 rgba(0,0,0,.35), 0 0 0 3px rgba(255,217,59,.35);
}
.form-status { min-height: 1.5em; margin-top: 1rem; font-weight: 800; color: var(--yellow); }
.form-status.is-error { color: #ffb4a8; }

.auth-wrap { display: grid; place-items: start center; }
.auth-box { width: 100%; max-width: 440px; }
.auth-box .page-title { text-align: center; margin-bottom: 1.5rem; }
.link-text { margin-top: 1.25rem; text-align: center; color: var(--text-soft); }
.link-text a { color: var(--yellow); font-weight: 900; }

.form-panel { max-width: 680px; }

/* ---------- Footer ---------- */
.site-footer {
  text-align: center; padding: 1.25rem 1.5rem;
  background: var(--navy); border-top: 5px solid var(--navy-deep);
  color: #cfe0ff; font-size: .9rem;
}

/* ---------- Small screens ---------- */
@media (max-width: 768px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: .25rem;
    padding: .75rem 1rem 1rem; background: var(--navy); border-bottom: 5px solid var(--navy-deep);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: .75rem 1rem; }
  .nav-links .nav-cta a { text-align: center; }
  .hero { padding-top: 2.25rem; }
  .runway { --cx: 65px; }
  .panel { padding: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .runway-spikes, .runway-cube, .runway-ground { animation: none; }
  .btn { transition: none; }
}

/* ---------- Sign-in buttons ---------- */
.auth-intro { margin-bottom: 1.25rem; font-weight: 800; }
.oauth-stack { display: grid; gap: 1rem; }
.btn-oauth {
  display: flex; align-items: center; justify-content: center; gap: .75rem;
  width: 100%; padding: .8rem 1.25rem; cursor: pointer;
  font: 900 1.05rem var(--font); border-radius: var(--radius-control);
  transition: transform .08s, box-shadow .08s, filter .15s;
}
.btn-oauth:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--edge); }
.btn-oauth:hover:not(:disabled) { filter: brightness(1.12); }
.btn-oauth:disabled { opacity: .55; cursor: not-allowed; }
.btn-github { --edge: #0d1117; background: #24292f; color: #fff; border: 3px solid #0d1117; box-shadow: 0 5px 0 var(--edge); }
.btn-google { --edge: #8f8f8f; background: #fff; color: #1f1f1f; border: 3px solid #bdbdbd; box-shadow: 0 5px 0 var(--edge); }
.btn-google:hover:not(:disabled) { filter: none; background: #f1f1f1; }
.auth-note { margin-top: 1.25rem; font-size: .9rem; color: var(--text-soft); text-align: center; }
.auth-status { text-align: center; }

/* Nav while signing in is still being checked, then the signed-in chip */
html:not(.auth-ready) .nav-cta { visibility: hidden; }
.nav-user { display: flex; align-items: center; gap: .6rem; }
.user-chip { display: flex; align-items: center; gap: .5rem; font-weight: 800; color: #fff; }
.user-chip img { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; background: var(--navy-deep); }
.user-name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-signout {
  cursor: pointer; padding: .4rem .8rem; border-radius: var(--radius-control);
  font: 800 .9rem var(--font); color: #cfe0ff; background: rgba(255,255,255,.1);
  border: 2px solid rgba(255,255,255,.25);
}
.btn-signout:hover { background: rgba(255,255,255,.2); color: #fff; }
@media (max-width: 768px) {
  .nav-user { justify-content: space-between; padding: .5rem 1rem; }
}
@media (prefers-reduced-motion: reduce) { .btn-oauth { transition: none; } }

/* ---------- Email + password form ---------- */
.auth-divider {
  display: flex; align-items: center; gap: .75rem;
  margin: 1.5rem 0 1.25rem; font-weight: 800; font-size: .9rem; color: var(--text-soft);
}
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 2px; background: rgba(255,255,255,.25); border-radius: 2px; }
.email-form .btn { margin-top: .25rem; }
.link-button {
  display: block; margin: 1rem auto 0; padding: .25rem .5rem; cursor: pointer;
  background: none; border: 0; font: 800 .95rem var(--font);
  color: var(--yellow); text-decoration: underline;
}
.link-button:disabled { opacity: .55; cursor: not-allowed; }
.form-group input:user-invalid { border-color: #ff8c7a; }
