/* ==========================================================================
   STICK ARENA RESKIN — TITLE SCREEN
   Clones the Stick Arena: Ballistick (XGen Studios, Flash ~2007) boot
   screen: graffiti logo, chunky 3D menu buttons, blinking begin prompt,
   dark warehouse backdrop with animated stick figures
   (animation lives in js/sa/title-screen.js).
   Loaded after sa-core.css — uses its tokens, never redefines :root.
   Markup is fixed in index.html (#screen-title > .title-stage).
   ========================================================================== */

/* --- Stage: full-plate warehouse backdrop -------------------------------- */
.title-stage {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 78vh;
  padding: clamp(26px, 5vh, 56px) 24px 88px;
  border: var(--sa-frame);
  border-radius: var(--sa-radius);
  box-shadow: inset 0 -70px 90px -50px rgba(0, 0, 0, 0.65);
  cursor: pointer;
  /* BACKGROUND ART GOES HERE: the AI-generated warehouse painting belongs at
     /assets/sa/title-bg.png (not committed yet). A 404 on that layer is
     harmless — the steel-blue gradient underneath stays as placeholder. */
  background:
    linear-gradient(180deg, rgba(9, 14, 23, 0.18) 0%, rgba(9, 14, 23, 0.52) 58%, rgba(4, 7, 12, 0.9) 100%),
    url('/assets/sa/title-bg.png') center / cover no-repeat,
    radial-gradient(130% 95% at 50% 0%, var(--sa-steel-600) 0%, var(--sa-steel-800) 46%, #0b1220 100%);
}

#title-bg-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.title-logo,
.title-menu,
.title-footer {
  position: relative;
  z-index: 1;
}

/* --- Graffiti logo -------------------------------------------------------- */
.title-logo {
  text-align: center;
  user-select: none;
  animation: sa-title-logo-bob 5.2s ease-in-out infinite;
}
.title-logo-line {
  display: block;
  font-family: var(--sa-chunky);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: 0.01em;
  paint-order: stroke fill;
}
.title-logo-top {
  transform: rotate(-2deg);
  font-size: clamp(46px, 7.5vw, 92px);
  color: #f2ec3e; /* yellow-lime, like STICK in the reference */
  -webkit-text-stroke: 3px #10233c;
  text-shadow:
    0 4px 0 #0a1826,
    0 10px 24px rgba(0, 0, 0, 0.55);
}
.title-logo-bottom {
  transform: rotate(1deg);
  margin-top: -0.16em; /* graffiti stacking: ARENA overlaps INKSHOT slightly */
  font-size: clamp(62px, 10vw, 122px);
  color: #e3f4ff; /* pale cyan-white, like ARENA in the reference */
  -webkit-text-stroke: 3.5px #16344f;
  text-shadow:
    0 4px 0 #0d2233,
    0 12px 26px rgba(0, 0, 0, 0.55);
}
.title-logo-sub {
  display: inline-block;
  margin-top: 10px;
  transform: rotate(-1deg);
  padding-left: 0.34em; /* optically re-centers letter-spaced text */
  font-family: var(--sa-pixel);
  font-size: clamp(13px, 1.7vw, 20px);
  letter-spacing: 0.34em;
  color: #ffffff;
  /* pixel fonts turn mushy with text-stroke: fake the BALLISTICK outline
     with an 8-direction shadow stack instead */
  text-shadow:
    2px 0 0 #16344f, -2px 0 0 #16344f, 0 2px 0 #16344f, 0 -2px 0 #16344f,
    2px 2px 0 #16344f, -2px -2px 0 #16344f, 2px -2px 0 #16344f, -2px 2px 0 #16344f,
    0 5px 8px rgba(0, 0, 0, 0.6);
}

@keyframes sa-title-logo-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

/* --- Menu: chunky 3D steel buttons ---------------------------------------- */
.title-menu {
  margin: auto 0; /* centers the menu in the space left under the logo */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.title-button {
  min-width: 280px;
  max-width: 88vw;
  padding: 13px 30px 14px;
  border: 3px solid var(--sa-btn-border);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--sa-btn-hi) 0%, var(--sa-btn-mid) 52%, var(--sa-btn-lo) 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.9),
    inset 0 -4px 0 rgba(70, 88, 110, 0.5),
    0 3px 0 rgba(0, 0, 0, 0.5),
    0 12px 24px rgba(0, 0, 0, 0.35);
  color: var(--sa-btn-ink);
  font-family: var(--sa-chunky);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: filter 80ms ease, transform 60ms ease, box-shadow 60ms ease;
}
.title-button:hover {
  background: linear-gradient(180deg, var(--sa-btn-hover-hi) 0%, var(--sa-btn-hover-mid) 55%, var(--sa-btn-lo) 100%);
  filter: brightness(1.06);
}
.title-button:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 2px 4px rgba(30, 45, 62, 0.45),
    inset 0 -1px 0 rgba(255, 255, 255, 0.35),
    0 1px 0 rgba(0, 0, 0, 0.4);
}
.title-button:focus-visible {
  outline: 2px solid var(--sa-gold);
  outline-offset: 2px;
}

