/* Third Story Games — site styles.
   Deep night blue, never black (owner 2026-10-29). Saira = titles + both logos, Inter = body text.
   Motion is gentle: the Hyper Joyride road dashes glide left forever, sections fade up once,
   a faint brand glow drifts behind the game logo. Everything stops under prefers-reduced-motion. */

/* ---------- Fonts (self-hosted, SIL OFL 1.1) ---------- */
@font-face {
  font-family: "Saira";
  src: url("../fonts/saira-var.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 50% 125%;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-semibold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: dark;

  /* Night sky: deep blue overhead, a touch lighter and warmer toward the horizon (owner 2026-10-29). */
  --bg: #050914;
  --sky-top: #03060f;
  --sky-mid: #060c1d;
  --sky-low: #0a1330;
  --sky-horizon: #111a40;
  --bg-raised: #0d1430;
  --bg-card: rgba(14, 22, 50, 0.55);
  --line: rgba(244, 246, 250, 0.08);
  --line-strong: rgba(244, 246, 250, 0.16);

  --ink: #f4f6fa;
  --ink-2: #b4bac6;
  --ink-3: #8c93a1;

  --third: #feed1c;
  --third-shadow: #fdbd00;

  --cool: #26d6ff;
  --mid: #b44dff;
  --hot: #ff4dd8;
  --brand: linear-gradient(90deg, var(--cool), var(--mid) 55%, var(--hot));

  --dash: rgba(255, 255, 255, 0.78);

  --font-title: "Saira", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --wrap: 1120px;
  --gutter: 24px;
  --radius: 24px;
  --header-h: 68px;

  --ease-out: cubic-bezier(0.2, 0.8, 0.3, 1);
}

@media (max-width: 640px) {
  :root {
    --gutter: 16px;
    --radius: 20px;
    --header-h: 60px;
  }
}

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

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

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: transparent; /* the sky is html + body::before; never let a host page paint over it */
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* The sky: one fixed layer behind every page, so it stays put while the page scrolls (a fixed
   pseudo-element, because background-attachment: fixed is ignored on iPhone). */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(130% 55% at 50% 112%, rgba(72, 86, 180, 0.26), transparent 70%),
    radial-gradient(70% 40% at 88% 104%, rgba(140, 70, 190, 0.1), transparent 70%),
    radial-gradient(60% 35% at 10% 106%, rgba(38, 140, 220, 0.08), transparent 70%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 38%, var(--sky-low) 74%, var(--sky-horizon) 100%);
}

/* Belt and braces against sideways scrolling on phones (clip keeps the sticky header working). */
html,
body {
  overflow-x: clip;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--cool);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.nowrap {
  white-space: nowrap;
}

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

/* ---------- Type ---------- */
.eyebrow {
  margin: 0 0 14px;
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 600;
  font-stretch: 125%;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.title {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 700;
  font-stretch: 112%;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.title--xl {
  font-size: clamp(34px, 5.4vw, 64px);
}

.title--lg {
  font-size: clamp(28px, 4vw, 46px);
}

.title--md {
  font-size: clamp(22px, 2.6vw, 30px);
}

.lede {
  margin: 20px 0 0;
  max-width: 38em;
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.6;
  color: var(--ink-2);
  text-wrap: pretty;
}

.prose p {
  margin: 0 0 1.1em;
  color: var(--ink-2);
  text-wrap: pretty;
}

.prose p:last-child {
  margin-bottom: 0;
}

.prose strong {
  color: var(--ink);
  font-weight: 600;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(3, 6, 15, 0.62);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

/* Header logo: the real stacked logo at its true proportions. Never stretch or re-set it
   (owner 2026-10-29: the stretched roof-over-one-line lockup is forbidden). */
.brand {
  display: inline-flex;
  align-items: center;
  padding: 4px 0;
  text-decoration: none;
}

.brand__logo {
  width: auto;
  height: 50px;
}

@media (max-width: 640px) {
  .brand__logo {
    height: 44px;
  }
}
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav a {
  position: relative;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.nav a:hover {
  color: var(--ink);
  background: rgba(244, 246, 250, 0.06);
}

.nav a[aria-current="page"] {
  color: var(--ink);
}

.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--third);
}

.nav-toggle {
  display: none;
}

@media (max-width: 640px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-right: -10px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
  }

  .nav-toggle svg {
    width: 22px;
    height: 22px;
  }

  .nav-toggle .icon-close {
    display: none;
  }

  .site-header.is-open .nav-toggle .icon-open {
    display: none;
  }

  .site-header.is-open .nav-toggle .icon-close {
    display: block;
  }

  .nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
  }

  .site-header.is-open .nav {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 0.2s ease, transform 0.2s var(--ease-out);
  }

  .nav a {
    padding: 14px 4px;
    border-radius: 0;
    font-size: 18px;
    border-bottom: 1px solid var(--line);
  }

  .nav a:last-child {
    border-bottom: 0;
  }

  .nav a:hover {
    background: transparent;
  }

  .nav a[aria-current="page"]::after {
    left: auto;
    right: 4px;
    top: 50%;
    bottom: auto;
    width: 6px;
    height: 6px;
    margin-top: -3px;
    border-radius: 50%;
  }
}

