/* Cubelo Games — site styles */

:root {
  --ink: #131218;
  --ink-2: #5a5767;
  --ink-3: #6f6c80;
  --paper: #ffffff;
  --paper-2: #f6f5fa;
  --dark: #232329;
  --line: #e9e7f0;
  --line-2: #d9d6e5;

  /* Block colours, taken from the game board */
  --blue: #4e7df5;
  --blue-deep: #3a63d8;
  --violet: #9b6bff;
  --amber: #ffc53d;
  --orange: #ff9432;
  --coral: #ff4f6b;
  --mint: #3fcf8e;
  --sky: #37bdf3;

  --display: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Jakarta", system-ui, -apple-system, "Segoe UI", sans-serif;

  --shell: min(100% - 2.25rem, 1120px);

  /* Written by site.js; the page is complete without them */
  --mx: 0;
  --my: 0;
  --sy: 0;

  color-scheme: light;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

:focus-visible {
  outline: 2.5px solid var(--blue-deep);
  outline-offset: 3px;
  border-radius: 8px;
}

/* Blue on blue would vanish inside the dark bar */
.masthead__bar :focus-visible {
  outline-color: #fff;
}

.shell {
  width: var(--shell);
  margin-inline: auto;
}

h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
  margin: 0;
}

.eyebrow {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ---------- Header ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 0.7rem 0;
}

.masthead__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(100% - 1.5rem, 46rem);
  margin-inline: auto;
  padding: 0.45rem 0.45rem 0.45rem 0.7rem;
  border-radius: 999px;
  background: rgba(35, 35, 41, 0.92);
  box-shadow: 0 10px 30px -12px rgba(19, 18, 24, 0.5);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(0.95rem, 3.6vw, 1.05rem);
  letter-spacing: -0.02em;
  white-space: nowrap;
  text-decoration: none;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.cta {
  flex: none;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  background: var(--blue-deep);
  color: #fff;
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  box-shadow: 0 6px 16px -6px rgba(58, 99, 216, 0.85);
  transition: transform 0.18s ease, filter 0.18s ease;
}

.cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding-top: 2.5rem;
  text-align: center;
  isolation: isolate;
}

.traits {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.traits li {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.8rem 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 8px -6px rgba(19, 18, 24, 0.4);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-2);
  white-space: nowrap;
}

.traits li::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 3px;
}

.traits li:nth-child(1)::before {
  background: var(--mint);
}
.traits li:nth-child(2)::before {
  background: var(--blue);
}
.traits li:nth-child(3)::before {
  background: var(--violet);
}

.hero__title {
  margin: 1.15rem 0 0;
  font-size: clamp(2.1rem, 9.2vw, 4.75rem);
  letter-spacing: -0.045em;
  text-wrap: balance;
}

.hero__title span {
  color: #918ea0;
}

.hero__lead {
  margin: 1rem auto 0;
  max-width: 33ch;
  color: var(--ink-2);
  font-size: clamp(1rem, 4vw, 1.15rem);
  text-wrap: pretty;
}

/* ---------- Store badges ---------- */

.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.9rem;
}

.badge {
  display: inline-flex;
  border-radius: 10px;
  box-shadow: 0 10px 24px -14px rgba(19, 18, 24, 0.9);
  transition: transform 0.2s ease;
}

.badge img {
  height: 54px;
  width: auto;
  border-radius: 10px;
}

a.badge:hover {
  transform: translateY(-2px);
}

/* ---------- The two phones ---------- */

/* Sized so the phones are cropped by the bottom edge, never by the top */
.stage {
  position: relative;
  aspect-ratio: 1 / 1.02;
  margin-top: 2.25rem;
  perspective: 1500px;
  overflow: hidden;
}

.stage::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 8%;
  width: min(120%, 60rem);
  aspect-ratio: 1;
  transform: translateX(-50%);
  z-index: -1;
  background: radial-gradient(
    closest-side,
    rgba(155, 107, 255, 0.16),
    rgba(78, 125, 245, 0.08) 55%,
    transparent 75%
  );
}

.phone {
  position: absolute;
  top: 2%;
  width: 56%;
  filter: drop-shadow(0 40px 50px rgba(19, 18, 24, 0.28));
  will-change: transform;
}

.phone--light {
  left: 4%;
  z-index: 1;
  transform: translate3d(calc(var(--mx) * -10px), calc(var(--my) * -8px + var(--sy) * -14px), 0)
    rotateY(15deg) rotateZ(-7deg);
}

.phone--dark {
  right: 4%;
  z-index: 2;
  transform: translate3d(calc(var(--mx) * 12px), calc(var(--my) * 9px + var(--sy) * -26px), 0)
    rotateY(-15deg) rotateZ(7deg);
}

