/*
 * "Woodcut in color" (docs/DESIGN.md section 6): the Playdate game's woodcut
 * look with colour. Bold ink outlines, hard ink shadows down and to the right,
 * flat colour: pale wood, grass green, paper. Londrina Solid Black for the
 * display type; Inter and the frame from the shared tokens (tokens.css,
 * vendored from thingelstad.com/shared). Light only. No italics on sans-serif
 * type: accents are colour and weight.
 */

@font-face {
  font-family: "Londrina Solid";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("/fonts/LondrinaSolid-Black.woff2") format("woff2");
}

:root {
  --ink: #16130f;
  --paper: #f7f0de;
  --wood: #ecd09a;
  --wood-dark: #c79a58;
  --grass: #4f9a3b;
  --grass-dark: #3d7f2c;
  --baton: #fbf6ea;
  --shadow: 5px 5px 0 var(--ink);
  --display: "Londrina Solid", "Inter Tight", system-ui, sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  background: var(--paper);
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--jt-font-body);
  font-size: var(--jt-size-base);
  line-height: var(--jt-line-height);
  -webkit-text-size-adjust: 100%;
}
img,
svg {
  max-width: 100%;
}
a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}
a:hover {
  text-decoration-thickness: 3px;
}
a:focus-visible,
.button:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}
.frame {
  width: 100%;
  max-width: var(--jt-frame);
  margin-inline: auto;
  padding-inline: var(--jt-gutter);
}
.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 2;
  background: var(--paper);
  padding: 0.5rem 1rem;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The rail: an ink bar along the top, the HUD's. */
.rail {
  background: var(--ink);
  color: var(--paper);
}
.rail__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 24px;
  min-height: 48px;
}
.rail a {
  color: var(--paper);
  text-decoration: none;
}
.rail__brand {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}
.rail__nav {
  display: flex;
  gap: 20px;
}
.rail__nav a {
  font-weight: 800;
  font-size: var(--jt-size-label);
  letter-spacing: var(--jt-tracking-label);
  text-transform: uppercase;
}
.rail a[aria-current="page"],
.rail a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}
.rail a:focus-visible {
  outline-color: var(--paper);
}

/* Type */
.display,
h1,
h2,
h3 {
  font-family: var(--display);
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0.01em;
}
h1.display {
  font-size: clamp(2.6rem, 8vw, 4.2rem);
  margin: 0 0 0.3em;
}
h2.display {
  font-size: clamp(1.9rem, 5vw, 2.6rem);
  margin: 0 0 0.4em;
}
.lede {
  font-size: 1.15em;
  max-width: var(--jt-measure);
}
.label {
  font-weight: 800;
  font-size: var(--jt-size-label);
  letter-spacing: var(--jt-tracking-label);
  text-transform: uppercase;
}
.notice {
  display: inline-block;
  margin: 1.2rem 0 0;
  padding: 0.5rem 0.9rem;
  background: var(--baton);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  font-weight: 600;
  font-size: var(--jt-size-small);
}

/* Buttons: pale wood blocks with an ink outline and a hard shadow that the
   block drops into when pressed. */
.button {
  display: inline-block;
  padding: 0.7rem 1.3rem;
  background: var(--wood);
  color: var(--ink);
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.3rem;
  letter-spacing: 0.04em;
  line-height: 1.1;
  text-transform: uppercase;
  text-decoration: none;
  transition:
    transform 80ms,
    box-shadow 80ms;
}
.button:hover {
  background: #f2dcae;
}
.button:active {
  transform: translate(4px, 4px);
  box-shadow: 1px 1px 0 var(--ink);
}
.button--start {
  background: var(--grass);
  color: var(--baton);
  font-size: clamp(1.8rem, 6vw, 2.4rem);
  padding: 0.8rem 1.8rem;
  box-shadow: 7px 7px 0 var(--ink);
  -webkit-text-stroke: 1px var(--ink);
  paint-order: stroke fill;
}
.button--start:hover {
  background: #5aab45;
}

