/* Gnomeageddon website. Colours: the game's Day palette (scripts/pixel/PhasePalette.cs) for the cream column, and Dusk Wren's
   own three (#2b1b3d, #ef8a3c, #f6e7c8) for the page around it and the footer. All pixel art is drawn at 1x and scaled here
   by whole numbers, pixelated. */

:root {
  /* Dusk Wren */
  --wren-purple: #2b1b3d;
  --wren-orange: #ef8a3c;
  --wren-cream: #f6e7c8;
  /* the game's Day palette */
  --day-bg: #efe5cf;
  --day-fill: #fbf5e6;
  --day-ink: #3b2a20;
  --day-spot: #d8612b;
  --day-light: #e9dcc0;
  --day-door: #ddcfb2;
  --day-dim: #c7b99c;
  /* the plum outline of the wordmark (the Harvest Moon's silhouette) */
  --plum: #1b1320;

  /* pixel scales: --k the logo, gnome strip and buttons; --hk the headings (drawn at font size 2); --ck the countdown */
  --k: 2;
  --hk: 2;
  --ck: 2;
  /* the screen's device pixel ratio (js/site.js sets it), so whole-number scales stay whole in device pixels */
  --dpr: 1;

  --gutter: 16px;
  --pad: 16px;
  color-scheme: light;
}

@media (min-width: 560px) {
  :root { --ck: 3; --gutter: 24px; --pad: 24px; }
}
@media (max-width: 359px) {
  :root { --hk: 1; }
}
@media (min-width: 1072px) {
  :root { --pad: 40px; }
}

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

html { background: var(--wren-purple); }

body {
  margin: 0;
  padding: var(--gutter);
  background: var(--wren-purple);
  color: var(--day-ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

/* ---------- pixel art: drawn at 1x, scaled by a whole number ---------- */

img, canvas, video { max-width: 100%; }

.px {
  --s: var(--k);
  display: block;
  image-rendering: pixelated;
  width: calc(var(--w) * var(--s) * 1px);
  height: calc(var(--h) * var(--s) * 1px);
  max-width: none;
}
/* Where CSS round() exists, the scale is rounded to whole device pixels (a 2x image on a 125% screen gets 3 device pixels
   per art pixel, not 2.5), so every art pixel is the same size. */
@supports (width: calc(round(nearest, 2.5, 1) * 1px)) {
  .px {
    width: calc(var(--w) * round(nearest, var(--s) * var(--dpr), 1) / var(--dpr) * 1px);
    height: calc(var(--h) * round(nearest, var(--s) * var(--dpr), 1) / var(--dpr) * 1px);
  }
}

.sr-only, .countdown-text.drawn {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip {
  position: absolute;
  left: 8px; top: -60px;
  z-index: 10;
  padding: 8px 14px;
  background: var(--wren-cream);
  color: var(--wren-purple);
  font-weight: 700;
  text-decoration: none;
}
.skip:focus { top: 8px; }

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

/* ---------- the page: a cream column, centred, not full width ---------- */

.page {
  max-width: 1040px;
  margin: 0 auto;
  background: var(--day-bg);
  /* a crisp ink frame and a hard pixel shadow */
  box-shadow: 0 0 0 4px var(--day-ink), 8px 8px 0 4px var(--plum);
}

/* ---------- header: the logo, the gnome strip, the countdown and the buttons ---------- */

.top {
  padding: calc(var(--pad) + 8px) var(--pad) var(--pad);
  border-bottom: 4px solid var(--day-ink);
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.logo { margin: 0; line-height: 0; }
.logo img { --w: 108; --h: 53; }
@media (min-width: 560px) {
  .logo img { --w: 187; --h: 32; }
}

/* the strip is a button (click to pause); it may be wider than a phone, so its sides are cropped */
.gnome-run {
  display: flex;
  justify-content: center;
  width: 100%;
  overflow: hidden;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  cursor: pointer;
  line-height: 0;
}
.gnome-run .px { flex: none; }

@media (min-width: 880px) {
  .hero {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end;
  }
  .gnome-run { width: auto; }
}

.bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-top: 28px;
}
@media (min-width: 720px) {
  .bar {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
}
.countdown .px { --s: var(--ck); }
.countdown canvas:not(.ready) { display: none; }
.countdown-text {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--day-spot);
}

/* the separator between the countdown and the buttons */
@media (min-width: 720px) {
  .buttons {
    padding-left: 24px;
    border-left: 4px solid var(--day-ink);
  }
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 16px;
  background: var(--day-fill);
  border: 4px solid var(--day-ink);
  box-shadow: 4px 4px 0 var(--day-ink);
  text-decoration: none;
}
.btn .px { --s: 3; }
.btn:hover { background: var(--day-light); }
.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--day-ink); }
.btn[aria-disabled="true"] {
  background: var(--day-door);
  border-color: var(--day-dim);
  box-shadow: 4px 4px 0 var(--day-dim);
  cursor: not-allowed;
  opacity: 0.75;
}
.btn[aria-disabled="true"]:active { transform: none; box-shadow: 4px 4px 0 var(--day-dim); }

/* ---------- About this game ---------- */

.about {
  padding: var(--pad);
  padding-top: calc(var(--pad) + 8px);
}
.about:focus { outline: none; }

.pixel-head {
  margin: 0 0 20px;
  line-height: 0;
}
.pixel-head .px { --s: var(--hk); }
h2.pixel-head {
  display: flex;
  justify-content: center;
  margin-bottom: 36px;
}
@media (min-width: 640px) {
  h2.pixel-head .px { --s: calc(var(--hk) + 1); }
}
/* the long headings swap to two lines below 640 px (a <picture> in index.html); their art sizes follow */
.h-acorn { --w: 207; --h: 13; }
.h-grove { --w: 249; --h: 13; }
.h-hundreds { --w: 231; --h: 13; }
.h-land { --w: 257; --h: 13; }
@media (max-width: 639px) {
  .h-acorn { --w: 119; --h: 29; }
  .h-grove { --w: 145; --h: 29; }
  .h-hundreds { --w: 151; --h: 29; }
  .h-land { --w: 151; --h: 29; }
  h3.pixel-head { display: flex; justify-content: center; }
}

.chunk { margin: 0 0 56px; }
.chunk:last-child { margin-bottom: 16px; }

.copy { max-width: 42em; }
.copy p, .feature-list li { margin: 0 0 1em; }
strong { color: var(--day-ink); font-weight: 750; }

.clip {
  margin: 24px auto 0;
  max-width: 960px;
}
.clip video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: var(--day-ink);
  outline: 4px solid var(--day-ink);
  image-rendering: pixelated;
  cursor: pointer;
}
.clip figcaption {
  margin-top: 10px;
  font-size: 0.9375rem;
  font-style: italic;
}
.clip.missing { display: none; }