/* ---------- Sections ---------- */

.section {
  padding: 4rem 0 0;
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--line);
}

.section__head p:last-child {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-3);
}

/* ---------- Features ---------- */

.features {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.feature {
  padding: 1.4rem;
  border-radius: 20px;
  background: var(--paper-2);
}

.feature h3 {
  margin: 1rem 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.feature p {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.92rem;
}

/* Icons built from the game's own blocks */
.blocks {
  display: grid;
  grid-template-columns: repeat(3, 11px);
  grid-auto-rows: 11px;
  gap: 3px;
}

.blocks i {
  border-radius: 3.5px;
  background: var(--line-2);
}

.blocks i.b-blue {
  background: var(--blue);
}
.blocks i.b-violet {
  background: var(--violet);
}
.blocks i.b-mint {
  background: var(--mint);
}
.blocks i.b-amber {
  background: var(--amber);
}
.blocks i.b-coral {
  background: var(--coral);
}
.blocks i.b-orange {
  background: var(--orange);
}
.blocks i.b-sky {
  background: var(--sky);
}

/* ---------- Games ---------- */

.games {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.game {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(19, 18, 24, 0.03),
    0 24px 44px -38px rgba(19, 18, 24, 0.5);
}

.game__top {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.game__icon {
  width: 58px;
  height: 58px;
  flex: none;
  border-radius: 16px;
  box-shadow: 0 6px 16px -8px rgba(19, 18, 24, 0.7);
}

.game__name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.game__genre {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-3);
}

.game__text {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.95rem;
}

/* Store buttons: the official badges, shared style across every card */
.game__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-top: auto;
}

.store {
  display: inline-flex;
  border-radius: 9px;
  box-shadow: 0 8px 20px -12px rgba(19, 18, 24, 0.85);
  transition: transform 0.18s ease;
}

.store img {
  height: 44px;
  width: auto;
  border-radius: 9px;
}

a.store:hover {
  transform: translateY(-2px);
}

/* Not in the store yet: same layout, dimmed and inert */
.store--soon {
  filter: grayscale(1);
  opacity: 0.4;
  box-shadow: none;
  cursor: not-allowed;
}

.game__soon {
  flex-basis: 100%;
  margin: 0.1rem 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-3);
}

.game__soon::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 0.55rem;
  border-radius: 2px;
  background: var(--amber);
  vertical-align: middle;
}

.game__legal {
  margin: 0.9rem 0 0;
  font-size: 0.8rem;
}

.game__legal a {
  color: var(--ink-3);
  text-decoration: none;
  text-underline-offset: 3px;
}

.game__legal a:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ---------- Footer ---------- */

.colophon {
  margin-top: 4.5rem;
  padding: 1.75rem 0 2.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--ink-3);
}

.colophon__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}

.colophon p {
  margin: 0;
}

.colophon nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
}

.colophon a {
  color: var(--ink-2);
  text-decoration: none;
  text-underline-offset: 3px;
}

.colophon a:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ---------- Larger screens ---------- */

@media (min-width: 40rem) {
  .hero {
    padding-top: 4rem;
  }

  .stage {
    aspect-ratio: 1 / 0.62;
    margin-top: 3rem;
  }

  .phone {
    width: 36%;
  }

  .phone--light {
    left: 15%;
  }

  .phone--dark {
    right: 15%;
  }

  .features {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }

  .games {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  /* An odd card would orphan a full-width row: centre it at column width */
  .game:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - 0.625rem);
  }

  .colophon__inner {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }
}

@media (min-width: 64rem) {
  .hero {
    padding-top: 5rem;
  }

  .games {
    grid-template-columns: repeat(3, 1fr);
  }

  .game:last-child:nth-child(odd) {
    grid-column: auto;
    justify-self: auto;
    width: auto;
  }

  .hero__lead {
    max-width: 40ch;
    font-size: 1.2rem;
  }

  .stage {
    max-width: 68rem;
    margin-inline: auto;
    aspect-ratio: 1 / 0.5;
  }

  .phone {
    width: 27%;
  }

  .phone--light {
    left: 24%;
  }

  .phone--dark {
    right: 24%;
  }
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .rise {
    animation: rise 0.75s cubic-bezier(0.2, 0.65, 0.2, 1) backwards;
  }

  .rise-1 {
    animation-delay: 0.05s;
  }
  .rise-2 {
    animation-delay: 0.13s;
  }
  .rise-3 {
    animation-delay: 0.22s;
  }
  .rise-4 {
    animation-delay: 0.32s;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(16px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  /* Revealed by site.js; without JS they stay visible */
  .js .reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.65, 0.2, 1);
  }

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

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