/* metaeden.net mobile treatment for the PLAY SURFACE, sites/v4-game.html.
   TASK-1136[Q].  The counterpart of browser-frame.css on that page: the two
   are never both live (see the swap comment in sites/v4-game.html).

   THE SIBLING OF FRAMEWORK E, NOT A COPY OF IT.  mobile-e.css dresses chrome
   that mobile-e.js BUILDS at runtime -- a sticky header, a drawer, a jump-to
   row, a minimize tray -- because the site root is a tabbed SPA with floating
   windows and nothing else would fit a phone.  This page is a static header,
   one section, one control strip, one game mount and one way out.  There is
   nothing to rebuild, so there is no framework here: this file REFLOWS markup
   that is already on the page, and its JS half does nothing but stand
   browser-frame.js down.

   WHY NOT JUST LOAD mobile-e.css HERE, which is the obvious saving and was
   the first thing tried.  Two reasons, and the first is fatal on its own:
   every rule in that file is scoped either to `body.mobile-e` (a class only
   mobile-e.js adds) or to ids only mobile-e.js creates (#mtop, .mdir,
   #mdrawer, #mtray).  Served to this page it would paint NOTHING, because
   neither half exists here.  Making it paint would mean adding that class,
   and the very first rule it carries is `body.mobile-e .hd{display:none}` --
   it hides the desktop header because it has built a replacement.  This page
   has no replacement to show, so hiding the header would leave a visitor on a
   game with no way back to anything.  The overlap is real but small (both
   sheets have opinions about .shell and .bbtn) and it is overlap in VALUES,
   not in rules: the two pages want different numbers for the same properties.
   Extracting a shared base for that would be a file whose entire content is
   two properties, and a third place to look when either page is wrong.
   Duplicated deliberately, and this paragraph is the record of the decision.

   SCOPED TWICE, ON PURPOSE, AND DIFFERENTLY FROM ITS SIBLING.  Every rule is
   prefixed `.v4-game-page`, the class this page's own <body> carries in the
   MARKUP, and the whole file sits inside one @media that repeats the <link>'s
   own gate.  mobile-e.css scopes on a class its JS adds, which is right for a
   sheet that dresses JS-built chrome; here it would be wrong.  If the script
   half ever fails to run, this file must still lay the page out -- the markup
   it styles is present either way -- and the media wrapper, not a runtime
   class, is what keeps it off a desktop.  So a stale cache cannot produce a
   half-swapped page in either direction, and a JS failure degrades to a
   correctly-reflowed page rather than an unstyled one.

   IT DECLARES NO COLOUR, exactly like metaeden-v4-game.css and for the same
   reason: every text/background pair on this surface has been measured in all
   four themes (metaeden_net_v4_game_surface.test.js F3, and the scanline
   contrast suite), and a mobile-only ink would be a fifth set of pairs nobody
   has measured.  Sizes, spacing and wrapping only.  A phone is where contrast
   is hardest to read, not easiest, so this is the last place to start
   guessing.

   READABILITY FLOOR (CLAUDE.md): every size below is 13px or more.  There is
   no decoration exception in this file because there is no decoration in it.

   TO GIVE ANOTHER PAGE THIS TREATMENT: it needs a body class of its own to
   scope to and a header of the same .hd/.tabs/.bbtn shape.  Add its hooks to
   server/metaeden_net_mobile_e_game.test.js in the same change, so the
   coupling stays visible to whoever edits the markup next. */

/* The number here MUST stay identical to the two media attributes in
   sites/v4-game.html and to MOBILE_QUERY in mobile-e-game.js.  The guard suite
   compares all four verbatim, and the sibling page's three against them. */
