/* ============================================================================
   RBA — start screen
   ----------------------------------------------------------------------------
   While the START button is up (page load, or after the connection drops),
   the screen is the ball itself: a close-up of the leather full-bleed, the
   RBA logo in the middle and START right under it — the same
   title-then-button arrangement Pirate Fleet opens on.

   The state comes from js/script.js: showStartButton() puts .in-match on
   <body> whenever START is hidden. Everything below is keyed on its ABSENCE,
   so the photo is there on the very first paint, before any script runs.

   Kept out of index.html's own <style> on purpose: that file is edited by
   other work on the game all the time, and this screen is self-contained.
   ============================================================================ */

/* The photo is a layer of #overlay, under its text, so the game's own
   show/hide logic for the overlay still applies to it. It fades out when the
   match starts, underneath the SDK's match-found card. */
#overlay::before {
  content: '';
  position: absolute; inset: 0; z-index: -1;
  pointer-events: none;
  background:
    /* Legibility: darker at the edges, a little lighter where the title sits. */
    radial-gradient(ellipse 85% 65% at 50% 46%, rgba(0,0,0,.18) 0%, rgba(0,0,0,.62) 100%),
    linear-gradient(rgba(10,4,0,.28), rgba(10,4,0,.28)),
    url('images/start-bg.webp') center / cover no-repeat,
    #1a0b04;
  opacity: 0;
  transition: opacity .35s ease;
}
body:not(.in-match) #overlay::before { opacity: 1; }

/* The logo artwork (images/rba-logo.webp, 852x638) is the navy logo with a
   white outline and a soft shadow baked in: navy alone sank into the dark
   leather and vanished where it crossed the black seams. The letters are 780
   wide inside a 36px margin that holds the outline and shadow.

   Displayed 215px wide — letters 197px, about half a phone's width — or 58%
   of a phone narrower than ~370px. 3x
   artwork, so sharp on every phone. Everything that lines up with it
   derives from this number. */
:root { --rba-logo-w: min(215px, 58vw); }

/* The photo covers everything, so there is nothing for the overlay's blur to
   show — and a live backdrop-filter over the WebGL canvas costs every frame. */
body:not(.in-match) #overlay {
  backdrop-filter: none; -webkit-backdrop-filter: none;
  /* Lifts the logo so logo + gap + START sit centred as one group: padding
     of gap (16) + START (~50) puts the logo's centre 33px above the middle,
     whatever the logo's height. The 16px gap reads as ~28 because the
     artwork's own margin sits under the letters. */
  padding-bottom: 66px;
}

/* The RBA logo in place of the typed title. It is #big-text's background,
   so the word "RBA" is still in the page for screen readers, and it shows
   even when the game empties that text (it does after a dropped
   connection, while START comes back). */
body:not(.in-match) #big-text {
  width: var(--rba-logo-w);
  height: calc(var(--rba-logo-w) * 638 / 852);
  background: url('images/rba-logo.webp') center / contain no-repeat;
  font-size: 0; color: transparent; text-shadow: none;
}

/* START sits right under the logo, not at the bottom of the screen. The bar
   is only ever visible on this screen, so the position is not conditional —
   switching it on .in-match would make the button jump as it fades out. */
#bottom-bar {
  /* logo centre (-33) + half the logo's height + gap (16) */
  top: calc(50% - 17px + var(--rba-logo-w) * 319 / 852);
  bottom: auto;
}

/* "Tap to start" is a leftover from before the START button existed —
   tapping the overlay starts nothing. The game only ever shows this line at
   load, with that text, so it goes everywhere: keyed on the start screen
   alone it came back for the moment between match-found and the 3-2-1. */
#sub-text { display: none !important; }

/* "Connection lost" has to read above the photo, not under it. */
body:not(.in-match) #match-status { z-index: 21; }
