/* Every page's body: the one place for its padding (side edge, vertical room, action-bar rail, bottom safe area).
   Sizes are the project's three: phone <=600px, tablet 601-1024px, desktop >=1025px.
   Family hooks: a page whose <main> carries data-page-layout (content page) pads nothing itself, because
   page-layout.css gives the container its edge; every other page (board pages) keeps a thin edge so the board is large.
   Page-specific body exceptions (Calisma screens) live in their own stylesheet and win by specificity.
   Values come from design-tokens.css (--page-edge-board, --page-edge-content) and chess-controls.css (--action-bar-reserve). */
body {
  --page-edge: var(--page-edge-board);
  --page-edge-wide: 1rem;
  --page-pad-y: .75rem;
  --page-rail: 0px;
  padding: 0 var(--page-edge) env(safe-area-inset-bottom, 0px);
}
body:has(> [data-page-layout]) { --page-edge: 0px; --page-edge-wide: 0px; --page-pad-y: 0px; }

@media (min-width: 601px) {
  body { padding: var(--page-pad-y) calc(var(--page-edge-wide) + var(--page-rail)) var(--page-pad-y) var(--page-edge-wide); }
  /* The action rail is out of flow: a page with one keeps its content clear of it (the player and editor carry their bar inside the layout on tablets). */
  body:has(chess-toolbar:not(.board-turn-controls) > chess-button.page-close) { --page-rail: var(--action-bar-reserve); }
}
@media (min-width: 601px) and (max-height: 500px) { body:has(chess-toolbar:not(.board-turn-controls) > chess-button.page-close) { --page-rail: 0px; } }
@media (min-width: 601px) and (max-width: 1024px) {
  body.pgn-player, body.position-editor { padding: 0 var(--page-edge-board) var(--page-pad-y); }
}
@media (min-width: 1025px) {
  body:not(:has(> [data-page-layout])) { --page-pad-y: 1.5rem; }
}