@media (max-width: 768px) {

  /* THE COLUMN.  min(100% - 48px, 1760px) spends 48px on side margin, which is
     right beside a 1760px page and is 12% of a 390px phone.  20px is what
     mobile-e.css settled on for the same reason, and matching it means the two
     pages have the same gutter where a visitor moves between them. */
  .v4-game-page .shell { width: calc(100% - 20px); margin: 8px auto 28px; }

  /* ...AND THE DOCUMENT ENDS WELL CLEAR OF THE GLASS (TASK-1186[Q]).  A
     cartridge may dock a control strip to the viewport -- fishing's touch pad
     is position:fixed at the bottom of the screen on a phone, by the user's
     own instruction ("always be docked to the bottom of the screen never off
     the bottom of the screen"), and it is 114px tall.  A fixed strip is not in
     the flow, so the document does not know it is there: MEASURED at both
     375x812 and 360x880 before this rule, scrolling to the very bottom left
     `back to games` sitting at 732..784 with the pad covering 698..812.  The
     way out was under it, at every scroll position there is.  120px of run-out
     is what buys the last row of the page a place to be; a page with nothing
     docked just ends 120px sooner than the scrollbar suggests, which costs
     nothing and is invisible.  Kept OFF .shell's own margin because this is
     scroll clearance rather than layout, and mixing them makes the number look
     like taste. */
  .v4-game-page { padding-bottom: 120px; }

  /* THE MASTHEAD.  Measured at 390 before this rule: .hd-top was 112px tall and
     nav.tabs another 114 across THREE rows, so 226px of a 844px screen was
     header and the game did not start until y=417.  The parts all stay; they
     stop being sized for a 1760px bar.  The tagline takes a line of its own
     (flex-basis:100%) rather than fighting the wordmark for the first one. */
  /* RESTACKED (TASK-1189[Q]).  The user: "have the site name 'metaeden.net'
     and the slogan be right above/under each other and take up the same height
     as the logo, you can make the logo 10% large so there's more room to fit
     both rows to it's right but it should net reduce the height taken up."
       GRID, because that is the thing that lets the mark span BOTH text rows
     without a wrapper the markup does not have -- .hd-top's children are three
     siblings (the logo link, a <strong>, a <span class="tag">), and no flex
     arrangement puts two of them in a column beside the third.  Logo in column
     one across both rows; name and slogan stacked in column two.
       The tagline's flex-basis:100% goes with it: that declaration is exactly
     what used to force it onto a line of its own BELOW everything, which is
     the row the user is asking to reclaim. */
  .v4-game-page .hd-top {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 10px;
    row-gap: 0;
    padding: 6px 10px;
  }
  /* The mark is artwork now, not a font size (TASK-1137[Q]), so the box is
     sized and then the drawing is sized inside it.  Grown ~11% (34 -> 38px,
     the drawing with it) on the user's own offer, which is what buys the two
     lines beside it the room to be tight rather than cramped. */
  .v4-game-page .hd-top .logo {
    grid-column: 1;
    grid-row: 1 / span 2;
    min-width: 48px;
    height: 38px;
  }
  .v4-game-page .hd-top .logo svg { width: 31px; height: 20.5px; }
  /* Set tight, so the two lines together come to about the mark's own 38px and
     the pair reads as one block beside it rather than a list under it.  13px
     on the tagline is the readability floor and not a pixel under it. */
  .v4-game-page .hd-top strong {
    grid-column: 2;
    grid-row: 1;
    font-size: 20px;
    line-height: 1.1;
  }
  .v4-game-page.grey .hd-top strong { font-size: 21px; }
  .v4-game-page .hd-top .tag {
    grid-column: 2;
    grid-row: 2;
    flex-basis: auto;
    font-size: 13px;
    line-height: 1.15;
  }

  /* THE SIX LINKS, AND SINCE TASK-1186[Q] THEY ARE ONE ROW.  Two shapes,
     because the themes give .bbtn two: the three bevel themes draw a raised
     button (24px Bebas, 24px of side padding), grey draws a row of underlined
     text links.  This paragraph used to end "so the row lands on two lines
     instead of three", which was the right trade when three was the
     alternative and is not a place to stop: the user counted those two rows as
     the first of several rows of chrome between the top of the page and the
     game, 58px of an 812px screen, and asked for one.

     TWO THINGS GET IT THERE, and the sizes alone could not have.  The markup
     now carries a short form for the two long words (v4-game.html; `docs` and
     `g-book`), swapped in just below -- 30 characters of label where there
     were 40.  And the numbers here come down again: 15px in the bevel themes
     with 6px of side padding, 14px in grey.  MEASURED at 360, the narrower of
     the two phones this was checked at, in all four themes; 375 has 15px more
     to play with and the same rules leave it slack.  Everything here is above
     the 12px floor, and the row is a link list rather than a hit-target grid
     (the two controls that must be finger-sized are further down and are). */
  .v4-game-page .tabs { gap: 6px 6px; padding: 6px 4px; }
  .v4-game-page .tabs .bbtn { font-size: 15px; padding: 5px 5px; letter-spacing: 0.5px; }
  .v4-game-page.grey .tabs .bbtn { font-size: 14px; padding: 3px 2px; }

  /* THE SHORT FORM IS THE ONE THAT PAINTS HERE.  Its twin is hidden by
     metaeden-v4-game.css, which is this surface's always-sheet and so declares
     the desktop answer; this is the only file that undoes it, and no desktop
     fetches this file.  display, not visibility, both ways, so exactly one
     name per link reaches the accessibility tree. */
  .v4-game-page .tabwide { display: none; }
  .v4-game-page .tabnarrow { display: inline; }

  /* GREY'S DRAWN "|" SEPARATORS ARE DROPPED, NOT RESIZED, and this is the one
     rule here that came out of looking rather than measuring.  Each is a
     ::before on the link that FOLLOWS the gap, positioned absolutely at
     left:-13px so it lands in the space between two links.  That holds on one
     line and breaks on two: the first link of a wrapped row carries its
     separator with it, so the row opens with a pipe hanging in the left
     margin.  At 390 and 360 the long labels ALWAYS wrapped, so this was not an edge
     case, it was the normal view.  A column gap says the same thing and cannot
     dangle.  The [ and ] that frame the row are attached to the first and last
     links rather than to the gaps between them, so they cannot land in the
     wrong place and they stay. */
  .v4-game-page.grey .tabs .bbtn + .bbtn { margin-left: 0; }
  .v4-game-page.grey .tabs .bbtn + .bbtn::before { content: none; }

  /* THE GAME'S OWN HEADING -- and the blurb is no longer under it
     (TASK-1186[Q]).  The user: "the description of the game can maybe move
     under the game."  At 375x812 the title line plus a two-line blurb was 63px
     of the 288px above the game; the blurb costs nothing down there and the
     title alone is 35px.

     HOW IT MOVES, given that CSS cannot reparent anything.  The two are
     siblings inside .ghead (see v4-game.html), which on a desk is a centred
     flex row and here is `display: contents`: the wrapper's box goes away and
     the <h2> and the <p> become items of #page-play's own column, where
     `order` is free to put one of them after the frame.  #page-play is the
     .gplay section itself and is display:block from metaeden-v4.css's
     `.page.on`; the id in the selector below is what outranks that.

     THE ORDER, and everything not named keeps 0 and its document position:
     the heading, then the frame, then the blurb, then whichever of the note
     and the not-here panel is showing, then the way out last.  A cartridge the
     phone gate turns away (word-fret) has no frame, so its blurb simply
     follows its title, which is where a blurb goes when there is no game
     between them.

     WHAT IS LOST HERE, said plainly: with .ghead's box gone so is the 1px
     divider it carries, so the three bevel themes draw no rule under the
     heading on a phone.  It was a line under a title and a sentence; there is
     no sentence there now, and 7px of the ask was in it.  grey -- the theme a
     guest arrives in -- never drew one. */
  .v4-game-page #page-play { display: flex; flex-direction: column; }
  .v4-game-page .ghead { display: contents; }
  .v4-game-page #page-play h2 { font-size: 26px; margin: 12px 0 4px; }
  .v4-game-page #gsubwrap { order: 1; margin: 14px 0 0; }
  .v4-game-page .gnote { order: 2; }
  .v4-game-page #gmiss { order: 2; }
  .v4-game-page .gback { order: 3; }
  .v4-game-page .gsub { font-size: 14px; }
  /* The "-" joined a title to a sentence on one line.  Under the game there is
     nothing on its left to join to. */
  .v4-game-page .gsubdot { display: none; }

  /* THE MODE CONTROL (one button since TASK-1143[Q] merged widescreen and
     fullscreen), and the way out.  A finger is not a mouse pointer, so these
     get room to be hit; 44px is the smallest target that is comfortable on
     glass.  min-height rather than padding, because .bbtn is already
     display:flex with align-items:center, so the label stays centred and grey's
     border-less text link grows a target without growing a box.

     NOT INSIDE THE MODE, which is the exception that matters.  In the mode
     the control sits on its own bezel with the game right under it, which is
     a much easier thing to hit than a link in a page, and on a phone the
     frame now fills the glass (metaeden-v4-game-fit.css), where every row of
     chrome is taken out of the game's own budget -- so it keeps the compact
     size the desktop uses. */
  .v4-game-page .gfsbar { margin: 10px 0 0; }
  .v4-game-page:not(.gfs) .gfsbar .bbtn,
  .v4-game-page .gback .bbtn { min-height: 44px; }
  .v4-game-page .gback { margin: 18px 0 0; }

  /* WIDE CARTRIDGE INTERNALS ARE STILL NOT THIS FILE'S BUSINESS, but they are
     no longer left alone either (TASK-1172[Q]).  This paragraph used to say
     golf's 18-hole strip scrolls sideways inside #gstage and that making it
     wrap would mean naming a cartridge here.  Both halves were true and the
     second one still is: the per-game phone re-cuts (golf's 9x2 scorecard,
     minesweeper's width-derived cells, solitaire's seven-visible piles) live
     in metaeden-v4-game-fit.css, whose charter is exactly that -- and since
     that ticket they apply to THIS default view too, not only inside the
     fullscreen mode.  So a cartridge here is sized for the glass before the
     visitor ever presses fullscreen, and this file remains what it always
     was: the page's chrome, no cartridge names in it.  The containment
     guarantee stands regardless -- anything still wider than the column
     scrolls inside #gstage and never reaches the document. */

  /* THE CONTROLS RIDE THE FRAME THEY OPERATE (TASK-1189[Q]).  The user: "have
     fullscreen and share have almost no bottom padding so it's riding the top
     border of the box it's referencing."  The gap was never padding on the bar
     -- measured, the bar's own bottom margin is 0 -- it was the stage's 16px
     top margin, and the border being referenced is the stage's own 1px top
     edge.  A hairline is left rather than zero so the two are legibly separate
     things touching, not one merged box. */
  .v4-game-page #gframe .gstage { margin-top: 2px; }

}
