/* Formatily Games. Mobile first. Fonts are self-hosted (Baloo Bhaijaan 2, OFL: /assets/fonts/OFL.txt). */

@font-face {
  font-family: "Baloo Bhaijaan 2 Web";
  src: url("/assets/fonts/baloo-bhaijaan2-800-latin.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Baloo Bhaijaan 2 Web";
  src: url("/assets/fonts/baloo-bhaijaan2-600-latin.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #17123b;
  --ink-2: #4b4668;
  --line: #e7e3f5;
  --page: #ffffff;
  --lilac: #f3f0ff;
  --lilac-2: #e6e0ff;
  --violet: #5b3df5;
  --violet-700: #4326dd;
  --violet-900: #2a178f;
  --night: #120d33;
  --sun: #ffc93c;
  --sun-700: #c9941a;
  --mint: #1db491;
  --coral: #ff6a55;
  --font-display: "Baloo Bhaijaan 2 Web", ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI",
    Roboto, Arial, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
  --radius: 24px;
}

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

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

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--violet-700);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}

a:hover {
  color: var(--ink);
}

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

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

p {
  margin: 0 0 1em;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

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

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

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

.site-header {
  background: var(--page);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  padding-block: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
}

.brand img {
  width: auto;
  height: 34px;
}

/* "Games" next to the Formatily logo: the studio's name is Formatily Games. */
.brand-games {
  color: var(--violet);
  font-size: 1.42rem;
  line-height: 1;
  margin-top: 4px;
}

.site-nav ul,
.footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: var(--lilac);
  color: var(--violet-700);
}

/* ---------- Buttons: tactile, like the game ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 26px;
  border-radius: 999px;
  border: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

.btn-sun {
  background: var(--sun);
  color: var(--ink);
  box-shadow: 0 6px 0 var(--sun-700);
}

.btn-sun:hover {
  color: var(--ink);
  background: #ffd45f;
}

.btn-sun:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--sun-700);
}

.btn-violet {
  background: var(--violet);
  color: #fff;
  box-shadow: 0 6px 0 var(--violet-900);
}

.btn-violet:hover {
  color: #fff;
  background: var(--violet-700);
}

.btn-violet:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--violet-900);
}

.btn-ghost {
  color: #fff;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.75);
}

.btn-ghost:hover {
  color: var(--ink);
  background: #fff;
}

.btn-outline {
  color: var(--ink);
  box-shadow: inset 0 0 0 2px var(--ink);
}

.btn-outline:hover {
  color: #fff;
  background: var(--ink);
}

.btn-play::before {
  content: "";
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 12px;
  border-color: transparent transparent transparent currentColor;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* ---------- Hero: the violet stage of the game ---------- */

.hero {
  position: relative;
  overflow: hidden;
  background: var(--violet);
  color: #fff;
  padding-block: clamp(40px, 8vw, 88px) 0;
}

/* Sun disc: behind the phones on small screens (never behind text), top corner on wide screens. */
.hero::before {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  right: -110px;
  bottom: 90px;
  border-radius: 50%;
  background: var(--sun);
}

@media (min-width: 900px) {
  .hero::before {
    width: 360px;
    height: 360px;
    right: -150px;
    top: -170px;
    bottom: auto;
  }
}

.hero::after {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  left: -130px;
  bottom: -140px;
  border-radius: 50%;
  background: var(--mint);
}

.hero .wrap {
  position: relative;
  z-index: 1;
  display: grid;
  gap: clamp(28px, 5vw, 56px);
  align-items: end;
}

.hero-copy {
  padding-bottom: clamp(8px, 4vw, 96px);
}

.hero h1 {
  font-size: clamp(3rem, 12vw, 5.6rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.hero .lead {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.25rem, 3.2vw, 1.6rem);
  line-height: 1.3;
  color: #efebff;
  max-width: 28ch;
  margin-bottom: 30px;
}

/* Real screenshots of the game in phone frames. */
.phones {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  min-height: 300px;
}

.phone {
  margin: 0;
  width: min(44vw, 250px);
  aspect-ratio: 540 / 1168;
  padding: 8px;
  border-radius: 36px;
  background: var(--night);
  box-shadow: 0 24px 50px rgba(18, 13, 51, 0.35);
}

.phone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 28px;
}

.hero .phone {
  margin-bottom: -70px;
}

