/* kondavo.com — one stylesheet for the whole static site.
 *
 * No framework, no web fonts, nothing loaded from another host. Two reasons,
 * both measured elsewhere in this repository: a rules page competing with
 * 2005-era hobby pages wins on being fast and readable, and every external
 * request is a request that can be slow, blocked or tracked. System fonts
 * render instantly and match the reader's platform.
 *
 * The rules pages do load two local scripts — the game's own engine compiled to
 * JavaScript, and the board that drives it — both deferred, so they cost the
 * first paint nothing and the page still shows the static diagram without
 * them.
 */

:root {
  color-scheme: light dark;

  --ink: #241d16;
  --ink-soft: #5b4d3f;
  --paper: #fbf7f0;
  --paper-raised: #ffffff;
  --rule: #e3d7c4;
  --accent: #8a5622;
  --accent-soft: #f2e6d4;
  --board-edge: #7c5330;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece3d6;
    --ink-soft: #b3a596;
    --paper: #171310;
    --paper-raised: #211b16;
    --rule: #3a2f26;
    --accent: #e0a869;
    --accent-soft: #2c221a;
    --board-edge: #4a3120;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }

.wrap { max-width: 62rem; margin: 0 auto; padding: 0 1.25rem; }
.prose { max-width: 40rem; }

/* Header ------------------------------------------------------------------ */

.site-head {
  border-bottom: 1px solid var(--rule);
  background: var(--paper-raised);
}

.site-head .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  padding-top: 0.9rem;
  padding-bottom: 0.9rem;
}

.wordmark {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.95rem;
  margin-left: auto;
}

.site-nav a { color: var(--ink-soft); text-decoration: none; }
.site-nav a:hover { color: var(--accent); text-decoration: underline; }

/* Text -------------------------------------------------------------------- */

main { padding: 2.5rem 0 3.5rem; }

h1 {
  font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.75rem;
}

h2 {
  font-size: 1.4rem;
  line-height: 1.25;
  margin: 2.5rem 0 0.6rem;
}

h3 { font-size: 1.1rem; margin: 1.75rem 0 0.4rem; }

.lead { font-size: 1.15rem; color: var(--ink-soft); max-width: 40rem; }

ul, ol { padding-left: 1.25rem; }
li { margin: 0.3rem 0; }

.note {
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  padding: 0.75rem 1rem;
  margin: 1.5rem 0;
  border-radius: 0 6px 6px 0;
}

.note p { margin: 0.35rem 0; }

/* Boards ------------------------------------------------------------------ */

.board {
  display: block;
  width: 100%;
  max-width: 340px;
  height: auto;
  border-radius: 8px;
}

.board-figure {
  margin: 1.5rem 0;
  max-width: 340px;
}

.board-figure figcaption {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-top: 0.5rem;
}

.split {
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

@media (min-width: 46rem) {
  .split { grid-template-columns: 340px minmax(0, 1fr); }
  .split .board-figure { margin-top: 0.4rem; }
}

/* Variant cards ----------------------------------------------------------- */

.cards {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 1rem 1.1rem 1.2rem;
  margin: 0;
}

.card h3 { margin: 0.8rem 0 0.3rem; font-size: 1.05rem; }
.card p { margin: 0.3rem 0 0; font-size: 0.95rem; color: var(--ink-soft); }
.card .board { max-width: 100%; }

/* Facts table ------------------------------------------------------------- */

.facts {
  border-collapse: collapse;
  width: 100%;
  max-width: 40rem;
  margin: 1.25rem 0;
  font-size: 0.97rem;
}

.facts th, .facts td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.facts th { width: 12rem; font-weight: 600; color: var(--ink-soft); }

/* Call to action ---------------------------------------------------------- */

.cta {
  display: inline-block;
  margin: 1.25rem 0 0;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  background: var(--accent);
  color: var(--paper);
  font-weight: 600;
  text-decoration: none;
}

.cta:hover { filter: brightness(1.08); }

@media (prefers-color-scheme: dark) {
  .cta { color: #1b140d; }
}

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

.site-foot {
  border-top: 1px solid var(--rule);
  padding: 1.75rem 0 2.5rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.site-foot ul {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.site-foot a { color: var(--ink-soft); }

/* Language row ------------------------------------------------------------ */

.site-foot .langs {
  margin: 0 0 0.75rem;
  gap: 0.4rem 1rem;
  font-size: 0.9rem;
}

.site-foot .langs strong { font-weight: 600; color: var(--ink); }

/* Playable board ----------------------------------------------------------
 *
 * The rules pages ship a static SVG of the starting position and js/board.js
 * replaces it with this. Both look the same at rest, so the page does not jump
 * when the engine finishes loading — and with JavaScript off the diagram is
 * still there.
 */

.playboard { max-width: 340px; margin: 1.5rem 0; }

.playboard-grid {
  display: grid;
  grid-template-columns: repeat(var(--size), 1fr);
  aspect-ratio: 1;
  border: 8px solid var(--board-edge);
  border-radius: 10px;
  overflow: hidden;
  touch-action: manipulation;
}

.sq {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  position: relative;
  cursor: default;
}

.sq-light { background: #efdcc0; }
.sq-dark { background: #b07f4e; }
.sq-movable { cursor: pointer; }
.sq:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; z-index: 1; }

.pc {
  width: 74%;
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.28);
}

.pc-dark { background: #2f2a26; }
.pc-light { background: #faf3e6; }

/* A king is a ring, not a glyph: it reads at 30 px and needs no font. */
.pc-king { box-shadow: inset 0 0 0 4px #e0a869, inset 0 0 0 6px rgba(0, 0, 0, 0.3); }

.sq-movable .pc { box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.28), 0 0 0 2px rgba(224, 168, 105, 0.55); }
.sq-selected .pc { box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.28), 0 0 0 3px var(--accent); }

.sq-target::after,
.sq-target-capture::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.sq-target::after {
  width: 28%;
  aspect-ratio: 1;
  background: rgba(224, 168, 105, 0.85);
}

.sq-target-capture::after {
  width: 74%;
  aspect-ratio: 1;
  border: 3px solid #c8452f;
}

.sq-doomed .pc { opacity: 0.55; box-shadow: inset 0 0 0 3px #c8452f; }

.playboard-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.6rem;
}

.playboard-status {
  margin: 0;
  font-size: 0.92rem;
  color: var(--ink-soft);
  min-height: 1.4em;
}

.playboard-reset {
  appearance: none;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  color: var(--ink-soft);
  border-radius: 6px;
  padding: 0.3rem 0.7rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  white-space: nowrap;
}

.playboard-reset:hover { color: var(--accent); border-color: var(--accent); }

.playboard-note {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.playboard-over .playboard-status { color: var(--ink); font-weight: 600; }