/* No-JS: keep the links visible on phones. */
@media (max-width: 640px) {
  html:not(.js) .nav-toggle {
    display: none;
  }

  html:not(.js) .nav {
    position: static;
    flex-direction: row;
    padding: 0;
    background: none;
    border: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  html:not(.js) .nav a {
    padding: 8px 6px;
    font-size: 14px;
    border: 0;
  }
}

/* While Games is the only link (About + Support hidden — owner 2026-11-01), phones show it inline
   instead of a one-item menu. Delete this block when those links come back. */
@media (max-width: 640px) {
  .nav-toggle {
    display: none;
  }

  .nav {
    position: static;
    flex-direction: row;
    padding: 0;
    background: none;
    border: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .nav a {
    padding: 10px 14px;
    font-size: 15px;
    border: 0;
  }

  .nav a[aria-current="page"]::after {
    left: 14px;
    right: 14px;
    top: auto;
    bottom: 4px;
    width: auto;
    height: 2px;
    margin-top: 0;
    border-radius: 2px;
  }
}

/* ---------- Buttons + badges ---------- */
.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(244, 246, 250, 0.04);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s var(--ease-out);
}

.button:hover {
  background: rgba(244, 246, 250, 0.09);
  border-color: rgba(244, 246, 250, 0.28);
}

.button:active {
  transform: scale(0.98);
}

.button svg {
  width: 18px;
  height: 18px;
  transition: transform 0.25s var(--ease-out);
}

.button:hover svg {
  transform: translateX(3px);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px 9px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(3, 6, 15, 0.5);
  font-family: var(--font-title);
  font-size: 13px;
  font-weight: 600;
  font-stretch: 125%;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}

.badge__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 12px rgba(180, 77, 255, 0.7);
}

/* ---------- Hyper Joyride wordmark ----------
   HYPER / road dashes / JOYRIDE, sized off --hjr-size. Dash proportions match the app icon
   (dash = 0.89em long, 0.147em thick, 0.42em gap). The dash strip is one period wider than its
   box and slides left by exactly one period, so the loop is seamless. */
.hjr {
  --hjr-size: 120px;
  --dash-w: 0.89em;
  --dash-gap: 0.42em;
  --dash-h: 0.147em;
  --dash-period: calc(var(--dash-w) + var(--dash-gap));
  --dash-speed: 1.25s;

  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 0;
  font-family: var(--font-title);
  font-size: var(--hjr-size);
  font-weight: 730;
  font-stretch: 125%;
  line-height: 1;
  letter-spacing: 0.005em;
  user-select: none;
}