.hero .phone-back {
  transform: translateX(12%) rotate(-6deg);
}

.hero .phone-front {
  position: relative;
  z-index: 1;
  transform: translateX(-12%) translateY(-28px) rotate(4deg);
}

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

.section {
  padding-block: clamp(64px, 9vw, 112px) clamp(48px, 8vw, 96px);
}

.section h2 {
  font-size: clamp(2rem, 6vw, 3rem);
}

.section-lead {
  color: var(--ink-2);
  font-size: 1.15rem;
  max-width: 56ch;
  margin-bottom: clamp(28px, 4vw, 44px);
}

/* FlexFacts feature */
.feature {
  display: grid;
  gap: clamp(28px, 5vw, 56px);
  align-items: center;
  background: var(--lilac);
  border-radius: 32px;
  padding: clamp(24px, 5vw, 56px);
  overflow: hidden;
}

.feature .shots {
  display: flex;
  gap: 12px;
  justify-content: center;
  padding-top: 18px;
}

.feature .phone {
  width: min(28vw, 180px);
  padding: 6px;
  border-radius: 26px;
  box-shadow: 0 16px 32px rgba(18, 13, 51, 0.22);
}

.feature .phone img {
  border-radius: 20px;
}

.feature .shots .phone:nth-child(2) {
  transform: translateY(-18px);
}

.feature h3 {
  font-size: clamp(2.2rem, 6vw, 3rem);
  margin-bottom: 4px;
}

.tagline {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3rem;
  color: var(--violet-700);
  margin-bottom: 14px;
}

.details {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  display: grid;
  gap: 10px;
}

.details li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
}

/* Shape markers, the same circle, square and triangle used in the game. */
.details li::before {
  content: "";
  width: 18px;
  height: 18px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: inset 0 0 0 4px var(--ink);
}

.details li:nth-child(3n + 2)::before {
  border-radius: 5px;
  background: var(--mint);
}

.details li:nth-child(3n)::before {
  background: var(--coral);
  border-radius: 0;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  box-shadow: none;
}

/* Studio */
.studio {
  display: grid;
  gap: clamp(28px, 5vw, 56px);
  align-items: start;
}

.studio p {
  color: var(--ink-2);
  max-width: 60ch;
}

.company {
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  padding: clamp(24px, 4vw, 36px);
}

.company h3 {
  font-size: 1.5rem;
}

.company dl {
  margin: 0;
  display: grid;
  gap: 14px;
}

.company dt {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--lilac-2);
  font-size: 0.95rem;
}

.company dd {
  margin: 0;
  font-weight: 650;
}

.company a {
  color: var(--sun);
}

.company a:hover {
  color: #fff;
}

/* ---------- Inner pages ---------- */

.page-hero {
  background: var(--lilac);
  padding-block: clamp(36px, 7vw, 72px);
  margin-bottom: clamp(32px, 5vw, 56px);
}

.page-hero h1 {
  font-size: clamp(2.4rem, 8vw, 3.8rem);
  margin-bottom: 10px;
}

.page-hero .lead {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.15rem, 2.8vw, 1.4rem);
  line-height: 1.35;
  color: var(--ink-2);
  max-width: 44ch;
  margin: 0;
}

.content {
  padding-bottom: clamp(56px, 9vw, 104px);
}

.cards {
  display: grid;
  gap: 18px;
}

.card {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(22px, 4vw, 32px);
}

.card h2 {
  font-size: 1.6rem;
}

.card p:last-child,
.card dl:last-child,
.card address:last-child {
  margin-bottom: 0;
}

.big-link {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.35rem, 5vw, 1.75rem);
  word-break: break-word;
}

address {
  font-style: normal;
}

.facts-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 18px;
  margin: 0;
}

.facts-list dt {
  font-weight: 700;
  color: var(--ink-2);
}

.facts-list dd {
  margin: 0;
  font-weight: 650;
}

.game-row {
  display: grid;
  gap: 22px;
  align-items: start;
}

.game-row .phone {
  width: 150px;
  padding: 5px;
  border-radius: 24px;
  box-shadow: 0 12px 24px rgba(18, 13, 51, 0.2);
}

.game-row .phone img {
  border-radius: 19px;
}

.game-row h3 {
  font-size: 2rem;
  margin-bottom: 4px;
}

.game-row ul {
  margin: 0 0 20px;
  padding-left: 1.2em;
}

