/*
  CraftAttack design system.
  Flat colour blocks, ink outlines, hard "pixel" shadows, one pixel display font.
  Everything is built from the tokens below; pages should not introduce new colours.
*/

:root {
  --ink: #16120f;
  --paper: #fff6e0;
  --white: #fff;
  --grass: #6fdc5a;
  --diamond: #4be3d6;
  --gold: #ffd23f;
  --redstone: #ff6452;
  /* Purple, pink and orange are taken from the CraftAttack 14 logo (dragon, portal stone, lettering). */
  --amethyst: #c88ae6;
  --pink: #f0b6e4;
  --lava: #ff9a2e;
  --ender: #2d1c36;
  --ender-2: #4f1a6d;
  --sky: #8ccdff;
  --dirt: #8a5a3b;
  --twitch: #9146ff;

  /* One "pixel". Outlines, notches and shadows are multiples of it. */
  --px: 4px;
  --outline: 0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink),
    calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink);
  --drop: var(--px) calc(var(--px) * 2) 0 0 var(--ink), calc(var(--px) * 2) var(--px) 0 0 var(--ink),
    calc(var(--px) * 2) calc(var(--px) * 2) 0 0 var(--ink);

  --font-display: 'Monocraft', ui-monospace, 'Courier New', monospace;
  --font-body: 'Bricolage Grotesque Variable', 'Bricolage Grotesque', system-ui, -apple-system,
    'Segoe UI', Roboto, sans-serif;

  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --space-block: clamp(48px, 8vw, 104px);

  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

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

a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

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

[data-tone='ink'] :focus-visible,
[data-tone='ender'] :focus-visible,
[data-tone='ender-2'] :focus-visible {
  outline-color: var(--gold);
}

/* Classes that set display (.tag, .btn, .cluster) must not defeat the hidden attribute. */
[hidden] {
  display: none !important;
}

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

/* ---------- Tones: put data-tone on a block, card, tag or button ---------- */

[data-tone='paper'] { --bg: var(--paper); --fg: var(--ink); }
[data-tone='white'] { --bg: var(--white); --fg: var(--ink); }
[data-tone='ink'] { --bg: var(--ink); --fg: var(--paper); }
[data-tone='ender'] { --bg: var(--ender); --fg: var(--paper); }
[data-tone='ender-2'] { --bg: var(--ender-2); --fg: var(--paper); }
[data-tone='lava'] { --bg: var(--lava); --fg: var(--ink); }
[data-tone='grass'] { --bg: var(--grass); --fg: var(--ink); }
[data-tone='diamond'] { --bg: var(--diamond); --fg: var(--ink); }
[data-tone='gold'] { --bg: var(--gold); --fg: var(--ink); }
[data-tone='redstone'] { --bg: var(--redstone); --fg: var(--ink); }
[data-tone='amethyst'] { --bg: var(--amethyst); --fg: var(--ink); }
[data-tone='pink'] { --bg: var(--pink); --fg: var(--ink); }
[data-tone='sky'] { --bg: var(--sky); --fg: var(--ink); }
[data-tone='twitch'] { --bg: var(--twitch); --fg: var(--white); }

/* ---------- Layout ---------- */

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

.wrap--narrow {
  max-width: calc(760px + var(--gutter) * 2);
}

/* Full-width coloured section. */
.block {
  background: var(--bg, var(--paper));
  color: var(--fg, var(--ink));
  padding-block: var(--space-block);
}

.block--tight {
  padding-block: calc(var(--space-block) / 2);
}

/* Page header block used on every sub page. */
.page-head {
  padding-block: clamp(40px, 7vw, 88px) clamp(32px, 5vw, 64px);
}

.page-head p {
  max-width: 56ch;
  margin-top: 16px;
  font-size: 1.1875rem;
}

.stack > * + * {
  margin-top: var(--stack, 16px);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap, 12px);
  align-items: center;
}

.grid {
  display: grid;
  gap: var(--gap, 24px);
  grid-template-columns: repeat(auto-fill, minmax(var(--min, 260px), 1fr));
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: clamp(24px, 4vw, 40px);
}

/* ---------- Type ---------- */

.h-hero {
  font-size: clamp(3.25rem, 13vw, 9rem);
  line-height: 0.86;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.h-1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  text-transform: uppercase;
}

.h-2 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  text-transform: uppercase;
}

.h-3 {
  font-size: clamp(1.375rem, 3vw, 1.75rem);
}