.features .clip { margin: 0 auto 28px; }
.feature-list {
  margin: 0;
  padding-left: 1.25em;
  max-width: 46em;
}
.feature-list li::marker { color: var(--day-spot); }
@media (min-width: 880px) {
  .feature-list {
    max-width: none;
    columns: 2;
    column-gap: 48px;
  }
  .feature-list li { break-inside: avoid; }
}

a { color: var(--day-ink); text-decoration-color: var(--day-spot); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--day-spot); }

/* ---------- footer: Dusk Wren ---------- */

.foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px var(--pad) 32px;
  background: var(--wren-purple);
  color: var(--wren-cream);
  border-top: 4px solid var(--day-ink);
  text-align: center;
}
.foot .studio { --s: 1; }
.foot p { margin: 0; font-size: 1rem; }
.foot .sep { color: var(--wren-orange); margin: 0 0.4em; }
.foot a { color: var(--wren-orange); text-decoration-color: var(--wren-orange); }
.foot a:hover { color: var(--wren-cream); }

/* ---------- the trailer, above About this game ---------- */

.trailer {
  max-width: 960px;
  margin: 0 auto 56px;
}
.trailer-frame { position: relative; }
.trailer video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  background: var(--day-bg);
  outline: 4px solid var(--day-ink);
  image-rendering: pixelated;
}
/* the play button covers the whole title card (a click anywhere plays); its pixel art sits a little below the middle, under
   the wordmark */
.play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12% 0 0;
  margin: 0;
  border: 0;
  background: none;
  cursor: pointer;
  line-height: 0;
}
.play[hidden] { display: none; }
.play .px { --s: 2; }
@media (min-width: 640px) {
  .play .px { --s: 3; }
}
.play:hover .px, .play:focus-visible .px { transform: translateY(-4px); }
.play:active .px { transform: none; }
.play:focus-visible { outline-offset: -8px; }
.trailer-missing {
  position: absolute;
  left: 50%;
  bottom: 14%;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 14px;
  background: var(--day-fill);
  border: 4px solid var(--day-ink);
  font-weight: 700;
  white-space: nowrap;
}

/* ---------- reduced motion: nothing moves on its own ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