/* --- Footer: blinking prompt, credits link, tiny copy ---------------------- */
.title-footer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 16px;
}
.title-begin {
  font-family: var(--sa-pixel);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: #ffffff;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.8);
  animation: sa-title-blink 1.1s linear infinite;
}
.title-credits-link {
  border: 0;
  background: none;
  padding: 4px 8px;
  font-family: var(--sa-pixel);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--sa-steel-200);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  cursor: pointer;
}
.title-credits-link:hover {
  color: var(--sa-gold);
  text-decoration: underline;
}
.title-credits-link:focus-visible {
  outline: 2px solid var(--sa-gold);
  outline-offset: 2px;
}
.title-copy {
  font-family: var(--sa-pixel);
  font-size: 8px;
  letter-spacing: 0.12em;
  color: rgba(190, 205, 220, 0.55);
  text-align: right;
}

@keyframes sa-title-blink {
  0%, 55% { opacity: 1; }
  56%, 100% { opacity: 0.12; }
}

/* --- Credits overlay (nodes are created by js/sa/title-screen.js) --------- */
.sa-credits-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(5, 9, 15, 0.72);
}
.sa-credits-card {
  position: relative;
  max-width: 460px;
  padding: 26px 30px 24px;
  border: var(--sa-frame);
  border-radius: var(--sa-radius);
  background: linear-gradient(180deg, var(--sa-steel-600) 0%, var(--sa-steel-700) 55%, var(--sa-steel-800) 100%);
  box-shadow: var(--sa-bevel-panel), 0 20px 50px rgba(0, 0, 0, 0.6);
  color: #e8eef5;
  font-family: var(--sa-chunky);
  font-size: 15px;
  line-height: 1.55;
  text-align: center;
}
.sa-credits-kicker {
  display: block;
  margin-bottom: 10px;
  color: var(--sa-gold);
  font-family: var(--sa-pixel);
  font-size: 9px;
  letter-spacing: 0.14em;
}
.sa-credits-card p { margin: 0; }
.sa-credits-close {
  position: absolute;
  top: 6px;
  right: 8px;
  border: 0;
  background: none;
  padding: 4px 8px;
  color: var(--sa-steel-200);
  font-family: var(--sa-chunky);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.sa-credits-close:hover { color: #ffffff; }

/* --- Small screens --------------------------------------------------------- */
@media (max-width: 560px) {
  .title-footer {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 16px;
  }
}

/* Mirrors sa-core's global reduced-motion guard for this screen's keyframes
   (markup can't gain the .sa-anim hook, so this screen opts out locally). */
@media (prefers-reduced-motion: reduce) {
  .title-logo,
  .title-begin,
  .title-button {
    animation: none !important;
    transition: none !important;
  }
}
