/* Crown Race: the 16-bit sunset tube inside the shared editorial shell.
   Colours come from CrownArt.kt. Hard edges and hard offset shadows only: no blur, no glow.
   --u is the size of one frame pixel on screen, so the watch art always scales by a whole number. */
.crownrace {
  --ink-0:#0a0618;
  --night:#0f0c2e;
  --night-2:#1c1650;
  --plum:#241250;
  --edge:#4c3296;
  --edge-lt:#8a68dc;
  --lilac:#b8a0f0;
  --body-dark:#d8ccf4;
  --cream:#fff4c8;
  --sun:#ffe88a;
  --yel:#ffd232;
  --amber:#ee8a1c;
  --red:#d81e30;
  --red-hi:#ff4a3c;
  --red-lo:#841236;
  --mint:#58f0ae;
  --violet:#c08cff;
  --cyan:#58e4ff;
  --cyan-mid:#1a9ce0;
  --pink:#ff4d9a;
  --pink-hi:#ffc6e0;
  --steel:#a8b8ec;
  --accent:var(--red-lo);
  --ink:var(--ink-0);
  --ink-dim:#3b2a5e;
  --ink-mute:#54406f;
  --rule:#d9c98f;
  --u:3px;
  --logo:6;
  --pixel:'Silkscreen',var(--mono);
  /* Notched pixel corners with a game-panel bevel: light top and left, shade bottom and right. */
  --panel:
    inset 4px 4px 0 var(--edge-lt),
    inset -4px -4px 0 var(--plum),
    -4px 0 0 var(--ink-0),
    4px 0 0 var(--ink-0),
    0 -4px 0 var(--ink-0),
    0 4px 0 var(--ink-0),
    8px 8px 0 var(--edge)
}

@media(max-width:479px),(min-width:1001px) and (max-width:1239px) {
  .crownrace {
    --u:2px
  }
}

.icon-sprite {
  position:absolute;
  width:0;
  height:0;
  overflow:hidden
}

/* Pixel icons: 12 x 12 bitmaps, always at a whole-number scale (1x, 2x or 3x). */
.icon {
  width:24px;
  height:24px;
  flex:none;
  fill:currentColor;
  shape-rendering:crispEdges
}

.crownrace a {
  text-decoration-thickness:2px
}

.wrap {
  max-width:1400px;
  margin:auto;
  padding:0 var(--gutter)
}

.split {
  display:grid;
  grid-template-columns:minmax(0,5fr) minmax(0,6fr);
  gap:clamp(32px,6vw,96px);
  align-items:center
}

.crownrace h2 {
  font:900 clamp(32px,4vw,56px)/1.02 var(--display);
  letter-spacing:-.04em;
  margin:0;
  max-width:17ch;
  text-wrap:balance;
  text-shadow:3px 3px 0 var(--yel)
}

.tunnel h2,.versions h2 {
  text-shadow:3px 3px 0 var(--edge)
}

.crownrace h3 {
  font:900 20px/1.25 var(--display);
  letter-spacing:-.03em;
  margin:0 0 6px
}

.lead {
  font-size:clamp(17px,1.4vw,20px);
  line-height:1.6;
  color:var(--ink-dim);
  margin:20px 0 0;
  max-width:46ch
}

/* Buttons: square, 52px, hard offset shadow that presses in. */
.btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  min-height:52px;
  padding:14px 22px;
  font-size:16px;
  font-weight:600;
  text-decoration:none;
  border:2px solid var(--ink-0)
}

.btn-line {
  background:var(--plum);
  color:var(--cream);
  box-shadow:inset 2px 2px 0 var(--edge-lt),4px 4px 0 var(--edge)
}

.crownrace .btn-line:hover {
  background:var(--cream);
  color:var(--night);
  box-shadow:4px 4px 0 var(--yel)
}

.crownrace .btn-line:active {
  transform:translate(2px,2px);
  box-shadow:2px 2px 0 var(--yel)
}

/* Dark sections share the game's yellow for focus. */
.cr-hero :focus-visible,.tunnel :focus-visible,.versions :focus-visible {
  outline:3px solid var(--yel);
  outline-offset:3px
}

