/* ==========================================================================
   The Narrow Way -- this board's own look  (styles.css)
   ==========================================================================
   Shared chrome comes from theme.css, shell.css and board/board.css. This file
   holds ONLY what is particular to this board -- 01-Architecture.md §9: Go
   stones and Mancala seeds are not the same object, so a board's own colours
   and piece artwork are never shared.

   Every colour and measurement is a token in the block below, so changing the
   look is one place rather than a hunt.

   THE PAGE MUST NEVER SCROLL, and nothing may ever scroll sideways. .stage is
   the only element allowed to grow or shrink. The max-height: 299px exception
   in Standards.md §5 applies unchanged.
   ========================================================================== */

/*
   EVERY LINE BELOW IS A TOKEN, AND THAT IS THE WHOLE CUSTOMISATION SURFACE.

   board.css already wires these to the real class hooks -- `.board__piece` gets
   `.is-side-0`, `.is-side-1` and so on from sprites.js, and an alternating cell
   gets `.is-alt`. A game that writes its own `.board__piece--0` rule instead is
   writing a selector that matches nothing: the page renders, the pieces are the
   shared gold and blue, and no tool anywhere reports a thing. That was the
   first version of this scaffold, and it is why the token list is the only
   thing here.
*/
.app {
    /* ---- the board surface --------------------------------------------- */
    --board-bg:       #1a1440;
    --board-line:     #4b3f8f;
    --board-cell:     #221a52;
    --board-cell-alt: #1d1748;

    /*
       The two players' colours. NOT their shapes: those come from sprites.js
       and are the signal that survives a colour-blind eye, a photocopy and
       Windows High Contrast. Change a colour here and rename the side in
       rules.js to match, or the board will say "Gold to play" in blue.

       Each colour has an EDGE, and it is not decoration: a piece is drawn with
       `paint-order: stroke`, so the darker edge is what keeps a pale piece
       legible against a pale square.
    */
    --piece-0:        #ffd45c;
    --piece-0-edge:   #7a5313;
    --piece-1:        #7fc8ff;
    --piece-1-edge:   #143d5c;
}

/*
 * THE BOARD'S SIZE IS NOT THIS FILE'S BUSINESS, AND THAT IS DELIBERATE.
 *
 * board.css already gives .board__frame `flex: 1 1 auto; min-height: 0` and the
 * SVG carries `preserveAspectRatio="xMidYMid meet"`, so the browser fits the
 * board into whatever space the column leaves -- at every viewport, for all
 * seven topologies, with no media query and no JavaScript.
 *
 * A per-game override here fights that. The first version of this scaffold
 * capped the frame at `calc(100vh - 16rem)`, which on a 360px-tall phone in
 * landscape is 104px: the board shrank into the top-left corner with two-thirds
 * of the screen empty. NOTHING FAILED. There was no overflow, no scrolling and
 * no console error -- every automated check passed and the game was unplayable.
 * Only the screenshot showed it (2026-09-03).
 *
 * If a board genuinely needs a different shape, change its viewBox in the
 * TOPOLOGY, which is the one place that knows the geometry.
 */

/* --------------------------------------------------------------------------
   THE LATTICE (decision QQQQ). Seven squares by seven on a thirteen-by-
   thirteen grid: a SQUARE at (even, even), a POST at (odd, odd), a GAP
   between. The squares are pale stone; the gaps and the posts are the ground
   between them, so what a child sees is forty-nine flagstones with lanes
   between -- the narrow way. A post is the renderer's dot; when a wall may
   be set through it the post wears a ring. A wall is three bar sprites in a
   row -- gap, post, gap -- and both sides' walls are the same dark stone,
   because a wall's owner is nothing once it stands (decision SSSS): the
   pilgrims are the two shapes and the two colours, and nothing else is.
   -------------------------------------------------------------------------- */
.app {
    --ground:         #1a1440;
    --stone:          #3a3170;
    --stone-edge:     #4b3f8f;
    --post:           #8f84c9;
    --wall:           #d9b98a;
    --wall-edge:      #5a3f1c;

    /* The shared tokens, pointed at this board's stone and ground. */
    --board-bg:       var(--ground);
    --board-cell:     var(--stone);
    --board-cell-alt: var(--stone);
    --board-line:     var(--stone-edge);
}

/* The gaps and the posts are the ground; nothing is drawn on them but the
   post's dot. `fill: none` would make them untappable, so they are filled. */
.board__cell.is-gap,
.board__cell.is-post {
    fill: var(--ground);
    stroke: var(--ground);
    stroke-width: 1;
}

/* The post's dot, bright enough to be seen as a thing that can be tapped. */
.board__dot {
    fill: var(--post);
}

/* A post a wall may be set through wears a RING (the rim, rounded to a
   circle) rather than a square rim -- thirty-six square rims at rest read as
   a second grid. A picked-up post is filled. */
.board__cell.is-post.is-origin {
    /* Named again here: the ground stroke above outranks board.css's rim
       (same specificity, later file), so the ring vanished in the first
       picture. */
    stroke: var(--board-hint, #ffd45c);
    stroke-width: 2.5;
    rx: 50;
}
.board__cell.is-post[aria-selected="true"] {
    fill: var(--board-hint, #ffd45c);
    rx: 50;
}

/* A wall is stone, whichever pilgrim set it -- drawn WHOLE by the overlay
   (one bar per wall, rules.overlay). The three bar sprites the renderer draws
   for the wall's three cells are hidden: three pieces with breaks between
   them read as three pieces (the first picture). The pieces stay in the
   position, so the spoken label of a wall cell still says "wall". */
.board__piece.is-kind-1,
.board__piece.is-kind-2 {
    display: none;
}
.board__shape.is-wall {
    fill: var(--wall);
    stroke: var(--wall-edge);
    stroke-width: 2;
    stroke-linejoin: round;
    paint-order: stroke;
}

@media (forced-colors: active) {
    .board__cell.is-gap, .board__cell.is-post { fill: Canvas; stroke: Canvas; }
    .board__cell { fill: Canvas; stroke: CanvasText; }
    .board__dot { fill: CanvasText; }
    .board__cell.is-post.is-origin { stroke: Highlight; }
    .board__shape.is-wall { fill: CanvasText; stroke: Canvas; }
}

/*
   LANDSCAPE: the score chips drop out, as on the Quilt, the Kingdom and the
   Chain. The turn line on this page says both roads and both wall counts,
   so the chips are the thing to give up.
*/
@media (min-height: 300px) and (max-height: 520px) and (min-width: 520px) {
    .tray {
        display: none;
    }
    .boardbar {
        min-height: 52px;
    }
}
