/* ==========================================================================
   Andile — holding page + runner game
   Colours, type and spacing follow Andile Style Guide (Aug 2026).
   ========================================================================== */

:root {
  /* --- Brand palette (sampled from the style guide) --------------------- */
  --green-900:  #023826;  /* primary dark — page ground                     */
  --green-800:  #0B4A33;
  --green-700:  #037D5A;
  --green-500:  #00AB4D;
  --green-400:  #4B7641;
  --olive-700:  #53682B;
  --olive-500:  #8E9300;
  --olive-300:  #89AF40;
  --lime-500:   #C9DD03;
  --lime-400:   #C0FF00;  /* primary accent                                 */
  --sage-300:   #B0BEA4;
  --sage-200:   #BED2B6;
  --mint-300:   #8BD4B8;
  --stone-500:  #82786F;
  --ink-900:    #30373C;

  /* --- Semantic tokens -------------------------------------------------- */
  --bg:            var(--green-900);
  --bg-deep:       #011f15;
  --accent:        var(--lime-400);
  --accent-dim:    var(--lime-500);
  --text:          #EAF3E4;
  --text-muted:    var(--sage-300);
  --rule:          rgba(192, 255, 0, .22);

  /* --- Type ------------------------------------------------------------- */
  --font-display: 'Michroma', 'Courier New', monospace;
  --font-body:    'Manrope', system-ui, -apple-system, sans-serif;
  --font-mono:    ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

  /* --- Layout ----------------------------------------------------------- */
  --shell-max: 1080px;
  --gutter: clamp(1.25rem, 5vw, 3rem);
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* --------------------------------------------------------------------------
   Screen — the CRT-ish surface everything sits on
   -------------------------------------------------------------------------- */

.screen {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 6vw, 4.5rem) var(--gutter);
  overflow: hidden;

  /* Brand gradient: deep green ground with a lime bloom, per the style guide */
  background:
    radial-gradient(120% 90% at 50% 118%, rgba(192,255,0,.20) 0%, rgba(192,255,0,0) 55%),
    radial-gradient(90% 70% at 12% -10%, rgba(3,125,90,.42) 0%, rgba(3,125,90,0) 60%),
    linear-gradient(178deg, var(--bg) 0%, var(--bg-deep) 100%);
}

/* Subtle scanlines + vignette — sells the "offline terminal" idea */
.scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0,0,0,.16) 0px,
      rgba(0,0,0,.16) 1px,
      transparent 1px,
      transparent 3px
    );
  mix-blend-mode: multiply;
  opacity: .55;
}

.scanlines::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(115% 85% at 50% 50%, transparent 55%, rgba(0,0,0,.55) 100%);
}

.shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--shell-max);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Status line
   -------------------------------------------------------------------------- */

/* Chip Style 1 from the style guide: soft fill, hairline border, lime label. */
.status {
  margin: 0 0 clamp(1.5rem, 4vw, 2.25rem);
  font-family: var(--font-mono);
  font-size: clamp(.625rem, 1.6vw, .75rem);
  font-weight: 600;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--accent-dim);

  display: inline-flex;
  align-items: center;
  gap: .7em;
  padding: .7em 1.25em .7em 1.1em;
  border: 1px solid rgba(192, 255, 0, .20);
  border-radius: 999px;
  background: rgba(192, 255, 0, .07);
}

.status__dot {
  width: .5em;
  height: .5em;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(192,255,0,.7);
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0   rgba(192,255,0,.55); opacity: 1;  }
  70%  { box-shadow: 0 0 0 .6em rgba(192,255,0,0);  opacity: .55;}
  100% { box-shadow: 0 0 0 0   rgba(192,255,0,0);   opacity: 1;  }
}

/* --------------------------------------------------------------------------
   Headline
   -------------------------------------------------------------------------- */

.headline {
  margin: 0 0 clamp(1rem, 2.5vw, 1.5rem);
  font-family: var(--font-display);
  font-weight: 400;
  /* Michroma is very wide — keep the ceiling modest so two lines still fit. */
  font-size: clamp(1.125rem, 3.6vw, 2.375rem);
  line-height: 1.42;
  letter-spacing: -.005em;
  color: var(--accent);
  text-wrap: balance;
  text-shadow: 0 0 26px rgba(192,255,0,.28);
}

/* --- Stroke element ------------------------------------------------------
   The brand's signature device: a lime band skewed at exactly 8.6°, with the
   word sitting straight on top of it (see "Style guide" on the cover).
   Only the band is skewed — the text stays level.
   -------------------------------------------------------------------------- */

.stroke {
  position: relative;
  display: inline-block;
  padding: 0 .32em;
  color: var(--green-900);
  text-shadow: none;
}

