/* play.razorsharp.digital
   Plain CSS, no frameworks and no external requests.
   Matches razorsharp.digital: Raleway, white/zinc, purple accent in light mode
   and emerald accent in dark mode. Colours are the same values Tailwind uses
   on the main site. Change them in :root (and the dark block under it). */

@font-face {
  font-family: "Raleway";
  src: url("fonts/Raleway-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Raleway";
  src: url("fonts/Raleway-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --background: #ffffff;
  --foreground: oklch(21% 0.006 285.885);       /* zinc-900 */
  --line: oklch(92% 0.004 286.32);              /* zinc-200 */
  --tag: oklch(92% 0.004 286.32);               /* zinc-200: tags, like the breadcrumbs */
  --tag-highlight: oklch(82.7% 0.119 306.383);  /* purple-300: the first tag */
  --on-tag-highlight: oklch(21% 0.006 285.885); /* zinc-900 */
  --tag-selection: oklch(49.6% 0.265 301.924);  /* purple-700 */
  --accent: oklch(55.8% 0.288 302.321);         /* purple-600: links on hover, buttons */
  --accent-strong: oklch(49.6% 0.265 301.924);  /* purple-700: button hover */
  --ring: oklch(62.7% 0.265 303.9);             /* purple-500: focus ring */
  --on-accent: #ffffff;                         /* text sitting on the accent colour */
  --selection: oklch(76.5% 0.177 163.223);      /* emerald-400 */

  --font: "Raleway", Arial, Helvetica, sans-serif;
  --width: 56rem;
  --gutter: 1rem;
  /* Distance from the screen edge to the content column */
  --edge: max(var(--gutter), calc((100% - var(--width)) / 2));
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: oklch(21% 0.006 285.885);     /* zinc-900 */
    --foreground: #ffffff;
    --line: oklch(37% 0.013 285.805);           /* zinc-700 */
    --tag: oklch(27.4% 0.006 286.033);          /* zinc-800 */
    --tag-highlight: oklch(76.5% 0.177 163.223);/* emerald-400 */
    --on-tag-highlight: oklch(21% 0.006 285.885);
    --tag-selection: oklch(37.8% 0.077 168.94); /* emerald-900 */
    --accent: oklch(76.5% 0.177 163.223);       /* emerald-400: links on hover */
    --accent-fill: oklch(69.6% 0.17 162.48);    /* emerald-500: buttons */
    --accent-strong: oklch(59.6% 0.145 163.225);/* emerald-600: button hover */
    --ring: oklch(76.5% 0.177 163.223);         /* emerald-400 */
    --on-accent: oklch(21% 0.006 285.885);
    --selection: oklch(71.4% 0.203 305.504);    /* purple-400 */
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font);
  font-size: 1.25rem;
  line-height: 1.75rem;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--selection); color: #000; }

h1, h2, h3, p, ul, ol, figure { margin: 0; }
/* As on the main site (Tailwind resets headings), headings use the same
   weight as body text, so everything shows in Raleway SemiBold. Only
   <strong> uses Raleway Bold. */
h1, h2, h3 { font-weight: inherit; }
img { max-width: 100%; height: auto; display: block; }

:focus { outline: none; }
:focus-visible { box-shadow: 0 0 0 2px var(--ring); }

/* Text links, as on the main site: underlined, purple/emerald on hover */
a {
  color: var(--foreground);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  transition: color 0.2s;
}
a:hover, a:active, a:focus-visible { color: var(--accent); }

/* Primary button */
.button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--accent-fill, var(--accent));
  color: var(--on-accent);
  text-decoration: none;
  transition: background-color 0.2s;
}
.button:hover, .button:active, .button:focus-visible {
  background: var(--accent-strong);
  color: var(--on-accent);
}
.button::selection { background: var(--accent-strong); color: #fff; }

/* ---------- Skip link ---------- */
.skip {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 40;
  padding: 0.75rem 1.5rem;
  background: var(--accent-fill, var(--accent));
  color: var(--on-accent);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus { transform: none; color: var(--on-accent); }

/* ---------- Header ---------- */
.site-header {
  position: relative;
  z-index: 10;
  margin-bottom: 6rem;
  font-size: 1rem;
  line-height: 1;
}

/* The border sits on this inner bar so it can react to the header sticking */
.header-bar {
  background: var(--background);
  border-bottom: 2px solid transparent;
  transition: border-color 0.4s;
}

.brand {
  display: flex;
  align-items: center;
  width: max-content;
  height: 4rem;
  margin-left: var(--edge);
  text-decoration: none;
}

@media (min-width: 40rem) {
  .site-header { margin-bottom: 12rem; }
}

/* Sticky header with a border that fades in as soon as you scroll, like the
   main site. */
@media (min-width: 48rem) {
  .site-header {
    position: sticky;
    top: 0;
    container-type: scroll-state;
  }

  /* Newer browsers know when the header is stuck to the top, so the border
     fades in over 0.4 seconds, exactly as on the main site */
  @container scroll-state(stuck: top) {
    .header-bar { border-color: var(--line); }
  }

  /* Other browsers: tie the border to the scroll position instead, so it's
     fully shown within the first couple of pixels of scrolling. Browsers with
     neither feature simply show no border. */
  @supports not (container-type: scroll-state) {
    @supports (animation-timeline: scroll()) {
      .header-bar {
        animation: header-border linear both;
        animation-timeline: scroll();
      }
    }
  }
}

@keyframes header-border {
  0% { border-color: transparent; }
  0.2%, 100% { border-color: var(--line); }
}

/* ---------- Main and sections ---------- */
main {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 var(--gutter);
}

.section {
  width: 100%;
  max-width: var(--width);
  margin-bottom: 6rem;
}
.section--border {
  margin-bottom: 3rem;
  padding-bottom: 3rem;
  border-bottom: 2px solid var(--line);
}

/* Sections fade up as they scroll into view, in browsers that support it */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .section--reveal {
      animation: reveal ease-out both;
      animation-timeline: view();
      animation-range: entry 0% entry 40%;
    }
  }
}
@keyframes reveal { from { opacity: 0; transform: translateY(20px); } }