.hjr__word {
  display: inline-block;
  padding: 0 0.04em;
  background: var(--brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.hjr__road {
  position: relative;
  display: block;
  width: 100%;
  height: var(--dash-h);
  margin: 0.2em 0 0.24em;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14%, #000 86%, transparent);
}

.hjr--edge .hjr__road {
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.hjr__dashes {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(100% + var(--dash-period) * 2);
  background: repeating-linear-gradient(
    90deg,
    var(--dash) 0,
    var(--dash) var(--dash-w),
    transparent var(--dash-w),
    transparent var(--dash-period)
  );
  will-change: transform;
  animation: dash-glide var(--dash-speed) linear infinite;
}

@keyframes dash-glide {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(calc(var(--dash-period) * -1), 0, 0);
  }
}

/* ---------- Drifting brand glow ---------- */
.glow {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.glow span {
  position: absolute;
  width: 60%;
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0.5;
  will-change: transform;
}

.glow span:nth-child(1) {
  left: 4%;
  top: 0%;
  background: radial-gradient(closest-side, rgba(38, 214, 255, 0.28), transparent);
  animation: drift-a 22s ease-in-out infinite alternate;
}

.glow span:nth-child(2) {
  left: 22%;
  top: 14%;
  background: radial-gradient(closest-side, rgba(180, 77, 255, 0.34), transparent);
  animation: drift-b 26s ease-in-out infinite alternate;
}

.glow span:nth-child(3) {
  right: 2%;
  top: 4%;
  background: radial-gradient(closest-side, rgba(255, 77, 216, 0.26), transparent);
  animation: drift-c 30s ease-in-out infinite alternate;
}

@media (max-width: 640px) {
  .glow span {
    width: 100%;
  }
}

@keyframes drift-a {
  to {
    transform: translate3d(12%, 10%, 0) scale(1.1);
  }
}

@keyframes drift-b {
  to {
    transform: translate3d(-10%, -8%, 0) scale(0.92);
  }
}

@keyframes drift-c {
  to {
    transform: translate3d(-14%, 12%, 0) scale(1.08);
  }
}

/* ---------- Reveal on scroll (only when JS is running) ---------- */
.js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
  transition-delay: var(--reveal-delay, 0s);
}

.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

.delay-1 {
  --reveal-delay: 0.08s;
}

.delay-2 {
  --reveal-delay: 0.16s;
}

.delay-3 {
  --reveal-delay: 0.24s;
}

.delay-4 {
  --reveal-delay: 0.32s;
}

/* ---------- Sections ---------- */
.section {
  padding: clamp(72px, 10vw, 128px) 0;
}

.section--tight {
  padding-top: 0;
}

/* ---------- Home: studio hero ---------- */
.studio-hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: calc(92vh - var(--header-h));
  min-height: calc(92svh - var(--header-h));
  padding: 56px 0 72px;
  text-align: center;
  isolation: isolate;
  overflow: hidden;
}

.studio-hero::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 46%;
  z-index: -1;
  width: min(900px, 140vw);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(254, 237, 28, 0.07), rgba(254, 237, 28, 0.02) 55%, transparent);
  pointer-events: none;
}

.studio-hero .wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.studio-logo {
  width: min(400px, 72vw);
  height: auto;
}

.studio-hero .title {
  margin-top: clamp(40px, 6vw, 64px);
  max-width: 15em;
}

.studio-hero .lede {
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Screenshots ---------- */
.shot {
  margin: 0;
  border-radius: clamp(16px, 2vw, 24px);
  overflow: hidden;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  box-shadow: 0 30px 60px -20px rgba(2, 5, 16, 0.75), 0 0 0 1px rgba(2, 5, 16, 0.4);
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out);
}

.shot img {
  width: 100%;
  height: auto;
  aspect-ratio: 282 / 612;
  object-fit: cover;
}

.shot:hover,
.shot:active {
  transform: translate3d(0, -6px, 0);
  box-shadow: 0 40px 70px -24px rgba(2, 5, 16, 0.85), 0 0 0 1px rgba(180, 77, 255, 0.18);
}

.shots {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(170px, 1fr);
  gap: clamp(14px, 2vw, 24px);
  margin: 0;
  padding: 12px 0 28px;
  list-style: none;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

.shots::-webkit-scrollbar {
  display: none;
}

.shots li {
  scroll-snap-align: center;
}

@media (max-width: 900px) {
  .shots {
    grid-auto-columns: 58%;
    margin: 0 calc(var(--gutter) * -1);
    padding-left: var(--gutter);
    padding-right: var(--gutter);
    scroll-padding: 0 var(--gutter);
  }
}

@media (min-width: 560px) and (max-width: 900px) {
  .shots {
    grid-auto-columns: 34%;
  }
}

/* ---------- Games page ---------- */
.game-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(86vh - var(--header-h));
  min-height: calc(86svh - var(--header-h));
  padding: clamp(56px, 9vw, 112px) 0 clamp(56px, 8vw, 96px);
  text-align: center;
  isolation: isolate;
  overflow: hidden;
}