.eyebrow {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.lead {
  font-size: clamp(1.125rem, 2.2vw, 1.375rem);
  max-width: 52ch;
}

.muted {
  opacity: 0.72;
}

.num {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
}

/* ---------- Pixel box: notched outline + hard shadow ---------- */

.box {
  background: var(--bg, var(--white));
  color: var(--fg, var(--ink));
  box-shadow: var(--outline), var(--drop);
  /* The outline lives outside the box, keep it from touching neighbours. */
  margin: var(--px) calc(var(--px) * 2) calc(var(--px) * 2) var(--px);
  padding: clamp(16px, 3vw, 24px);
}

/* .box sets its own margin, which would swallow the spacing of a .stack parent. */
.stack > * + .box {
  margin-top: calc(var(--stack, 16px) + var(--px));
}

.box--flat {
  box-shadow: var(--outline);
  margin: var(--px);
}

a.box,
.box--link {
  display: block;
  text-decoration: none;
  transition: transform 0.12s ease;
}

@media (hover: hover) {
  a.box:hover,
  .box--link:hover {
    transform: translate(-2px, -3px);
  }
}

a.box:active,
.box--link:active {
  transform: translate(var(--px), var(--px));
  box-shadow: var(--outline);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 20px;
  margin: var(--px) calc(var(--px) * 2) calc(var(--px) * 2) var(--px);
  border: 0;
  background: var(--bg, var(--gold));
  color: var(--fg, var(--ink));
  box-shadow: var(--outline), var(--drop);
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) {
  .btn:hover {
    transform: translate(-2px, -2px);
  }
}

.btn:active {
  transform: translate(var(--px), var(--px));
  box-shadow: var(--outline);
}

.btn--small {
  min-height: 40px;
  padding: 6px 14px;
  font-size: 1rem;
}

.btn svg {
  width: 1.2em;
  height: 1.2em;
  flex: none;
}

/* ---------- Tags, stickers, live dot ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  margin: var(--px);
  background: var(--bg, var(--white));
  color: var(--fg, var(--ink));
  box-shadow: var(--outline);
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.sticker {
  display: inline-block;
  padding: 8px 16px;
  background: var(--bg, var(--gold));
  color: var(--fg, var(--ink));
  box-shadow: var(--outline), var(--drop);
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  line-height: 1;
  rotate: var(--tilt, -4deg);
}

.dot {
  width: 10px;
  height: 10px;
  flex: none;
  background: var(--dot, var(--grass));
  box-shadow: 0 0 0 2px var(--ink);
}

.dot--live {
  --dot: var(--redstone);
  animation: blink 1.4s steps(2, jump-none) infinite;
}

@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

/* ---------- Pixel teeth between two blocks ----------
   <div class="teeth" data-tone="grass"></div> placed at the top of the next block
   draws a row of square teeth in the tone colour. */

.teeth {
  height: calc(var(--px) * 3);
  background: linear-gradient(90deg, var(--bg) 50%, transparent 0) 0 0 / calc(var(--px) * 6) 100%;
}

/* ---------- Marquee ---------- */

.marquee {
  overflow: hidden;
  background: var(--bg, var(--ink));
  color: var(--fg, var(--paper));
  padding-block: 12px;
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.marquee__track {
  display: inline-flex;
  gap: 2.5em;
  padding-right: 2.5em;
  animation: marquee 40s linear infinite;
  will-change: transform;
}

@keyframes marquee {
  to {
    transform: translateX(-50%);
  }
}

/* ---------- Prose (news posts, imprint, season texts) ---------- */

.prose {
  font-size: 1.125rem;
  line-height: 1.65;
}

.prose > * + * {
  margin-top: 1.1em;
}

.prose h2 {
  font-size: clamp(1.625rem, 4vw, 2.25rem);
  margin-top: 1.8em;
  text-transform: uppercase;
}

.prose h3 {
  font-size: 1.375rem;
  margin-top: 1.6em;
}

.prose ul,
.prose ol {
  padding-left: 1.3em;
}

.prose li + li {
  margin-top: 0.4em;
}

.prose a {
  font-weight: 600;
  background: linear-gradient(var(--gold), var(--gold)) 0 100% / 100% 0.45em no-repeat;
  text-decoration: none;
}

.prose a:hover {
  background-size: 100% 100%;
}

.prose blockquote {
  margin-inline: 0;
  padding: 16px 20px;
  background: var(--white);
  box-shadow: var(--outline);
}

.prose img {
  box-shadow: var(--outline);
}

.prose code {
  font-size: 0.9em;
  background: var(--white);
  padding: 2px 6px;
  box-shadow: 0 0 0 2px var(--ink);
}

.prose hr {
  border: 0;
  height: var(--px);
  background: var(--ink);
  margin-block: 2em;
}

/* ---------- Skins ---------- */

/* Skin renders are transparent pixel art: keep them crisp when scaled up. */
.skin {
  image-rendering: auto;
  object-fit: contain;
  filter: drop-shadow(6px 6px 0 rgb(22 18 15 / 0.22));
}

.head {
  image-rendering: pixelated;
  box-shadow: 0 0 0 3px var(--ink);
  background: var(--white);
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .marquee__track {
    animation: none;
  }
}
