/* The site's own rules, and the kit every screen is built from: the type, the one button, the
 * one input, the focus ring, and the landing (src/pages/home.js) with its blobs. play.css
 * builds the play shell's screens from the same pieces. Every colour, size, radius and shadow
 * is a token from tokens.css.
 */

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: var(--size-1) / 1.5 var(--font);
  -webkit-text-size-adjust: 100%;
}

/* ------------------------------------------------------------------ type */

h1,
h2,
h3,
legend,
label {
  font-family: var(--font-display);
}

h1 {
  font-size: var(--size-4);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-3);
  overflow-wrap: anywhere;
}

h2 {
  font-weight: 600;
}

p {
  color: var(--ink-2);
}

a {
  color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

.note {
  color: var(--muted);
  font-size: var(--size-0);
}

/* ------------------------------------------------------------------ the focus ring */
/* Every control shows where the keyboard is, in one ring that no fill can hide. */

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

/* ------------------------------------------------------------------ the page */

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--space-5) var(--space-3);
}

/* ------------------------------------------------------------------ the button */
/* One button: a chunky outline, a hard shadow, and a squish when it is pressed. Quiet is the
   same button on the raised surface. */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  box-sizing: border-box;
  padding: var(--space-2) var(--space-4);
  border: var(--edge-1) solid var(--edge);
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow);
  font-family: var(--font-display);
  font-size: var(--size-2);
  font-weight: 600;
  line-height: 1.1;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out;
}

.button-quiet {
  background: var(--paper-2);
  color: var(--ink);
}

.button:active:not(:disabled) {
  transform: translateY(var(--press));
  box-shadow: var(--shadow-pressed);
}

@media (hover: hover) {
  .button:hover:not(:disabled) {
    filter: brightness(1.06);
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-4) 0;
}

/* ------------------------------------------------------------------ the input */

.join label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--size-2);
  font-weight: 600;
}

.row {
  display: flex;
  gap: var(--space-2);
}

input {
  min-height: var(--tap);
  min-width: 0;
  flex: 1;
  box-sizing: border-box;
  padding: 0 var(--space-3);
  border: var(--edge-1) solid var(--edge);
  border-radius: var(--radius);
  background: var(--paper-2);
  color: var(--ink);
  font: inherit;
  font-size: var(--size-2);
}

/* ------------------------------------------------------------------ the landing */
/* src/pages/home.js, and the play shell's own landing (src/client/app.js): the logo over a
   strip of lawn where two blobs knock a ball back and forth. The blobs are shapes in CSS, so
   the page needs no script to show them. */

.landing {
  padding-top: var(--space-4);
}

.logo {
  margin: 0 0 var(--space-2);
  font-size: var(--size-5);
  line-height: 0.95;
}

.logo-amp {
  color: var(--accent);
}

.lede {
  font-size: var(--size-2);
  color: var(--ink);
}

.hero {
  position: relative;
  height: 9rem;
  margin: 0 0 var(--space-4);
  overflow: hidden;
  border: var(--edge-2) solid var(--edge);
  border-radius: var(--radius-lg);
  background: var(--lawn);
}

/* The court: a green slab with a net across the middle. */
.hero-court {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 0.75rem;
  height: 2.25rem;
  border: 3px solid var(--court-line);
  border-radius: var(--radius-sm);
  background: var(--court);
}

.hero-court::after {
  content: "";
  position: absolute;
  top: -1.25rem;
  bottom: -3px;
  left: 50%;
  width: 3px;
  margin-left: -1.5px;
  border-radius: var(--radius-pill);
  background: var(--court-line);
}

/* A blob: a squashed round body with a shine, and two eyes looking at the other. */
.hero-blob {
  position: absolute;
  bottom: 1.5rem;
  width: 4.5rem;
  height: 3.75rem;
  border: var(--edge-2) solid var(--edge);
  border-radius: 50% 50% 44% 44% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 30% 28%, var(--blob-shine) 0 9%, transparent 10%), var(--blob-1);
  transform-origin: 50% 100%;
  animation: hero-hit 3.2s ease-out infinite;
}

.hero-blob-1 {
  left: 10%;
}

.hero-blob-2 {
  right: 10%;
  background: radial-gradient(circle at 70% 28%, var(--blob-shine) 0 9%, transparent 10%), var(--blob-2);
  animation-delay: -1.6s;
}

.hero-blob::before,
.hero-blob::after {
  content: "";
  position: absolute;
  top: 30%;
  width: 0.5rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--blob-ink);
}

.hero-blob-1::before { left: 50%; }
.hero-blob-1::after { left: 70%; }
.hero-blob-2::before { left: 22%; }
.hero-blob-2::after { left: 42%; }

/* The ball's flight: across, linear, while it rises and falls. */
.hero-flight {
  position: absolute;
  left: 24%;
  bottom: 3.5rem;
  animation: hero-across 1.6s linear infinite alternate;
}

.hero-ball {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  border: var(--edge-2) solid var(--edge);
  border-radius: 50%;
  background: radial-gradient(circle at 120% 50%, transparent 55%, var(--ball-seam) 56% 64%, transparent 65%), var(--ball);
  animation: hero-arc 0.8s ease-out infinite alternate;
}

@keyframes hero-across {
  from { left: 22%; }
  to { left: calc(78% - 1.1rem); }
}

@keyframes hero-arc {
  from { transform: translateY(0) rotate(0deg); }
  to { transform: translateY(-3.5rem) rotate(180deg); }
}

/* A squash as the ball arrives, then a wobble back to round. */
@keyframes hero-hit {
  0% { transform: scale(1.18, 0.8); }
  8% { transform: scale(0.92, 1.1); }
  16% { transform: scale(1.04, 0.97); }
  24%, 100% { transform: scale(1, 1); }
}

/* How a Big Point goes, in three steps. */
.how {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-5) 0 0;
  padding: 0;
  list-style: none;
  counter-reset: how;
}

.how li {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-3);
  border: var(--edge-2) solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper-2);
  color: var(--ink-2);
  box-shadow: var(--shadow-panel);
  counter-increment: how;
}

.how li::before {
  content: counter(how);
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--banner);
  color: var(--banner-ink);
  font-family: var(--font-display);
  font-weight: 700;
}

.how strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .button {
    transition: none;
  }

  .hero-blob,
  .hero-flight,
  .hero-ball {
    animation: none;
  }

  .hero-flight {
    left: calc(50% - 0.55rem);
    bottom: 5rem;
  }
}