/* Keep the glow centred on the logo however tall the hero gets. */
.game-hero .glow {
  z-index: -1;
  top: 50%;
  bottom: auto;
  height: min(100%, 100vw);
  transform: translateY(-62%);
}

.game-hero .glow span {
  width: 52%;
}

@media (max-width: 640px) {
  .game-hero .glow span {
    width: 100%;
  }
}

.game-hero .hjr {
  --hjr-size: clamp(54px, 13vw, 168px);
}

.game-hero__meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  margin-top: clamp(36px, 5vw, 56px);
  padding: 0 var(--gutter);
}

.game-hero__meta p {
  margin: 0;
  font-size: clamp(17px, 1.8vw, 21px);
  color: var(--ink-2);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(28px, 6vw, 96px);
  align-items: start;
}

@media (max-width: 860px) {
  .split {
    grid-template-columns: 1fr;
  }
}

.prose--lg p {
  font-size: clamp(17px, 1.6vw, 19px);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: clamp(24px, 3vw, 36px);
}

.section-head .eyebrow {
  margin: 0;
}

.section-head .hint {
  margin: 0;
  color: var(--ink-3);
  font-size: 14px;
  white-space: nowrap;
}

@media (min-width: 901px) {
  .section-head .hint {
    display: none;
  }
}

/* ---------- About + support ---------- */
.page-head {
  padding: clamp(64px, 10vw, 128px) 0 clamp(40px, 6vw, 72px);
}

.page-head .lede {
  max-width: 34em;
}

/* About: the logo floats beside the words (no box — owner 2026-10-29); stacks on phones. */
.about {
  display: flex;
  align-items: center;
  min-height: calc(88vh - var(--header-h));
  min-height: calc(88svh - var(--header-h));
  padding: clamp(48px, 8vw, 96px) 0;
}

.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(40px, 7vw, 104px);
  align-items: center;
}

.about__mark {
  display: grid;
  place-items: center;
  background: radial-gradient(closest-side, rgba(254, 237, 28, 0.07), rgba(254, 237, 28, 0.02) 55%, transparent);
}

.about__mark img {
  width: 84%;
  height: auto;
}

.about__text .title {
  max-width: 11em;
}

.about__text .lede {
  max-width: 26em;
}

@media (max-width: 720px) {
  .about__grid {
    grid-template-columns: 1fr;
  }

  .about__mark {
    justify-items: start;
    background: none;
  }

  .about__mark img {
    width: min(64%, 260px);
  }
}

.notice {
  max-width: 40em;
  margin-top: clamp(28px, 4vw, 40px);
  padding: clamp(28px, 4vw, 40px);
  border-radius: var(--radius);
  border: 1px dashed var(--line-strong);
  color: var(--ink-2);
}

.notice p {
  margin: 0;
}

/* ---------- 404 ---------- */
.lost {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(80vh - var(--header-h));
  padding: 64px 0;
  text-align: center;
}

.lost .wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lost .hjr {
  --hjr-size: clamp(30px, 5vw, 48px);
  max-width: 560px;
  margin-bottom: 40px;
}

.lost .lede {
  margin-bottom: 32px;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: clamp(72px, 10vw, 128px);
  padding: 40px 0 48px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 14px;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px 32px;
}

.site-footer .brand__logo {
  height: 72px;
}

.site-footer nav {
  display: flex;
  gap: 24px;
}

.site-footer nav a {
  color: var(--ink-2);
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-footer nav a:hover {
  color: var(--ink);
}

.site-footer small {
  font-size: 14px;
}

@media (max-width: 640px) {
  .site-footer .wrap {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .hjr__dashes,
  .glow span {
    animation: none;
  }

  .js [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .shot,
  .button,
  .button svg,
  .nav {
    transition: none;
  }
}
