/* Gnome Sweet Gnome site styles: a daylight storybook garden.
   Colour roles map to game objects, so the palette doubles as a legend (docs/ART_SPEC.md):
   hat red = the gnome and his house, timber = player walls, gold = hints,
   teal / violet / amber = teleporter pairs, blue = river, brown = bridge, grey and green = permanent. */

:root {
  --page: #e3ecd2;       /* page background */
  --panel: #f8fbf1;      /* cards, stats, result panel */
  --grid: #c9d7b2;       /* borders */
  --chalk: #2f4220;      /* primary text */
  --muted: #5d6e4c;      /* secondary text */
  --robot: #c94a32;      /* the gnome, primary actions, current level. White text on it */
  --robot-deep: #a8382a; /* pressed and hover state of --robot */
  --wall: #c48a52;       /* anything about player walls (fills, never text) */
  --sign: #8d5d38;       /* wooden sign boards: timber dark enough for cream text */
  --sign-deep: #6b4226;  /* the sign you are on */
  --beacon: #c94a32;     /* the house, used sparingly */
  --teleporter: #3fb8a3; /* teleporter badges and link line (graphics, with an outline) */
  --teleporter-ink: #1f6f5f; /* teleporter colour when it has to be text on cream */
  --gold: #e9b949;       /* stars, hints */
  --outline: #3b2618;    /* 2px outlines on buttons and cards, like the art */
  --grass: #8cbf5a;
  --river: #5aa9d6;
  --bridge: #a0703f;
  --rock: #9aa3a6;

  --font-display: "Grandstander", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: 1.75rem;
  --step-3: clamp(2.25rem, 6vw, 3.75rem);

  --gutter: 16px;
  --measure: 62ch;
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--page);
  color: var(--chalk);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
}

a { color: var(--chalk); text-decoration-color: var(--robot); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--robot-deep); }

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

.wrap {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1rem;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--step-1);
  color: var(--chalk);
  text-decoration: none;
  letter-spacing: 0.005em;
  white-space: nowrap;
}
.wordmark:hover { color: var(--chalk); }
.wordmark img { width: 36px; height: 36px; display: block; }
.site-nav a {
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
  margin-left: 1.25rem;
  display: inline-block;
  padding-block: 0.6rem;
}
.site-nav a:hover { color: var(--chalk); }
.site-nav a[aria-current="page"] { color: var(--chalk); text-decoration: underline; text-decoration-color: var(--robot); text-decoration-thickness: 3px; text-underline-offset: 6px; }

/* Hero */
.hero {
  display: grid;
  gap: 2.5rem;
  align-items: center;
  padding-block: 1.5rem 3rem;
}
@media (min-width: 860px) {
  .hero { grid-template-columns: 1.05fr 1fr; padding-block: 3rem 5rem; }
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--step-3);
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
  text-wrap: balance;
}
.hero .tagline {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--step-1);
  line-height: 1.25;
  color: var(--robot-deep);
  margin: 0 0 1.1rem;
}
.hero p {
  max-width: 44ch;
  color: var(--muted);
  font-size: var(--step-0);
  line-height: 1.55;
  margin: 0 0 1.75rem;
}
.hero p.tagline { max-width: none; }
/* Home hero text column: everything centred under Sir Croakwell. */
.hero-text { text-align: center; }
.hero-text p { margin-inline: auto; }
.hero-text .hero-actions { margin-inline: auto; }

