/*
 * SORTSTORM.COM: one stylesheet for every page, in the game's own look: the
 * deep storm navy, Gary's painted sky, the SORT STORM lettering (as on the
 * home screen: SORT in white over a bigger STORM in storm yellow, a thick navy
 * outline and a deep shadow), chunky buttons with a dark base and a glossy
 * streak, and dark glass panels like the game's sockets. Fredoka is served by
 * this site itself (fonts/): nothing comes from any other website.
 */

@font-face {
  font-family: 'Fredoka';
  src: url('/fonts/fredoka-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'Fredoka';
  src: url('/fonts/fredoka-600.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'Fredoka';
  src: url('/fonts/fredoka-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

:root {
  --ink: #1e1633;
  --night: #120d2b;
  --glass: rgba(16, 11, 40, 0.86);
  --rim: rgba(171, 160, 255, 0.42);
  --bolt: #ffd23f;
  --bolt-light: #fff07a;
  --bolt-deep: #ff9f1c;
  --bolt-lip: #d99a12;
  --cream: #fff6e5;
  --muted: #cfc8f2;
  --link: #8fd8ff;
}

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

html {
  background: var(--night);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Fredoka', ui-rounded, 'Arial Rounded MT Bold', system-ui, sans-serif;
  font-weight: 500;
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--cream);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Gary's painted storm sky, behind everything, a little darker so words stay easy to read. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(255, 210, 63, 0.1), transparent 55%),
    linear-gradient(180deg, rgba(10, 6, 30, 0.2), rgba(10, 6, 30, 0.6)),
    url('/images/bg.webp') center / cover no-repeat,
    var(--night);
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

a:focus-visible,
.button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

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

/* ---------------------------------------------------------------------------
 * THE LOGO: SORT over a bigger STORM. Each line is drawn three times: its deep
 * shadow (::before), its thick navy outline (the line itself) and its face on
 * top (::after: white, or STORM's yellow deepening to orange).
 */
.logo {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: 700;
  font-size: var(--logo-size, clamp(3.6rem, 19vw, 6.4rem));
  line-height: 0.86;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.logo .line {
  position: relative;
  z-index: 0;
  display: block;
  color: var(--ink);
  -webkit-text-stroke: 0.17em var(--ink);
}

.logo .line::before,
.logo .line::after {
  content: attr(data-text);
  position: absolute;
  left: 0;
  top: 0;
}

.logo .line::before {
  z-index: -1;
  top: 0.09em;
  color: var(--ink);
  -webkit-text-stroke: 0.17em var(--ink);
}

.logo .line::after {
  -webkit-text-stroke: 0;
  color: #fff;
}

.logo .sort {
  font-size: 0.77em;
}

.logo .storm {
  margin-top: 0.02em;
}

.logo .storm::after {
  background: linear-gradient(180deg, var(--bolt-light) 20%, var(--bolt) 55%, var(--bolt-deep) 88%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------------------------------------------------------------------------
 * BUTTONS: chunky, like the game's: a thick navy outline, a darker base along
 * the bottom, a face lighter at the top, and a glossy streak.
 */
.button {
  --face-top: var(--bolt-light);
  --face: var(--bolt);
  --lip: var(--bolt-lip);
  --text: var(--ink);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.4rem;
  padding: 0.5em 1.6em 0.85em;
  font: 700 1.15rem/1.1 'Fredoka', ui-rounded, system-ui, sans-serif;
  color: var(--text);
  text-decoration: none;
  background: linear-gradient(180deg, var(--face-top) 0%, var(--face) 48%);
  border: 4px solid var(--ink);
  border-radius: 20px;
  box-shadow:
    inset 0 -0.45em 0 var(--lip),
    0 0.2em 0 rgba(0, 0, 0, 0.35);
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}

.button::before {
  content: '';
  position: absolute;
  left: 11%;
  top: 12%;
  width: 30%;
  height: 0.3em;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.7);
}

.button:active {
  transform: translateY(3px);
  box-shadow:
    inset 0 -0.3em 0 var(--lip),
    0 0.05em 0 rgba(0, 0, 0, 0.35);
}

.button.blue {
  --face-top: #7fb0ff;
  --face: #2f6bff;
  --lip: #1d47b8;
  --text: #fff;
  text-shadow: 0 2px 0 var(--ink);
}

/* "Coming soon to iPhone and Android": a dark glass plate with a yellow rim (not a button). */
.soon {
  display: inline-block;
  margin: 0;
  padding: 0.55em 1.3em;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--bolt);
  background: var(--glass);
  border: 3px solid var(--bolt);
  border-radius: 999px;
  box-shadow:
    0 0 0 4px var(--ink),
    0 0 26px rgba(255, 210, 63, 0.28);
}

.stores {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
}

.stores .badge img {
  display: block;
  height: 56px;
  width: auto;
}

/* ---------------------------------------------------------------------------
 * THE HOME PAGE
 */
.home {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 2.2rem 1.2rem 1rem;
  display: grid;
  gap: 2rem;
  justify-items: center;
  text-align: center;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}

.tagline {
  margin: 0;
  max-width: 22em;
  text-wrap: balance;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.35;
  text-shadow: 0 2px 0 var(--ink);
}

.stormy {
  position: relative;
  width: 11rem;
  height: 11rem;
}

.stormy::before {
  content: '';
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 210, 63, 0.45), rgba(255, 210, 63, 0) 70%);
}

.stormy img {
  position: relative;
  width: 100%;
  height: 100%;
  animation: bob 2.6s ease-in-out infinite;
}

@keyframes bob {
  50% {
    transform: translateY(-6px);
  }
}

/* The clip of the game, in a phone. */
.phone {
  width: min(78vw, 300px);
  padding: 10px;
  border: 4px solid var(--ink);
  border-radius: 42px;
  background: linear-gradient(160deg, #3a3358, #1e1633 60%);
  box-shadow:
    0 0 0 3px var(--rim),
    0 26px 60px rgba(0, 0, 0, 0.45);
}

.phone video,
.phone img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 360 / 780;
  border-radius: 30px;
  background: #1c1847;
}

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

.crystals img {
  display: block;
  width: 3rem;
  height: 3rem;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
}

.crystals li:nth-child(odd) img {
  animation: bob 3.1s ease-in-out infinite;
}

.crystals li:nth-child(even) img {
  animation: bob 3.1s ease-in-out -1.5s infinite;
}

@media (min-width: 900px) {
  .home {
    grid-template-columns: 1fr auto;
    align-items: center;
    padding-top: 3.5rem;
    gap: 2rem 4rem;
  }

  .hero {
    --logo-size: 7rem;
  }

  .crystals {
    grid-column: 1 / -1;
  }

  .phone {
    width: 320px;
  }
}

/* ---------------------------------------------------------------------------
 * THE PRIVACY AND SUPPORT PAGES: a small logo home, then the words on dark glass.
 */
.top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.4rem 1rem 0.4rem;
}

.top .logo {
  --logo-size: 2.4rem;
}

.top img {
  width: 3.6rem;
  height: 3.6rem;
}

.page {
  flex: 1;
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

.panel {
  padding: 1.4rem 1.3rem 1.6rem;
  background: var(--glass);
  border: 3px solid var(--rim);
  border-radius: 28px;
  box-shadow:
    0 0 0 4px var(--ink),
    0 18px 40px rgba(0, 0, 0, 0.35);
}

.panel h1 {
  margin: 0 0 0.2rem;
  font-size: 2.1rem;
  line-height: 1.15;
  color: var(--bolt);
  text-shadow: 0 3px 0 var(--ink);
}

.panel h2 {
  margin: 1.8rem 0 0.4rem;
  font-size: 1.35rem;
  line-height: 1.25;
  color: var(--bolt);
}

.panel p,
.panel li {
  color: var(--cream);
}

.panel ul {
  padding-left: 1.3rem;
}

.panel li + li {
  margin-top: 0.3rem;
}

.dated {
  margin-top: 0;
  color: var(--muted);
  font-weight: 600;
}

.contact {
  margin: 1.4rem 0 0.4rem;
  text-align: center;
}

@media (min-width: 700px) {
  .panel {
    padding: 2rem 2.4rem 2.4rem;
  }
}

/* A page that isn't there. */
.lost {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem 1rem;
  text-align: center;
}

.lost h1 {
  margin: 0;
  font-size: 2rem;
  color: var(--bolt);
  text-shadow: 0 3px 0 var(--ink);
}

.lost p {
  margin: 0;
}

/* ---------------------------------------------------------------------------
 * THE FOOTER: Privacy, Support and the support email on every page.
 */
.footer {
  padding: 1.6rem 1rem 2rem;
  text-align: center;
  font-weight: 600;
}

.footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.6rem;
}

.footer a {
  color: var(--cream);
}

.footer p {
  margin: 0.8rem 0 0;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  .stormy img,
  .crystals img {
    animation: none;
  }

  .button {
    transition: none;
  }
}