h1 { font-size: 3.75rem; line-height: 4.5rem; margin-bottom: 3rem; }
h2 { font-size: 2.25rem; line-height: 2.5rem; margin-bottom: 1.5rem; }
h3 { font-size: 1.5rem; line-height: 2rem; }

.section p + p,
.section p + .list,
.section .list + p,
.section p + .button { margin-top: 1.5rem; }

.list {
  list-style: disc inside;
  padding: 0;
}
.list li + li { margin-top: 0.75rem; }

/* ---------- Game list ----------
   Add a game by copying one <li class="game"> in index.html.
   The grid fills in by itself, so there's nothing to change here. */
.games {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  column-gap: 2rem;
}
@media (min-width: 40rem) {
  .games { grid-template-columns: repeat(2, 1fr); }
}

.game {
  position: relative;
  display: flex;
  gap: 1.25rem;
  padding: 2rem 0;
  border-bottom: 2px solid var(--line);
}
.games > .game:nth-child(-n+2) { padding-top: 0; }
@media (max-width: 39.99rem) {
  .games > .game:nth-child(2) { padding-top: 2rem; }
}

.game img {
  flex: none;
  align-self: flex-start;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 1rem;
}

/* Text column: title, sentence, then tags pinned to the bottom so they
   line up across each row */
.game > div {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.game h3 { font-size: 1.25rem; line-height: 1.75rem; margin-bottom: 0.5rem; }
/* Makes the whole entry clickable */
.game h3 a::after { content: ""; position: absolute; inset: 0; }
.game:hover h3 a { color: var(--accent); }

.game p { font-size: 1.125rem; line-height: 1.75rem; }

/* Tags look like the breadcrumbs on the main site: flat grey blocks, with
   the first one (the kind of game) in purple, or emerald in dark mode */
.game .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1.25rem;
  font-size: 1rem;
  line-height: 1.5rem;
}
.tag {
  padding: 0.5rem 0.75rem;
  background: var(--tag);
  color: var(--foreground);
  white-space: nowrap;
}
.tag:first-child {
  background: var(--tag-highlight);
  color: var(--on-tag-highlight);
}
.tag:first-child::selection { background: var(--tag-selection); color: #fff; }

/* ---------- Questions (same as the FAQ on the main site) ---------- */
.faq {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: 2rem;
  align-items: start;
}
@media (min-width: 40rem) {
  .faq { grid-template-columns: repeat(2, 1fr); }
}

.faq details { border-bottom: 2px solid var(--line); }
.faq summary {
  padding: 1rem 0;
  cursor: pointer;
  transition: color 0.2s;
}
.faq summary:hover, .faq summary:active, .faq summary:focus-visible { color: var(--accent); }
.faq .body { margin: 1rem 0; font-size: 1.125rem; line-height: 1.75rem; }
.faq .body p + p { margin-top: 0.75rem; }
.faq .body h3 { font-size: 1.125rem; line-height: 1.75rem; font-weight: 700; margin: 1.25rem 0 0.25rem; }
.faq ol { padding-left: 1.5rem; }
.faq ol li + li { margin-top: 0.5rem; }

/* ---------- Footer ---------- */
/* Arrow-in-a-box icon on links that open in a new tab, as on the main site */
.external {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin-left: 0.25rem;
  vertical-align: baseline;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 var(--gutter);
  margin-bottom: 6rem;
  font-size: 1rem;
  line-height: 1.5rem;
}
.site-footer .inner {
  width: 100%;
  max-width: var(--width);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
}
.site-footer nav { display: flex; gap: 1rem; }
@media (min-width: 48rem) {
  .site-footer .inner { flex-direction: row; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
main:focus-visible { box-shadow: none; }