.stroke::before {
  content: '';
  position: absolute;
  inset: -.02em 0 -.06em;
  background: var(--accent-dim);
  transform: skewY(-8.6deg);
}

.stroke > span {
  position: relative;   /* keeps the word above the band */
}

.subhead {
  margin: 0 auto clamp(2rem, 5vw, 3rem);
  max-width: 46ch;
  font-size: clamp(.9375rem, 1.9vw, 1.0625rem);
  line-height: 1.65;
  color: var(--text-muted);
}

.br-desktop { display: none; }
@media (min-width: 640px) { .br-desktop { display: inline; } }

/* --------------------------------------------------------------------------
   Game
   -------------------------------------------------------------------------- */

.game {
  margin: 0 auto;
  max-width: 940px;
}

.game__hud {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0 .25rem .625rem;

  font-family: var(--font-mono);
  font-size: clamp(.75rem, 1.8vw, .875rem);
  font-weight: 600;
  letter-spacing: .18em;
  color: var(--accent-dim);
  font-variant-numeric: tabular-nums;
}

.game__best { color: var(--text-muted); }
.game__best span { color: var(--accent-dim); }

.game__stage {
  position: relative;
  border: 1px solid var(--rule);
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(2,56,38,.75) 0%, rgba(1,31,21,.9) 100%);
  box-shadow:
    0 0 0 1px rgba(0,0,0,.35),
    0 22px 60px -22px rgba(0,0,0,.85),
    inset 0 1px 0 rgba(192,255,0,.10);
}

#game {
  display: block;
  width: 100%;
  height: auto;
  /* Keep the pixel art crisp when the canvas is upscaled. */
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: manipulation;
  cursor: pointer;
}

/* --- Overlays ------------------------------------------------------------ */

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  padding: 1rem;

  background: rgba(1, 31, 21, .72);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  text-align: center;
  transition: opacity .18s ease;
}

.overlay.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(.875rem, 2.6vw, 1.375rem);
  color: var(--accent);
  letter-spacing: .02em;
}

.overlay__hint {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(.6875rem, 1.7vw, .8125rem);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* --- Key caps ------------------------------------------------------------ */

.key {
  display: inline-block;
  padding: .18em .5em;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: rgba(192,255,0,.07);
  color: var(--accent-dim);
  font-family: var(--font-mono);
  font-size: .95em;
  line-height: 1.2;
}

.game__controls {
  margin: .875rem 0 0;
  font-family: var(--font-mono);
  font-size: clamp(.625rem, 1.5vw, .75rem);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(176, 190, 164, .6);
  line-height: 2;
}

/* Show the hint that matches the input device, not the screen width. */
.ctl--keys  { display: none; }
.ctl--touch { display: inline; }

@media (hover: hover) and (pointer: fine) {
  .ctl--keys  { display: inline; }
  .ctl--touch { display: none; }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.foot {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding-top: clamp(1.5rem, 4vw, 2rem);
  border-top: 1px solid rgba(176, 190, 164, .16);
}

.foot__lead {
  margin: 0 0 .625rem;
  font-size: .9375rem;
  color: var(--text-muted);
}

.foot__links {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .75rem;
}

/* --- Buttons, per the style guide's UI elements --------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  padding: .8em 1.5em;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: .9375rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.btn--primary {
  background: var(--accent-dim);
  color: var(--green-900);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background: var(--accent);
}

.btn--secondary {
  border-color: var(--accent-dim);
  color: var(--accent-dim);
}

.btn--secondary:hover,
.btn--secondary:focus-visible {
  background: var(--accent-dim);
  color: var(--green-900);
}

.btn__arrow {
  transition: transform .15s ease;
}

.btn:hover .btn__arrow {
  transform: translateX(3px);
}

@media (prefers-reduced-motion: reduce) {
  .btn__arrow, .btn:hover .btn__arrow { transition: none; transform: none; }
}

/* --------------------------------------------------------------------------
   Focus + motion preferences
   -------------------------------------------------------------------------- */

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .status__dot { animation: none; }
  .overlay { transition: none; }
  .scanlines { opacity: .3; }
}

/* Small screens: Michroma is a wide face, so ease the headline down and let
   it wrap naturally rather than at the desktop line break. */
@media (max-width: 639px) {
  .screen { padding-top: 2.25rem; padding-bottom: 2.25rem; }

  .headline {
    font-size: clamp(1rem, 4.6vw, 1.25rem);
    line-height: 1.55;
    letter-spacing: -.01em;
  }

  .subhead { max-width: 34ch; }
  .status  { letter-spacing: .2em; }
}
