/* Demo game — shared by the top page (index.html) and the samples page (samples.html).
   On both pages it is a card; pressing it opens the game over the whole window, and ✕ (or the phone's Back) closes it.
   Script: assets/js/demo-embed.js. Markup: the block with id="demoEmbed" in those pages. */

/* ===== the card (start button) =====
   The picture is a screenshot of the game's title screen (assets/img/demo-title.png, 960x540 = 3x the game's
   320x180). Retake it when the game's title screen changes. */
.demo-card {
  display: flex; align-items: stretch; width: 100%; padding: 0; overflow: hidden;
  background: var(--white); border: var(--line); border-radius: var(--radius);
  font-family: inherit; text-align: left; color: var(--text); cursor: pointer;
  transition: all 0.2s;
}
.demo-card:hover { box-shadow: var(--shadow); }
.demo-card-thumb {
  flex: 0 0 280px; aspect-ratio: 16/9; border-right: var(--line);
  background: #1b1622 url('../img/demo-title.png') 0 0 / 100% 100% no-repeat;
}
.demo-card-body {
  flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 14px 28px;
}
.demo-card-title { font-size: 16px; font-weight: 800; line-height: 1.5; margin-bottom: 4px; }
.demo-card-cv { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.demo-card-text { font-size: 13px; color: var(--text-mid); line-height: 1.7; }
.demo-card-play {
  margin-top: 12px;
  background: var(--accent); color: var(--ink); border: var(--line);
  font-size: 13px; font-weight: 900;
  padding: 6px 22px; border-radius: 999px;
  box-shadow: var(--shadow);
}

/* ===== the game, over the whole window =====
   Nothing of it is on the page until the card is pressed (the iframe is only made then). */
.demo-frame { display: none; }
.demo-embed.is-open .demo-frame {
  display: block; position: fixed; inset: 0; z-index: 1000;
  background: #1b1622;
}
.demo-stage { position: absolute; inset: 0; display: flex; background: #1b1622; }
.demo-stage iframe { flex: 1; min-width: 0; height: 100%; border: 0; display: block; }
/* close button in a narrow strip beside the picture, so it never covers the demo's own buttons */
.demo-side {
  display: flex; flex: 0 0 44px; flex-direction: column; align-items: center;
  padding-top: 8px;
}
.demo-close {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px solid rgba(234,223,240,0.45); background: transparent;
  color: #eadff0; font-family: inherit; font-size: 15px; line-height: 1; cursor: pointer;
}
html.demo-open, html.demo-open body { overflow: hidden; }   /* the page behind does not scroll */

/* ---- Phone held upright, while the demo only has a landscape layout (data-sp="rotate" on #demoEmbed):
        turn the whole overlay sideways so the 16:9 picture fills the tall screen.
        (Touch devices only — a narrow desktop window should not show the demo sideways.)
        If the phone itself rotates to landscape, this rule stops applying and the overlay is simply upright.
        Once the demo has a portrait layout, set data-sp="portrait" and this rule no longer applies. */
@media (max-width: 640px) and (orientation: portrait) and (pointer: coarse) {
  .demo-embed[data-sp="rotate"].is-open .demo-stage {
    inset: auto; top: 0; left: 0;
    width: 100vh; width: 100dvh; height: 100vw;
    transform-origin: 0 0;
    transform: translateX(100vw) rotate(90deg);
  }
}

/* ===== data-usage warning (touch screens, before the demo starts; made by demo-embed.js) ===== */
.demo-warn {
  position: fixed; inset: 0; z-index: 1100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(30,16,40,0.55);
}
.demo-warn-box {
  width: 100%; max-width: 360px;
  background: var(--white); border: var(--line); border-radius: 20px; padding: 24px 22px 18px;
  box-shadow: var(--shadow-lg);
}
.demo-warn-title { font-size: 16px; font-weight: 900; color: var(--text); margin-bottom: 8px; }
.demo-warn-text { font-size: 13px; color: var(--text-mid); line-height: 1.8; }
.demo-warn-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.demo-warn-actions button {
  font-family: inherit; font-size: 14px; font-weight: 800;
  padding: 9px 20px; border-radius: 50px; cursor: pointer;
}
.demo-warn-cancel { background: var(--white); color: var(--ink); border: var(--line); box-shadow: var(--shadow); }
.demo-warn-ok {
  background: var(--accent); color: var(--ink); border: var(--line);
  box-shadow: var(--shadow);
}

/* ---- Phones: the card stacks (picture on top) */
@media (max-width: 640px) {
  .demo-card { flex-direction: column; }
  .demo-card-thumb { flex: none; width: 100%; border-right: 0; border-bottom: var(--line); }
  .demo-card-body { padding: 12px 16px 16px; }
  .demo-card-title { font-size: 14px; }
  .demo-card-text { font-size: 12px; }
  .demo-card-cv { font-size: 11px; }
}