/* The home page's hero */
.hero {
  position: relative;
  background: var(--paper);
  border-bottom: 6px solid var(--ink);
}
.hero__inner {
  padding-top: clamp(1.5rem, 5vw, 3.5rem);
  padding-bottom: 1rem;
}
.hero__title {
  margin: 0 0 1rem;
  font-family: var(--display);
  line-height: 0.9;
}
.hero__kubb {
  display: block;
  font-size: clamp(5rem, 22vw, 10rem);
  color: var(--wood);
  -webkit-text-stroke: clamp(3px, 0.9vw, 6px) var(--ink);
  paint-order: stroke fill;
  text-shadow: 0.05em 0.05em 0 var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.hero__band {
  display: inline-block;
  margin-top: 0.15em;
  padding: 0.12em 0.4em 0.08em;
  background: var(--ink);
  color: var(--paper);
  font-size: clamp(1.8rem, 6.5vw, 3rem);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.1rem;
  margin-top: 1.6rem;
}
.actions__more {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.1rem;
}
.hero__scene {
  display: block;
  width: 100%;
  height: clamp(130px, 26vw, 320px);
  margin-top: 1rem;
}

/* Sections */
main > section:not(.hero) {
  padding-block: clamp(1.8rem, 5vw, 3rem);
}
.steps {
  list-style: none;
  counter-reset: step;
  margin: 0 0 1.2rem;
  padding: 0;
  display: grid;
  gap: 1rem;
  max-width: var(--jt-measure);
}
.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 3.2rem;
  min-height: 2.4rem;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.1rem;
  width: 2.3rem;
  height: 2.3rem;
  display: grid;
  place-items: center;
  background: var(--wood);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.3rem;
}
.about p,
.how > p,
.prose p {
  max-width: var(--jt-measure);
}
.more {
  font-weight: 700;
}
.intro {
  padding-top: clamp(1.8rem, 5vw, 3rem);
}

/* The rules: wood cards with hard shadows. */
.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 1.6rem;
}
.card {
  background: var(--baton);
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
  padding: 1rem 1.2rem 0.4rem;
}
.card__title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.6rem;
  font-size: 1.7rem;
}
.card__n {
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  background: var(--grass);
  color: var(--baton);
  border: 3px solid var(--ink);
  font-size: 1.2rem;
}
.card p {
  margin: 0 0 0.7rem;
}
.throw-steps {
  max-width: var(--jt-measure);
  padding-left: 1.4rem;
}
.throw-steps li + li {
  margin-top: 0.6rem;
}
.controls {
  border-collapse: collapse;
  margin: 1.4rem 0;
  max-width: var(--jt-measure);
  width: 100%;
  background: var(--baton);
  border: 3px solid var(--ink);
  box-shadow: var(--shadow);
}
.controls caption {
  text-align: left;
  padding-bottom: 0.4rem;
}
.controls th,
.controls td {
  text-align: left;
  vertical-align: top;
  padding: 0.55rem 0.8rem;
  border-top: 2px solid var(--ink);
}
.controls tr:first-child th,
.controls tr:first-child td {
  border-top: 0;
}
.controls th {
  font-weight: 700;
  width: 45%;
}

/* Footer: the grass. */
.foot {
  margin-top: 1rem;
  background: var(--grass);
  color: var(--baton);
  border-top: 6px solid var(--ink);
  padding-block: 1.6rem 2rem;
  font-size: var(--jt-size-small);
}
.foot p {
  margin: 0 0 0.6rem;
  max-width: var(--jt-measure);
}
.foot__small {
  font-size: var(--jt-size-meta);
}
.h-card {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  vertical-align: middle;
}
.h-card data {
  display: none;
}
.h-card img {
  border-radius: 50%;
  border: 2px solid var(--ink);
  width: 28px;
  height: 28px;
}

/* The game page: the canvas fills the window; the client draws #ui over it. */
html.game-html,
body.game {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body.game {
  background: var(--grass);
  touch-action: none;
}
#pitch {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
#ui > * {
  pointer-events: auto;
}
.noscript {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  gap: 0.6rem;
  padding: var(--jt-gutter);
  background: var(--paper);
  text-align: center;
}
.noscript p {
  margin: 0 auto;
  max-width: 34rem;
}

@media (max-width: 40rem) {
  .rail__brand {
    font-size: 1.15rem;
  }
  .controls th {
    width: auto;
  }
  .controls th,
  .controls td {
    display: block;
  }
  .controls td {
    border-top: 0;
    padding-top: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .button {
    transition: none;
  }
}
main > section.intro + section {
  padding-top: 0.5rem;
}

/* The home page's choice beside START A PITCH (public/js/start.js) */
.access {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  border: 0;
}
.access legend {
  margin-bottom: 0.2rem;
  padding: 0;
}
.access label {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  font-weight: 600;
}
.access input {
  accent-color: var(--grass);
}

/* Open games (public/js/open-games.js) */
.open-games > p {
  max-width: var(--jt-measure);
}
.open-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.8rem;
  max-width: var(--jt-measure);
}
.open-list:empty {
  display: none;
}
.open-game {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 1rem;
  padding: 0.7rem 0.9rem;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}
.open-game__text {
  font-weight: 700;
}
.open-game__join {
  font-size: 1.1rem;
  padding: 0.45rem 1rem;
}
.open-status:empty {
  display: none;
}