.sub {
  margin-top: clamp(36px, 6vw, 56px);
}

.sub > h2 {
  font-size: clamp(1.8rem, 5vw, 2.4rem);
}

/* Legal prose */
.prose {
  max-width: 74ch;
}

.prose h2 {
  font-size: clamp(1.4rem, 4vw, 1.7rem);
  margin-top: 2em;
  scroll-margin-top: 16px;
}

.prose h3 {
  font-size: 1.2rem;
  margin-top: 1.5em;
}

.prose ul {
  padding-left: 1.25em;
  margin: 0 0 1em;
}

.prose li {
  margin-bottom: 0.45em;
}

.updated {
  display: inline-block;
  font-weight: 700;
  color: var(--ink-2);
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  margin: 8px 0 0;
}

.toc {
  background: var(--lilac);
  border-radius: 18px;
  padding: 18px 22px;
  margin: 8px 0;
}

.toc h2 {
  font-size: 1.1rem;
  margin: 0 0 8px;
}

.toc ol {
  margin: 0;
  padding-left: 1.3em;
}

.toc li {
  margin-bottom: 4px;
}

.summary {
  border: 2px solid var(--line);
  border-radius: 18px;
  padding: 18px 22px 8px;
  margin: 24px 0;
}

.summary h2 {
  margin-top: 0;
}

/* 404 */
.notfound {
  text-align: center;
  padding-block: clamp(56px, 12vw, 128px);
}

.notfound .code {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(5rem, 26vw, 10rem);
  line-height: 1;
  color: var(--violet);
  margin: 0 0 8px;
}

.notfound .lead {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--ink-2);
  max-width: 36ch;
  margin-inline: auto;
  margin-bottom: 28px;
}

.notfound .actions {
  justify-content: center;
}

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

.site-footer {
  background: var(--night);
  color: #d9d4f2;
  padding-block: 40px 32px;
  font-size: 0.98rem;
}

.site-footer .wrap {
  display: grid;
  gap: 24px;
}

.site-footer .brand {
  color: #fff;
}

.site-footer .brand-games {
  color: var(--sun);
}

.site-footer .legal-name {
  color: #fff;
  font-weight: 700;
  margin: 10px 0 0;
}

.site-footer address {
  margin-top: 6px;
}

.footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  color: #fff;
  font-weight: 650;
  text-decoration: none;
  border-radius: 999px;
}

.footer-nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.site-footer :focus-visible {
  outline-color: var(--sun);
}

.site-footer a.mail {
  color: #fff;
}

/* ---------- Play page ---------- */

.play-page {
  background: var(--night);
}

.stage {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background: var(--violet);
}

.game-frame {
  width: min(100vw, calc(100vh * 9 / 16));
  width: min(100vw, calc(100dvh * 9 / 16));
  height: 100vh;
  height: 100dvh;
  background: var(--violet);
}

.game-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.stage-back {
  display: none;
}

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

@media (min-width: 640px) {
  .game-row {
    grid-template-columns: 150px 1fr;
  }

  .toc ol {
    columns: 2;
    column-gap: 32px;
  }
}

@media (min-width: 760px) {
  .cards.two {
    grid-template-columns: repeat(2, 1fr);
  }

  .site-footer .wrap {
    grid-template-columns: 1.4fr 1fr;
    align-items: start;
  }

  .footer-nav ul {
    justify-content: flex-end;
  }
}

@media (min-width: 900px) {
  .hero .wrap {
    grid-template-columns: 1.05fr 0.95fr;
  }

  .phones {
    min-height: 520px;
  }

  .feature {
    grid-template-columns: 1.1fr 0.9fr;
  }

  .studio {
    grid-template-columns: 1.2fr 0.8fr;
  }
}

/* Room beside the portrait game for a way back to the site. */
@media (min-width: 1000px) {
  .stage {
    background:
      radial-gradient(circle at 94% 4%, var(--sun) 0 150px, transparent 151px),
      radial-gradient(circle at 3% 97%, var(--mint) 0 130px, transparent 131px),
      var(--night);
  }

  .stage-back {
    display: inline-flex;
    position: absolute;
    top: 20px;
    left: 24px;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 16px 0 10px;
    border-radius: 999px;
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    font-family: var(--font-display);
    font-weight: 600;
    text-decoration: none;
  }

  .stage-back:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
  }

  .stage-back img {
    width: 28px;
    height: 28px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