/* Buttons: rounded pills with a 2px outline and a small offset shadow that flattens on press. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--step-0);
  line-height: 1.2;
  min-height: 48px;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  text-decoration: none;
  border: 2px solid var(--outline);
  background: var(--robot);
  color: #fff;
  box-shadow: 0 2px 0 var(--outline);
  cursor: pointer;
  transition: transform 80ms ease, box-shadow 80ms ease, background-color 120ms ease;
}
.btn:hover { background: var(--robot-deep); color: #fff; }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 0 0 var(--outline); }
.btn.quiet { background: var(--panel); color: var(--chalk); }
.btn.quiet:hover { background: var(--grid); color: var(--chalk); }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }

/* Home hero: Sir Croakwell faces the player with his bubble, then the daily buttons. */
.toad-stage { position: relative; width: min(100%, 240px); margin: 0 auto 1rem; } /* small on a phone so Easy and Hard stay above the fold */
@media (min-width: 860px) { .toad-stage { width: min(100%, 300px); margin: 0 auto 1.25rem; } }
.toad-stage .toad-front { display: block; width: 100%; height: auto; }
.bubble {
  position: absolute;
  margin: 0;
  padding: 0.45rem 0.65rem;
  background: #fffaf0;
  color: var(--chalk);
  border: 2px solid var(--outline);
  border-radius: 16px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.875rem;
  line-height: 1.2;
}
.bubble::before, .bubble::after { content: ""; position: absolute; border-style: solid; border-color: transparent; }
/* The tail points right and down, at the toad. */
.bubble::before { right: -17px; top: 62%; border-width: 8px 0 8px 17px; border-left-color: var(--outline); }
.bubble::after { right: -12px; top: calc(62% + 2.5px); border-width: 6px 0 6px 13px; border-left-color: #fffaf0; }
.toad-stage .bubble { left: -2%; top: 60%; width: 40%; } /* below his cheek, 2 to 3 lines */
.hero-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 26rem; }
.hero-actions .btn.big { flex-direction: column; gap: 2px; min-height: 64px; border-radius: 16px; font-size: var(--step-1); }
.hero-actions .btn.big small { font-family: var(--font-body); font-weight: 700; font-size: 0.8125rem; line-height: 1.2; }
.btn.hard { background: #4a3478; }
.btn.hard:hover { background: #3b2768; }

/* Board pieces shared by the game and the home-page replay. sprites.css draws the art. */
.board-frame {
  justify-self: center;
  width: min(440px, 100%);
}
.board {
  --n: 9;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  grid-template-rows: repeat(var(--n), 1fr);
  gap: 3px;
  aspect-ratio: 1 / 1;
  position: relative;
  box-shadow: 0 0 0 3px var(--outline); /* the board frame (a border would shift the measured bar positions) */
  border-radius: 14px;
}
.cell {
  position: relative;
  background: var(--grass);
}
.cell.teleporter.flash { box-shadow: 0 0 0 3px var(--teleporter), 0 0 16px var(--teleporter); z-index: 1; }
.cell.beacon.reached { box-shadow: 0 0 0 3px var(--beacon), 0 0 20px color-mix(in srgb, var(--beacon) 60%, transparent); z-index: 1; }
.cell.trail::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: color-mix(in srgb, var(--gold) 38%, transparent);
  pointer-events: none;
}
/* The spot the gnome starts from. It stays marked after he leaves. */
.cell.start::after {
  content: "";
  position: absolute;
  inset: 14%;
  border: 2px dashed color-mix(in srgb, var(--outline) 55%, transparent);
  border-radius: 50%;
  pointer-events: none;
}

/* Walls sit on the lines between tiles. Position and size are set from the tile boxes. */
.wall-bar {
  position: absolute;
  z-index: 1;
  pointer-events: none;
}

.robot {
  position: absolute;
  left: 0; top: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  transition: transform 300ms cubic-bezier(.4,.1,.3,1);
}

.status {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-top: 0.9rem;
  min-height: 3em;
  font-size: var(--step--1);
  color: var(--muted);
}
.status .moves { white-space: nowrap; }
.status strong { font-family: var(--font-display); color: var(--robot-deep); font-size: var(--step-0); }

/* Sections */
section { padding-block: 3rem; border-top: 2px solid var(--grid); }
h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--step-2);
  line-height: 1.15;
  margin: 0 0 1.5rem;
}
.rules {
  display: grid;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 760px) { .rules { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; } }
.rules li {
  background: var(--panel);
  border: 2px solid var(--outline);
  border-radius: 14px;
  padding: 1rem 1.1rem 1.2rem;
}
.rules h3 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--step-1);
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.rules p { margin: 0; color: var(--muted); max-width: 34ch; }
/* Small inline sprites as illustrations. */
.rules .art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 84px;
  margin-bottom: 0.75rem;
  border-radius: 8px;
  background: var(--grass);
  overflow: hidden;
}
.rules .art .tile { width: 64px; height: 64px; flex: none; background: center / 100% 100% no-repeat; }
.rules .art .wall-art { position: relative; display: block; width: 96px; }
.rules .art .gnome-sprite { display: block; width: 76px; height: 76px; }
.rules .art .gnome-sprite svg { display: block; width: 100%; height: 100%; }
.rules .art .wall-art svg { display: block; width: 100%; height: auto; }

.roadmap { list-style: none; margin: 0; padding: 0; max-width: var(--measure); counter-reset: phase; }
.roadmap li {
  position: relative;
  padding: 0 0 1.4rem 2.75rem;
  counter-increment: phase;
}
.roadmap li::before {
  content: counter(phase);
  position: absolute; left: 0; top: 0.05rem;
  width: 1.9rem; height: 1.9rem;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: var(--step--1);
  border: 2px solid var(--outline); border-radius: 50%;
  background: var(--panel);
  color: var(--muted);
}
.roadmap li.done::before { background: var(--grid); color: var(--chalk); }
.roadmap li.now::before { background: var(--robot); color: #fff; }
.roadmap strong { font-family: var(--font-display); font-weight: 800; }
.roadmap span { display: block; color: var(--muted); }

/* Simple content pages */
.page { padding-block: 3rem 5rem; max-width: var(--measure); }
.page h1 { font-family: var(--font-display); font-weight: 800; font-size: var(--step-3); line-height: 1.05; margin: 0 0 1rem; }
.page p { color: var(--muted); font-size: var(--step-1); }

.site-footer {
  border-top: 2px solid var(--grid);
  padding-block: 2rem 3rem;
  color: var(--muted);
  font-size: var(--step--1);
}

@media (max-width: 420px) {
  .site-header { padding-block: 0.5rem; }
  .wordmark { font-size: 0.9375rem; gap: 0.35rem; }
  .wordmark img { width: 32px; height: 32px; }
  .site-header { gap: 0.5rem; }
  .site-nav { white-space: nowrap; }
  .site-nav a { margin-left: 0.4rem; }
}

@media (max-width: 380px) {
  .wordmark { font-size: 0.875rem; gap: 0.3rem; }
  .wordmark img { width: 28px; height: 28px; }
  .site-header { gap: 0.25rem; }
  .site-nav a { margin-left: 0.3rem; font-size: 0.9375rem; }
}

@media (prefers-reduced-motion: reduce) {
  .robot, .cell, .btn { transition: none; }
  .wall-bar.drop { animation: none; }
}