/* Hero */
.cr-hero {
  background:var(--night);
  color:var(--cream)
}

/* The tube's own colour steps, night to sun, in bands of one chunky pixel. */
.cr-hero::after {
  content:"";
  display:block;
  height:32px;
  background:linear-gradient(180deg,#1c1650 0 4px,#241250 4px 8px,#471864 8px 12px,#7a2268 12px 16px,#b83a50 16px 20px,#d4563e 20px 24px,#ee8a1c 24px 28px,#ffd232 28px 32px)
}

.hero-inner {
  display:grid;
  grid-template-columns:minmax(0,7fr) minmax(0,5fr);
  gap:clamp(32px,5vw,80px);
  align-items:center;
  padding:clamp(40px,6vw,88px) var(--gutter) clamp(40px,6vw,80px);
  max-width:1800px;
  margin:auto
}

.app-icon {
  display:block;
  width:96px;
  height:96px;
  margin:0 0 28px;
  box-shadow:-4px 0 0 var(--ink-0),4px 0 0 var(--ink-0),0 -4px 0 var(--ink-0),0 4px 0 var(--ink-0),8px 8px 0 var(--edge)
}

.app-icon img {
  display:block;
  width:96px;
  height:96px;
  image-rendering:pixelated
}

.cr-hero h1 {
  margin:0 0 28px;
  line-height:0
}

/* The real title logo, lifted from the game's frame at a whole-number scale. */
.logo {
  display:block;
  width:calc(74px*var(--logo));
  height:calc(34px*var(--logo));
  image-rendering:pixelated
}

.hero-lede {
  font-size:clamp(18px,1.6vw,22px);
  line-height:1.55;
  color:var(--body-dark);
  max-width:38ch;
  margin:0 0 36px
}

.hero-actions {
  display:flex;
  flex-wrap:wrap;
  align-items:stretch;
  gap:12px 16px;
  margin-bottom:44px
}

.soon {
  display:inline-flex;
  align-items:center;
  gap:12px;
  min-height:52px;
  margin:0;
  padding:12px 22px 12px 18px;
  border:2px solid var(--ink-0);
  background:var(--yel);
  color:var(--ink-0);
  font-size:16px;
  font-weight:700;
  box-shadow:inset 2px 2px 0 var(--sun),inset -2px -2px 0 var(--amber),4px 4px 0 var(--red-lo)
}

.hero-facts {
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  margin:0 8px 8px 0;
  max-width:720px;
  background:var(--night-2);
  box-shadow:var(--panel)
}

.hero-facts div {
  padding:16px 14px
}

.hero-facts div + div {
  box-shadow:inset 2px 0 0 var(--edge)
}

.hero-facts dt {
  font:400 16px/1.5 var(--pixel);
  text-transform:uppercase;
  -webkit-font-smoothing:none;
  color:var(--lilac)
}

.hero-facts dd {
  margin:4px 0 0;
  font:900 clamp(16px,1.3vw,19px)/1.2 var(--display);
  letter-spacing:-.02em;
  white-space:nowrap;
  color:var(--cream)
}

.hero-demo {
  margin:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  min-width:0
}

.demo-bar {
  width:min(100%,456px);
  margin-top:20px;
  padding-top:12px;
  border-top:2px solid var(--edge);
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  font:400 12px/1.5 var(--mono);
  color:var(--lilac)
}

/* Live caption: demo.js swaps the text on real demo events and fades it via opacity. */
.demo-caption {
  flex:1 1 100%;
  min-width:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  transition:opacity .2s steps(2,end)
}

@media(prefers-reduced-motion:reduce) {
  .demo-caption {
    transition:none
  }
}

/* Play in your browser: a square, chunky 44px target. */
.demo-play,.demo-toggle {
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:44px;
  padding:8px 14px;
  border:2px solid var(--ink-0);
  background:var(--plum);
  color:var(--cream);
  font:600 13px/1 var(--sans);
  flex:none;
  box-shadow:inset 2px 2px 0 var(--edge-lt),3px 3px 0 var(--edge)
}

.demo-play {
  background:var(--yel);
  color:var(--ink-0);
  box-shadow:inset 2px 2px 0 var(--sun),3px 3px 0 var(--red-lo)
}

.demo-play[hidden],.demo-toggle[hidden],.demo-hint[hidden] {
  display:none
}

.demo-toggle:hover {
  background:var(--edge);
  color:var(--cream)
}

.demo-play:hover {
  background:var(--cream)
}

.demo-play:active,.demo-toggle:active {
  transform:translate(2px,2px);
  box-shadow:1px 1px 0 var(--edge)
}

.demo-play .icon,.demo-toggle .icon {
  width:12px;
  height:12px
}

/* The full controls line, shown under the buttons only while playing. */
.demo-hint {
  flex:1 1 100%;
  font-size:11px;
  color:var(--cream)
}

/* Touch screens get the touch line; keyboards and mice the key line. */
.hint-touch {
  display:none
}

@media(pointer:coarse) {
  .hint-keys {
    display:none
  }

  .hint-touch {
    display:inline
  }
}

/* Play mode: the canvas takes keys and drags, so the page does not scroll under a finger on the
   watch, and the watch rings in yellow while it has keyboard focus. */
.is-playing .demo-canvas {
  touch-action:none;
  cursor:pointer
}

.demo-canvas:focus {
  outline:none
}

.is-playing .watch:focus-within {
  outline:4px solid var(--yel);
  outline-offset:2px
}

/* Watch: the frame shows at a whole number of device pixels, and the case art (watch.webp, with a
   stepped-circle hole cut from the same 64 px display radius) sits over it. The art has 152 x 188
   pixels and the display sits at (12, 30), so everything is a whole multiple of --u. */
.watch {
  position:relative;
  flex:none;
  width:calc(var(--u)*152);
  height:calc(var(--u)*188);
  /* Negative when the watch is wider than its column, so it stays centred without overflowing. */
  margin-inline:calc((100% - var(--u)*152)/2)
}

.watch::after {
  content:"";
  position:absolute;
  inset:0;
  background:url(/crownrace/watch.webp) center/100% 100% no-repeat;
  image-rendering:pixelated;
  pointer-events:none
}

.watch-face {
  position:absolute;
  left:calc(var(--u)*12);
  top:calc(var(--u)*30);
  width:calc(var(--u)*128);
  height:calc(var(--u)*128);
  overflow:hidden;
  /* Hides the frame's square corners behind the case; the stepped edge is the hole in watch.webp. */
  clip-path:circle(calc(var(--u)*67));
  background:var(--night)
}

.watch-face img,.demo-canvas {
  display:block;
  width:100%;
  height:100%;
  image-rendering:pixelated
}

.demo-canvas {
  position:absolute;
  inset:0;
  display:none
}

.has-demo .demo-canvas {
  display:block
}

/* Once the canvas is up the still is hidden from screen readers too, so only one image is announced. */
.has-demo .demo-still {
  visibility:hidden
}

/* How it plays: cream paper with chunky panels. */
.how {
  padding:clamp(64px,8vw,112px) 0;
  background:var(--cream);
  border-bottom:4px solid var(--ink-0)
}

.steps {
  list-style:none;
  margin:52px 0 0;
  padding:0;
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  column-gap:clamp(24px,3vw,48px);
  row-gap:32px
}

.steps li {
  padding:24px 22px;
  background:var(--night);
  color:var(--cream);
  box-shadow:var(--panel)
}

.steps .icon {
  width:36px;
  height:36px;
  color:var(--yel);
  margin-bottom:18px
}

.steps p {
  margin:0;
  font-size:16px;
  line-height:1.6;
  color:var(--body-dark)
}

/* What is in the tunnel: the game's own night field and the shipped sprites. */
.tunnel {
  position:relative;
  background:var(--night-2);
  color:var(--cream);
  padding:clamp(64px,8vw,112px) 0
}

/* One checker row, the only dither the tube uses. */
.tunnel::before,.versions::before {
  content:"";
  position:absolute;
  left:0;
  right:0;
  top:0;
  height:8px;
  background:repeating-conic-gradient(var(--plum) 0 25%,var(--edge) 0 50%) 0 0/8px 8px
}

.tunnel .lead {
  color:var(--body-dark)
}

.items {
  list-style:none;
  margin:52px 0 0;
  padding:0;
  display:grid;
  gap:24px
}

.items li {
  display:grid;
  grid-template-columns:96px minmax(0,1fr) minmax(120px,auto);
  gap:clamp(18px,3vw,48px);
  align-items:center;
  padding:22px 24px;
  background:var(--night);
  box-shadow:var(--panel)
}

.item-art {
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:96px
}

.item-icon {
  display:block;
  image-rendering:pixelated
}

.ic-block,.ic-oil {
  width:66px;
  height:42px
}

.ic-heart {
  width:54px;
  height:48px
}

.ic-missile {
  width:42px;
  height:54px
}

.ic-ring {
  width:96px;
  height:96px
}

.items h3 {
  font-size:clamp(20px,2vw,26px)
}

.items p {
  margin:0;
  max-width:60ch;
  font-size:16px;
  line-height:1.6;
  color:var(--body-dark)
}

.tag {
  justify-self:end;
  font:400 16px/1.25 var(--pixel);
  text-transform:uppercase;
  -webkit-font-smoothing:none;
  color:var(--cream)
}

.items li:nth-child(1) .tag,.items li:nth-child(2) .tag {
  color:var(--red-hi)
}

.items li:nth-child(3) .tag {
  color:var(--amber)
}

.items li:nth-child(4) .tag {
  color:var(--mint)
}

.items li:nth-child(5) .tag {
  color:var(--violet)
}

/* Built for the watch */
.built {
  background:var(--cream);
  padding:clamp(64px,8vw,112px) 0
}

.shot {
  margin:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  min-width:0
}

/* The two extra frames at 2x: side by side where they fit, stacked where they do not. */
.shot-more {
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:24px;
  margin-top:24px
}

.shot-more img {
  display:block;
  width:256px;
  height:256px;
  image-rendering:pixelated;
  filter:drop-shadow(4px 4px 0 var(--ink-0))
}

.shot figcaption {
  width:min(100%,456px);
  margin:20px auto 0;
  padding-top:12px;
  border-top:2px solid var(--ink-0);
  font:400 12px/1.6 var(--mono);
  color:var(--ink-mute)
}

.facts {
  list-style:none;
  margin:40px 0 0;
  padding:0;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  column-gap:clamp(24px,3vw,40px)
}

.facts li {
  display:flex;
  align-items:flex-start;
  gap:16px;
  padding:20px 0;
  border-top:4px solid var(--rule);
  font-size:16px;
  line-height:1.5;
  color:var(--ink-dim)
}

.facts li:nth-child(-n+2) {
  border-top-color:var(--ink-0)
}

.facts strong {
  display:block;
  font:900 18px/1.3 var(--display);
  letter-spacing:-.02em;
  color:var(--ink-0);
  margin-bottom:2px
}

.facts .icon {
  color:var(--red-lo)
}

/* Version history: the game's night field again, native disclosure rows as panels. */
.versions {
  position:relative;
  background:var(--night);
  color:var(--cream);
  padding:clamp(64px,8vw,112px) 0
}

.versions .lead {
  color:var(--body-dark)
}

.vlist {
  margin:52px 0 0;
  display:grid;
  gap:20px
}

.vlist details {
  background:var(--night-2);
  box-shadow:var(--panel)
}

.vlist summary {
  display:flex;
  align-items:baseline;
  gap:8px 20px;
  min-height:44px;
  padding:20px 22px;
  cursor:pointer;
  list-style:none
}

.vlist summary::-webkit-details-marker {
  display:none
}

/* A hard plus that turns into a minus when open. */
.vlist summary::after {
  content:"";
  flex:none;
  align-self:center;
  width:14px;
  height:14px;
  background:
    linear-gradient(var(--yel),var(--yel)) center/14px 4px no-repeat,
    linear-gradient(var(--yel),var(--yel)) center/4px 14px no-repeat
}

.vlist details[open] > summary::after {
  background:linear-gradient(var(--yel),var(--yel)) center/14px 4px no-repeat
}

.vlist summary:hover .v-title {
  color:var(--yel)
}

.v-num {
  flex:none;
  min-width:32px;
  font:600 14px/1.4 var(--mono);
  color:var(--cyan)
}

.v-title {
  flex:1 1 auto;
  min-width:0;
  font:900 clamp(20px,2vw,26px)/1.25 var(--display);
  letter-spacing:-.03em
}

.v-date {
  flex:none;
  font:400 12px/1.4 var(--mono);
  color:var(--lilac)
}

.vlist ul {
  margin:0;
  padding:0 22px 28px 74px;
  list-style:none;
  max-width:78ch
}

.vlist li {
  position:relative;
  padding-left:18px;
  font-size:16px;
  line-height:1.6;
  color:var(--body-dark)
}

.vlist li + li {
  margin-top:6px
}

.vlist li::before {
  content:"";
  position:absolute;
  left:0;
  top:.6em;
  width:8px;
  height:8px;
  background:var(--amber)
}

.site-footer {
  background:#0a0618;
  border-top-color:#0a0618
}

@media(max-width:1000px) {
  .hero-inner {
    grid-template-columns:1fr
  }

  /* Narrow screens: the watch and its caption bar lead, above the title and pitch. */
  .hero-demo {
    order:-1
  }

  .split {
    grid-template-columns:1fr
  }

  .steps {
    grid-template-columns:repeat(2,minmax(0,1fr))
  }
}

@media(max-width:600px) {
  .steps,.facts {
    grid-template-columns:1fr
  }

  .facts li:nth-child(2) {
    border-top-color:var(--rule)
  }

  .hero-facts {
    grid-template-columns:repeat(2,minmax(0,1fr))
  }

  .hero-facts div:nth-child(3) {
    box-shadow:none
  }

  .hero-facts div:nth-child(n+3) {
    border-top:2px solid var(--edge)
  }

  .hero-actions > * {
    flex:1 1 100%;
    justify-content:center
  }

  .crownrace {
    --logo:4
  }

  .items li {
    grid-template-columns:64px minmax(0,1fr);
    align-items:start;
    padding:18px 16px
  }

  .item-art {
    min-height:56px
  }

  .ic-block,.ic-oil {
    width:44px;
    height:28px
  }

  .ic-heart {
    width:36px;
    height:32px
  }

  .ic-missile {
    width:28px;
    height:36px
  }

  .ic-ring {
    width:64px;
    height:64px
  }

  .tag {
    grid-column:2;
    justify-self:start;
    margin-top:-8px
  }

  .vlist summary {
    gap:12px;
    padding:18px 16px
  }

  .v-title {
    font-size:18px
  }

  .vlist ul {
    padding:0 16px 24px
  }
}

/* Narrow phones: version, title and date stay on one line down to 320 px. */
@media(max-width:400px) {
  .vlist summary {
    gap:10px;
    padding:16px 14px
  }

  .v-num {
    min-width:24px;
    font-size:13px
  }

  .v-title {
    font-size:16px;
    letter-spacing:-.02em
  }

  .v-date {
    font-size:11px
  }

  .vlist summary::after {
    width:12px;
    height:12px;
    background-size:12px 4px,4px 12px
  }

  .vlist details[open] > summary::after {
    background-size:12px 4px
  }
}

/* The logo is 74 frame pixels wide: 3x still fits the content box at 320 px. */
@media(max-width:343px) {
  .crownrace {
    --logo:3
  }
}

/* Very narrow phones: the Pause/Play label hides visually (it still names the button) and the
   caption steps down a size, so the longest live caption stays on one line at 320 px. */
@media(max-width:379px) {
  .demo-bar {
    gap:8px;
    font-size:11px
  }

  .demo-toggle {
    min-width:44px;
    padding:8px 13px;
    justify-content:center
  }

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

/* Smallest phones: "Play in your browser" shortens to "Play" on screen (the full name stays). */
@media(max-width:344px) {
  .demo-play .opt {
    position:absolute;
    width:1px;
    height:1px;
    overflow:hidden;
    clip:rect(0 0 0 0);
    clip-path:inset(50%);
    white-space:nowrap
  }
}
